Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1060 lines
37 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
3 years ago
​
​
3 years ago
​
​
3 years ago
​
​
3 years ago
​
​
​
3 years ago
​
​
​
3 years ago
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var ActiveZones = null;
  3. var map = null;
  4. var map_ed = null;
  5. var markers = [];
  6. var selectedMarkerIcon = L.icon({
  7. iconUrl: '/style/assets/cursor.png',
  8. iconSize: [32, 32],
  9. iconAnchor: [16, 16]//,
  10. //popupAnchor: [-3, -76],
  11. //shadowUrl: 'my-icon-shadow.png',
  12. //shadowSize: [68, 95],
  13. //shadowAnchor: [22, 94]
  14. });
  15. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  16. function getZoneByNode( nid ){
  17. var rVal = -1;
  18. for( var i=0; i < ActiveZones.totalCount; i++ ){
  19. if( ActiveZones.zones[i].dev_id == nid ){
  20. rVal = i;
  21. break;
  22. };
  23. };
  24. return rVal;
  25. };
  26. function turnOffAllGzButThis( nid ){
  27. var chocho = -1;
  28. for( var i=0; i < ActiveZones.totalCount; i++ ){
  29. if( ActiveZones.zones[i].dev_id == nid ) chocho = i;
  30. map.removeLayer( ActiveZones.fig[i] );
  31. map.removeLayer( ActiveZones.zang[i] );
  32. map.removeLayer( ActiveZones.center[i] );
  33. };
  34. if( chocho > -1 ){
  35. map.addLayer( ActiveZones.fig[chocho] );
  36. map.addLayer( ActiveZones.zang[chocho] );
  37. map.addLayer( ActiveZones.center[chocho] );
  38. var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) );
  39. map.flyToBounds( cVisible.getBounds() );
  40. };
  41. };
  42. function turnAllGzOn(){
  43. var tall = Array();
  44. for( var i=0; i < ActiveZones.totalCount; i++ ){
  45. tall[i*3] = ActiveZones.fig[i];
  46. tall[i*3+1] = ActiveZones.zang[i];
  47. tall[i*3+2] = ActiveZones.center[i];
  48. if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] );
  49. if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] );
  50. if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
  51. };
  52. var cVisible = L.featureGroup( tall );
  53. map.flyToBounds( cVisible.getBounds() );
  54. };
  55. function loadMapZones( SID ){
  56. Ext.Ajax.request({
  57. url: '/lib/controller/getGeoZones.php',
  58. params: {
  59. SITE: SID,
  60. UID: <?=$UserID;?>,
  61. SID: '<?=$Session;?>'
  62. },
  63. success: function( response, opts ){
  64. // If the response is JSON, you have to decode it
  65. var data = Ext.decode(response.responseText);
  66. var pp = Ext.getCmp('sources_panel');
  67. if( typeof pp !== 'undefined' ) pp.removeAll();
  68. ActiveZones = data;
  69. ActiveZones.fig = new Array();
  70. ActiveZones.zang = new Array();
  71. ActiveZones.center = new Array();
  72. for(var i = 0; i < data.totalCount; i++ ) {
  73. switch( data.zones[i].type ){
  74. case 'circle':{
  75. //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map );
  76. ActiveZones.fig[i] = new L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } );
  77. //map.addLayer( ActiveZones.fig[i] );
  78. break;
  79. };
  80. case 'poly':{
  81. ActiveZones.fig[i] = new L.polygon( data.zones[i].points, {color: data.zones[i].color, dashArray: "4 1 2 3", weight: 1, opacity: 0.8, clickable: false, interactive: false, bubblingMouseEvents: false });//.addTo(map);
  82. //map.addLayer( ActiveZones.fig[i] );
  83. break;
  84. };
  85. case 'image':{
  86. ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map );
  87. //map.addLayer( ActiveZones.fig[i] );
  88. break;
  89. };
  90. case 'image_rot':{
  91. ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, {
  92. opacity: 0.8 //,
  93. //interactive: true,
  94. //attribution: "Historical building plan &copy; <a href='http://www.ign.es'>Instituto Geogr?fico Nacional de Espa?a</a>"
  95. });//.addTo( map );
  96. //map.addLayer( ActiveZones.fig[i] );
  97. break;
  98. };
  99. };
  100. /*
  101. if( data.zones[i].dev_is_source ){
  102. if( typeof pp !== 'undefined' ) {
  103. var sty = '';
  104. if( selecredActiveSourceFilter == data.zones[i].dev_id ){
  105. sty = 'cardDeviceSourceSelected';
  106. } else {
  107. sty = 'cardDeviceSource';
  108. };
  109. pp.add( {
  110. id: data.zones[i].dev_id+'_container',
  111. frame: false,
  112. border: false,
  113. width: 130,
  114. height: 130,
  115. html: '<div id="'+data.zones[i].dev_id+'_div" class="'+sty+'" onclick="clickDeviceSelector('+data.zones[i].dev_id+');"><img id="'+data.zones[i].dev_id+'_ind" width="16px" src="/style/assets/led_green_blink_300ms.gif"><center><img src="/style/assets/'+data.zones[i].dev_type+'_node.png"><br/><p class="dev_name">'+data.zones[i].dev_name+'</p></center></div>'
  116. });
  117. };
  118. };*/
  119. if( data.zones[i].zang != undefined ){
  120. //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  121. ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  122. };
  123. if( data.zones[i].center != undefined ){
  124. //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  125. ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  126. };
  127. };
  128. //if( selecredActiveSourceFilter == 0 ){
  129. turnAllGzOn();
  130. //} else {
  131. // turnOffAllGzButThis( selecredActiveSourceFilter );
  132. //};
  133. //if( typeof pp !== 'undefined' ) pp.doLayout();
  134. },
  135. failure: function( response, opts ) {
  136. //Ext.fly('some_div').update('Fail!');
  137. }
  138. });
  139. };
  140. var cevt = Array();
  141. var coz = Array();
  142. function showEventsOnMap( data, removeCursor ){
  143. if( removeCursor == undefined ) removeCursor = true;
  144. if( removeCursor ) map.removeLayer( selectedMarker );
  145. if( cevt.length ){
  146. for( i=0; i< cevt.length; i++ ){
  147. if( cevt[i]!= null ){
  148. cevt[i].remove();
  149. delete( cevt[i] );
  150. cevt[i] = null;
  151. };
  152. };
  153. };
  154. if( coz.length ){
  155. for( i=0; i< coz.length; i++ ){
  156. if( coz[i]!= null ){
  157. coz[i].remove();
  158. delete( coz[i] );
  159. coz[i]=null;
  160. };
  161. };
  162. };
  163. var idx = 0;
  164. for( i=0; i < data.length; i++ ){
  165. if( data[i].targets != undefined ){
  166. var zz = ( 1.0 / ( data[i].targets.length + 0 ) );
  167. var cp_color='#FF0000';
  168. for( j = 0; j < data[i].targets.length; j++ ){
  169. //switch( data.log[i].event ){
  170. // case 36: cp_color='#0000FF'; break;
  171. //};
  172. cLon = data[i].targets[j].lat;
  173. cLat = data[i].targets[j].lon;
  174. cevt[idx] = L.circleMarker( [cLat, cLon], {id:data[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } );//.on('click', function( e, a ){
  175. // loadEventPropertiesByID( this.options.id );
  176. //} );
  177. cevt[idx].addTo(map);
  178. idx++;
  179. };
  180. };
  181. };
  182. };
  183. function LoadMapEventsZ( Mode ){
  184. if( tlLoadLocker ) return;
  185. tlLoadLocker = true;
  186. Ext.Ajax.request({
  187. url: '/lib/controller/getGeoAlerts.php',
  188. params: {
  189. SITE: <?=$SiteID;?>,
  190. UID: <?=$UserID;?>,
  191. SID: '<?=$Session;?>',
  192. MODE: Mode
  193. },
  194. success: function( response, opts ){
  195. if( cevt.length ){
  196. for( i=0; i< cevt.length; i++ ){
  197. if( cevt[i]!= null ){
  198. cevt[i].remove();
  199. delete( cevt[i] );
  200. cevt[i] = null;
  201. };
  202. };
  203. };
  204. if( coz.length ){
  205. for( i=0; i< coz.length; i++ ){
  206. if( coz[i]!= null ){
  207. coz[i].remove();
  208. delete( coz[i] );
  209. coz[i]=null;
  210. };
  211. };
  212. };
  213. var data = Ext.decode( response.responseText );
  214. var zz = ( 1.0 / ( data.evt.length + 0 ) );
  215. for( i=0; i < data.evt.length; i++ ){
  216. cevt[i] = L.circleMarker( [data.evt[i].lat,data.evt[i].lon], {id:data.evt[i].id, color: '#FF0000', radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } ).on('click', function( e, a ){
  217. loadEventProperties( this.options.id );
  218. } );
  219. cevt[i].addTo(map);
  220. };
  221. for( i=0; i < data.other.length; i++ ){
  222. switch( data.other[i].type ){
  223. case 'circle':{
  224. coz[i] = L.circleMarker( data.other[i].loc, {id:data.other[i].id, color: data.other[i].color, radius: 5, stroke: false, fillOpacity: 1.0 } );
  225. coz[i].addTo(map);
  226. break;
  227. };
  228. };
  229. };
  230. //eventsListStore.reload();
  231. tlLoadLocker = false;
  232. },
  233. failure: function( response, opts ) {
  234. //Ext.fly('some_div').update('Fail!');
  235. tlLoadLocker = false;
  236. }
  237. });
  238. };
  239. function initMapMonitoring(){
  240. map = L.map('event_map',{
  241. attributionControl: true,
  242. //preferCanvas: true,
  243. zoomControl: true,
  244. center: [SiteLat, SiteLon],
  245. /*zoomControl: false,
  246. zoom: 17,
  247. minZoom: 17,
  248. maxZoom: 17,*/
  249. keyboard: false
  250. }).setView([SiteLat, SiteLon], 17);
  251. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  252. var mapLayers = [];
  253. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  254. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  255. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  256. detectRetina: true
  257. });*/
  258. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  259. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  260. maxNativeZoom: 18,
  261. maxZoom: 24,
  262. })
  263. // https://leaflet-extras.github.io/leaflet-providers/preview/
  264. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  265. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  266. maxZoom: 19
  267. });
  268. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  269. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  270. maxZoom: 19
  271. });
  272. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  273. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  274. maxZoom: 24
  275. });
  276. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  277. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  278. maxZoom: 19
  279. });
  280. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  281. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  282. maxZoom: 19
  283. });
  284. /*
  285. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  286. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  287. maxZoom: 22
  288. });
  289. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  290. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  291. maxZoom: 22
  292. });
  293. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  294. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  295. maxZoom: 22
  296. });
  297. */
  298. var baseMaps = {
  299. "MyMap": mapLayers["MyMap"],
  300. "OpenStreetMap": mapLayers["OpenStreetMap"],
  301. "OpenTopoMap": mapLayers["OpenTopoMap"],
  302. "EsriSat": mapLayers["EsriSat"],
  303. "EsriStreet": mapLayers["EsriStreet"],
  304. "EsriTopo": mapLayers["EsriTopo"],
  305. //"Bing": mapLayers["Bing"],
  306. //"OSM-Cycle": mapLayers["Cycle"],
  307. //"Landscape": mapLayers["Landscape"],
  308. //"Outdoor": mapLayers["Outdoor"],
  309. };
  310. L.control.layers( baseMaps ).addTo(map);
  311. mapLayers["MyMap"].addTo(map);
  312. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  313. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  314. maxNativeZoom: 18,
  315. maxZoom: 24,
  316. }).addTo(map); */
  317. //loadTimeLineGroups( selectedSite );
  318. loadMapZones( 0 );
  319. //getData( 'arch' );
  320. };
  321. var iconSaver = null;
  322. var markerSaver = null;
  323. function updateLocation( e ){
  324. locationSelectedNode = e.target.options.mycustomid;
  325. Ext.Ajax.request({
  326. url: '/lib/controller/updateLocation.php',
  327. params: {
  328. NODE: locationSelectedNode,
  329. SITE: <?=$SiteID;?>,
  330. UID: <?=$UserID;?>,
  331. TYPE: 0,
  332. SID: '<?=$Session;?>',
  333. LAT: e.target._latlng.lat,
  334. LON: e.target._latlng.lng
  335. },
  336. success: function( response, opts ){
  337. loadNodeLocationProps( locationSelectedNode );
  338. },
  339. failure: failureAJAXFunction
  340. });
  341. };
  342. function markerDblClick( e ){
  343. if( iconSaver == null ){
  344. iconSaver = e.target.options.icon;
  345. markerSaver = e.target;
  346. e.target.setIcon( SNAPE_Icon );
  347. for( i=0; i< markers.length; i++){
  348. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  349. markers[i].setOpacity( 0.1 );
  350. } else {
  351. markers[i].setOpacity( 1.0 );
  352. }
  353. };
  354. } else {
  355. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  356. e.target.setIcon( iconSaver );
  357. iconSaver = null;
  358. markerSaver = null;
  359. for( i=0; i< markers.length; i++){
  360. markers[i].setOpacity( 1.0 );
  361. };
  362. } else {
  363. markerSaver.setIcon( iconSaver );
  364. iconSaver = e.target.options.icon;
  365. markerSaver = e.target;
  366. e.target.setIcon( SNAPE_Icon );
  367. for( i=0; i< markers.length; i++){
  368. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  369. markers[i].setOpacity( 0.1 );
  370. } else {
  371. markers[i].setOpacity( 1.0 );
  372. }
  373. };
  374. };
  375. };
  376. };
  377. function setNodeLocationToAnchor(){
  378. Ext.Ajax.request({
  379. url: '/lib/controller/updateLocation.php',
  380. params: {
  381. NODE: locationSelectedNode,
  382. SITE: <?=$SiteID;?>,
  383. UID: <?=$UserID;?>,
  384. TYPE: 0,
  385. SID: '<?=$Session;?>',
  386. LAT: SiteLat,
  387. LON: SiteLon,
  388. ALT: SiteAlt
  389. },
  390. success: function( response, opts ){
  391. loadLocationEditor();
  392. },
  393. failure: failureAJAXFunction
  394. });
  395. };
  396. function setNodeLocationByDelta(){
  397. var dx = Ext.getCmp('dx').getValue();
  398. var dy = Ext.getCmp('dy').getValue();
  399. var dz = Ext.getCmp('dz').getValue();
  400. Ext.Ajax.request({
  401. url: '/lib/controller/updateLocation.php',
  402. params: {
  403. NODE: locationSelectedNode,
  404. SITE: <?=$SiteID;?>,
  405. UID: <?=$UserID;?>,
  406. TYPE: 3,
  407. SID: '<?=$Session;?>',
  408. LAT: dx,
  409. LON: dy,
  410. ALT: dz
  411. },
  412. success: function( response, opts ){
  413. loadLocationEditor();
  414. },
  415. failure: failureAJAXFunction
  416. });
  417. };
  418. var LRF3D_Icon = L.icon({
  419. iconUrl: '/style/assets/5_node.png',
  420. //shadowUrl: 'leaf-shadow.png',
  421. iconSize: [64, 64], // size of the icon
  422. //shadowSize: [50, 64], // size of the shadow
  423. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  424. //shadowAnchor: [4, 62], // the same for the shadow
  425. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  426. });
  427. var LFS_Icon = L.icon({
  428. iconUrl: '/style/assets/2_node.png',
  429. //shadowUrl: 'leaf-shadow.png',
  430. iconSize: [64, 64], // size of the icon
  431. //shadowSize: [50, 64], // size of the shadow
  432. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  433. //shadowAnchor: [4, 62], // the same for the shadow
  434. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  435. });
  436. var PLS200_Icon = L.icon({
  437. iconUrl: '/style/assets/3_node.png',
  438. //shadowUrl: 'leaf-shadow.png',
  439. iconSize: [64, 64], // size of the icon
  440. //shadowSize: [50, 64], // size of the shadow
  441. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  442. //shadowAnchor: [4, 62], // the same for the shadow
  443. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  444. });
  445. var PLSNET200_Icon = L.icon({
  446. iconUrl: '/style/assets/6_node.png',
  447. //shadowUrl: 'leaf-shadow.png',
  448. iconSize: [64, 64], // size of the icon
  449. //shadowSize: [50, 64], // size of the shadow
  450. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  451. //shadowAnchor: [4, 62], // the same for the shadow
  452. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  453. });
  454. var PLS360_Icon = L.icon({
  455. iconUrl: '/style/assets/4_node.png',
  456. //shadowUrl: 'leaf-shadow.png',
  457. iconSize: [64, 64], // size of the icon
  458. //shadowSize: [50, 64], // size of the shadow
  459. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  460. //shadowAnchor: [4, 62], // the same for the shadow
  461. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  462. });
  463. var ALS_Icon = L.icon({
  464. iconUrl: '/style/assets/1_node.png',
  465. //shadowUrl: 'leaf-shadow.png',
  466. iconSize: [64, 64], // size of the icon
  467. //shadowSize: [50, 64], // size of the shadow
  468. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  469. //shadowAnchor: [4, 62], // the same for the shadow
  470. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  471. });
  472. var PTZCAM_Icon = L.icon({
  473. iconUrl: '/style/assets/12_node.png',
  474. //shadowUrl: 'leaf-shadow.png',
  475. iconSize: [64, 64], // size of the icon
  476. //shadowSize: [50, 64], // size of the shadow
  477. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  478. //shadowAnchor: [4, 62], // the same for the shadow
  479. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  480. });
  481. var FIXCAM_Icon = L.icon({
  482. iconUrl: '/style/assets/11_node.png',
  483. //shadowUrl: 'leaf-shadow.png',
  484. iconSize: [64, 64], // size of the icon
  485. //shadowSize: [50, 64], // size of the shadow
  486. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  487. //shadowAnchor: [4, 62], // the same for the shadow
  488. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  489. });
  490. var SITEZ_Icon = L.icon({
  491. iconUrl: '/style/assets/centre_1.png',
  492. //shadowUrl: 'leaf-shadow.png',
  493. iconSize: [32, 32], // size of the icon
  494. //shadowSize: [50, 64], // size of the shadow
  495. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  496. //shadowAnchor: [4, 62], // the same for the shadow
  497. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  498. });
  499. var SNAPE_Icon = L.icon({
  500. iconUrl: '/style/assets/cursor.png',
  501. //shadowUrl: 'leaf-shadow.png',
  502. iconSize: [32, 32], // size of the icon
  503. //shadowSize: [50, 64], // size of the shadow
  504. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  505. //shadowAnchor: [4, 62], // the same for the shadow
  506. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  507. });
  508. function loadLocationNodes(){
  509. Ext.Ajax.request({
  510. url: '/lib/controller/getLocationItems.php',
  511. params: {
  512. SITE: <?=$SiteID;?>,
  513. UID: <?=$UserID;?>,
  514. SID: '<?=$Session;?>'
  515. },
  516. success: function( response, opts ){
  517. var data = Ext.decode(response.responseText);
  518. for( i=0; i < data.length; i++){
  519. switch( data[i].type ){
  520. case 1:{
  521. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: ALS_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  522. break;
  523. };
  524. case 2:{
  525. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LFS_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  526. break;
  527. };
  528. case 3:{
  529. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS200_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  530. break;
  531. };
  532. case 4:{
  533. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS360_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  534. break;
  535. };
  536. case 5:{
  537. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LRF3D_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  538. break;
  539. };
  540. case 6:{
  541. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLSNET200_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  542. break;
  543. };
  544. case 10:
  545. case 12:{
  546. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: FIXCAM_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  547. break;
  548. };
  549. case 11:
  550. case 13:{
  551. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PTZCAM_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  552. break;
  553. };
  554. };
  555. //bindPopup('A pretty CSS3 popup.<br> Easily customizable.');//.openPopup();
  556. };
  557. },
  558. failure: function( response, opts ) {
  559. //var tPanel = Ext.getCmp('main_portal');
  560. //tPanel.remove(0);
  561. //tPanel.add( { html: 'Failed to load dashboard!' } );
  562. //tPanel.doLayout();
  563. }
  564. });
  565. };
  566. function orientationEditor(){
  567. if( orientationEditorWindow == null ){
  568. orientationEditorWindow = new Ext.Window({
  569. modal: true,
  570. title: 'Orientation',
  571. closeAction: 'hide',
  572. width: 640,
  573. height: 500,
  574. items:[{
  575. layout: 'table',
  576. defaults: {
  577. bodyStyle:'padding:5px'
  578. },
  579. layoutConfig: {
  580. columns: 3
  581. },
  582. items:[{
  583. html: 'Roll:'
  584. },{
  585. xtype: 'textfield',
  586. id: 'roll',
  587. name: 'roll',
  588. value: 30.0029,
  589. listeners:{
  590. change: function( sl, nv, tt ){
  591. setCubeOrientation( nv / 1.0, curY, curZ );
  592. }
  593. }
  594. },{
  595. xtype: 'slider',
  596. id: 'roll_sld',
  597. width: 200,
  598. value: 30.0029,
  599. minValue: -180.0,
  600. maxValue: 180.0,
  601. listeners:{
  602. change: function( sl, nv, tt ){
  603. setCubeOrientation( nv, curY, curZ );
  604. }
  605. }
  606. },{
  607. html: 'Pitch:'
  608. },{
  609. xtype: 'textfield',
  610. id: 'pitch',
  611. name: 'pitch',
  612. value: 30.0029,
  613. listeners:{
  614. change: function( sl, nv, tt ){
  615. setCubeOrientation( curX, nv / 1.0, curZ );
  616. }
  617. }
  618. },{
  619. xtype: 'slider',
  620. id: 'pitch_sld',
  621. width: 200,
  622. value: 30.0029,
  623. minValue: -180.0,
  624. maxValue: 180.0,
  625. listeners:{
  626. change: function( sl, nv, tt ){
  627. setCubeOrientation( curX, nv, curZ );
  628. }
  629. }
  630. },{
  631. html: 'Yaw:'
  632. },{
  633. xtype: 'textfield',
  634. id: 'yaw',
  635. name: 'yaw',
  636. value: 30.0029,
  637. listeners:{
  638. change: function( sl, nv, tt ){
  639. //alert( nv );
  640. setCubeOrientation( curX, curY, nv / 1.0 );
  641. }
  642. }
  643. },{
  644. xtype: 'slider',
  645. id: 'yaw_sld',
  646. width: 200,
  647. value: 30.0029,
  648. minValue: -180.0,
  649. maxValue: 180.0,
  650. listeners:{
  651. change: function( sl, nv, tt ){
  652. setCubeOrientation( curX, curY, nv );
  653. }
  654. }
  655. }]
  656. },{
  657. html: '<div id="wrapper"><div class="viewport"><div class="cube"><div class="side"><div class="cube-image top">FRONT</div></div><div class="side"><div class="cube-image">TOP</div></div><div class="side"><div class="cube-image">RIGHT</div></div><div class="side"><div class="cube-image">BOTTOM</div></div><div class="side"><div class="cube-image">LEFT</div></div><div class="side"><div class="cube-image active">BACK</div></div></div></div></div>'
  658. }],
  659. buttons:[{
  660. text: 'Cancel',
  661. width: 200,
  662. handler: function(){
  663. orientationEditorWindow.hide();
  664. }
  665. },{
  666. text: 'Apply',
  667. width: 200,
  668. handler: function(){
  669. Ext.getCmp('sroll').setValue( Ext.getCmp('roll').getValue() );
  670. Ext.getCmp('spitch').setValue( Ext.getCmp('pitch').getValue() );
  671. Ext.getCmp('syaw').setValue( Ext.getCmp('yaw').getValue() );
  672. orientationEditorWindow.hide();
  673. }
  674. }]
  675. });
  676. orientationEditorWindow.show();
  677. cubeViewport = new Viewport({
  678. element: document.getElementsByClassName('cube')[0],
  679. fps: 20,
  680. sensivity: .1,
  681. sensivityFade: .93,
  682. speed: 2,
  683. touchSensivity: 1.5
  684. });
  685. cube = new Cube({
  686. viewport: cubeViewport,
  687. element: document.getElementsByClassName('cube')[0]
  688. });
  689. } else {
  690. orientationEditorWindow.show();
  691. };
  692. setCubeOrientation( Ext.getCmp('sroll').getValue(), Ext.getCmp('spitch').getValue(), Ext.getCmp('syaw').getValue() );
  693. };
  694. var locationSelectedNode = 0;
  695. function loadLoactionProps( e ){
  696. if( typeof e == 'number' ){
  697. locationSelectedNode = e;
  698. } else {
  699. locationSelectedNode = e.sourceTarget.options.mycustomid;
  700. }
  701. loadNodeLocationProps( locationSelectedNode );
  702. };
  703. function loadNodeLocationProps( NodeID ){
  704. //alert( 'Node: ' + NodeID );
  705. Ext.Ajax.request({
  706. url: '/lib/controller/getLocationNodeProps.php',
  707. params: {
  708. NID: <?=$SiteID;?>,
  709. UID: <?=$UserID;?>,
  710. SID: '<?=$Session;?>',
  711. NODE: NodeID
  712. },
  713. success: function( response, opts ){
  714. // If the response is JSON, you have to decode it
  715. var data = Ext.decode(response.responseText);
  716. var tPanel = Ext.getCmp('prop_content');
  717. tPanel.remove(0);
  718. tPanel.add( data );
  719. tPanel.doLayout();
  720. },
  721. failure: failureAJAXFunction
  722. });
  723. };
  724. function LoadNodesList(){
  725. Ext.Ajax.request({
  726. url: '/lib/controller/getLocationNodes.php',
  727. params: {
  728. SITE: <?=$SiteID;?>,
  729. UID: <?=$UserID;?>,
  730. SID: '<?=$Session;?>'
  731. },
  732. success: function( response, opts ){
  733. // If the response is JSON, you have to decode it
  734. var data = Ext.decode(response.responseText);
  735. var tPanel = Ext.getCmp('prop_content');
  736. tPanel.remove(0);
  737. tPanel.add( data );
  738. tPanel.doLayout();
  739. },
  740. failure: failureAJAXFunction
  741. });
  742. };
  743. function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
  744. if( tlInterval!= null ){
  745. window.clearInterval( tlInterval );
  746. tlInterval = null;
  747. timelineObj = null;
  748. };
  749. if( node_type == undefined ) node_type = 0;
  750. if( lat == undefined ){
  751. lat = SiteLat;
  752. lon = SiteLon;
  753. };
  754. map_ed = L.map( el_id,{
  755. attributionControl: true,
  756. //preferCanvas: true,
  757. zoomControl: true,
  758. center: [SiteLat, SiteLon],
  759. /*zoomControl: false,
  760. zoom: 17,
  761. minZoom: 17,
  762. maxZoom: 17,*/
  763. keyboard: false
  764. }).setView([SiteLat, SiteLon], 17);
  765. if( node_type ){
  766. L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");//.openPopup();
  767. } else {
  768. L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");//.openPopup();
  769. };
  770. var mapLayers = [];
  771. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  772. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  773. maxNativeZoom: 18,
  774. maxZoom: 24,
  775. })
  776. // https://leaflet-extras.github.io/leaflet-providers/preview/
  777. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  778. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  779. maxZoom: 19
  780. });
  781. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  782. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  783. maxZoom: 19
  784. });
  785. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  786. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  787. maxZoom: 24
  788. });
  789. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  790. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  791. maxZoom: 19
  792. });
  793. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  794. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  795. maxZoom: 19
  796. });
  797. var baseMaps = {
  798. "MyMap": mapLayers["MyMap"],
  799. "OpenStreetMap": mapLayers["OpenStreetMap"],
  800. "OpenTopoMap": mapLayers["OpenTopoMap"],
  801. "EsriSat": mapLayers["EsriSat"],
  802. "EsriStreet": mapLayers["EsriStreet"],
  803. "EsriTopo": mapLayers["EsriTopo"],
  804. //"Bing": mapLayers["Bing"],
  805. //"OSM-Cycle": mapLayers["Cycle"],
  806. //"Landscape": mapLayers["Landscape"],
  807. //"Outdoor": mapLayers["Outdoor"],
  808. };
  809. L.control.layers( baseMaps ).addTo( map_ed );
  810. mapLayers["MyMap"].addTo( map_ed );
  811. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  812. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
  813. }).addTo( map_ed );
  814. if( node_type ){
  815. switch( node_type ){
  816. case 1:{
  817. markers[0] = L.marker([lat,lon], {draggable: true,icon: ALS_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  818. break;
  819. };
  820. case 2:{
  821. markers[0] = L.marker([lat,lon], {draggable: true,icon: LFS_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  822. break;
  823. };
  824. case 3:{
  825. markers[0] = L.marker([lat,lon], {draggable: true,icon: PLS200_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  826. break;
  827. };
  828. case 4:{
  829. markers[0] = L.marker([lat,lon], {draggable: true,icon: PLS360_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  830. break;
  831. };
  832. case 5:{
  833. markers[0] = L.marker([lat,lon], {draggable: true,icon: LRF3D_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  834. break;
  835. };
  836. case 6:{
  837. markers[0] = L.marker([lat,lon], {draggable: true,icon: PLSNET200_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  838. break;
  839. };
  840. case 10:
  841. case 12:{
  842. markers[0] = L.marker([lat,lon], {draggable: true,icon: FIXCAM_Icon, mycustomid: node_id} ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  843. break;
  844. };
  845. case 11:
  846. case 13:{
  847. markers[0] = L.marker([lat,lon], {draggable: true,icon: PTZCAM_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  848. break;
  849. };
  850. };
  851. } else loadLocationNodes();
  852. };
  853. function updateSiteAnchor(){
  854. SiteLat = Ext.getCmp('siteLat').getValue();
  855. SiteLon = Ext.getCmp('siteLon').getValue();
  856. SiteAlt = Ext.getCmp('siteAlt').getValue();
  857. Ext.Ajax.request({
  858. url: '/lib/controller/updateLocation.php',
  859. params: {
  860. SITE: <?=$SiteID;?>,
  861. UID: <?=$UserID;?>,
  862. TYPE: 1,
  863. SID: '<?=$Session;?>',
  864. LAT: SiteLat,
  865. LON: SiteLon,
  866. ALT: SiteAlt
  867. },
  868. failure: failureAJAXFunction
  869. });
  870. };
  871. function updateLocationOrientation(){
  872. var tLat = Ext.getCmp('slat').getValue();
  873. var tLon = Ext.getCmp('slon').getValue();
  874. var tAlt = Ext.getCmp('salt').getValue();
  875. var tRoll = Ext.getCmp('sroll').getValue();
  876. var tPitch = Ext.getCmp('spitch').getValue();
  877. var tYaw = Ext.getCmp('syaw').getValue();
  878. Ext.Ajax.request({
  879. url: '/lib/controller/updateLocation.php',
  880. params: {
  881. NODE: locationSelectedNode,
  882. UID: <?=$UserID;?>,
  883. TYPE: 2,
  884. SID: '<?=$Session;?>',
  885. LAT: tLat,
  886. LON: tLon,
  887. ALT: tAlt,
  888. YAW: tYaw,
  889. ROLL: tRoll,
  890. PITCH: tPitch
  891. },
  892. failure: failureAJAXFunction
  893. });
  894. };
  895. var iconSaver = null;
  896. var markerSaver = null;
  897. function updateLocation( e ){
  898. locationSelectedNode = e.target.options.mycustomid;
  899. Ext.Ajax.request({
  900. url: '/lib/controller/updateLocation.php',
  901. params: {
  902. NODE: locationSelectedNode,
  903. SITE: <?=$SiteID;?>,
  904. UID: <?=$UserID;?>,
  905. TYPE: 0,
  906. SID: '<?=$Session;?>',
  907. LAT: e.target._latlng.lat,
  908. LON: e.target._latlng.lng
  909. },
  910. success: function( response, opts ){
  911. loadNodeLocationProps( locationSelectedNode );
  912. },
  913. failure: failureAJAXFunction
  914. });
  915. };
  916. function markerDblClick( e ){
  917. if( iconSaver == null ){
  918. iconSaver = e.target.options.icon;
  919. markerSaver = e.target;
  920. e.target.setIcon( SNAPE_Icon );
  921. for( i=0; i< markers.length; i++){
  922. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  923. markers[i].setOpacity( 0.1 );
  924. } else {
  925. markers[i].setOpacity( 1.0 );
  926. }
  927. };
  928. } else {
  929. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  930. e.target.setIcon( iconSaver );
  931. iconSaver = null;
  932. markerSaver = null;
  933. for( i=0; i< markers.length; i++){
  934. markers[i].setOpacity( 1.0 );
  935. };
  936. } else {
  937. markerSaver.setIcon( iconSaver );
  938. iconSaver = e.target.options.icon;
  939. markerSaver = e.target;
  940. e.target.setIcon( SNAPE_Icon );
  941. for( i=0; i< markers.length; i++){
  942. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  943. markers[i].setOpacity( 0.1 );
  944. } else {
  945. markers[i].setOpacity( 1.0 );
  946. }
  947. };
  948. };
  949. };
  950. };
  951. function setNodeLocationToAnchor(){
  952. Ext.Ajax.request({
  953. url: '/lib/controller/updateLocation.php',
  954. params: {
  955. NODE: locationSelectedNode,
  956. SITE: <?=$SiteID;?>,
  957. UID: <?=$UserID;?>,
  958. TYPE: 0,
  959. SID: '<?=$Session;?>',
  960. LAT: SiteLat,
  961. LON: SiteLon,
  962. ALT: SiteAlt
  963. },
  964. success: function( response, opts ){
  965. loadLocationEditor();
  966. },
  967. failure: failureAJAXFunction
  968. });
  969. };
  970. function setNodeLocationByDelta(){
  971. var dx = Ext.getCmp('dx').getValue();
  972. var dy = Ext.getCmp('dy').getValue();
  973. var dz = Ext.getCmp('dz').getValue();
  974. Ext.Ajax.request({
  975. url: '/lib/controller/updateLocation.php',
  976. params: {
  977. NODE: locationSelectedNode,
  978. SITE: <?=$SiteID;?>,
  979. UID: <?=$UserID;?>,
  980. TYPE: 3,
  981. SID: '<?=$Session;?>',
  982. LAT: dx,
  983. LON: dy,
  984. ALT: dz
  985. },
  986. success: function( response, opts ){
  987. loadLocationEditor();
  988. },
  989. failure: failureAJAXFunction
  990. });
  991. };