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.

763 lines
31 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var ActiveZones = null;
  3. var map = null;
  4. var map_ed = null;
  5. var markers = [];
  6. function getZoneByNode( nid ){
  7. var rVal = -1;
  8. for( var i=0; i < ActiveZones.totalCount; i++ ){
  9. if( ActiveZones.zones[i].dev_id == nid ){
  10. rVal = i;
  11. break;
  12. };
  13. };
  14. return rVal;
  15. };
  16. function turnOffAllGzButThis( nid ){
  17. var chocho = -1;
  18. for( var i=0; i < ActiveZones.totalCount; i++ ){
  19. if( ActiveZones.zones[i].dev_id == nid ) chocho = i;
  20. map.removeLayer( ActiveZones.fig[i] );
  21. map.removeLayer( ActiveZones.zang[i] );
  22. map.removeLayer( ActiveZones.center[i] );
  23. };
  24. if( chocho > -1 ){
  25. map.addLayer( ActiveZones.fig[chocho] );
  26. map.addLayer( ActiveZones.zang[chocho] );
  27. map.addLayer( ActiveZones.center[chocho] );
  28. var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) );
  29. map.flyToBounds( cVisible.getBounds() );
  30. };
  31. };
  32. function turnAllGzOn(){
  33. var tall = Array();
  34. for( var i=0; i < ActiveZones.totalCount; i++ ){
  35. tall[i*3] = ActiveZones.fig[i];
  36. tall[i*3+1] = ActiveZones.zang[i];
  37. tall[i*3+2] = ActiveZones.center[i];
  38. if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] );
  39. if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] );
  40. if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
  41. };
  42. var cVisible = L.featureGroup( tall );
  43. map.flyToBounds( cVisible.getBounds() );
  44. };
  45. function loadMapZones( SID ){
  46. Ext.Ajax.request({
  47. url: '/lib/controller/getGeoZones.php',
  48. params: {
  49. SITE: SID,
  50. UID: <?=$UserID;?>,
  51. SID: '<?=$Session;?>'
  52. },
  53. success: function( response, opts ){
  54. // If the response is JSON, you have to decode it
  55. var data = Ext.decode(response.responseText);
  56. var pp = Ext.getCmp('sources_panel');
  57. if( typeof pp !== 'undefined' ) pp.removeAll();
  58. ActiveZones = data;
  59. ActiveZones.fig = new Array();
  60. ActiveZones.zang = new Array();
  61. ActiveZones.center = new Array();
  62. for(var i = 0; i < data.totalCount; i++ ) {
  63. switch( data.zones[i].type ){
  64. case 'circle':{
  65. //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map );
  66. 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 } );
  67. //map.addLayer( ActiveZones.fig[i] );
  68. break;
  69. };
  70. case 'poly':{
  71. 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);
  72. //map.addLayer( ActiveZones.fig[i] );
  73. break;
  74. };
  75. case 'image':{
  76. ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map );
  77. //map.addLayer( ActiveZones.fig[i] );
  78. break;
  79. };
  80. case 'image_rot':{
  81. ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, {
  82. opacity: 0.8 //,
  83. //interactive: true,
  84. //attribution: "Historical building plan &copy; <a href='http://www.ign.es'>Instituto Geogr?fico Nacional de Espa?a</a>"
  85. });//.addTo( map );
  86. //map.addLayer( ActiveZones.fig[i] );
  87. break;
  88. };
  89. };
  90. if( data.zones[i].dev_is_source ){
  91. if( typeof pp !== 'undefined' ) {
  92. var sty = '';
  93. if( selecredActiveSourceFilter == data.zones[i].dev_id ){
  94. sty = 'cardDeviceSourceSelected';
  95. } else {
  96. sty = 'cardDeviceSource';
  97. };
  98. pp.add( {
  99. id: data.zones[i].dev_id+'_container',
  100. frame: false,
  101. border: false,
  102. width: 130,
  103. height: 130,
  104. 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>'
  105. });
  106. };
  107. };
  108. if( data.zones[i].zang != undefined ){
  109. //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  110. ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  111. };
  112. if( data.zones[i].center != undefined ){
  113. //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  114. ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } ).addTo( map );
  115. };
  116. };
  117. if( selecredActiveSourceFilter == 0 ){
  118. turnAllGzOn();
  119. } else {
  120. turnOffAllGzButThis( selecredActiveSourceFilter );
  121. };
  122. if( typeof pp !== 'undefined' ) pp.doLayout();
  123. //LoadMapEvents( SelectedSite );
  124. //tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite );
  125. },
  126. failure: function( response, opts ) {
  127. //Ext.fly('some_div').update('Fail!');
  128. }
  129. });
  130. };
  131. var cevt = Array();
  132. var coz = Array();
  133. function showEventsOnMap( data, removeCursor = true ){
  134. if( removeCursor ) map.removeLayer( selectedMarker );
  135. if( cevt.length ){
  136. for( i=0; i< cevt.length; i++ ){
  137. if( cevt[i]!= null ){
  138. cevt[i].remove();
  139. delete( cevt[i] );
  140. cevt[i] = null;
  141. };
  142. };
  143. };
  144. if( coz.length ){
  145. for( i=0; i< coz.length; i++ ){
  146. if( coz[i]!= null ){
  147. coz[i].remove();
  148. delete( coz[i] );
  149. coz[i]=null;
  150. };
  151. };
  152. };
  153. var zz = ( 1.0 / ( data.log.length + 0 ) );
  154. var idx = 0;
  155. for( i=0; i < data.log.length; i++ ){
  156. if( data.log[i].has_geo ){
  157. var cp_color='#FF0000';
  158. switch( data.log[i].event ){
  159. case 36: cp_color='#0000FF'; break;
  160. };
  161. cevt[idx] = L.circleMarker( [data.log[i].geo.lat, data.log[i].geo.lon], {id:data.log[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } ).on('click', function( e, a ){
  162. loadEventPropertiesByID( this.options.id );
  163. } );
  164. cevt[idx].addTo(map);
  165. idx++;
  166. };
  167. };
  168. };
  169. function LoadMapEventsZ( Mode ){
  170. if( tlLoadLocker ) return;
  171. tlLoadLocker = true;
  172. Ext.Ajax.request({
  173. url: '/lib/controller/getGeoAlerts.php',
  174. params: {
  175. SITE: <?=$SiteID;?>,
  176. UID: <?=$UserID;?>,
  177. SID: '<?=$Session;?>',
  178. MODE: Mode
  179. },
  180. success: function( response, opts ){
  181. if( cevt.length ){
  182. for( i=0; i< cevt.length; i++ ){
  183. if( cevt[i]!= null ){
  184. cevt[i].remove();
  185. delete( cevt[i] );
  186. cevt[i] = null;
  187. };
  188. };
  189. };
  190. if( coz.length ){
  191. for( i=0; i< coz.length; i++ ){
  192. if( coz[i]!= null ){
  193. coz[i].remove();
  194. delete( coz[i] );
  195. coz[i]=null;
  196. };
  197. };
  198. };
  199. var data = Ext.decode( response.responseText );
  200. var zz = ( 1.0 / ( data.evt.length + 0 ) );
  201. for( i=0; i < data.evt.length; i++ ){
  202. 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 ){
  203. loadEventProperties( this.options.id );
  204. } );
  205. cevt[i].addTo(map);
  206. };
  207. for( i=0; i < data.other.length; i++ ){
  208. switch( data.other[i].type ){
  209. case 'circle':{
  210. 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 } );
  211. coz[i].addTo(map);
  212. break;
  213. };
  214. };
  215. };
  216. //eventsListStore.reload();
  217. tlLoadLocker = false;
  218. },
  219. failure: function( response, opts ) {
  220. //Ext.fly('some_div').update('Fail!');
  221. tlLoadLocker = false;
  222. }
  223. });
  224. };
  225. function initMapMonitoring(){
  226. map = L.map('event_map',{
  227. attributionControl: true,
  228. //preferCanvas: true,
  229. zoomControl: true,
  230. center: [SiteLat, SiteLon],
  231. /*zoomControl: false,
  232. zoom: 17,
  233. minZoom: 17,
  234. maxZoom: 17,*/
  235. keyboard: false
  236. }).setView([SiteLat, SiteLon], 17);
  237. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  238. var mapLayers = [];
  239. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  240. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  241. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  242. detectRetina: true
  243. });*/
  244. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  245. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  246. maxNativeZoom: 18,
  247. maxZoom: 24,
  248. })
  249. // https://leaflet-extras.github.io/leaflet-providers/preview/
  250. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  251. 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',
  252. maxZoom: 19
  253. });
  254. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  255. 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',
  256. maxZoom: 19
  257. });
  258. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  259. 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',
  260. maxZoom: 24
  261. });
  262. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  263. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  264. maxZoom: 19
  265. });
  266. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  267. 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>) ',
  268. maxZoom: 19
  269. });
  270. /*
  271. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  272. 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>',
  273. maxZoom: 22
  274. });
  275. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  276. 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>',
  277. maxZoom: 22
  278. });
  279. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  280. 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>',
  281. maxZoom: 22
  282. });
  283. */
  284. var baseMaps = {
  285. "MyMap": mapLayers["MyMap"],
  286. "OpenStreetMap": mapLayers["OpenStreetMap"],
  287. "OpenTopoMap": mapLayers["OpenTopoMap"],
  288. "EsriSat": mapLayers["EsriSat"],
  289. "EsriStreet": mapLayers["EsriStreet"],
  290. "EsriTopo": mapLayers["EsriTopo"],
  291. //"Bing": mapLayers["Bing"],
  292. //"OSM-Cycle": mapLayers["Cycle"],
  293. //"Landscape": mapLayers["Landscape"],
  294. //"Outdoor": mapLayers["Outdoor"],
  295. };
  296. L.control.layers( baseMaps ).addTo(map);
  297. mapLayers["MyMap"].addTo(map);
  298. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  299. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  300. maxNativeZoom: 18,
  301. maxZoom: 24,
  302. }).addTo(map); */
  303. //loadTimeLineGroups( selectedSite );
  304. loadMapZones( 0 );
  305. //getData( 'arch' );
  306. };
  307. var iconSaver = null;
  308. var markerSaver = null;
  309. function updateLocation( e ){
  310. locationSelectedNode = e.target.options.mycustomid;
  311. Ext.Ajax.request({
  312. url: '/lib/controller/updateLocation.php',
  313. params: {
  314. NODE: locationSelectedNode,
  315. SITE: <?=$SiteID;?>,
  316. UID: <?=$UserID;?>,
  317. TYPE: 0,
  318. SID: '<?=$Session;?>',
  319. LAT: e.target._latlng.lat,
  320. LON: e.target._latlng.lng
  321. },
  322. success: function( response, opts ){
  323. loadNodeLocationProps( locationSelectedNode );
  324. },
  325. failure: failureAJAXFunction
  326. });
  327. };
  328. function markerDblClick( e ){
  329. if( iconSaver == null ){
  330. iconSaver = e.target.options.icon;
  331. markerSaver = e.target;
  332. e.target.setIcon( SNAPE_Icon );
  333. for( i=0; i< markers.length; i++){
  334. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  335. markers[i].setOpacity( 0.1 );
  336. } else {
  337. markers[i].setOpacity( 1.0 );
  338. }
  339. };
  340. } else {
  341. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  342. e.target.setIcon( iconSaver );
  343. iconSaver = null;
  344. markerSaver = null;
  345. for( i=0; i< markers.length; i++){
  346. markers[i].setOpacity( 1.0 );
  347. };
  348. } else {
  349. markerSaver.setIcon( iconSaver );
  350. iconSaver = e.target.options.icon;
  351. markerSaver = e.target;
  352. e.target.setIcon( SNAPE_Icon );
  353. for( i=0; i< markers.length; i++){
  354. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  355. markers[i].setOpacity( 0.1 );
  356. } else {
  357. markers[i].setOpacity( 1.0 );
  358. }
  359. };
  360. };
  361. };
  362. };
  363. function setNodeLocationToAnchor(){
  364. Ext.Ajax.request({
  365. url: '/lib/controller/updateLocation.php',
  366. params: {
  367. NODE: locationSelectedNode,
  368. SITE: <?=$SiteID;?>,
  369. UID: <?=$UserID;?>,
  370. TYPE: 0,
  371. SID: '<?=$Session;?>',
  372. LAT: SiteLat,
  373. LON: SiteLon,
  374. ALT: SiteAlt
  375. },
  376. success: function( response, opts ){
  377. loadLocationEditor();
  378. },
  379. failure: failureAJAXFunction
  380. });
  381. };
  382. function setNodeLocationByDelta(){
  383. var dx = Ext.getCmp('dx').getValue();
  384. var dy = Ext.getCmp('dy').getValue();
  385. var dz = Ext.getCmp('dz').getValue();
  386. Ext.Ajax.request({
  387. url: '/lib/controller/updateLocation.php',
  388. params: {
  389. NODE: locationSelectedNode,
  390. SITE: <?=$SiteID;?>,
  391. UID: <?=$UserID;?>,
  392. TYPE: 3,
  393. SID: '<?=$Session;?>',
  394. LAT: dx,
  395. LON: dy,
  396. ALT: dz
  397. },
  398. success: function( response, opts ){
  399. loadLocationEditor();
  400. },
  401. failure: failureAJAXFunction
  402. });
  403. };
  404. var LRF3D_Icon = L.icon({
  405. iconUrl: '/style/assets/5_node.png',
  406. //shadowUrl: 'leaf-shadow.png',
  407. iconSize: [64, 64], // size of the icon
  408. //shadowSize: [50, 64], // size of the shadow
  409. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  410. //shadowAnchor: [4, 62], // the same for the shadow
  411. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  412. });
  413. var LFS_Icon = L.icon({
  414. iconUrl: '/style/assets/2_node.png',
  415. //shadowUrl: 'leaf-shadow.png',
  416. iconSize: [64, 64], // size of the icon
  417. //shadowSize: [50, 64], // size of the shadow
  418. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  419. //shadowAnchor: [4, 62], // the same for the shadow
  420. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  421. });
  422. var PLS200_Icon = L.icon({
  423. iconUrl: '/style/assets/3_node.png',
  424. //shadowUrl: 'leaf-shadow.png',
  425. iconSize: [64, 64], // size of the icon
  426. //shadowSize: [50, 64], // size of the shadow
  427. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  428. //shadowAnchor: [4, 62], // the same for the shadow
  429. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  430. });
  431. var PLSNET200_Icon = L.icon({
  432. iconUrl: '/style/assets/6_node.png',
  433. //shadowUrl: 'leaf-shadow.png',
  434. iconSize: [64, 64], // size of the icon
  435. //shadowSize: [50, 64], // size of the shadow
  436. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  437. //shadowAnchor: [4, 62], // the same for the shadow
  438. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  439. });
  440. var PLS360_Icon = L.icon({
  441. iconUrl: '/style/assets/4_node.png',
  442. //shadowUrl: 'leaf-shadow.png',
  443. iconSize: [64, 64], // size of the icon
  444. //shadowSize: [50, 64], // size of the shadow
  445. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  446. //shadowAnchor: [4, 62], // the same for the shadow
  447. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  448. });
  449. var ALS_Icon = L.icon({
  450. iconUrl: '/style/assets/1_node.png',
  451. //shadowUrl: 'leaf-shadow.png',
  452. iconSize: [64, 64], // size of the icon
  453. //shadowSize: [50, 64], // size of the shadow
  454. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  455. //shadowAnchor: [4, 62], // the same for the shadow
  456. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  457. });
  458. var PTZCAM_Icon = L.icon({
  459. iconUrl: '/style/assets/12_node.png',
  460. //shadowUrl: 'leaf-shadow.png',
  461. iconSize: [64, 64], // size of the icon
  462. //shadowSize: [50, 64], // size of the shadow
  463. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  464. //shadowAnchor: [4, 62], // the same for the shadow
  465. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  466. });
  467. var FIXCAM_Icon = L.icon({
  468. iconUrl: '/style/assets/11_node.png',
  469. //shadowUrl: 'leaf-shadow.png',
  470. iconSize: [64, 64], // size of the icon
  471. //shadowSize: [50, 64], // size of the shadow
  472. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  473. //shadowAnchor: [4, 62], // the same for the shadow
  474. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  475. });
  476. var SITEZ_Icon = L.icon({
  477. iconUrl: '/style/assets/centre_1.png',
  478. //shadowUrl: 'leaf-shadow.png',
  479. iconSize: [32, 32], // size of the icon
  480. //shadowSize: [50, 64], // size of the shadow
  481. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  482. //shadowAnchor: [4, 62], // the same for the shadow
  483. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  484. });
  485. var SNAPE_Icon = L.icon({
  486. iconUrl: '/style/assets/cursor.png',
  487. //shadowUrl: 'leaf-shadow.png',
  488. iconSize: [32, 32], // size of the icon
  489. //shadowSize: [50, 64], // size of the shadow
  490. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  491. //shadowAnchor: [4, 62], // the same for the shadow
  492. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  493. });
  494. function loadLocationNodes(){
  495. Ext.Ajax.request({
  496. url: '/lib/controller/getLocationItems.php',
  497. params: {
  498. SITE: <?=$SiteID;?>,
  499. UID: <?=$UserID;?>,
  500. SID: '<?=$Session;?>'
  501. },
  502. success: function( response, opts ){
  503. var data = Ext.decode(response.responseText);
  504. for( i=0; i < data.length; i++){
  505. switch( data[i].type ){
  506. case 1:{
  507. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: ALS_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  508. break;
  509. };
  510. case 2:{
  511. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LFS_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  512. break;
  513. };
  514. case 3:{
  515. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS200_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  516. break;
  517. };
  518. case 4:{
  519. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS360_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  520. break;
  521. };
  522. case 5:{
  523. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LRF3D_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  524. break;
  525. };
  526. case 6:{
  527. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLSNET200_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  528. break;
  529. };
  530. case 10:
  531. case 12:{
  532. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: FIXCAM_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  533. break;
  534. };
  535. case 11:
  536. case 13:{
  537. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PTZCAM_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  538. break;
  539. };
  540. };
  541. //bindPopup('A pretty CSS3 popup.<br> Easily customizable.');//.openPopup();
  542. };
  543. },
  544. failure: function( response, opts ) {
  545. var tPanel = Ext.getCmp('main_portal');
  546. tPanel.remove(0);
  547. tPanel.add( { html: 'Failed to load dashboard!' } );
  548. tPanel.doLayout();
  549. }
  550. });
  551. };
  552. function loadNodeLocationProps( NodeID ){
  553. //alert( 'Node: ' + NodeID );
  554. Ext.Ajax.request({
  555. url: '/lib/controller/getLocationNodeProps.php',
  556. params: {
  557. NID: <?=$SiteID;?>,
  558. UID: <?=$UserID;?>,
  559. SID: '<?=$Session;?>',
  560. NODE: NodeID
  561. },
  562. success: function( response, opts ){
  563. // If the response is JSON, you have to decode it
  564. var data = Ext.decode(response.responseText);
  565. var tPanel = Ext.getCmp('prop_content');
  566. tPanel.remove(0);
  567. tPanel.add( data );
  568. tPanel.doLayout();
  569. },
  570. failure: failureAJAXFunction
  571. });
  572. };
  573. function LoadNodesList(){
  574. Ext.Ajax.request({
  575. url: '/lib/controller/getLocationNodes.php',
  576. params: {
  577. SITE: <?=$SiteID;?>,
  578. UID: <?=$UserID;?>,
  579. SID: '<?=$Session;?>'
  580. },
  581. success: function( response, opts ){
  582. // If the response is JSON, you have to decode it
  583. var data = Ext.decode(response.responseText);
  584. var tPanel = Ext.getCmp('prop_content');
  585. tPanel.remove(0);
  586. tPanel.add( data );
  587. tPanel.doLayout();
  588. },
  589. failure: failureAJAXFunction
  590. });
  591. };
  592. function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
  593. if( tlInterval!= null ){
  594. window.clearInterval( tlInterval );
  595. tlInterval = null;
  596. timelineObj = null;
  597. };
  598. if( node_type == undefined ) node_type = 0;
  599. if( lat == undefined ){
  600. lat = SiteLat;
  601. lon = SiteLon;
  602. };
  603. map_ed = L.map( el_id,{
  604. attributionControl: true,
  605. //preferCanvas: true,
  606. zoomControl: true,
  607. center: [SiteLat, SiteLon],
  608. /*zoomControl: false,
  609. zoom: 17,
  610. minZoom: 17,
  611. maxZoom: 17,*/
  612. keyboard: false
  613. }).setView([SiteLat, SiteLon], 17);
  614. 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();
  615. var mapLayers = [];
  616. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  617. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  618. maxNativeZoom: 18,
  619. maxZoom: 24,
  620. })
  621. // https://leaflet-extras.github.io/leaflet-providers/preview/
  622. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  623. 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',
  624. maxZoom: 19
  625. });
  626. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  627. 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',
  628. maxZoom: 19
  629. });
  630. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  631. 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',
  632. maxZoom: 24
  633. });
  634. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  635. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  636. maxZoom: 19
  637. });
  638. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  639. 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>) ',
  640. maxZoom: 19
  641. });
  642. /*
  643. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  644. 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>',
  645. maxZoom: 22
  646. });
  647. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  648. 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>',
  649. maxZoom: 22
  650. });
  651. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  652. 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>',
  653. maxZoom: 22
  654. });
  655. */
  656. var baseMaps = {
  657. "MyMap": mapLayers["MyMap"],
  658. "OpenStreetMap": mapLayers["OpenStreetMap"],
  659. "OpenTopoMap": mapLayers["OpenTopoMap"],
  660. "EsriSat": mapLayers["EsriSat"],
  661. "EsriStreet": mapLayers["EsriStreet"],
  662. "EsriTopo": mapLayers["EsriTopo"],
  663. //"Bing": mapLayers["Bing"],
  664. //"OSM-Cycle": mapLayers["Cycle"],
  665. //"Landscape": mapLayers["Landscape"],
  666. //"Outdoor": mapLayers["Outdoor"],
  667. };
  668. L.control.layers( baseMaps ).addTo( map_ed );
  669. mapLayers["MyMap"].addTo( map_ed );
  670. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  671. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
  672. }).addTo( map_ed );
  673. if( node_type ){
  674. switch( node_type ){
  675. case 1:{
  676. 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 );
  677. break;
  678. };
  679. case 2:{
  680. 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 );
  681. break;
  682. };
  683. case 3:{
  684. 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 );
  685. break;
  686. };
  687. case 4:{
  688. 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 );
  689. break;
  690. };
  691. case 5:{
  692. 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 );
  693. break;
  694. };
  695. case 6:{
  696. 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 );
  697. break;
  698. };
  699. case 10:
  700. case 12:{
  701. 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 );
  702. break;
  703. };
  704. case 11:
  705. case 13:{
  706. 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 );
  707. break;
  708. };
  709. };
  710. };
  711. //loadLocationNodes();
  712. };