diff --git a/cunimb.js b/cunimb.js index 7595eab..df59028 100644 --- a/cunimb.js +++ b/cunimb.js @@ -26,6 +26,7 @@ var online = []; // ([cn,alt*1,cn+"_"+ps,colcn,afdif]); var offline = []; // ([cn,alt*1,cn+"_"+ps,colcn,afdif]); var receivers = []; var all = 0; +var stick = 0; var pathl = 30; // path length 5' (30points) var unit = "m"; // metric units var onoff = 1; // 1: online, 2: offline, 3: Menu @@ -62,8 +63,8 @@ var m2kt={"m":1, "i":1.94384}; var am2kt={"m":"m/s", "i":"kt"}; -var hashc="",hashz="",hashm="",hasho="",hashb="",hashs="",hashl="",hasht="",hl=" ",hashw="",hashu="",hashp="",hashn="",hashy=""; -// center zoom maptype offline bound autoset2ma layers tasks warning units pathlength nolist devtype +var hashc="",hashz="",hashm="",hasho="",hashb="",hashs="",hashl="",hasht="",hl=" ",hashw="",hashu="",hashp="",hashn="",hashy="",hasha=""; +// center zoom maptype offline bound autoset2ma layers tasks warning units pathlength nolist devtype altitudestick // close popup @@ -93,6 +94,16 @@ function chunit() { // change units rehash(); } +function chstick() { // change altitude stick + if (document.getElementById('stick').checked === true) { // stick visible + stick = 1; + hasha = "&a=1"; + } else { // no altitude stick + stick = 0; + hasha = ""; + } + rehash(); +} function chpl() { // change path length if (document.getElementById('rp1').checked === true) { // 5 minutes @@ -166,6 +177,7 @@ function delpon() { // delete all online path while (online[++j]) { window["P_" + online[j][2]].getPath().clear(); window["M_" + online[j][2]].set('tra', 0); + window["S_" + online[j][2]].getPath().clear(); } } @@ -174,8 +186,8 @@ function delpoff() { // delete all offline path while (offline[++j]) { window["P_" + offline[j][2]].getPath().clear(); window["M_" + offline[j][2]].set('tra', 0); + window["S_" + offline[j][2]].getPath().clear(); } - } function deletepath(pol) { @@ -223,6 +235,9 @@ function allmarker() { window["M_" + online[j][2]].setOptions({ visible: vallmaron }); + window["S_" + online[j][2]].setOptions({ + visible: vallmaron + }); } } else { if (vallmaroff === true) vallmaroff = false; @@ -231,6 +246,9 @@ function allmarker() { window["M_" + offline[j][2]].setOptions({ visible: vallmaroff }); + window["S_" + offline[j][2]].setOptions({ + visible: vallmaroff + }); } } afftab(); @@ -375,6 +393,8 @@ function reseton() { // delete all online markers and their path while (online[++j]) { window["M_" + online[j][2]].setMap(null); delete window["M_" + online[j][2]]; + window["S_" + online[j][2]].setMap(null); + delete window["S_" + online[j][2]]; window["P_" + online[j][2]].setMap(null); delete window["P_" + online[j][2]]; } @@ -385,6 +405,8 @@ function resetoff() { // delete all offline markers and their path while (offline[++j]) { window["M_" + offline[j][2]].setMap(null); delete window["M_" + offline[j][2]]; + window["S_" + offline[j][2]].setMap(null); + delete window["S_" + offline[j][2]]; window["P_" + offline[j][2]].setMap(null); delete window["P_" + offline[j][2]]; } @@ -459,7 +481,9 @@ function afftab() { while (online[++j]) { mar = "M_" + online[j][2]; pol = "P_" + online[j][2]; - dlistd += "" + online[j][0] + "  "; + stk = "S_" + online[j][2]; + dlistd += "" + online[j][0] + "  "; +// dlistd += "" + online[j][0] + "  "; if (unit == "i") { dlistd += (online[j][1] * m2ft[unit]).toFixed(); } // { var tv=online[j][1]*m2ft[unit]; dlistd+= tv.toFixed(); } @@ -474,7 +498,9 @@ function afftab() { while (offline[++j]) { mar = "M_" + offline[j][2]; pol = "P_" + offline[j][2]; - dlistd += "" + offline[j][0] + "  "; + stk = "S_" + offline[j][2]; + dlistd += "" + offline[j][0] + "  "; +// dlistd += "" + offline[j][0] + "  "; if (unit == "i") { dlistd += (offline[j][1] * m2ft[unit]).toFixed(); } else dlistd += offline[j][1] + "m"; @@ -610,7 +636,8 @@ function dec2dms(dec) { function changecolor(mark) { var colactive = window[mark].get('icol'); - if (++colactive == 9) colactive = 0; +// if (++colactive == 9) colactive = 0; + if (++colactive == tcolor.length) colactive = 0; var ncol = tcolor[colactive]; window[window[mark].get('poly')].setOptions({ strokeColor: '#' + ncol @@ -910,6 +937,15 @@ function gesmark() { var posi = new google.maps.LatLng(lat, lon); + var te = 0; //altitude sol +// elevator.getElevationForLocations({'locations': [posi]}, function(results, status) { +// if (status == google.maps.ElevationStatus.OK) { +// if (results[0]) { +// te = Math.round(results[0].elevation); +// } +// } +// }); + var posiBaton = new google.maps.LatLng(lat+(0.00001*(alt-te)), lon); var polyvar = "P_" + crc; var markvar = "M_" + crc; var visib = true; @@ -946,9 +982,26 @@ function gesmark() { document.getElementById("divInfo").innerHTML = " "; }); + // création du Baton d'altitude + var stickOptions = { +// strokeColor: '#' + hcol, + strokeColor: '#' + '000000', // black for now + strokeOpacity: 0.75, + strokeWeight: 2, + visible: visib + }; + window[stickvar] = new google.maps.Polyline(stickOptions); + window[stickvar].setMap(map); + window[stickvar].set('nom', "" + cn + " - " + ps); + window[stickvar].set('baton', "" + stickvar); + + window[stickvar].getPath().push(posi); + window[stickvar].getPath().push(posiBaton); + // création du Marker window[markvar] = new google.maps.Marker({ - position: posi, +// position: posi, + position: posiBaton, title: cn + " - " + ps + " @ " + alt + "m", map: map, icon: "" + tld + "/markers/" + cn + ftypec[typ * 1] + ".png", @@ -956,6 +1009,7 @@ function gesmark() { }); window[markvar].set('poly', "" + polyvar); window[markvar].set('mark', "" + markvar); + window[markvar].set('stick', "" + stickvar); window[markvar].set('nom', "" + cn + " - " + ps); window[markvar].set('cn', "" + cn); window[markvar].set('reg', "" + ps); @@ -979,11 +1033,13 @@ function gesmark() { var bcol = window[this.get('poly')].strokeColor; document.getElementById("divInfo").innerHTML = "    " + this.get('nom'); focuson(this.get('poly')); + focuson(this.get('stick')); }); google.maps.event.addListener(window[markvar], "mouseout", function() { document.getElementById("divInfo").innerHTML = " "; focusoff(this.get('poly')); + focusoff(this.get('stick')); }); google.maps.event.addListener(window[markvar], "click", function() { @@ -1002,7 +1058,8 @@ function gesmark() { redraw(pol); }); - if (++ccolor == 9) ccolor = 0; +// if (++ccolor == 9) ccolor = 0; + if (++ccolor == tcolor.length) ccolor = 0; } // fin du if typeof... var difalt = vz * 1; @@ -1034,7 +1091,18 @@ function gesmark() { window[polyvar].getPath().push(posi); // ajout d'une position sur le tracé - window[markvar].setPosition(posi); // déplace le marker +// window[markvar].setPosition(posi); // déplace le marker + if (stick === 1) { + window[stickvar].setOptions({visible: true}); + window[markvar].setPosition(posiBaton); // déplace le marker + window[stickvar].getPath().pop(); // déplace le baton + window[stickvar].getPath().pop(); // for now - better way ? + window[stickvar].getPath().push(posi); + window[stickvar].getPath().push(posiBaton); + } else { + window[stickvar].setOptions({visible: false}); + window[markvar].setPosition(posi); // déplace le marker + } // change l'altitude affichée window[markvar].setTitle("" + cn + " - " + ps + " @ " + (alt * m2ft[unit]).toFixed() + am2ft[unit] + " @ " + tim); @@ -1048,7 +1116,11 @@ function gesmark() { } else { if (all === 0) { if (typeof(window[polyvar]) != 'undefined') { // si pas déjà effacé - // efface et détruit le PolyLine et le Marker +// // efface et détruit le PolyLine et le Marker + // efface et détruit le baton, le PolyLine et le Marker + window[stickvar].setMap(null); + delete window[stickvar]; + window[polyvar].setMap(null); delete window[polyvar]; @@ -1107,7 +1179,8 @@ function wd() { } function rehash() { - window.location.replace("#" + hashc + hashz + hashm + hasho + hashb + hashs + hashl + hashw + hashp + hashu + hashn + hashy); +// window.location.replace("#" + hashc + hashz + hashm + hasho + hashb + hashs + hashl + hashw + hashp + hashu + hashn + hashy); + window.location.replace("#" + hashc + hashz + hashm + hasho + hashb + hashs + hashl + hashw + hashp + hashu + hashn + hashy + hasha); } function rempl(po, c) { @@ -1573,7 +1646,8 @@ function initialize() { document.getElementById("ett2").innerHTML = "
CNAlti.Vz
"; document.getElementById("ac").innerHTML = "   ..::Aircraft::..
CN:
Regist.:
Device Id:
Type:
Model:
Last time:
Latitude:
Longitude:
Altitude:
G.Speed:
Track:  °
Vz:
Receiver:
"; document.getElementById("dtable").innerHTML = "
"; - document.getElementById("menu").innerHTML = "
Hide new gliders
Ignore Offline
Bounds

       
Auto Set to map
..:: Devices ::..
ICAO
Flarm
OGN Trackers
..:: Layers ::..
Temperature
Wind \"\"
Pressure
Precipitation
AirSpaces ( openaip.net )
Airports ( openaip.net )
Receivers
Tasks

