<html>
<title>Survey Traverse Calculation - RJM Programming - Copyright © 2013 rjmprogramming.com.au all rights reserved.</title>
<head>
<meta charset="utf-8">
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<style>
table {
border: 1px solid black;
}
.lightgray {
background-color: lightgray;
}
.lightblue {
background-color: lightblue;
}
.white {
background-color: white;
}
.lightgreen {
background-color: lightgreen;
}
.yellow {
background-color: yellow;
}
.cyellow {
color: yellow;
}
.pink {
background-color: pink;
}
</style>
<script>
var edone=false, ndone=false;
var maxe=-1.0, mine=-1.0, maxn=-1.0, minn=-1.0;
var justen=-1;
var numlegs=0;
var firstBearing=0;
var currb = 0.0;
var currx = 0.0;
var curry = 0.0;
var lastBearing="-0";
var adjust=0;
var lbbit = "";
var lbval = "";
var ballval = "";
var prmstr = window.location.search.substr(1);
var prmarr = prmstr.split ("&");
var params = {};
var parambits = {};
var enarr = {};
var enarrstr = "";
var eoff=0.0;
var noff=0.0;
if (prmstr.indexOf("=") != (0 - 1)) {
for ( var i = 0; i < prmarr.length; i++) {
var tmparr = prmarr[i].split("=");
params[tmparr[0]] = tmparr[1];
//alert(tmparr[1]);
numlegs = -1;
parambits = tmparr[1].split(",");
}
}
function ifzeromakezero(innum,e_or_n) {
var cinnum = innum.toString();
if (cinnum.indexOf("e-") != (0 - 1)) {
if (e_or_n == 1) {
if (!edone) {
mine=0.0;
maxe=0.0;
} else {
if (mine > 0.0) { mine=0.0; }
if (maxe < 0.0) { maxe=0.0; }
}
edone=true;
} else if (e_or_n == 2) {
if (!ndone) {
minn=0.0;
maxn=0.0;
} else {
if (minn > 0.0) { minn=0.0; }
if (maxn < 0.0) { maxn=0.0; }
}
ndone=true;
}
return 0.000;
}
if (e_or_n == 1) {
if (!edone) {
mine=innum;
maxe=innum;
} else {
if (mine > innum) { mine=innum; }
if (maxe < innum) { maxe=innum; }
}
edone=true;
} else if (e_or_n == 2) {
if (!ndone) {
minn=innum;
maxn=innum;
} else {
if (minn > innum) { minn=innum; }
if (maxn < innum) { maxn=innum; }
}
ndone=true;
}
return innum;
}
function postspanscheck() {
var eles=document.getElementsByTagName('span');
for (var ieles=0; ieles<eles.length; ieles++) {
if (('' + eles[ieles].style.zIndex) != '') {
if (('' + eles[ieles].style.zIndex).indexOf('-') != -1) {
eles[ieles].style.zIndex=('' + eles[ieles].style.zIndex).replace('-','');
eles[ieles].style.opacity='1.0';
document.getElementById(eles[ieles].id.replace('S','')).style.opacity='0.0';
} else {
eles[ieles].style.zIndex=('-' + eles[ieles].style.zIndex);
eles[ieles].style.opacity='0.0';
document.getElementById(eles[ieles].id.replace('S','')).style.opacity='1.0';
}
}
}
setTimeout(postspanscheck, 15000);
}
function postcheck() {
var rectis, dothis=false, ieles=0;
var eles=document.getElementsByTagName('td');
for (ieles=0; ieles<eles.length; ieles++) {
if (('' + eles[ieles].getAttribute('data-title')).replace(/^null$/g,'') != '') {
rectis=eles[ieles].getBoundingClientRect();
if (document.getElementById('overlays')) {
dothis=true;
document.getElementById('overlays').innerHTML+='<span id=S' + eles[ieles].id + ' style="overflow:hidden;position:absolute;z-index:-78;opacity:0.3;top:' + rectis.top + 'px;left:' + rectis.left + 'px;width:' + rectis.width + 'px;height:' + rectis.height + 'px;">' + (('' + eles[ieles].getAttribute('data-title')).replace(':','°').replace(":","'") + '"') + '</span>';
}
}
}
eles=document.getElementsByTagName('input');
for (ieles=0; ieles<eles.length; ieles++) {
if (('' + eles[ieles].getAttribute('data-title')).replace(/^null$/g,'') != '') {
rectis=eles[ieles].getBoundingClientRect();
if (document.getElementById('overlays')) {
dothis=true;
document.getElementById('overlays').innerHTML+='<span id=S' + eles[ieles].id + ' style="overflow:hidden;position:absolute;z-index:-78;opacity:0.3;top:' + rectis.top + 'px;left:' + rectis.left + 'px;width:' + rectis.width + 'px;height:' + rectis.height + 'px;">' + (('' + eles[ieles].getAttribute('data-title')).replace(':','°').replace(":","'") + '"') + '</span>';
}
}
}
if (dothis) {
//alert('mine=' + mine + ' and maxe=' + maxe + ' and minn=' + minn + ' and maxn=' + maxn + ' <canvas height=' + eval(20 + eval('' + maxn) - eval('' + minn)) + ' width=' + eval(20 + eval('' + maxe) - eval('' + mine)) + ' id=mycanvas></canvas>');
document.getElementById('overlays').innerHTML+='<br><br><canvas style="background-color:#f0f0f0;border:2px dashed red;" height=' + eval(40 + eval('' + maxn) - eval('' + minn)) + ' width=' + eval(40 + eval('' + maxe) - eval('' + mine)) + ' id=mycanvas></canvas>';
setTimeout(postspanscheck, 5000);
var ele=document.getElementById('mycanvas');
var context=document.getElementById('mycanvas').getContext('2d');
var iz=0, mto=true, grad;
// Red Orange Yellow Green Cyan Blue Violet
var pts = [[0, 0, "red"], [0, 0, "orange"], [0, 0, "yellow"], [0, 0, "green"], [0, 0, "cyan"], [0, 0, "blue"], [0, 0, "violet"]];
//var pts = [[0, 0, "red"], [0, 0, "green"], [0, 0, "blue"], [0, 0, "purple"], [0, 0, "olive"], [0, 0, "magenta"], [0, 0, "cyan"], [0, 0, "brown"], [0, 0, "black"], [0, 0, "pink"], [0, 0, "darkgreen"], [0, 0, "darkblue"], [0, 0, "darkorange"]];
var begin = pts[0];
var end = pts[1];
while (document.getElementById('E' + iz)) {
if (document.getElementById('E' + iz).value != '') {
if (mto) {
context.lineWidth = 6;
context.lineJoin = "round";
context.lineCap = "round";
//context.strokeStyle = "black";
context.beginPath();
begin=pts[eval(iz % pts.length)];
begin[0] = eval(20 + eval('' + document.getElementById('E' + iz).value) - eval('' + mine));
begin[1] = eval(eval('' + maxn) + 20 - eval('' + document.getElementById('N' + iz).value) + 0 * eval('' + minn));
context.moveTo(eval(20 + eval('' + document.getElementById('E' + iz).value) - eval('' + mine)), eval(eval('' + maxn) + 20 - eval('' + document.getElementById('N' + iz).value) + 0 * eval('' + minn)));
} else {
end=pts[eval(1 + eval(iz % 5))];
end[0] = eval(20 + eval('' + document.getElementById('E' + iz).value) - eval('' + mine));
end[1] = eval(eval('' + maxn) + 20 - eval('' + document.getElementById('N' + iz).value) + 0 * eval('' + minn));
grad = context.createLinearGradient(begin[0], begin[1], end[0], end[1]);
grad.addColorStop(0, begin[2]);
grad.addColorStop(1, end[2]);
context.strokeStyle = grad;
context.lineTo(eval(20 + eval('' + document.getElementById('E' + iz).value) - eval('' + mine)), eval(eval('' + maxn) + 20 - eval('' + document.getElementById('N' + iz).value) + 0 * eval('' + minn)));
context.stroke();
//context.strokeStyle = "black";
context.beginPath();
context.moveTo(eval(20 + eval('' + document.getElementById('E' + iz).value) - eval('' + mine)), eval(eval('' + maxn) + 20 - eval('' + document.getElementById('N' + iz).value) + 0 * eval('' + minn)));
begin=pts[eval(iz % pts.length)];
begin[0] = eval(20 + eval('' + document.getElementById('E' + iz).value) - eval('' + mine));
begin[1] = eval(eval('' + maxn) + 20 - eval('' + document.getElementById('N' + iz).value) + 0 * eval('' + minn));
}
mto=false;
}
iz++;
}
}
}
function checkAtStart() { // check query string
if (numlegs != 0) {
//alert(params['traverse']);
processTraverse(params['traverse']);
} else {
numlegs = prompt("Please tell me how many Traverse legs you have. If you have a set of co-ordinates number of Traverse legs is one less than this number of co-ordinate sets.", "0");
if (numlegs != "0" && numlegs != null) {
window.location = window.location + "?traverse=" + numlegs + ",0";
}
}
}
function fixthis(afix) {
var areal = 0.0;
var breal = 0.0;
var creal = 0.0;
var ien = 0;
areal = eval(afix);
//alert(enarrstr);
enarr = enarrstr.split(",");
for ( var j = 0; j <= numlegs; j++) {
document.getElementById('E' + j).value = ifzeromakezero(enarr[ien],1);
ien += 1;
document.getElementById('N' + j).value = ifzeromakezero(enarr[ien],2);
ien += 1;
breal = eval(document.getElementById('A' + j).value);
creal = eval(areal+breal);
while (creal >= 360.0) {
creal = eval(creal-360.0);
}
while (creal < 0.0) {
creal = eval(creal+360.0);
}
document.getElementById('A' + j).value = ifzeromakezero(creal,0);
var deg = eval(creal);
document.getElementById('A' + j).title = document.getElementById('A' + j).title + " ... DMS " + Math.floor(deg) + "°";
deg = deg - Math.floor(deg);
if (Math.floor((deg * 60.0)) < 10.0) document.getElementById('A' + j).title = document.getElementById('A' + j).title + "0";
document.getElementById('A' + j).title = document.getElementById('A' + j).title + Math.floor((deg * 60.0)) + "'";
deg = (deg * 60.0 - Math.floor((deg * 60.0))) * 60.0;
if (deg < 10) document.getElementById('A' + j).title = document.getElementById('A' + j).title + "0";
document.getElementById('A' + j).title = document.getElementById('A' + j).title + deg + '"';
}
//alert(afix + " " + areal);
adjust = -1;
document.getElementById('Ball').innerHTML = ""; //lbbit;
document.getElementById('lastBearing').value = ifzeromakezero(lbval,0);
analyze(document.getElementById('adjust'));
document.getElementById('adjust').value = 'Bowditch Adjust';
}
function analyze(but) {
justen=1;
var kjw=0, thisdiste=0.0, thisdistn=0.0, thisbrgis=0.0, lastb=0.0;
// alert(1);
if (adjust <= 0) {
// alert('' + Math.atan2(10.0,10.0) * (180.0 / Math.PI));
if (adjust == 0) {
// alert(3);
var kk;
enarrstr = "";
lbbit = document.getElementById('Ball').innerHTML;
lbval = document.getElementById('lastBearing').value;
for ( var jj = 0; jj < numlegs; jj++) {
kk = jj+1;
if (adjust == 0) {
if (document.getElementById('E' + jj).value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') == '') { justen--; }
if (document.getElementById('N' + jj).value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') == '') { justen--; }
enarrstr = enarrstr + document.getElementById('E' + jj).value + ",";
enarrstr = enarrstr + document.getElementById('N' + jj).value + ",";
if (kk == numlegs) {
if (adjust == 0) {
if (document.getElementById('E' + numlegs).value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') == '') { justen--; }
if (document.getElementById('N' + numlegs).value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') == '') { justen--; }
enarrstr = enarrstr + document.getElementById('E' + numlegs).value + ",";
enarrstr = enarrstr + document.getElementById('N' + numlegs).value + ",";
}
}
}
}
}
if (document.getElementById('firstBearing').value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') != '') { justen--; }
if (document.getElementById('lastBearing').value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') != '') { justen--; }
//alert('justen=' + justen);
document.getElementById('adjust').title = 'Bowditch Adjust';
document.getElementById('adjust').value = 'Adjust';
//alert(79);
if (eval('' + justen) > 0) {
//alert(89);
kjw=0;
for (jw = 0; jw < numlegs; jw++) {
kjw++;
thisdiste=eval('' + document.getElementById('E' + jw).value);
//alert('01 thisdiste=' + thisdiste + ' thisdistn=' + thisdistn + ' ' + document.getElementById('E' + jw).value + ' then ' + document.getElementById('E' + kjw).value);
thisdiste-=eval('' + document.getElementById('E' + kjw).value);
//alert('02 thisdiste=' + thisdiste + ' thisdistn=' + thisdistn);
thisdiste*=thisdiste;
//alert('03 thisdiste=' + thisdiste + ' thisdistn=' + thisdistn);
thisdistn=eval('' + document.getElementById('N' + jw).value);
//alert('04 thisdiste=' + thisdiste + ' thisdistn=' + thisdistn + ' ' + kjw + ':' + document.getElementById('N' + kjw).value);
thisdistn-=eval('' + document.getElementById('N' + kjw).value);
//alert('05 thisdiste=' + thisdiste + ' thisdistn=' + thisdistn);
thisdistn*=thisdistn;
//alert('06 thisdiste=' + thisdiste + ' thisdistn=' + thisdistn);
//document.getElementById('L' + jw).value='' + Math.pow( ( ((eval('' + document.getElementById('E' + jw).value)) - (eval('' + document.getElementById('E' + kjw).value))) * ((eval('' + document.getElementById('E' + jw).value)) - (eval('' + document.getElementById('E' + kjw).value))) + ((eval('' + document.getElementById('N' + jw).value)) - (eval('' + document.getElementById('N' + kjw).value))) * ((eval('' + document.getElementById('N' + jw).value)) - (eval('' + document.getElementById('N' + kjw).value))) ),0.5);
//document.getElementById('L' + jw).value='' + Math.pow( eval(thisdiste + thisdistn), 0.5);
document.getElementById('L' + jw).title='' + Math.pow( eval(thisdiste + thisdistn), 0.5);
thisbrgis=eval('' + Math.atan2(eval(eval('' + document.getElementById('E' + kjw).value) - eval('' + document.getElementById('E' + jw).value)), eval(eval('' + document.getElementById('N' + kjw).value) - eval('' + document.getElementById('N' + jw).value))) * (180.0 / Math.PI));
if (thisbrgis < 0) { thisbrgis+=360.0; }
//document.getElementById('B' + jw).innerHTML='' + thisbrgis;
document.getElementById('B' + jw).title='' + thisbrgis;
if (jw == 0) {
if (('' + thisbrgis).indexOf('.') == -1) {
document.getElementById('A' + jw).setAttribute('data-title', '' + '' + thisbrgis + '.00');
} else {
document.getElementById('A' + jw).setAttribute('data-title', '' + '' + thisbrgis);
}
lastb=eval('' + thisbrgis);
} else {
if (eval('' + thisbrgis) > eval('' + lastb)) {
//alert('thisbrgis=' + eval('' + thisbrgis) + ' and lastb=' + eval('' + lastb) + ' results in ' + eval(eval(180.0 + eval(eval('' + thisbrgis) - eval('' + lastb))) % 360.0));
lastb=eval(eval(180.0 + eval(eval('' + thisbrgis) - eval('' + lastb))) % 360.0);
} else {
lastb=eval(eval(540.0 + eval(eval('' + thisbrgis) - eval('' + lastb))) % 360.0);
}
if (('' + lastb).indexOf('.') == -1) {
document.getElementById('A' + jw).setAttribute('data-title', '' + lastb + '.00');
} else {
document.getElementById('A' + jw).setAttribute('data-title', '' + lastb);
}
}
lastb=eval('' + thisbrgis);
document.getElementById('E' + jw).title='' + '' + document.getElementById('E' + jw).value;
document.getElementById('N' + jw).title='' + '' + document.getElementById('N' + jw).value;
if (eval(1 + jw) == numlegs) {
document.getElementById('E' + kjw).title='' + document.getElementById('E' + kjw).value;
document.getElementById('N' + kjw).title='' + document.getElementById('N' + kjw).value;
if (('' + eval(eval(540.0 + eval(eval('0.000') - eval('' + thisbrgis))) % 360.0)).indexOf('.') != -1) {
document.getElementById('A' + kjw).setAttribute('data-title', '' + eval(eval(540.0 + eval(eval('0.000') - eval('' + thisbrgis))) % 360.0));
} else {
document.getElementById('A' + kjw).setAttribute('data-title', '' + eval(eval(540.0 + eval(eval('0.000') - eval('' + thisbrgis))) % 360.0) + '.00');
}
}
}
// alert(99);
}
var x360 = 0.0;
var areal = 0.0;
var breal = 0.0;
var deltae = 0.0;
var deltan = 0.0;
var badj = 0.0;
var thise="", thisn="", laste="", lastn="", lastb="", lpre=".0", vareal="", k;
laste = document.getElementById('E' + numlegs).value;
lastn = document.getElementById('N' + numlegs).value;
currb = eval(document.getElementById('firstBearing').value);
currx = eval(document.getElementById('E0').value);
curry = eval(document.getElementById('N0').value);
for ( var j = 0; j < numlegs; j++) {
k = j+1;
thise = document.getElementById('E' + k).value;
thisn = document.getElementById('N' + k).value;
areal = eval(currb);
//if (document.getElementById('A' + j).value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') != '') { justen--; alert('Ajusten=' + justen); }
//if (document.getElementById('L' + j).value.replace(/\./g,'').replace(/\-/g,'').replace(/0/g,'') != '') { justen--; alert('Ljusten=' + justen); }
breal = eval(document.getElementById('A' + j).value);
areal += breal;
currb = eval(areal);
x360 = eval(currb);
while (x360 >= 360.0) {
x360 = eval(x360-360.0);
}
document.getElementById('B' + j).innerHTML = ifzeromakezero(x360,0);
deltae = eval(Math.sin(currb * Math.PI / 180.0) * document.getElementById('L' + j).value);
deltan = eval(Math.cos(currb * Math.PI / 180.0) * document.getElementById('L' + j).value);
document.getElementById('dE' + j).innerHTML = ifzeromakezero(deltae,0);
document.getElementById('dN' + j).innerHTML = ifzeromakezero(deltan,0);
currx += deltae;
curry += deltan;
//alert(j);
document.getElementById('E' + k).value = ifzeromakezero(currx,1);
document.getElementById('N' + k).value = ifzeromakezero(curry,2);
//alert("k");
if (k == numlegs) {
eoff = ifzeromakezero(eval(-currx/numlegs),0);
noff = ifzeromakezero(eval(-curry/numlegs),0);
//alert("Eoff=" + eoff);
}
if (thise.replace("-0.000","").length != 0 && thisn.replace("-0.000","").length != 0) {
if (k == numlegs) {
if (adjust == 0) {
enarrstr = enarrstr + document.getElementById('E' + numlegs).value + ",";
enarrstr = enarrstr + document.getElementById('N' + numlegs).value + ",";
}
document.getElementById('Eall').innerHTML = ifzeromakezero(eval(thise-currx),0);
document.getElementById('Nall').innerHTML = ifzeromakezero(eval(thisn-curry),0);
} else {
document.getElementById('eE' + k).innerHTML = ifzeromakezero(eval(thise-currx),0);
document.getElementById('eN' + k).innerHTML = ifzeromakezero(eval(thisn-curry),0);
}
}
//alert(j);
areal = eval(currb);
areal += 180.0;
currb = eval(areal);
//alert("j");
}
//alert(currx + " " + curry);
//thise = laste;
//thisn = lastn;
//alert(laste + " " + lastn);
if (laste.replace("-0.000","").length != 0 && lastn.replace("-0.000","").length != 0) {
//alert(' ' + justen);
document.getElementById('Eall').innerHTML = ifzeromakezero(eval(laste-currx),0);
document.getElementById('Nall').innerHTML = ifzeromakezero(eval(lastn-curry),0);
}
//alert('+' + justen);
//if (adjust == 0) {
if (document.getElementById('A' + numlegs).value.replace("-0").length > 0) {
//alert(8);
if (document.getElementById('lastBearing').value.replace("-0").length > 0) {
//alert(9);
if (eval('' + justen) > 0) {
//alert(29);
kjw=0;
for (jw = 0; jw < numlegs; jw++) {
kjw++;
//alert('title');
if (eval(1 + jw) == numlegs) {
document.getElementById('E' + kjw).value=ifzeromakezero('' + document.getElementById('E' + kjw).title,1);
document.getElementById('N' + kjw).value=ifzeromakezero('' + document.getElementById('N' + kjw).title,2);
document.getElementById('A' + kjw).value='' + document.getElementById('A' + kjw).getAttribute('data-title');
document.getElementById('adjust').style.display='none';
}
document.getElementById('L' + jw).value='' + document.getElementById('L' + jw).title;
document.getElementById('A' + jw).value='' + document.getElementById('A' + jw).getAttribute('data-title');
document.getElementById('B' + jw).innerHTML='' + document.getElementById('B' + jw).title;
document.getElementById('B' + jw).title=bchange(document.getElementById('B' + jw).title, jw, numlegs);
document.getElementById('E' + jw).value=ifzeromakezero('' + document.getElementById('E' + jw).title,1);
document.getElementById('N' + jw).value=ifzeromakezero('' + document.getElementById('N' + jw).title,2);
}
//alert(39);
} else {
lastb = eval(document.getElementById('lastBearing').value);
areal = eval(currb);
breal = eval(document.getElementById('A' + numlegs).value);
areal -= breal;
//areal -= 180.0;
currb = eval(areal);
x360 = eval(currb);
while (x360 >= 360.0) {
x360 = eval(x360-360.0);
}
areal = eval(lastb-x360);
while (areal > 180.0) {
areal = eval(areal-360.0);
}
while (areal <= -180.0) {
areal = eval(areal+360.0);
}
badj = eval(numlegs);
var xoff = eval(document.getElementById('Eall').innerHTML);
var yoff = eval(document.getElementById('Nall').innerHTML);
if (xoff.length > 0 && yoff.length > 0) {
eoff = eval(xoff/badj);
noff = eval(yoff/badj);
}
badj = eval(badj+1);
vareal = areal.toString();
//alert("Vareal=" + vareal + " badj=" + badj);
if (vareal.indexOf(".") == (0 - 1)) vareal = vareal + ".0";
badj = eval(areal/badj);
vareal = badj.toString();
if (vareal.indexOf(".") == (0 - 1)) vareal = vareal + ".0";
//alert("vareal=" + vareal + " badj=" + badj);
if (adjust == 0) {
document.getElementById('Ball').innerHTML = ifzeromakezero(areal,0);
document.getElementById('Ball').innerHTML += " <input type='button' onclick='fixthis(" + '"' + vareal + '"' + ");' value='Adjust Angles'></input>";
document.getElementById('lastBearing').value = ifzeromakezero(areal,0);
}
}
}
//}
}
if (eval('' + justen) < 0) { adjust = 1; }
} else {
// alert("eoff=" + eoff + " noFF=" + noff);
//alert(10);
but.style.display = 'none';
var xxoff = eval(eoff);
var yyoff = eval(noff);
var eis=0.0, nis=0.0;
for ( var jj = 1; jj <= numlegs; jj++) {
eis = eval(document.getElementById('E' + jj).value);
nis = eval(document.getElementById('N' + jj).value);
document.getElementById('E' + jj).value = ifzeromakezero(eval(xxoff + eis),1);
if (document.getElementById('E' + jj).value.indexOf("e-") != (0 - 1)) document.getElementById('E' + jj).value = "0.000";
document.getElementById('N' + jj).value = ifzeromakezero(eval(yyoff + nis),2);
if (document.getElementById('N' + jj).value.indexOf("e-") != (0 - 1)) document.getElementById('N' + jj).value = "0.000";
//alert("xxoff=" + xxoff + " yyoff=" + yyoff);
xxoff += eval(eoff);
yyoff += eval(noff);
}
}
}
function bchange(inf, thisi, nlegs) {
var retval='';
var zz='';
var secsare=eval(eval('' + inf) * 3600.0);
var degsare=eval('' + Math.floor(secsare / 3600.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
//alert(inf + ' interim secsare=' + secsare);
secsare=Math.abs(secsare);
var minsare=Math.floor(eval(secsare * 60.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
secsare-=eval(minsare / 60.0); // -3.5
//alert(inf + ' final secsare=' + eval(secsare * 3600.0));
if (eval('' + eval(secsare * 3600.0)) < 10.0) { zz='0'; }
retval='' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0);
document.getElementById('B' + thisi).setAttribute('data-title','' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0));
if (thisi == 0) {
inf=document.getElementById('firstBearing').value;
secsare=eval(eval('' + inf) * 3600.0);
degsare=eval('' + Math.floor(secsare / 3600.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
//alert(inf + ' interim secsare=' + secsare);
secsare=Math.abs(secsare);
minsare=Math.floor(eval(secsare * 60.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
secsare-=eval(minsare / 60.0); // -3.5
//alert(inf + ' final secsare=' + eval(secsare * 3600.0));
zz='';
if (eval('' + eval(secsare * 3600.0)) < 10.0) { zz='0'; }
document.getElementById('firstBearing').setAttribute('data-title','' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0));
inf=document.getElementById('lastBearing').value;
secsare=eval(eval('' + inf) * 3600.0);
degsare=eval('' + Math.floor(secsare / 3600.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
//alert(inf + ' interim secsare=' + secsare);
secsare=Math.abs(secsare);
minsare=Math.floor(eval(secsare * 60.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
secsare-=eval(minsare / 60.0); // -3.5
//alert(inf + ' final secsare=' + eval(secsare * 3600.0));
zz='';
if (eval('' + eval(secsare * 3600.0)) < 10.0) { zz='0'; }
document.getElementById('lastBearing').setAttribute('data-title','' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0));
}
if (1 == 1) {
inf=document.getElementById('A' + thisi).value;
secsare=eval(eval('' + inf) * 3600.0);
degsare=eval('' + Math.floor(secsare / 3600.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
//alert(inf + ' interim secsare=' + secsare);
secsare=Math.abs(secsare);
minsare=Math.floor(eval(secsare * 60.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
secsare-=eval(minsare / 60.0); // -3.5
//alert(inf + ' final secsare=' + eval(secsare * 3600.0));
zz='';
if (eval('' + eval(secsare * 3600.0)) < 10.0) { zz='0'; }
document.getElementById('A' + thisi).setAttribute('data-title','' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0));
}
if (eval(eval('' + thisi) + 1) == eval('' + nlegs)) {
thisi++;
inf=document.getElementById('A' + thisi).value;
secsare=eval(eval('' + inf) * 3600.0);
degsare=eval('' + Math.floor(secsare / 3600.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
//alert(inf + ' interim secsare=' + secsare);
secsare=Math.abs(secsare);
minsare=Math.floor(eval(secsare * 60.0));
secsare=eval('' + inf);
secsare-=eval(degsare * 1.0); // -3.5
secsare-=eval(minsare / 60.0); // -3.5
//alert(inf + ' final secsare=' + eval(secsare * 3600.0));
zz='';
if (eval('' + eval(secsare * 3600.0)) < 10.0) { zz='0'; }
document.getElementById('A' + thisi).setAttribute('data-title','' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0));
setTimeout(postcheck, 500);
}
return retval; //'' + degsare + ':' + ('0' + minsare).substring(eval(-2 + ('0' + minsare).length)) + ':' + zz + eval(secsare * 3600.0);
}
function anglechange(ame) {
var deg=0.0;
var mn=0;
var secs=0;
if (ame.value.indexOf(".") == (0 - 1)) {
mn = prompt("Enter the minutes value of your " + ame.value + " degree angle/bearing", "0");
if (mn == null) mn = "0";
if (mn.length == 1) mn = "0" + mn;
secs = prompt("Enter the seconds value of your " + ame.value + " degree, " + mn + " minutes angle/bearing", "0");
if (secs == null) secs = "0";
if (secs.indexOf(".") == 0) secs = "00" + secs;
if (secs.length == 1 || secs.indexOf(".") == 1) secs = "0" + secs;
if (secs.indexOf(".") == (0 - 1)) secs = secs + ".0";
if (ame.value.indexOf("-") == (0 - 1)) {
deg = eval(ame.value);
if (deg >= 360) {
while (deg >= 360) {
deg = deg - 360;
}
}
deg = eval(deg + (mn / 60.0));
deg = eval(deg + (secs / 3600.0));
ame.value = deg;
ame.title = ame.title + " ... DMS " + Math.floor(deg) + "°";
deg = deg - Math.floor(deg);
if (Math.floor((deg * 60.0)) < 10.0) ame.title = ame.title + "0";
ame.title = ame.title + Math.floor((deg * 60.0)) + "'";
deg = (deg * 60.0 - Math.floor((deg * 60.0))) * 60.0;
if (deg < 10) ame.title = ame.title + "0";
ame.title = ame.title + deg + '"';
} else {
deg = eval(ame.value);
//alert(ame.value + " " + deg);
deg = -deg;
//alert(ame.value + "+" + deg);
if (deg >= 360) {
while (deg >= 360) {
deg = deg - 360;
//alert(ame.value + ":" + deg);
}
}
deg = eval(deg + (mn / 60.0));
deg = eval(deg + (secs / 3600.0));
//deg = -deg;
deg = eval(360.0 - deg);
ame.value = deg;
ame.title = ame.title + " ... DMS " + Math.floor(deg) + "°";
deg = deg - Math.floor(deg);
if (Math.floor((deg * 60.0)) < 10.0) ame.title = ame.title + "0";
ame.title = ame.title + Math.floor((deg * 60.0)) + "'";
deg = (deg * 60.0 - Math.floor((deg * 60.0))) * 60.0;
if (deg < 10) ame.title = ame.title + "0";
ame.title = ame.title + deg + '"';
}
} else {
if (ame.value.indexOf("-") == (0 - 1)) {
deg = eval(ame.value);
if (deg >= 360) {
while (deg >= 360) {
deg = deg - 360;
}
ame.value = deg;
ame.title = ame.title + " ... DMS " + Math.floor(deg) + "°";
deg = deg - Math.floor(deg);
if (Math.floor((deg * 60.0)) < 10.0) ame.title = ame.title + "0";
ame.title = ame.title + Math.floor((deg * 60.0)) + "'";
deg = deg * 60.0 - Math.floor((deg * 60.0));
if (deg < 10) ame.title = ame.title + "0";
ame.title = ame.title + deg + '"';
} else {
deg = ame.value;
ame.title = ame.title + " " + Math.floor(deg) + "°";
deg = deg - Math.floor(deg);
if (Math.floor((deg * 60.0)) < 10.0) ame.title = ame.title + "0";
ame.title = ame.title + Math.floor((deg * 60.0)) + "'";
deg = (deg * 60.0 - Math.floor((deg * 60.0))) * 60.0;
if (deg < 10) ame.title = ame.title + "0";
ame.title = ame.title + deg + '"';
}
} else {
deg = eval(ame.value);
deg = -deg;
if (deg >= 360) {
while (deg >= 360) {
deg = deg - 360;
}
}
ame.value = eval(360.0 - deg);
deg = ame.value;
ame.title = ame.title + " ... DMS " + Math.floor(deg) + "°";
deg = deg - Math.floor(deg);
if (Math.floor((deg * 60.0)) < 10.0) ame.title = ame.title + "0";
ame.title = ame.title + Math.floor((deg * 60.0)) + "'";
deg = (deg * 60.0 - Math.floor((deg * 60.0))) * 60.0;
if (deg < 10) ame.title = ame.title + "0";
ame.title = ame.title + deg + '"';
}
}
}
function achange() {
}
function processTraverse(ininfo) { // data items
for ( var i = 0; i < parambits.length; i++) {
if (numlegs == (0 - 1)) {
numlegs = parambits[i];
if (parambits.length > 1) firstBearing = parambits[i+1];
}
//alert(parambits[i]);
}
var zero="0.000";
var lightblue = "";
if (numlegs > 0) {
document.write("<h1>Survey Traverse Calculation</h1><input id='adjust' type='button' title='Analyze' onclick='analyze(this);' value='Analyze when Fully (or just E,N) Filled Out Below'></input> <a title='Restart' target='_blank' href='" + document.URL.split('#')[0].split('?')[0] + "'>Restart</a><br><br><table><tbody>");
document.write("<tr class='lightgray'><td title='Please enter Angles in Degrees'>Angles</td><td title='Please enter Bearings in Degrees'>Bearings</td><td>Lengths</td><td>Delta E</td><td>Delta N</td><td>E</td><td>N</td><td>Point</td></tr>");
document.write("<tr class='yellow'><td></td><td><input title='Entries with . are assumed as decimal degrees, else enter integer angle Degree value and will prompt for rest' onchange='anglechange(this);' type='text' id='firstBearing' value='" + firstBearing + "'></input></td><td></td><td></td><td></td><td></td><td></td><td><input class='lightgray' onclick='achange();' type='text' id='firstName'></input></td></tr>");
for ( var j = 0; j < numlegs; j++) {
document.write("<tr class='pink'><td><input title='Entries with . are assumed as decimal degrees, else enter integer angle Degree value and will prompt for rest' onchange='anglechange(this);' type='text' id='A" + j + "' value='0'></input></td><td id='dB" + j + "'></td><td></td><td><p class='cyellow' id='eE" + j + "'></p></td><td><p class='cyellow' id='eN" + j + "'></p></td><td><input " + lightblue + " onclick='achange();' type='text' id='E" + j + "' value='" + zero + "'></input></td><td><input " + lightblue + " onclick='achange();' type='text' id='N" + j + "' value='" + zero + "'></input></td><td><input class='lightblue' onclick='achange();' type='text' id='P" + j + "'></input></td></tr>");
document.write("<tr class='yellow'><td></td><td id='B" + j + "'>0</td><td><input onclick='achange();' type='text' id='L" + j + "' value='0.000'></input></td><td id='dE" + j + "'>0.000</td><td id='dN" + j + "'>0.000</td><td></td><td></td><td></td></tr>");
zero = "";
lightblue = " class='lightblue'";
}
document.write("<tr class='pink'><td><input class='lightgray' title='Entries with . are assumed as decimal degrees, else enter integer angle Degree value and will prompt for rest' onchange='anglechange(this);' type='text' id='A" + numlegs + "' value='-0'></input></td><td id='Ball' class='white'></td><td></td><td id='Eall' class='white'></td><td id='Nall' class='white'></td><td><input class='lightgreen' onclick='achange();' type='text' id='E" + numlegs + "' value='-0.000'></input></td><td><input class='lightgreen' onclick='achange();' type='text' id='N" + numlegs + "' value='-0.000'></input></td><td><input class='lightblue' onclick='achange();' type='text' id='P" + numlegs + "'></input></td></tr>");
document.write("<tr class='yellow'><td></td><td><input class='lightgray' title='Entries with . are assumed as decimal degrees, else enter integer angle Degree value and will prompt for rest' onchange='anglechange(this);' type='text' id='lastBearing' value='" + lastBearing + "'></input></td><td></td><td></td><td></td><td></td><td></td><td><input class='lightgray' onclick='achange();' type='text' id='firstName'></input></td></tr>");
document.write("</tbody></table><div id=overlays></div>");
setTimeout(postcheck, 2000);
}
}
checkAtStart();
</script>
<body>
</body>
</html>