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.

1873 lines
61 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 mapListStore = new Ext.data.JsonStore({
  7. root: 'maps',
  8. totalProperty: 'totalCount',
  9. idProperty: 'map_id',
  10. remoteSort: false,
  11. baseParams: {
  12. UID: '<?=$CUser->Data['id'];?>',
  13. SID: '<?=$Session;?>'//,
  14. //SITE: <?=$SiteID;?>
  15. },
  16. fields: [{
  17. name: 'map_id',
  18. type: 'int'
  19. },{
  20. name: 'map_name',
  21. type: 'string'
  22. }],
  23. proxy : new Ext.data.HttpProxy({
  24. method: 'POST',
  25. prettyUrls: false,
  26. url: '/lib/controller/listMaps.php'
  27. })
  28. });
  29. var selectedMarkerIcon = L.icon({
  30. iconUrl: '/style/assets/cursor.png',
  31. iconSize: [32, 32],
  32. iconAnchor: [16, 16]//,
  33. //popupAnchor: [-3, -76],
  34. //shadowUrl: 'my-icon-shadow.png',
  35. //shadowSize: [68, 95],
  36. //shadowAnchor: [22, 94]
  37. });
  38. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  39. function getZoneByNode( nid ){
  40. var rVal = -1;
  41. for( var i=0; i < ActiveZones.totalCount; i++ ){
  42. if( ActiveZones.zones[i].dev_id == nid ){
  43. rVal = i;
  44. break;
  45. };
  46. };
  47. return rVal;
  48. };
  49. function turnOffAllGzButThis( nid ){
  50. var chocho = -1;
  51. for( var i=0; i < ActiveZones.totalCount; i++ ){
  52. if( ActiveZones.zones[i].dev_id == nid ) chocho = i;
  53. map.removeLayer( ActiveZones.fig[i] );
  54. map.removeLayer( ActiveZones.zang[i] );
  55. map.removeLayer( ActiveZones.center[i] );
  56. };
  57. if( chocho > -1 ){
  58. map.addLayer( ActiveZones.fig[chocho] );
  59. map.addLayer( ActiveZones.zang[chocho] );
  60. map.addLayer( ActiveZones.center[chocho] );
  61. var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) );
  62. map.flyToBounds( cVisible.getBounds() );
  63. };
  64. };
  65. function turnAllGzOn(){
  66. var tall = Array();
  67. for( var i=0; i < ActiveZones.totalCount; i++ ){
  68. tall[i*3] = ActiveZones.fig[i];
  69. tall[i*3+1] = ActiveZones.zang[i];
  70. tall[i*3+2] = ActiveZones.center[i];
  71. if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] );
  72. if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] );
  73. if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
  74. };
  75. var cVisible = L.featureGroup( tall );
  76. map.flyToBounds( cVisible.getBounds() );
  77. };
  78. function loadMapZones( SiteID ){
  79. Ext.Ajax.request({
  80. url: '/lib/controller/getGeoZones.php',
  81. params: {
  82. SITE: SiteID,
  83. UID: <?=$UserID;?>,
  84. SID: '<?=$Session;?>'
  85. },
  86. success: function( response, opts ){
  87. // If the response is JSON, you have to decode it
  88. var data = Ext.decode(response.responseText);
  89. var pp = Ext.getCmp('sources_panel');
  90. if( typeof pp !== 'undefined' ) pp.removeAll();
  91. ActiveZones = data;
  92. ActiveZones.fig = new Array();
  93. ActiveZones.zang = new Array();
  94. ActiveZones.center = new Array();
  95. for(var i = 0; i < data.totalCount; i++ ) {
  96. switch( data.zones[i].type ){
  97. case 'circle':{
  98. //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map );
  99. 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 } );
  100. //map.addLayer( ActiveZones.fig[i] );
  101. break;
  102. };
  103. case 'poly':{
  104. 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);
  105. //map.addLayer( ActiveZones.fig[i] );
  106. break;
  107. };
  108. case 'image':{
  109. ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map );
  110. //map.addLayer( ActiveZones.fig[i] );
  111. break;
  112. };
  113. case 'image_rot':{
  114. ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, {
  115. opacity: 0.8 //,
  116. //interactive: true,
  117. //attribution: "Historical building plan &copy; <a href='http://www.ign.es'>Instituto Geogr?fico Nacional de Espa?a</a>"
  118. });//.addTo( map );
  119. //map.addLayer( ActiveZones.fig[i] );
  120. break;
  121. };
  122. };
  123. /*
  124. if( data.zones[i].dev_is_source ){
  125. if( typeof pp !== 'undefined' ) {
  126. var sty = '';
  127. if( selecredActiveSourceFilter == data.zones[i].dev_id ){
  128. sty = 'cardDeviceSourceSelected';
  129. } else {
  130. sty = 'cardDeviceSource';
  131. };
  132. pp.add( {
  133. id: data.zones[i].dev_id+'_container',
  134. frame: false,
  135. border: false,
  136. width: 130,
  137. height: 130,
  138. 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>'
  139. });
  140. };
  141. };*/
  142. if( data.zones[i].zang != undefined ){
  143. //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  144. ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  145. };
  146. if( data.zones[i].center != undefined ){
  147. //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  148. ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  149. };
  150. };
  151. //if( selecredActiveSourceFilter == 0 ){
  152. turnAllGzOn();
  153. //} else {
  154. // turnOffAllGzButThis( selecredActiveSourceFilter );
  155. //};
  156. //if( typeof pp !== 'undefined' ) pp.doLayout();
  157. },
  158. failure: function( response, opts ) {
  159. //Ext.fly('some_div').update('Fail!');
  160. }
  161. });
  162. };
  163. var cevt = Array();
  164. var coz = Array();
  165. function showEventsOnMap( data, removeCursor ){
  166. if( removeCursor == undefined ) removeCursor = true;
  167. if( removeCursor ) map.removeLayer( selectedMarker );
  168. if( cevt.length ){
  169. for( i=0; i< cevt.length; i++ ){
  170. if( cevt[i]!= null ){
  171. cevt[i].remove();
  172. delete( cevt[i] );
  173. cevt[i] = null;
  174. };
  175. };
  176. };
  177. if( coz.length ){
  178. for( i=0; i< coz.length; i++ ){
  179. if( coz[i]!= null ){
  180. coz[i].remove();
  181. delete( coz[i] );
  182. coz[i]=null;
  183. };
  184. };
  185. };
  186. var idx = 0;
  187. for( i=0; i < data.length; i++ ){
  188. if( data[i].targets != undefined ){
  189. var zz = ( 1.0 / ( data[i].targets.length + 0 ) );
  190. var cp_color='#FF0000';
  191. for( j = 0; j < data[i].targets.length; j++ ){
  192. //switch( data.log[i].event ){
  193. // case 36: cp_color='#0000FF'; break;
  194. //};
  195. cLon = data[i].targets[j].lon;
  196. cLat = data[i].targets[j].lat;
  197. 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 ){
  198. // loadEventPropertiesByID( this.options.id );
  199. //} );
  200. cevt[idx].addTo(map);
  201. idx++;
  202. };
  203. };
  204. };
  205. };
  206. function LoadMapEventsZ( Mode ){
  207. if( tlLoadLocker ) return;
  208. tlLoadLocker = true;
  209. Ext.Ajax.request({
  210. url: '/lib/controller/getGeoAlerts.php',
  211. params: {
  212. SITE: <?=$SiteID;?>,
  213. UID: <?=$UserID;?>,
  214. SID: '<?=$Session;?>',
  215. MODE: Mode
  216. },
  217. success: function( response, opts ){
  218. if( cevt.length ){
  219. for( i=0; i< cevt.length; i++ ){
  220. if( cevt[i]!= null ){
  221. cevt[i].remove();
  222. delete( cevt[i] );
  223. cevt[i] = null;
  224. };
  225. };
  226. };
  227. if( coz.length ){
  228. for( i=0; i< coz.length; i++ ){
  229. if( coz[i]!= null ){
  230. coz[i].remove();
  231. delete( coz[i] );
  232. coz[i]=null;
  233. };
  234. };
  235. };
  236. var data = Ext.decode( response.responseText );
  237. var zz = ( 1.0 / ( data.evt.length + 0 ) );
  238. for( i=0; i < data.evt.length; i++ ){
  239. 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 ){
  240. loadEventProperties( this.options.id );
  241. } );
  242. cevt[i].addTo(map);
  243. };
  244. for( i=0; i < data.other.length; i++ ){
  245. switch( data.other[i].type ){
  246. case 'circle':{
  247. 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 } );
  248. coz[i].addTo(map);
  249. break;
  250. };
  251. };
  252. };
  253. //eventsListStore.reload();
  254. tlLoadLocker = false;
  255. },
  256. failure: function( response, opts ) {
  257. //Ext.fly('some_div').update('Fail!');
  258. tlLoadLocker = false;
  259. }
  260. });
  261. };
  262. function initMapMonitoring(){
  263. var aK = true;
  264. if( MAP_SET.attribution == '' ) aK = false;
  265. var mapLayers = [];
  266. if( map != null ){
  267. //ToDo: must be moved to Upper Menu changer
  268. map.off();
  269. map.remove();
  270. map = null;
  271. };
  272. if( MAP_SET.type == 1 ){
  273. map = L.map( 'event_map',{
  274. //attributionControl: aK,
  275. attributionControl: false,
  276. preferCanvas: true,
  277. zoomControl: true,
  278. center: [SiteLat, SiteLon],
  279. /*zoomControl: false,
  280. zoom: 17,
  281. minZoom: 17,
  282. maxZoom: 17,*/
  283. keyboard: false
  284. });
  285. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  286. // attribution: MAP_SET.attribution,
  287. // maxNativeZoom: MAP_SET.maxNativeZoom,
  288. // maxZoom: MAP_SET.maxZoom
  289. //});
  290. L.tileLayer( MAP_SET.layer_url, {
  291. attribution: MAP_SET.attribution,
  292. attributionControl: false,
  293. maxNativeZoom: MAP_SET.maxNativeZoom,
  294. minZoom: 0,
  295. maxZoom: MAP_SET.maxZoom
  296. }).addTo( map );
  297. //map.setView([SiteLat, SiteLon], 17 );
  298. } else {
  299. map = L.map( 'event_map',{
  300. crs: L.CRS.Simple,
  301. attributionControl: false,
  302. preferCanvas: true,
  303. zoomControl: true,
  304. center: [SiteLat, SiteLon],
  305. /*zoomControl: false,*/
  306. zoom: 0,
  307. minZoom: -1,
  308. maxZoom: 4,
  309. keyboard: false
  310. });
  311. var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
  312. var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map );
  313. //map.setView([SiteLat, SiteLon], -1 );
  314. };
  315. //ToDo: Fix Initial Zoom level -> May be saving into a user profile
  316. loadMapZones( 0 );
  317. };
  318. function initMapReporting(){
  319. var aK = true;
  320. if( MAP_SET.attribution == '' ) aK = false;
  321. var mapLayers = [];
  322. if( map != null ){
  323. //ToDo: must be moved to Upper Menu changer
  324. map.off();
  325. map.remove();
  326. map = null;
  327. };
  328. if( MAP_SET.type == 1 ){
  329. map = L.map( 'report_map',{
  330. //attributionControl: aK,
  331. attributionControl: false,
  332. preferCanvas: true,
  333. zoomControl: true,
  334. center: [SiteLat, SiteLon],
  335. /*zoomControl: false,
  336. zoom: 17,
  337. minZoom: 17,
  338. maxZoom: 17,*/
  339. keyboard: false
  340. });
  341. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  342. // attribution: MAP_SET.attribution,
  343. // maxNativeZoom: MAP_SET.maxNativeZoom,
  344. // maxZoom: MAP_SET.maxZoom
  345. //});
  346. L.tileLayer( MAP_SET.layer_url, {
  347. attribution: MAP_SET.attribution,
  348. attributionControl: false,
  349. maxNativeZoom: MAP_SET.maxNativeZoom,
  350. minZoom: 0,
  351. maxZoom: MAP_SET.maxZoom
  352. }).addTo( map );
  353. //map.setView([SiteLat, SiteLon], 17 );
  354. } else {
  355. map = L.map( 'report_map',{
  356. crs: L.CRS.Simple,
  357. attributionControl: false,
  358. preferCanvas: true,
  359. zoomControl: true,
  360. center: [SiteLat, SiteLon],
  361. /*zoomControl: false,*/
  362. zoom: 0,
  363. minZoom: -1,
  364. maxZoom: 4,
  365. keyboard: false
  366. });
  367. var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
  368. var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map );
  369. //map.setView([SiteLat, SiteLon], -1 );
  370. };
  371. //ToDo: Fix Initial Zoom level -> May be saving into a user profile
  372. loadMapZones( 0 );
  373. };
  374. function initMapMonitoring_00(){
  375. map = L.map('event_map',{
  376. attributionControl: true,
  377. //preferCanvas: true,
  378. zoomControl: true,
  379. center: [SiteLat, SiteLon],
  380. /*zoomControl: false,
  381. zoom: 17,
  382. minZoom: 17,
  383. maxZoom: 17,*/
  384. keyboard: false
  385. }).setView([SiteLat, SiteLon], 17);
  386. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  387. var mapLayers = [];
  388. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  389. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  390. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  391. detectRetina: true
  392. });*/
  393. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  394. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  395. maxNativeZoom: 18,
  396. maxZoom: 24,
  397. })
  398. // https://leaflet-extras.github.io/leaflet-providers/preview/
  399. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  400. 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',
  401. maxZoom: 19
  402. });
  403. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  404. 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',
  405. maxZoom: 19
  406. });
  407. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  408. 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',
  409. maxZoom: 24
  410. });
  411. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  412. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  413. maxZoom: 19
  414. });
  415. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  416. 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>) ',
  417. maxZoom: 19
  418. });
  419. /*
  420. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  421. 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>',
  422. maxZoom: 22
  423. });
  424. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  425. 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>',
  426. maxZoom: 22
  427. });
  428. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  429. 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>',
  430. maxZoom: 22
  431. });
  432. */
  433. var baseMaps = {
  434. "MyMap": mapLayers["MyMap"],
  435. "OpenStreetMap": mapLayers["OpenStreetMap"],
  436. "OpenTopoMap": mapLayers["OpenTopoMap"],
  437. "EsriSat": mapLayers["EsriSat"],
  438. "EsriStreet": mapLayers["EsriStreet"],
  439. "EsriTopo": mapLayers["EsriTopo"],
  440. //"Bing": mapLayers["Bing"],
  441. //"OSM-Cycle": mapLayers["Cycle"],
  442. //"Landscape": mapLayers["Landscape"],
  443. //"Outdoor": mapLayers["Outdoor"],
  444. };
  445. L.control.layers( baseMaps ).addTo(map);
  446. mapLayers["MyMap"].addTo(map);
  447. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  448. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  449. maxNativeZoom: 18,
  450. maxZoom: 24,
  451. }).addTo(map); */
  452. //loadTimeLineGroups( selectedSite );
  453. loadMapZones( 0 );
  454. //getData( 'arch' );
  455. };
  456. var iconSaver = null;
  457. var markerSaver = null;
  458. function updateLocation( e ){
  459. locationSelectedNode = e.target.options.mycustomid;
  460. Ext.Ajax.request({
  461. url: '/lib/controller/updateLocation.php',
  462. params: {
  463. NODE: locationSelectedNode,
  464. SITE: <?=$SiteID;?>,
  465. UID: <?=$UserID;?>,
  466. TYPE: 0,
  467. SID: '<?=$Session;?>',
  468. LAT: e.target._latlng.lat,
  469. LON: e.target._latlng.lng
  470. },
  471. success: function( response, opts ){
  472. loadNodeLocationProps( locationSelectedNode );
  473. },
  474. failure: failureAJAXFunction
  475. });
  476. };
  477. function markerDblClick( e ){
  478. if( iconSaver == null ){
  479. iconSaver = e.target.options.icon;
  480. markerSaver = e.target;
  481. e.target.setIcon( SNAPE_Icon );
  482. for( i=0; i< markers.length; i++){
  483. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  484. markers[i].setOpacity( 0.1 );
  485. } else {
  486. markers[i].setOpacity( 1.0 );
  487. }
  488. };
  489. } else {
  490. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  491. e.target.setIcon( iconSaver );
  492. iconSaver = null;
  493. markerSaver = null;
  494. for( i=0; i< markers.length; i++){
  495. markers[i].setOpacity( 1.0 );
  496. };
  497. } else {
  498. markerSaver.setIcon( iconSaver );
  499. iconSaver = e.target.options.icon;
  500. markerSaver = e.target;
  501. e.target.setIcon( SNAPE_Icon );
  502. for( i=0; i< markers.length; i++){
  503. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  504. markers[i].setOpacity( 0.1 );
  505. } else {
  506. markers[i].setOpacity( 1.0 );
  507. }
  508. };
  509. };
  510. };
  511. };
  512. function setNodeLocationToAnchor(){
  513. Ext.Ajax.request({
  514. url: '/lib/controller/updateLocation.php',
  515. params: {
  516. NODE: locationSelectedNode,
  517. SITE: <?=$SiteID;?>,
  518. UID: <?=$UserID;?>,
  519. TYPE: 0,
  520. SID: '<?=$Session;?>',
  521. LAT: SiteLat,
  522. LON: SiteLon,
  523. ALT: SiteAlt
  524. },
  525. success: function( response, opts ){
  526. loadLocationEditor('sys_location_map');
  527. },
  528. failure: failureAJAXFunction
  529. });
  530. };
  531. function setNodeLocationByDelta(){
  532. var dx = Ext.getCmp('dx').getValue();
  533. var dy = Ext.getCmp('dy').getValue();
  534. var dz = Ext.getCmp('dz').getValue();
  535. Ext.Ajax.request({
  536. url: '/lib/controller/updateLocation.php',
  537. params: {
  538. NODE: locationSelectedNode,
  539. SITE: <?=$SiteID;?>,
  540. UID: <?=$UserID;?>,
  541. TYPE: 3,
  542. SID: '<?=$Session;?>',
  543. LAT: dx,
  544. LON: dy,
  545. ALT: dz
  546. },
  547. success: function( response, opts ){
  548. loadLocationEditor('sys_location_map');
  549. },
  550. failure: failureAJAXFunction
  551. });
  552. };
  553. var LRF3D_Icon = L.icon({
  554. iconUrl: '/style/assets/5_node.png',
  555. //shadowUrl: 'leaf-shadow.png',
  556. iconSize: [64, 64], // size of the icon
  557. //shadowSize: [50, 64], // size of the shadow
  558. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  559. //shadowAnchor: [4, 62], // the same for the shadow
  560. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  561. });
  562. var LFS_Icon = L.icon({
  563. iconUrl: '/style/assets/2_node.png',
  564. //shadowUrl: 'leaf-shadow.png',
  565. iconSize: [64, 64], // size of the icon
  566. //shadowSize: [50, 64], // size of the shadow
  567. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  568. //shadowAnchor: [4, 62], // the same for the shadow
  569. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  570. });
  571. var PLS200_Icon = L.icon({
  572. iconUrl: '/style/assets/3_node.png',
  573. //shadowUrl: 'leaf-shadow.png',
  574. iconSize: [64, 64], // size of the icon
  575. //shadowSize: [50, 64], // size of the shadow
  576. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  577. //shadowAnchor: [4, 62], // the same for the shadow
  578. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  579. });
  580. var PLSNET200_Icon = L.icon({
  581. iconUrl: '/style/assets/6_node.png',
  582. //shadowUrl: 'leaf-shadow.png',
  583. iconSize: [64, 64], // size of the icon
  584. //shadowSize: [50, 64], // size of the shadow
  585. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  586. //shadowAnchor: [4, 62], // the same for the shadow
  587. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  588. });
  589. var PLS360_Icon = L.icon({
  590. iconUrl: '/style/assets/4_node.png',
  591. //shadowUrl: 'leaf-shadow.png',
  592. iconSize: [64, 64], // size of the icon
  593. //shadowSize: [50, 64], // size of the shadow
  594. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  595. //shadowAnchor: [4, 62], // the same for the shadow
  596. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  597. });
  598. var ALS_Icon = L.icon({
  599. iconUrl: '/style/assets/1_node.png',
  600. //shadowUrl: 'leaf-shadow.png',
  601. iconSize: [64, 64], // size of the icon
  602. //shadowSize: [50, 64], // size of the shadow
  603. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  604. //shadowAnchor: [4, 62], // the same for the shadow
  605. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  606. });
  607. var PTZCAM_Icon = L.icon({
  608. iconUrl: '/style/assets/12_node.png',
  609. //shadowUrl: 'leaf-shadow.png',
  610. iconSize: [64, 64], // size of the icon
  611. //shadowSize: [50, 64], // size of the shadow
  612. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  613. //shadowAnchor: [4, 62], // the same for the shadow
  614. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  615. });
  616. var FIXCAM_Icon = L.icon({
  617. iconUrl: '/style/assets/11_node.png',
  618. //shadowUrl: 'leaf-shadow.png',
  619. iconSize: [64, 64], // size of the icon
  620. //shadowSize: [50, 64], // size of the shadow
  621. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  622. //shadowAnchor: [4, 62], // the same for the shadow
  623. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  624. });
  625. var SITEZ_Icon = L.icon({
  626. iconUrl: '/style/assets/centre_1.png',
  627. //shadowUrl: 'leaf-shadow.png',
  628. iconSize: [32, 32], // size of the icon
  629. //shadowSize: [50, 64], // size of the shadow
  630. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  631. //shadowAnchor: [4, 62], // the same for the shadow
  632. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  633. });
  634. var SNAPE_Icon = L.icon({
  635. iconUrl: '/style/assets/cursor.png',
  636. //shadowUrl: 'leaf-shadow.png',
  637. iconSize: [32, 32], // size of the icon
  638. //shadowSize: [50, 64], // size of the shadow
  639. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  640. //shadowAnchor: [4, 62], // the same for the shadow
  641. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  642. });
  643. function loadLocationNodes(){
  644. Ext.Ajax.request({
  645. url: '/lib/controller/getLocationItems.php',
  646. params: {
  647. SITE: <?=$SiteID;?>,
  648. UID: <?=$UserID;?>,
  649. SID: '<?=$Session;?>'
  650. },
  651. success: function( response, opts ){
  652. var data = Ext.decode(response.responseText);
  653. if( data!= null ){
  654. var i = 0;
  655. var tall = Array();
  656. for( ; i < data.length; i++){
  657. switch( data[i].type ){
  658. case 1:{
  659. 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 );
  660. break;
  661. };
  662. case 2:{
  663. 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 );
  664. break;
  665. };
  666. case 3:{
  667. 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 );
  668. break;
  669. };
  670. case 4:{
  671. 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 );
  672. break;
  673. };
  674. case 5:{
  675. 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 );
  676. break;
  677. };
  678. case 6:{
  679. 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 );
  680. break;
  681. };
  682. case 10:
  683. case 12:{
  684. 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 );
  685. break;
  686. };
  687. case 11:
  688. case 13:{
  689. 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 );
  690. break;
  691. };
  692. };
  693. tall[i] = markers[i];
  694. };
  695. tall[i++] = ed_anchor;
  696. var cVisible = L.featureGroup( tall );
  697. map_ed.flyToBounds( cVisible.getBounds() );
  698. } else {
  699. map_ed.setView([SiteLat, SiteLon], 4 );
  700. };
  701. },
  702. failure: function( response, opts ) {
  703. //var tPanel = Ext.getCmp('main_portal');
  704. //tPanel.remove(0);
  705. //tPanel.add( { html: 'Failed to load dashboard!' } );
  706. //tPanel.doLayout();
  707. }
  708. });
  709. };
  710. function orientationEditor(){
  711. if( orientationEditorWindow == null ){
  712. orientationEditorWindow = new Ext.Window({
  713. modal: true,
  714. title: '<?=$Labels->GetLabel('_ORIENTATION_');?>',
  715. closeAction: 'hide',
  716. width: 640,
  717. height: 500,
  718. items:[{
  719. layout: 'table',
  720. defaults: {
  721. bodyStyle:'padding:5px'
  722. },
  723. layoutConfig: {
  724. columns: 3
  725. },
  726. items:[{
  727. html: 'Roll:'
  728. },{
  729. xtype: 'textfield',
  730. id: 'roll',
  731. name: 'roll',
  732. value: 30.0029,
  733. listeners:{
  734. change: function( sl, nv, tt ){
  735. setCubeOrientation( nv / 1.0, curY, curZ );
  736. }
  737. }
  738. },{
  739. xtype: 'slider',
  740. id: 'roll_sld',
  741. width: 200,
  742. value: 30.0029,
  743. minValue: -180.0,
  744. maxValue: 180.0,
  745. listeners:{
  746. change: function( sl, nv, tt ){
  747. setCubeOrientation( nv, curY, curZ );
  748. }
  749. }
  750. },{
  751. html: 'Pitch:'
  752. },{
  753. xtype: 'textfield',
  754. id: 'pitch',
  755. name: 'pitch',
  756. value: 30.0029,
  757. listeners:{
  758. change: function( sl, nv, tt ){
  759. setCubeOrientation( curX, nv / 1.0, curZ );
  760. }
  761. }
  762. },{
  763. xtype: 'slider',
  764. id: 'pitch_sld',
  765. width: 200,
  766. value: 30.0029,
  767. minValue: -180.0,
  768. maxValue: 180.0,
  769. listeners:{
  770. change: function( sl, nv, tt ){
  771. setCubeOrientation( curX, nv, curZ );
  772. }
  773. }
  774. },{
  775. html: 'Yaw:'
  776. },{
  777. xtype: 'textfield',
  778. id: 'yaw',
  779. name: 'yaw',
  780. value: 30.0029,
  781. listeners:{
  782. change: function( sl, nv, tt ){
  783. //alert( nv );
  784. setCubeOrientation( curX, curY, nv / 1.0 );
  785. }
  786. }
  787. },{
  788. xtype: 'slider',
  789. id: 'yaw_sld',
  790. width: 200,
  791. value: 30.0029,
  792. minValue: -180.0,
  793. maxValue: 180.0,
  794. listeners:{
  795. change: function( sl, nv, tt ){
  796. setCubeOrientation( curX, curY, nv );
  797. }
  798. }
  799. }]
  800. },{
  801. 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>'
  802. }],
  803. buttons:[{
  804. text: 'Cancel',
  805. width: 200,
  806. handler: function(){
  807. orientationEditorWindow.hide();
  808. }
  809. },{
  810. text: 'Apply',
  811. width: 200,
  812. handler: function(){
  813. Ext.getCmp('sroll').setValue( Ext.getCmp('roll').getValue() );
  814. Ext.getCmp('spitch').setValue( Ext.getCmp('pitch').getValue() );
  815. Ext.getCmp('syaw').setValue( Ext.getCmp('yaw').getValue() );
  816. orientationEditorWindow.hide();
  817. }
  818. }]
  819. });
  820. orientationEditorWindow.show();
  821. cubeViewport = new Viewport({
  822. element: document.getElementsByClassName('cube')[0],
  823. fps: 20,
  824. sensivity: .1,
  825. sensivityFade: .93,
  826. speed: 2,
  827. touchSensivity: 1.5
  828. });
  829. cube = new Cube({
  830. viewport: cubeViewport,
  831. element: document.getElementsByClassName('cube')[0]
  832. });
  833. } else {
  834. orientationEditorWindow.show();
  835. };
  836. setCubeOrientation( Ext.getCmp('sroll').getValue(), Ext.getCmp('spitch').getValue(), Ext.getCmp('syaw').getValue() );
  837. };
  838. var locationSelectedNode = 0;
  839. function loadLoactionProps( e ){
  840. if( typeof e == 'number' ){
  841. locationSelectedNode = e;
  842. } else {
  843. locationSelectedNode = e.sourceTarget.options.mycustomid;
  844. }
  845. loadNodeLocationProps( locationSelectedNode );
  846. };
  847. function loadNodeLocationProps( NodeID ){
  848. //alert( 'Node: ' + NodeID );
  849. Ext.Ajax.request({
  850. url: '/lib/controller/getLocationNodeProps.php',
  851. params: {
  852. NID: <?=$SiteID;?>,
  853. UID: <?=$UserID;?>,
  854. SID: '<?=$Session;?>',
  855. NODE: NodeID
  856. },
  857. success: function( response, opts ){
  858. // If the response is JSON, you have to decode it
  859. var data = Ext.decode(response.responseText);
  860. var tPanel = Ext.getCmp('prop_content');
  861. tPanel.remove(0);
  862. tPanel.add( data );
  863. tPanel.doLayout();
  864. },
  865. failure: failureAJAXFunction
  866. });
  867. };
  868. function LoadNodesList(){
  869. Ext.Ajax.request({
  870. url: '/lib/controller/getLocationNodes.php',
  871. params: {
  872. SITE: <?=$SiteID;?>,
  873. UID: <?=$UserID;?>,
  874. SID: '<?=$Session;?>'
  875. },
  876. success: function( response, opts ){
  877. var data = Ext.decode(response.responseText);
  878. var tPanel = Ext.getCmp('prop_content');
  879. tPanel.remove(0);
  880. tPanel.add( data );
  881. tPanel.doLayout();
  882. },
  883. failure: failureAJAXFunction
  884. });
  885. };
  886. function reloadSiteMapData(){
  887. Ext.Ajax.request({
  888. url: '/lib/controller/getMapData.php',
  889. params: {
  890. SITE: <?=$SiteID;?>,
  891. UID: <?=$UserID;?>,
  892. SID: '<?=$Session;?>'
  893. },
  894. success: function( response, opts ){
  895. var data = Ext.decode(response.responseText);
  896. MAP_ID = parseInt( data.selected_map );
  897. MAP_IS_LOCAL = (MAP_ID)?data.local_binding:false;
  898. MAP_SET = data.maps;
  899. Ext.getCmp('lab_123').update( '<?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> '+((MAP_IS_LOCAL)?'Pos X':'<?=$Labels->GetLabel('_LON_SHORT_LBL_');?>')+':' );
  900. Ext.getCmp('lab_124').update( ((MAP_IS_LOCAL)?'Pos Y':'<?=$Labels->GetLabel('_LAT_SHORT_LBL_');?>')+':' );
  901. document.getElementById('lab_125').src = ((MAP_IS_LOCAL)?'/style/assets/map_mode_decart.png':'/style/assets/map_mode_wgs84.png');
  902. loadLocationEditor('sys_location_map');
  903. },
  904. failure: failureAJAXFunction
  905. });
  906. };
  907. var ed_anchor = null;
  908. function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
  909. if( tlInterval!= null ){
  910. window.clearInterval( tlInterval );
  911. tlInterval = null;
  912. timelineObj = null;
  913. };
  914. if( node_type == undefined ) node_type = 0;
  915. if( lat == undefined ){
  916. lat = SiteLat;
  917. lon = SiteLon;
  918. };
  919. //var cMSET = mapListStore.getAt( MAP_ID );
  920. //alert( MAP_SET.id );
  921. var aK = true;
  922. if( MAP_SET.attribution == '' ) aK = false;
  923. var mapLayers = [];
  924. if( map_ed != undefined ){
  925. map_ed.off();
  926. map_ed.remove();
  927. };
  928. if( MAP_SET.type == 1 ){
  929. map_ed = L.map( el_id,{
  930. attributionControl: aK,
  931. //preferCanvas: true,
  932. zoomControl: true,
  933. center: [SiteLat, SiteLon],
  934. /*zoomControl: false,
  935. zoom: 17,
  936. minZoom: 17,
  937. maxZoom: 17,*/
  938. keyboard: false
  939. });
  940. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  941. // attribution: MAP_SET.attribution,
  942. // maxNativeZoom: MAP_SET.maxNativeZoom,
  943. // maxZoom: MAP_SET.maxZoom
  944. //});
  945. L.tileLayer( MAP_SET.layer_url, {
  946. attribution: MAP_SET.attribution,
  947. maxNativeZoom: MAP_SET.maxNativeZoom,
  948. minZoom: 0,
  949. maxZoom: MAP_SET.maxZoom
  950. }).addTo( map_ed );
  951. } else {
  952. map_ed = L.map( el_id,{
  953. crs: L.CRS.Simple,
  954. attributionControl: false,
  955. preferCanvas: true,
  956. zoomControl: true,
  957. center: [SiteLat, SiteLon],
  958. /*zoomControl: false,*/
  959. zoom: 0,
  960. minZoom: 0,
  961. maxZoom: 4,
  962. keyboard: false
  963. });
  964. var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
  965. var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map_ed );
  966. }
  967. map_ed.setView([SiteLat, SiteLon], MAP_SET.maxZoom);
  968. if( node_type ){
  969. ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");//.openPopup();
  970. } else {
  971. ed_anchor = 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();
  972. };
  973. /*
  974. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  975. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  976. maxNativeZoom: 18,
  977. maxZoom: 24,
  978. })
  979. // https://leaflet-extras.github.io/leaflet-providers/preview/
  980. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  981. 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',
  982. maxZoom: 19
  983. });
  984. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  985. 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',
  986. maxZoom: 19
  987. });
  988. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  989. 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',
  990. maxZoom: 24
  991. });
  992. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  993. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  994. maxZoom: 19
  995. });
  996. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  997. 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>) ',
  998. maxZoom: 19
  999. });
  1000. var baseMaps = {
  1001. "MyMap": mapLayers["MyMap"],
  1002. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1003. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1004. "EsriSat": mapLayers["EsriSat"],
  1005. "EsriStreet": mapLayers["EsriStreet"],
  1006. "EsriTopo": mapLayers["EsriTopo"],
  1007. //"Bing": mapLayers["Bing"],
  1008. //"OSM-Cycle": mapLayers["Cycle"],
  1009. //"Landscape": mapLayers["Landscape"],
  1010. //"Outdoor": mapLayers["Outdoor"],
  1011. };
  1012. L.control.layers( baseMaps ).addTo( map_ed );
  1013. mapLayers["MyMap"].addTo( map_ed );
  1014. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1015. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
  1016. }).addTo( map_ed );
  1017. */
  1018. if( node_type ){
  1019. switch( node_type ){
  1020. case 1:{
  1021. 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 );
  1022. break;
  1023. };
  1024. case 2:{
  1025. 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 );
  1026. break;
  1027. };
  1028. case 3:{
  1029. 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 );
  1030. break;
  1031. };
  1032. case 4:{
  1033. 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 );
  1034. break;
  1035. };
  1036. case 5:{
  1037. 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 );
  1038. break;
  1039. };
  1040. case 6:{
  1041. 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 );
  1042. break;
  1043. };
  1044. case 10:
  1045. case 12:{
  1046. 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 );
  1047. break;
  1048. };
  1049. case 11:
  1050. case 13:{
  1051. 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 );
  1052. break;
  1053. };
  1054. };
  1055. } else loadLocationNodes();
  1056. };
  1057. function updateSiteAnchor(){
  1058. SiteLat = Ext.getCmp('siteLat').getValue();
  1059. SiteLon = Ext.getCmp('siteLon').getValue();
  1060. SiteAlt = Ext.getCmp('siteAlt').getValue();
  1061. Ext.Ajax.request({
  1062. url: '/lib/controller/updateLocation.php',
  1063. params: {
  1064. SITE: <?=$SiteID;?>,
  1065. UID: <?=$UserID;?>,
  1066. TYPE: 1,
  1067. SID: '<?=$Session;?>',
  1068. LAT: SiteLat,
  1069. LON: SiteLon,
  1070. ALT: SiteAlt
  1071. },
  1072. success: function(){
  1073. loadLocationEditor('sys_location_map');
  1074. },
  1075. failure: failureAJAXFunction
  1076. });
  1077. };
  1078. function updateSiteMap(){
  1079. MAP_ID = Ext.getCmp('siteMap').getValue();
  1080. Ext.Ajax.request({
  1081. url: '/lib/controller/updateLocation.php',
  1082. params: {
  1083. SITE: <?=$SiteID;?>,
  1084. UID: <?=$UserID;?>,
  1085. TYPE: 4,
  1086. SID: '<?=$Session;?>',
  1087. MID: MAP_ID
  1088. },
  1089. success: function( response, opts ){
  1090. reloadSiteMapData();
  1091. },
  1092. failure: failureAJAXFunction
  1093. });
  1094. };
  1095. var mapDataLoadded = false;
  1096. // Call this to prepare all data once in Session
  1097. function prepareMapData(){
  1098. //if( ap_type == 1 ) return;//Metro No Map ...
  1099. if( !mapDataLoadded ){
  1100. mapListStore.load();
  1101. };
  1102. };
  1103. function updateLocationOrientation(){
  1104. var tLat = Ext.getCmp('slat').getValue();
  1105. var tLon = Ext.getCmp('slon').getValue();
  1106. var tAlt = Ext.getCmp('salt').getValue();
  1107. var tRoll = Ext.getCmp('sroll').getValue();
  1108. var tPitch = Ext.getCmp('spitch').getValue();
  1109. var tYaw = Ext.getCmp('syaw').getValue();
  1110. Ext.Ajax.request({
  1111. url: '/lib/controller/updateLocation.php',
  1112. params: {
  1113. NODE: locationSelectedNode,
  1114. UID: <?=$UserID;?>,
  1115. TYPE: 2,
  1116. SID: '<?=$Session;?>',
  1117. LAT: tLat,
  1118. LON: tLon,
  1119. ALT: tAlt,
  1120. YAW: tYaw,
  1121. ROLL: tRoll,
  1122. PITCH: tPitch
  1123. },
  1124. failure: failureAJAXFunction
  1125. });
  1126. };
  1127. var iconSaver = null;
  1128. var markerSaver = null;
  1129. function updateLocation( e ){
  1130. locationSelectedNode = e.target.options.mycustomid;
  1131. Ext.Ajax.request({
  1132. url: '/lib/controller/updateLocation.php',
  1133. params: {
  1134. NODE: locationSelectedNode,
  1135. SITE: <?=$SiteID;?>,
  1136. UID: <?=$UserID;?>,
  1137. TYPE: 0,
  1138. SID: '<?=$Session;?>',
  1139. LAT: e.target._latlng.lat,
  1140. LON: e.target._latlng.lng
  1141. },
  1142. success: function( response, opts ){
  1143. loadNodeLocationProps( locationSelectedNode );
  1144. },
  1145. failure: failureAJAXFunction
  1146. });
  1147. };
  1148. function markerDblClick( e ){
  1149. if( iconSaver == null ){
  1150. iconSaver = e.target.options.icon;
  1151. markerSaver = e.target;
  1152. e.target.setIcon( SNAPE_Icon );
  1153. for( i=0; i< markers.length; i++){
  1154. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  1155. markers[i].setOpacity( 0.1 );
  1156. } else {
  1157. markers[i].setOpacity( 1.0 );
  1158. }
  1159. };
  1160. } else {
  1161. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  1162. e.target.setIcon( iconSaver );
  1163. iconSaver = null;
  1164. markerSaver = null;
  1165. for( i=0; i< markers.length; i++){
  1166. markers[i].setOpacity( 1.0 );
  1167. };
  1168. } else {
  1169. markerSaver.setIcon( iconSaver );
  1170. iconSaver = e.target.options.icon;
  1171. markerSaver = e.target;
  1172. e.target.setIcon( SNAPE_Icon );
  1173. for( i=0; i< markers.length; i++){
  1174. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  1175. markers[i].setOpacity( 0.1 );
  1176. } else {
  1177. markers[i].setOpacity( 1.0 );
  1178. }
  1179. };
  1180. };
  1181. };
  1182. };
  1183. /*
  1184. function setNodeLocationToAnchor(){
  1185. Ext.Ajax.request({
  1186. url: '/lib/controller/updateLocation.php',
  1187. params: {
  1188. NODE: locationSelectedNode,
  1189. SITE: <?=$SiteID;?>,
  1190. UID: <?=$UserID;?>,
  1191. TYPE: 0,
  1192. SID: '<?=$Session;?>',
  1193. LAT: SiteLat,
  1194. LON: SiteLon,
  1195. ALT: SiteAlt
  1196. },
  1197. success: function( response, opts ){
  1198. loadLocationEditor('sys_location_map');
  1199. },
  1200. failure: failureAJAXFunction
  1201. });
  1202. };
  1203. function setNodeLocationByDelta(){
  1204. var dx = Ext.getCmp('dx').getValue();
  1205. var dy = Ext.getCmp('dy').getValue();
  1206. var dz = Ext.getCmp('dz').getValue();
  1207. Ext.Ajax.request({
  1208. url: '/lib/controller/updateLocation.php',
  1209. params: {
  1210. NODE: locationSelectedNode,
  1211. SITE: <?=$SiteID;?>,
  1212. UID: <?=$UserID;?>,
  1213. TYPE: 3,
  1214. SID: '<?=$Session;?>',
  1215. LAT: dx,
  1216. LON: dy,
  1217. ALT: dz
  1218. },
  1219. success: function( response, opts ){
  1220. loadLocationEditor();
  1221. },
  1222. failure: failureAJAXFunction
  1223. });
  1224. };
  1225. */
  1226. var mapCreatorWindow = null;
  1227. function createNewMap(){
  1228. if( mapCreatorWindow == null ){
  1229. mapCreatorWindow = new Ext.Window({
  1230. width: 800,
  1231. height: 440,
  1232. title: 'Creeate Custom Map',
  1233. modal: true,
  1234. frame: true,
  1235. border: false,
  1236. resizable: false,
  1237. items: [{
  1238. xtype: 'tabpanel',
  1239. id: 'mcr_tbp',
  1240. activeTab: 0,
  1241. items:[{
  1242. xtype: 'form',
  1243. title: '<?=$Labels->GetLabel('_INTER_MAP_');?>',
  1244. id: 'map_map_frm',
  1245. labelWidth: 250,
  1246. labelAlign: 'right',
  1247. height: 350,
  1248. items:[{
  1249. xtype: 'textfield',
  1250. fieldLabel: '<?=$Labels->GetLabel('_NAME_MAP_');?>',
  1251. name: 'map_name',
  1252. width: 540,
  1253. },{
  1254. xtype: 'hidden',
  1255. name: 'ctype',
  1256. value: 1
  1257. },{
  1258. xtype: 'textfield',
  1259. fieldLabel: '<?=$Labels->GetLabel('_TILE_URL_MAP_');?>',
  1260. name: 'map_url',
  1261. width: 540,
  1262. },{
  1263. xtype: 'textfield',
  1264. fieldLabel: '<?=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
  1265. name: 'map_attr',
  1266. width: 540,
  1267. },{
  1268. xtype: 'textarea',
  1269. fieldLabel: '<?=$Labels->GetLabel('_DESCRIPTION_');?>',
  1270. name: 'map_desc',
  1271. width: 540,
  1272. },{
  1273. xtype: 'combo',
  1274. fieldLabel: '<?=$Labels->GetLabel('_MAX_ZOOM_');?>',
  1275. name: 'map_maxz',
  1276. editable: false,
  1277. typeAhead: true,
  1278. triggerAction: 'all',
  1279. width: 100,
  1280. lazyRender:true,
  1281. mode: 'local',
  1282. store: new Ext.data.ArrayStore({
  1283. fields: ['zoom_l'],
  1284. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1285. }),
  1286. value: '18',
  1287. valueField: 'zoom_l',
  1288. displayField: 'zoom_l'
  1289. },{
  1290. xtype: 'combo',
  1291. fieldLabel: '<?=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
  1292. name: 'map_maxnz',
  1293. editable: false,
  1294. typeAhead: true,
  1295. triggerAction: 'all',
  1296. width: 100,
  1297. lazyRender:true,
  1298. mode: 'local',
  1299. store: new Ext.data.ArrayStore({
  1300. fields: ['zoom_l'],
  1301. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1302. }),
  1303. value: '16',
  1304. valueField: 'zoom_l',
  1305. displayField: 'zoom_l'
  1306. }]
  1307. },{
  1308. xtype: 'form',
  1309. title: '<?=$Labels->GetLabel('_LOCAL_PIC_MAP_');?>',
  1310. id: 'map_pic_frm',
  1311. fileUpload: true,
  1312. height: 350,
  1313. //autoHeight: true,
  1314. //bodyStyle: 'padding: 10px 10px 0 10px;',
  1315. labelWidth: 250,
  1316. labelAlign: 'right',
  1317. defaults: {
  1318. //anchor: '95%',
  1319. //allowBlank: false,
  1320. msgTarget: 'side'
  1321. },
  1322. items: [{
  1323. xtype: 'textfield',
  1324. fieldLabel: '<?=$Labels->GetLabel('_MAP_NAME_');?>',
  1325. id: 'map_name_2',
  1326. name: 'map_name',
  1327. width: 540
  1328. },{
  1329. xtype: 'hidden',
  1330. name: 'ctype',
  1331. value: 2
  1332. },{
  1333. xtype: 'fileuploadfield',
  1334. id: 'form-file',
  1335. emptyText: '<?=$Labels->GetLabel('_SELE_ANIMAGE_');?>',
  1336. fieldLabel: '<?=$Labels->GetLabel('_MAP_PICTURE_');?>',
  1337. width: 500,
  1338. name: 'map_image',
  1339. buttonText: '<?=$Labels->GetLabel('_BROWSE_');?>'
  1340. },{
  1341. xtype: 'textfield',
  1342. fieldLabel: '<?=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
  1343. name: 'map_attr',
  1344. width: 540,
  1345. },{
  1346. xtype: 'textarea',
  1347. fieldLabel: '<?=$Labels->GetLabel('_DESCRIPTION_');?>',
  1348. name: 'map_desc',
  1349. width: 540,
  1350. },{
  1351. xtype: 'combo',
  1352. fieldLabel: '<?=$Labels->GetLabel('_MAX_ZOOM_');?>',
  1353. editable: false,
  1354. typeAhead: true,
  1355. name: 'map_maxz',
  1356. triggerAction: 'all',
  1357. width: 100,
  1358. lazyRender:true,
  1359. mode: 'local',
  1360. store: new Ext.data.ArrayStore({
  1361. fields: ['zoom_l'],
  1362. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1363. }),
  1364. value: '16',
  1365. valueField: 'zoom_l',
  1366. displayField: 'zoom_l'
  1367. },{
  1368. xtype: 'combo',
  1369. fieldLabel: '<?=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
  1370. editable: false,
  1371. typeAhead: true,
  1372. name: 'map_maxnz',
  1373. triggerAction: 'all',
  1374. width: 100,
  1375. lazyRender:true,
  1376. mode: 'local',
  1377. store: new Ext.data.ArrayStore({
  1378. fields: ['zoom_l'],
  1379. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1380. }),
  1381. value: '16',
  1382. valueField: 'zoom_l',
  1383. displayField: 'zoom_l'
  1384. },{
  1385. xtype: 'numberfield',
  1386. fieldLabel: '<?=$Labels->GetLabel('_TOP_PIC_BOUND_');?>',
  1387. name: 'map_tpb',
  1388. value: 0,
  1389. width: 540,
  1390. },{
  1391. xtype: 'numberfield',
  1392. fieldLabel: '<?=$Labels->GetLabel('_LEFT_PIC_BOUND_');?>',
  1393. name: 'map_lpb',
  1394. value: 0,
  1395. width: 540,
  1396. },{
  1397. xtype: 'numberfield',
  1398. fieldLabel: '<?=$Labels->GetLabel('_RIGHT_PIC_BOUND_');?>',
  1399. name: 'map_rpb',
  1400. value: 0,
  1401. width: 540,
  1402. },{
  1403. xtype: 'numberfield',
  1404. fieldLabel: '<?=$Labels->GetLabel('_BOT_PIC_BOUND_');?>',
  1405. name: 'map_bpb',
  1406. value: 0,
  1407. width: 540,
  1408. },{
  1409. xtype: 'numberfield',
  1410. fieldLabel: '<?=$Labels->GetLabel('_MAP_WIDTH_');?>',
  1411. name: 'map_width',
  1412. decimalPrecision: 2,
  1413. value: 1000.00,
  1414. width: 540,
  1415. },{
  1416. xtype: 'numberfield',
  1417. fieldLabel: '<?=$Labels->GetLabel('_MAP_HEIGHT_');?>',
  1418. name: 'map_heigth',
  1419. decimalPrecision: 2,
  1420. value: 1000.00,
  1421. width: 540,
  1422. }]
  1423. }]
  1424. }],
  1425. bbar:[ '->',{
  1426. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1427. handler: function(){
  1428. //Ext.getCmp('map_map_frm').getForm().reset();
  1429. //Ext.getCmp('map_pic_frm').getForm().reset();
  1430. mapCreatorEditorWindow.destroy();
  1431. }
  1432. },{
  1433. text: '<?=$Labels->GetLabel('_CREATE_NEW_LBL_');?>',
  1434. handler: function(){
  1435. var tt = Ext.getCmp('mcr_tbp').getActiveTab();
  1436. if( tt.id == 'map_map_frm' ){
  1437. if( Ext.getCmp('map_map_frm').getForm().isValid()){
  1438. Ext.getCmp('map_map_frm').getForm().submit({
  1439. url: '/lib/controller/addMap.php',
  1440. waitMsg: 'Uploading Data...',
  1441. encoding: 'multipart/form-data',
  1442. success: function(fp, o){
  1443. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1444. alert('Processed file on the server');
  1445. }
  1446. });
  1447. };
  1448. } else {
  1449. if( Ext.getCmp('map_pic_frm').getForm().isValid()){
  1450. Ext.getCmp('map_pic_frm').getForm().submit({
  1451. url: '/lib/controller/addMap.php',
  1452. waitMsg: 'Uploading Image...',
  1453. encoding: 'multipart/form-data',
  1454. success: function(fp, o){
  1455. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1456. alert('Processed file on the server');
  1457. }
  1458. });
  1459. };
  1460. };
  1461. }
  1462. }],
  1463. listeners:{
  1464. beforedestroy: function(){
  1465. mapCreatorEditorWindow = null;
  1466. }
  1467. }
  1468. });
  1469. };
  1470. mapCreatorWindow.show();
  1471. };
  1472. var mapEditorWindow = null;
  1473. function editCurrentMap(){
  1474. Ext.Ajax.request({
  1475. url: '/lib/controller/getMapData.php',
  1476. params: {
  1477. SITE: <?=$SiteID;?>,
  1478. UID: <?=$UserID;?>,
  1479. MID: MAP_ID
  1480. },
  1481. success: function( response, opts ){
  1482. var newMapData = Ext.decode( response.responseText );
  1483. if( mapEditorWindow == null ){
  1484. switch( newMapData.type ){
  1485. case 1:{
  1486. mapEditorWindow = new Ext.Window({
  1487. width: 800,
  1488. height: 440,
  1489. title: 'Edit Current Map',
  1490. modal: true,
  1491. //closeAction: 'hide',
  1492. frame: true,
  1493. border: false,
  1494. resizable: false,
  1495. items: [{
  1496. xtype: 'form',
  1497. id: 'map_map_frm',
  1498. labelWidth: 250,
  1499. labelAlign: 'right',
  1500. height: 350,
  1501. items:[{
  1502. xtype: 'textfield',
  1503. fieldLabel: 'Map Name',
  1504. id: 'map_name_1',
  1505. name: 'map_name',
  1506. width: 540,
  1507. },{
  1508. xtype: 'hidden',
  1509. name: 'ctype',
  1510. value: 1
  1511. },{
  1512. xtype: 'textfield',
  1513. fieldLabel: 'Tiles URL Pattern',
  1514. name: 'map_url',
  1515. width: 540,
  1516. },{
  1517. xtype: 'textfield',
  1518. fieldLabel: 'Layer Attribution',
  1519. name: 'map_attr',
  1520. width: 540,
  1521. },{
  1522. xtype: 'textarea',
  1523. fieldLabel: 'Description',
  1524. name: 'map_desc',
  1525. width: 540,
  1526. },{
  1527. xtype: 'combo',
  1528. fieldLabel: 'Max Zoom',
  1529. name: 'map_maxz',
  1530. editable: false,
  1531. typeAhead: true,
  1532. triggerAction: 'all',
  1533. width: 100,
  1534. lazyRender:true,
  1535. mode: 'local',
  1536. store: new Ext.data.ArrayStore({
  1537. fields: ['zoom_l'],
  1538. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1539. }),
  1540. value: '18',
  1541. valueField: 'zoom_l',
  1542. displayField: 'zoom_l'
  1543. },{
  1544. xtype: 'combo',
  1545. fieldLabel: 'Max Native Zoom',
  1546. name: 'map_maxnz',
  1547. editable: false,
  1548. typeAhead: true,
  1549. triggerAction: 'all',
  1550. width: 100,
  1551. lazyRender:true,
  1552. mode: 'local',
  1553. store: new Ext.data.ArrayStore({
  1554. fields: ['zoom_l'],
  1555. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1556. }),
  1557. value: '16',
  1558. valueField: 'zoom_l',
  1559. displayField: 'zoom_l'
  1560. }]
  1561. }],
  1562. bbar:[ '->',{
  1563. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1564. handler: function(){
  1565. mapEditorWindow.destroy();
  1566. }
  1567. },{
  1568. text: '<?=$Labels->GetLabel('_APPLY_CHANGES_');?>',
  1569. handler: function(){
  1570. var tt = Ext.getCmp('mcr_tbp').getActiveTab();
  1571. if( tt.id == 'map_map_frm' ){
  1572. if( Ext.getCmp('map_map_frm').getForm().isValid()){
  1573. Ext.getCmp('map_map_frm').getForm().submit({
  1574. url: '/lib/controller/addMap.php',
  1575. waitMsg: 'Uploading Image...',
  1576. encoding: 'multipart/form-data',
  1577. success: function(fp, o){
  1578. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1579. alert('Processed file on the server');
  1580. }
  1581. });
  1582. };
  1583. } else {
  1584. if( Ext.getCmp('map_pic_frm').getForm().isValid()){
  1585. Ext.getCmp('map_pic_frm').getForm().submit({
  1586. url: '/lib/controller/addMap.php',
  1587. waitMsg: 'Uploading Image...',
  1588. encoding: 'multipart/form-data',
  1589. success: function(fp, o){
  1590. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1591. alert('Processed file on the server');
  1592. }
  1593. });
  1594. };
  1595. };
  1596. }
  1597. }],
  1598. listeners: {
  1599. beforedestroy: function(){
  1600. mapEditorWindow = null;
  1601. }
  1602. }
  1603. });
  1604. break;
  1605. };
  1606. default:{
  1607. mapEditorWindow = new Ext.Window({
  1608. width: 800,
  1609. height: 540,
  1610. title: 'Edit Current Map',
  1611. modal: true,
  1612. //closeAction: 'hide',
  1613. frame: true,
  1614. border: false,
  1615. resizable: false,
  1616. items: [{
  1617. xtype: 'form',
  1618. id: 'map_edt_frm',
  1619. height: 480,
  1620. //autoHeight: true,
  1621. //bodyStyle: 'padding: 10px 10px 0 10px;',
  1622. labelWidth: 250,
  1623. labelAlign: 'right',
  1624. defaults: {
  1625. //anchor: '95%',
  1626. //allowBlank: false,
  1627. msgTarget: 'side'
  1628. },
  1629. items:[{
  1630. xtype: 'spacer',
  1631. height: 6
  1632. },{
  1633. xtype: 'textfield',
  1634. fieldLabel: '<?=$Labels->GetLabel('_MAP_NAME_');?>',
  1635. name: 'map_name',
  1636. value: newMapData.name,
  1637. width: 540
  1638. },{
  1639. xtype: 'hidden',
  1640. name: 'MID',
  1641. value: newMapData.id
  1642. },{
  1643. xtype: 'panel',
  1644. frame: false,
  1645. border: false,
  1646. html: '<center><img height="50px" SRC="/lib/controller/data/assets/images/'+MAP_SET.layer_url+'"></center>'
  1647. },{
  1648. xtype: 'textfield',
  1649. fieldLabel: '<?=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
  1650. name: 'map_attr',
  1651. value: newMapData.attribution,
  1652. width: 540,
  1653. },{
  1654. xtype: 'textarea',
  1655. fieldLabel: '<?=$Labels->GetLabel('_DESCRIPTION_');?>',
  1656. name: 'map_desc',
  1657. value: newMapData.desc,
  1658. width: 540,
  1659. },{
  1660. xtype: 'combo',
  1661. fieldLabel: '<?=$Labels->GetLabel('_MAX_ZOOM_');?>',
  1662. editable: false,
  1663. typeAhead: true,
  1664. name: 'map_maxz',
  1665. value: newMapData.maxZoom,
  1666. triggerAction: 'all',
  1667. width: 100,
  1668. lazyRender:true,
  1669. mode: 'local',
  1670. store: new Ext.data.ArrayStore({
  1671. fields: ['zoom_l'],
  1672. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1673. }),
  1674. value: '16',
  1675. valueField: 'zoom_l',
  1676. displayField: 'zoom_l'
  1677. },{
  1678. xtype: 'combo',
  1679. fieldLabel: '<?=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
  1680. editable: false,
  1681. typeAhead: true,
  1682. name: 'map_maxnz',
  1683. value: newMapData.maxNativeZoom,
  1684. triggerAction: 'all',
  1685. width: 100,
  1686. lazyRender:true,
  1687. mode: 'local',
  1688. store: new Ext.data.ArrayStore({
  1689. fields: ['zoom_l'],
  1690. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1691. }),
  1692. value: '16',
  1693. valueField: 'zoom_l',
  1694. displayField: 'zoom_l'
  1695. },{
  1696. xtype: 'numberfield',
  1697. fieldLabel: '<?=$Labels->GetLabel('_TOP_PIC_BOUND_');?>',
  1698. name: 'map_tpb',
  1699. value: newMapData.img_tb,
  1700. width: 540,
  1701. },{
  1702. xtype: 'numberfield',
  1703. fieldLabel: '<?=$Labels->GetLabel('_LEFT_PIC_BOUND_');?>',
  1704. name: 'map_lpb',
  1705. value: newMapData.img_lb,
  1706. width: 540,
  1707. },{
  1708. xtype: 'numberfield',
  1709. fieldLabel: '<?=$Labels->GetLabel('_RIGHT_PIC_BOUND_');?>',
  1710. name: 'map_rpb',
  1711. value: newMapData.img_rb,
  1712. width: 540,
  1713. },{
  1714. xtype: 'numberfield',
  1715. fieldLabel: '<?=$Labels->GetLabel('_BOT_PIC_BOUND_');?>',
  1716. name: 'map_bpb',
  1717. value: newMapData.img_bb,
  1718. width: 540,
  1719. },{
  1720. xtype: 'numberfield',
  1721. fieldLabel: '<?=$Labels->GetLabel('_MAP_WIDTH_');?>',
  1722. name: 'map_width',
  1723. decimalPrecision: 2,
  1724. value: newMapData.img_map_w,
  1725. width: 540,
  1726. },{
  1727. xtype: 'numberfield',
  1728. fieldLabel: '<?=$Labels->GetLabel('_MAP_HEIGHT_');?>',
  1729. name: 'map_height',
  1730. decimalPrecision: 2,
  1731. value: newMapData.img_map_h,
  1732. width: 540,
  1733. },{
  1734. xtype: 'panel',
  1735. frame: false,
  1736. border: false,
  1737. layout: 'table',
  1738. layoutConfig: {
  1739. columns: 5
  1740. },
  1741. items:[{
  1742. xtype: 'spacer',
  1743. width: 250,
  1744. html: '<p style="text-align:right; margin-right: 5px;"><?=$Labels->GetLabel('_MAP_CENTER_MODE_');?>:</p>'
  1745. },{
  1746. xtype: 'radio',
  1747. name: 'bounds_mode',
  1748. value: 0,
  1749. checked: ( newMapData.bounds_mode == 0 ),
  1750. fieldLabel: '',
  1751. },{
  1752. width: 80,
  1753. html: '<img src="/style/assets/cust_map_cord_sys-0.png">'
  1754. },{
  1755. xtype: 'radio',
  1756. name: 'bounds_mode',
  1757. checked: ( newMapData.bounds_mode == 1 ),
  1758. value: 1,
  1759. fieldLabel: '',
  1760. },{
  1761. html: '<img src="/style/assets/cust_map_cord_sys-1.png">'
  1762. }]
  1763. }]
  1764. }],
  1765. bbar:[ '->',{
  1766. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1767. handler: function(){
  1768. mapEditorWindow.destroy();
  1769. }
  1770. },{
  1771. text: '<?=$Labels->GetLabel('_APPLY_CHANGES_');?>',
  1772. handler: function(){
  1773. if( Ext.getCmp('map_edt_frm').getForm().isValid()){
  1774. Ext.getCmp('map_edt_frm').getForm().submit({
  1775. url: '/lib/controller/updateMap.php',
  1776. waitMsg: 'Uploading Image...',
  1777. encoding: 'multipart/form-data',
  1778. success: function(fp, o){
  1779. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1780. alert('Processed file on the server');
  1781. }
  1782. });
  1783. };
  1784. }
  1785. }],
  1786. listeners: {
  1787. beforedestroy: function(){
  1788. mapEditorWindow = null;
  1789. }
  1790. }
  1791. });
  1792. break;
  1793. };
  1794. };
  1795. };
  1796. mapEditorWindow.show();
  1797. },
  1798. failure: failureAJAXFunction
  1799. });
  1800. };