..::Units::..
Met. Imp.
..::Path length::..
5' 10' All
Join the
OGN DataBase

Sources
"; +// document.getElementById("menu").innerHTML = "
Hide new gliders
Ignore Offline
Bounds

       
Auto Set to map
..:: Devices ::..
ICAO
Flarm
OGN Trackers
..:: Layers ::..
Temperature
Wind \"\"
Pressure
Precipitation
AirSpaces ( openaip.net )
Airports ( openaip.net )
Receivers
Tasks

..::Units::..
Met. Imp.
..::Path length::..
5' 10' All
Join the
OGN DataBase

Sources
"; + document.getElementById("menu").innerHTML = "
Hide new gliders
Ignore Offline
Bounds

       
Auto Set to map
..:: Devices ::..
ICAO
Flarm
OGN Trackers
..:: Layers ::..
Wind
Pressure
AirSpaces ( openaip.net )
Airports ( openaip.net )
Receivers
Tasks

..::Units::..
Met. Imp.
..::Path length::..
5' 10' All
..:: Altitude ::..
Altitude stick
Join the
OGN DataBase

Sources
"; // parameter b=lat1,lon1,lat2,lon2 bounds if (typeof(parh.b) != 'undefined') { @@ -1681,6 +1755,14 @@ function initialize() { } } + // parameter a=0 (Display an altitude stick) + if (typeof(parh.a) != 'undefined') { + if (parh.a == "1") { + document.getElementById('stick').checked = true; + stick = 1; + hasha = "&a=1"; + } + } // parameter p=1,2 or 3 path length 5", 10" or all points if (typeof(parh.p) != 'undefined') {