<html>
<head> <title> Give me a point </title>
<script type = "text/javascript">
counter = 2
function Add(){
mytb = document.getElementById("tb1");
row = mytb.insertRow(mytb.rows.length);
row.insertCell(0).innerHTML = "<input type='text'>";
row.insertCell(1).innerHTML = "<input type='text'>";
row.insertCell(2).innerHTML = "<input type='text'>";
row.insertCell(3).innerHTML = "<input type='text'>";
row.insertCell(4).innerHTML = "<input type='text'>";
counter = counter + 1;
}
function Remove(){
if(counter>2){
document.getElementById("tb1").deleteRow(counter-1);
counter = counter-1;
} else { alert("no"); }}
function Calculate(){
out = document.getElementById("tb2");
outt = document.getElementById("tb1").getElementsByTagName('input');
SumAng = 0;SumE = 0;SumN = 0;sumDist=0;
azimuth = parseFloat(document.getElementById('azi').value);
azimuth1 = azimuth;
north = parseFloat(document.getElementById('n').value);
east = parseFloat(document.getElementById('e').value);
for(var i=2; i<counter; i++){SumAng = SumAng+parseInt(outt[2+5*(i-2)].value)+(parseInt(outt[3+5*(i-2)].value)/60)+(parseInt(outt[4+5*(i-2)].value)/3600);}
AdjAng = SumAng-180*(counter-4);
for(var i=2; i<counter; i++){
SumN = SumN+parseFloat(outt[1+(i-2)*5].value)*Math.cos((Math.PI*azimuth1)/180);
SumE = SumE+parseFloat(outt[1+(i-2)*5].value)*Math.sin((Math.PI*azimuth1)/180);
sumDist = sumDist+parseFloat(outt[1+(i-2)*5].value);
if(i<counter-1){azimuth1 = azimuth1+180+parseInt(outt[7+5*(i-2)].value)+(parseInt(outt[8+5*(i-2)].value)/60)+(parseInt(outt[9+5*(i-2)].value)/3600)-AdjAng;}
}
for(var i=2; i<counter; i++){
roww = document.getElementById("tb2").insertRow(document.getElementById("tb2").rows.length);
deltaN = parseFloat(outt[1+(i-2)*5].value)*Math.cos((Math.PI*azimuth)/180);
deltaE = parseFloat(outt[1+(i-2)*5].value)*Math.sin((Math.PI*azimuth)/180);
roww.insertCell(0).innerHTML = outt[(i-2)*5].value;
roww.insertCell(1).innerHTML = outt[(i-2)*5+1].value;
roww.insertCell(2).innerHTML = azimuth;
roww.insertCell(3).innerHTML = deltaN;
roww.insertCell(4).innerHTML = deltaE;
roww.insertCell(5).innerHTML = (parseFloat(outt[1+(i-2)*5].value)/sumDist)*SumN;
roww.insertCell(6).innerHTML = (parseFloat(outt[1+(i-2)*5].value)/sumDist)*SumE;
roww.insertCell(7).innerHTML = north;
roww.insertCell(8).innerHTML = east;
north = north+deltaN-(parseFloat(outt[1+(i-2)*5].value)/sumDist)*SumN;
east = east+deltaE-(parseFloat(outt[1+(i-2)*5].value)/sumDist)*SumE;
if(i<counter-1){azimuth = azimuth+180+parseInt(outt[7+5*(i-2)].value)+(parseInt(outt[8+5*(i-2)].value)/60)+(parseInt(outt[9+5*(i-2)].value)/3600)-AdjAng;}
if(azimuth>360){ azimuth=azimuth-360;}
if(azimuth<0){ azimuth=azimuth+360;}
}
}
</script>
<style type="text/css">
td{background-color: #FFFF66;}
</style>
</head>
<body bgcolor="#99FFCC">
<input name="Add" id="Add" type="button" value="Add" OnClick= "Add()">
<input name="Remove" id="Add" type="button" value="Remove" OnClick= "Remove()">
<input name="Calculate" id="Calculate" type="button" value="Calculate" OnClick= "Calculate()">
<br><br>
first azimuth : <input name="azi" id="azi" type='text'><br><br>
first coordinate : <input name="n" id="n" type='text'> , <input name="e" id="e" type='text'>
<br><br>
<table name="tb1" id="tb1" border="1">
<tr bgcolor='#66CC33'> <th rowspan = "2"> point </th> <th rowspan = "2"> Distance </th> <th colspan="3"> Hor Ang </th> </tr>
<tr bgcolor='#66CC33'> <th> deg </th> <th> min </th> <th> sec </th>
</table>
<br><br><br><br><br><br>
<table name="tb2" id="tb2" border="1">
<tr bgcolor='#66CC33'> <th> point </th> <th> distance </th> <th> azimuth </th> <th> Delta N </th> <th> Delta E </th> <th> adj N </th> <th> adj E </th> <th> N </th> <th> E </th> </tr>
</table>
</body>
</html>
|