
';
} else {
p1 = '
';
};
if( ( val & 2 ) == 2 ){
p2 = '
';
} else {
p2 = '
';
};
if( ( val & 4 ) == 4 ){
p3 = '
';
} else {
p3 = '
';
};
return p1+p2+p3;
};
function LocRenderer( val ){
if( val ){
return 'Select an Event from TimeLine to See Information
' } ); tPanel.doLayout(); }; }; function getZoneByNode( nid ){ var rVal = -1; for( var i=0; i < ActiveZones.totalCount; i++ ){ if( ActiveZones.zones[i].dev_id == nid ){ rVal = i; break; }; }; return rVal; }; function turnOffAllGzButThis( nid ){ var chocho = -1; for( var i=0; i < ActiveZones.totalCount; i++ ){ if( ActiveZones.zones[i].dev_id == nid ) chocho = i; map.removeLayer( ActiveZones.fig[i] ); map.removeLayer( ActiveZones.zang[i] ); map.removeLayer( ActiveZones.center[i] ); }; if( chocho > -1 ){ map.addLayer( ActiveZones.fig[chocho] ); map.addLayer( ActiveZones.zang[chocho] ); map.addLayer( ActiveZones.center[chocho] ); var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) ); map.flyToBounds( cVisible.getBounds() ); }; }; function turnAllGzOn(){ var tall = Array(); for( var i=0; i < ActiveZones.totalCount; i++ ){ tall[i*3] = ActiveZones.fig[i]; tall[i*3+1] = ActiveZones.zang[i]; tall[i*3+2] = ActiveZones.center[i]; if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] ); if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] ); if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] ); }; var cVisible = L.featureGroup( tall ); map.flyToBounds( cVisible.getBounds() ); }; function loadMapZones( SID ){ Ext.Ajax.request({ url: '/lib/controller/getGeoZones.php', params: { SITE: SID, UID: =$UserID;?>, SID: '=$Session;?>' }, success: function( response, opts ){ // If the response is JSON, you have to decode it var data = Ext.decode(response.responseText); var pp = Ext.getCmp('sources_panel'); if( typeof pp !== 'undefined' ) pp.removeAll(); ActiveZones = data; ActiveZones.fig = new Array(); ActiveZones.zang = new Array(); ActiveZones.center = new Array(); for(var i = 0; i < data.totalCount; i++ ) { switch( data.zones[i].type ){ case 'circle':{ //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map ); 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 } ); //map.addLayer( ActiveZones.fig[i] ); break; }; case 'poly':{ 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); //map.addLayer( ActiveZones.fig[i] ); break; }; case 'image':{ ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map ); //map.addLayer( ActiveZones.fig[i] ); break; }; case 'image_rot':{ ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, { opacity: 0.8 //, //interactive: true, //attribution: "Historical building plan © Instituto Geográfico Nacional de España" });//.addTo( map ); //map.addLayer( ActiveZones.fig[i] ); break; }; }; if( data.zones[i].dev_is_source ){ if( typeof pp !== 'undefined' ) { var sty = ''; if( selecredActiveSourceFilter == data.zones[i].dev_id ){ sty = 'cardDeviceSourceSelected'; } else { sty = 'cardDeviceSource'; }; pp.add( { id: data.zones[i].dev_id+'_container', frame: false, border: false, width: 130, height: 130, html: '

'+data.zones[i].dev_name+'
Select an Event from TimeLine to See Information
' }] }); tPanel.doLayout(); //BuildCalendar(); loadCalendarDates(); map = L.map('event_map',{ attributionControl: true, //preferCanvas: true, zoomControl: true, center: [SiteLat, SiteLon], /*zoomControl: false, zoom: 17, minZoom: 17, maxZoom: 17,*/ keyboard: false }).setView([SiteLat, SiteLon], 17); //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?>"); var mapLayers = []; /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', { subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], attribution: '© Bing Maps', detectRetina: true });*/ mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors', maxNativeZoom: 18, maxZoom: 24, }) // https://leaflet-extras.github.io/leaflet-providers/preview/ mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012', maxZoom: 19 }); mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', maxZoom: 19 }); mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — 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', maxZoom: 24 }); mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde attribution: 'Map data © OpenStreetMap contributors', maxZoom: 19 }); mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", { attribution: 'Kartendaten: © OpenStreetMap-Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA) ', maxZoom: 19 }); /* mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', maxZoom: 22 }); mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', maxZoom: 22 }); mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', maxZoom: 22 }); */ var baseMaps = { "MyMap": mapLayers["MyMap"], "OpenStreetMap": mapLayers["OpenStreetMap"], "OpenTopoMap": mapLayers["OpenTopoMap"], "EsriSat": mapLayers["EsriSat"], "EsriStreet": mapLayers["EsriStreet"], "EsriTopo": mapLayers["EsriTopo"], //"Bing": mapLayers["Bing"], //"OSM-Cycle": mapLayers["Cycle"], //"Landscape": mapLayers["Landscape"], //"Outdoor": mapLayers["Outdoor"], }; L.control.layers( baseMaps ).addTo(map); mapLayers["MyMap"].addTo(map); /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors', maxNativeZoom: 18, maxZoom: 24, }).addTo(map); */ //loadTimeLineGroups( selectedSite ); loadMapZones( SelectedSite ); getData( 'arch' ); //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }}); }; function loadMonitoring(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; setUserContent( 1 ); var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll( true ); Ext.getCmp('main_content').setTitle( 'Events Monitoring' ); tPanel.add({ columnWidth: 0.83, frame: false, border: false, items: [{ title: '=$Labels->getLabel('_MAP_MONITORING_');?>', frame: false, border: false, collapsible: false, draggable: false, layout: 'vbox', layoutConfig: { align : 'stretch', pack : 'start', }, height: PanelH-300, items:[{ height: PanelH-325, flex: 1, frame: false, border: false, layout: 'fit', items:{ id: 'event_map', html: ' ' } }] },{ frame: false, border: true, collapsible: false, draggable: false, layout: 'hbox', items:[{ title: 'Alarm Sources', xtype: 'panel', border: false, frame: false, collapsible: false, draggable: false, id: 'sources_panel', width: 160, autoScroll: 'auto', height: 303 },{ title: 'Event Log', height: 303, xtype: 'grid', border: false, frame: false, collapsible: false, draggable: false, ds: eventsListStore, cm: new Ext.grid.ColumnModel( eventsListColModel_ops ), sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ), bbar: [{ text: 'Clear', handler: function(){ Ext.Ajax.request({ url: '/lib/controller/clearEventCloud.php', params: { UID: =$UserID;?>, SID: '=$Session;?>' }, success: function( response, opts ){ }, failure: function( response, opts ) { } }); } }] }] }] }); tPanel.add({ columnWidth: 0.17, frame: false, id: 'prop_content', border: false, items: [{ title: 'Event Information', border: true, frame: true, html: 'Select an Event from TimeLine to See Information
' }] }); tPanel.doLayout(); map = L.map('event_map',{ attributionControl: true, //preferCanvas: true, zoomControl: true, center: [SiteLat, SiteLon], /*zoomControl: false, zoom: 17, minZoom: 17, maxZoom: 17,*/ keyboard: false }).setView([SiteLat, SiteLon], 17); //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?>"); var mapLayers = []; /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', { subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], attribution: '© Bing Maps', detectRetina: true });*/ mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors', maxNativeZoom: 18, maxZoom: 24, }) // https://leaflet-extras.github.io/leaflet-providers/preview/ mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012', maxZoom: 19 }); mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', maxZoom: 19 }); mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — 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', maxZoom: 24 }); mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde attribution: 'Map data © OpenStreetMap contributors', maxZoom: 19 }); mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", { attribution: 'Kartendaten: © OpenStreetMap-Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA) ', maxZoom: 19 }); /* mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', maxZoom: 22 }); mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', maxZoom: 22 }); mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', maxZoom: 22 }); */ var baseMaps = { "MyMap": mapLayers["MyMap"], "OpenStreetMap": mapLayers["OpenStreetMap"], "OpenTopoMap": mapLayers["OpenTopoMap"], "EsriSat": mapLayers["EsriSat"], "EsriStreet": mapLayers["EsriStreet"], "EsriTopo": mapLayers["EsriTopo"], //"Bing": mapLayers["Bing"], //"OSM-Cycle": mapLayers["Cycle"], //"Landscape": mapLayers["Landscape"], //"Outdoor": mapLayers["Outdoor"], }; L.control.layers( baseMaps ).addTo(map); mapLayers["MyMap"].addTo(map); /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors', maxNativeZoom: 18, maxZoom: 24, }).addTo(map); */ //loadTimeLineGroups( selectedSite ); loadMapZones( SelectedSite ); getData( 'live' ); //eventsListStore.load({params:{start:0, limit:50}}); }; function loadOnlineMonitoring(devID){ var tPanel = Ext.getCmp('main_content'); if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; tPanel.remove(0); tPanel.add({ html: 'Device Monitoring '+devID }); tPanel.doLayout(); };