// var ActiveZones = null; var map = null; var map_ed = null; var markers = []; var mapListStore = new Ext.data.JsonStore({ root: 'maps', totalProperty: 'totalCount', idProperty: 'map_id', remoteSort: false, baseParams: { UID: 'Data['id'];?>', SID: ''//, //SITE: }, fields: [{ name: 'map_id', type: 'int' },{ name: 'map_name', type: 'string' }], proxy : new Ext.data.HttpProxy({ method: 'POST', prettyUrls: false, url: '/lib/controller/listMaps.php' }) }); var selectedMarkerIcon = L.icon({ iconUrl: '/style/assets/cursor.png', iconSize: [32, 32], iconAnchor: [16, 16]//, //popupAnchor: [-3, -76], //shadowUrl: 'my-icon-shadow.png', //shadowSize: [68, 95], //shadowAnchor: [22, 94] }); selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } ); 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 ); //window.setTimeout(() => { // map.flyToBounds( cVisible.getBounds() ); //}, 500); map.flyToBounds( cVisible.getBounds() ); }; function loadMapZones( SiteID ){ Ext.Ajax.request({ url: '/lib/controller/getGeoZones.php', params: { SITE: SiteID, UID: , SID: '' }, 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+'

' }); }; };*/ if( data.zones[i].zang != undefined ){ //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map); ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map ); }; if( data.zones[i].center != undefined ){ //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map); ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map ); }; }; //if( selecredActiveSourceFilter == 0 ){ turnAllGzOn(); //} else { // turnOffAllGzButThis( selecredActiveSourceFilter ); //}; //if( typeof pp !== 'undefined' ) pp.doLayout(); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!'); } }); }; var cevt = Array(); var coz = Array(); function showEventsOnMap( data, removeCursor ){ if( removeCursor == undefined ) removeCursor = true; if( removeCursor ) map.removeLayer( selectedMarker ); if( cevt.length ){ for( i=0; i< cevt.length; i++ ){ if( cevt[i]!= null ){ cevt[i].remove(); delete( cevt[i] ); cevt[i] = null; }; }; }; if( coz.length ){ for( i=0; i< coz.length; i++ ){ if( coz[i]!= null ){ coz[i].remove(); delete( coz[i] ); coz[i]=null; }; }; }; var idx = 0; for( i=0; i < data.length; i++ ){ if( data[i].targets != undefined ){ var zz = ( 1.0 / ( data[i].targets.length + 0 ) ); var cp_color='#FF0000'; for( j = 0; j < data[i].targets.length; j++ ){ //switch( data.log[i].event ){ // case 36: cp_color='#0000FF'; break; //}; if( data[i].targets[j].color != undefined ){ cp_color= '#'+data[i].targets[j].color.toString(16); } else { cp_color='#FF00FF'; }; cLon = data[i].targets[j].lon; cLat = data[i].targets[j].lat; 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 ){ // loadEventPropertiesByID( this.options.id ); //} ); cevt[idx].addTo(map); idx++; }; }; }; }; function LoadMapEventsZ( Mode ){ if( tlLoadLocker ) return; tlLoadLocker = true; Ext.Ajax.request({ url: '/lib/controller/getGeoAlerts.php', params: { SITE: , UID: , SID: '', MODE: Mode }, success: function( response, opts ){ if( cevt.length ){ for( i=0; i< cevt.length; i++ ){ if( cevt[i]!= null ){ cevt[i].remove(); delete( cevt[i] ); cevt[i] = null; }; }; }; if( coz.length ){ for( i=0; i< coz.length; i++ ){ if( coz[i]!= null ){ coz[i].remove(); delete( coz[i] ); coz[i]=null; }; }; }; var data = Ext.decode( response.responseText ); var zz = ( 1.0 / ( data.evt.length + 0 ) ); for( i=0; i < data.evt.length; i++ ){ 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 ){ loadEventProperties( this.options.id ); } ); cevt[i].addTo(map); }; for( i=0; i < data.other.length; i++ ){ switch( data.other[i].type ){ case 'circle':{ 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 } ); coz[i].addTo(map); break; }; }; }; //eventsListStore.reload(); tlLoadLocker = false; }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!'); tlLoadLocker = false; } }); }; function initMapMonitoring__00(){ 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("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( 0 ); //getData( 'arch' ); }; function initMapMonitoring(){ var aK = true; if( MAP_SET.attribution == '' ) aK = false; var mapLayers = []; if( map != null ){ //ToDo: must be moved to Upper Menu changer map.off(); map.remove(); map = null; }; switch( MAP_SET.type ){ case 1: { map = L.map( 'event_map',{ //attributionControl: aK, attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat, SiteLon], /*zoomControl: false, zoom: 17, minZoom: 17, maxZoom: 17,*/ keyboard: false }); map.setView([SiteLat, SiteLon], 17 ); //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, { // attribution: MAP_SET.attribution, // maxNativeZoom: MAP_SET.maxNativeZoom, // maxZoom: MAP_SET.maxZoom //}); L.tileLayer( MAP_SET.layer_url, { attribution: MAP_SET.attribution, attributionControl: false, maxNativeZoom: MAP_SET.maxNativeZoom, //minZoom: 0, maxZoom: MAP_SET.maxZoom }).addTo( map ); break; }; case 2:{ map = L.map( 'event_map',{ crs: L.CRS.Simple, attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat, SiteLon], /*zoomControl: false,*/ zoom: 2, minZoom: -1, maxZoom: 4, keyboard: false }); var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]]; var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map ); //map.setView([SiteLat, SiteLon], -1 ); break; }; case 3:{ map = L.map( 'event_map',{ attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat,SiteLon], zoom: MAP_SET.maxZoom - 2, minZoom: MAP_SET.maxZoom - 4, maxZoom: MAP_SET.maxZoom, keyboard: false }); var bounds = [[MAP_SET.bounds_ly,MAP_SET.bounds_lx], [MAP_SET.bounds_ry,MAP_SET.bounds_rx]]; var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map ); break; }; }; //ToDo: Fix Initial Zoom level -> May be saving into a user profile loadMapZones( 0 ); }; function initMapReporting(){ var aK = true; if( MAP_SET.attribution == '' ) aK = false; var mapLayers = []; if( map != null ){ //ToDo: must be moved to Upper Menu changer map.off(); map.remove(); map = null; }; switch( MAP_SET.type ){ case 1:{ map = L.map( 'report_map',{ //attributionControl: aK, attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat, SiteLon], /*zoomControl: false, zoom: 17, minZoom: 17, maxZoom: 17,*/ keyboard: false }); map.setView([SiteLat, SiteLon], 17 ); //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, { // attribution: MAP_SET.attribution, // maxNativeZoom: MAP_SET.maxNativeZoom, // maxZoom: MAP_SET.maxZoom //}); L.tileLayer( MAP_SET.layer_url, { attribution: MAP_SET.attribution, attributionControl: false, maxNativeZoom: MAP_SET.maxNativeZoom, minZoom: 0, maxZoom: MAP_SET.maxZoom }).addTo( map ); break; }; case 2:{ map = L.map( 'report_map',{ crs: L.CRS.Simple, attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat, SiteLon], /*zoomControl: false,*/ zoom: 0, minZoom: -1, maxZoom: 4, keyboard: false }); var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]]; var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map ); //map.setView([SiteLat, SiteLon], -1 ); break; }; case 3:{ map = L.map( 'report_map',{ attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat,SiteLon], zoom: MAP_SET.maxZoom - 2, minZoom: MAP_SET.maxZoom - 4, maxZoom: MAP_SET.maxZoom, keyboard: false }); var bounds = [[MAP_SET.bounds_ly,MAP_SET.bounds_lx], [MAP_SET.bounds_ry,MAP_SET.bounds_rx]]; var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map ); break; }; }; //ToDo: Fix Initial Zoom level -> May be saving into a user profile loadMapZones( 0 ); }; var iconSaver = null; var markerSaver = null; function updateLocation( e ){ locationSelectedNode = e.target.options.mycustomid; Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, SITE: , UID: , TYPE: 0, SID: '', LAT: e.target._latlng.lat, LON: e.target._latlng.lng }, success: function( response, opts ){ loadNodeLocationProps( locationSelectedNode ); }, failure: failureAJAXFunction }); }; function markerDblClick( e ){ if( iconSaver == null ){ iconSaver = e.target.options.icon; markerSaver = e.target; e.target.setIcon( SNAPE_Icon ); for( i=0; i< markers.length; i++){ if( markers[i].options.mycustomid != e.target.options.mycustomid ){ markers[i].setOpacity( 0.1 ); } else { markers[i].setOpacity( 1.0 ); } }; } else { if( e.target.options.mycustomid == markerSaver.options.mycustomid ){ e.target.setIcon( iconSaver ); iconSaver = null; markerSaver = null; for( i=0; i< markers.length; i++){ markers[i].setOpacity( 1.0 ); }; } else { markerSaver.setIcon( iconSaver ); iconSaver = e.target.options.icon; markerSaver = e.target; e.target.setIcon( SNAPE_Icon ); for( i=0; i< markers.length; i++){ if( markers[i].options.mycustomid != e.target.options.mycustomid ){ markers[i].setOpacity( 0.1 ); } else { markers[i].setOpacity( 1.0 ); } }; }; }; }; function setNodeLocationToAnchor(){ Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, SITE: , UID: , TYPE: 0, SID: '', LAT: SiteLat, LON: SiteLon, ALT: SiteAlt }, success: function( response, opts ){ loadLocationEditor('sys_location_map'); }, failure: failureAJAXFunction }); }; function setNodeLocationByDelta(){ var dx = Ext.getCmp('dx').getValue(); var dy = Ext.getCmp('dy').getValue(); var dz = Ext.getCmp('dz').getValue(); Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, SITE: , UID: , TYPE: 3, SID: '', LAT: dx, LON: dy, ALT: dz }, success: function( response, opts ){ loadLocationEditor('sys_location_map'); }, failure: failureAJAXFunction }); }; //viewport function Events() { this.events = { }; } Events.prototype.on = function(name, fn) { var events = this.events[name]; if (events == undefined) { this.events[name] = [ fn ]; this.emit('event:on', fn); } else { if (events.indexOf(fn) == -1) { events.push(fn); this.emit('event:on', fn); } } return this; } Events.prototype.once = function(name, fn) { var events = this.events[name]; fn.once = true; if (!events) { this.events[name] = [ fn ]; this.emit('event:once', fn); } else { if (events.indexOf(fn) == -1) { events.push(fn); this.emit('event:once', fn); } } return this; } Events.prototype.emit = function(name, args) { var events = this.events[name]; if (events) { var i = events.length; while(i--) { if (events[i]) { events[i].call(this, args); if (events[i].once) { delete events[i]; } } } } return this; } Events.prototype.unbind = function(name, fn) { if (name) { var events = this.events[name]; if (events) { if (fn) { var i = events.indexOf(fn); if (i != -1) { delete events[i]; } } else { delete this.events[name]; } } } else { delete this.events; this.events = { }; } return this; } var userPrefix; var prefix = (function () { var styles = window.getComputedStyle(document.documentElement, ''), pre = (Array.prototype.slice .call(styles) .join('') .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']) )[1], dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1]; userPrefix = { dom: dom, lowercase: pre, css: '-' + pre + '-', js: pre[0].toUpperCase() + pre.substr(1) }; })(); function bindEvent(element, type, handler) { if(element.addEventListener) { element.addEventListener(type, handler, false); } else { element.attachEvent('on' + type, handler); } } function Viewport(data) { events.add( this ); var self = this; this.element = data.element; this.fps = data.fps; this.sensivity = data.sensivity; this.sensivityFade = data.sensivityFade; this.touchSensivity = data.touchSensivity; this.speed = data.speed; this.lastX = 0; this.lastY = 0; this.mouseX = 0; this.mouseY = 0; this.distanceX = 0; this.distanceY = 0; this.positionX = 0; this.positionY = 0; this.positionZ = 0; this.torqueX = 0; this.torqueY = 0; this.down = false; this.upsideDown = false; this.previousPositionX = 0; this.previousPositionY = 0; this.previousPositionZ = 0; this.currentSide = 0; this.calculatedSide = 0; bindEvent(data.element /*document*/, 'mousedown', function() { self.down = true; }); bindEvent(data.element, 'mouseup', function() { self.down = false; }); bindEvent(data.element, 'keyup', function() { self.down = false; }); bindEvent(data.element, 'mousemove', function(e) { self.mouseX = e.pageX; self.mouseY = e.pageY; }); bindEvent(data.element, 'touchstart', function(e) { self.down = true; e.touches ? e = e.touches[0] : null; self.mouseX = e.pageX / self.touchSensivity; self.mouseY = e.pageY / self.touchSensivity; self.lastX = self.mouseX; self.lastY = self.mouseY; }); bindEvent(data.element, 'touchmove', function(e) { if(e.preventDefault) { e.preventDefault(); } if(e.touches.length == 1) { e.touches ? e = e.touches[0] : null; self.mouseX = e.pageX / self.touchSensivity; self.mouseY = e.pageY / self.touchSensivity; } }); bindEvent(data.element, 'touchend', function(e) { self.down = false; }); setInterval(this.animate.bind(this), this.fps); } var events = new Events(); events.add = function(obj) { obj.events = { }; } events.implement = function(fn) { fn.prototype = Object.create(Events.prototype); } events.implement(Viewport); Viewport.prototype.animate = function() { this.distanceX = (this.mouseX - this.lastX); this.distanceY = (this.mouseY - this.lastY); this.lastX = this.mouseX; this.lastY = this.mouseY; if(this.down) { this.torqueX = this.torqueX * this.sensivityFade + (this.distanceX * this.speed - this.torqueX) * this.sensivity; this.torqueY = this.torqueY * this.sensivityFade + (this.distanceY * this.speed - this.torqueY) * this.sensivity; } if(Math.abs(this.torqueX) > 1.0 || Math.abs(this.torqueY) > 1.0) { if(!this.down) { this.torqueX *= this.sensivityFade; this.torqueY *= this.sensivityFade; } this.positionY -= this.torqueY; if(this.positionY > 360) { this.positionY -= 360; } else if(this.positionY < 0) { this.positionY += 360; } if(this.positionY > 90 && this.positionY < 270) { this.positionX -= this.torqueX; if(!this.upsideDown) { this.upsideDown = true; this.emit('upsideDown', { upsideDown: this.upsideDown }); } } else { this.positionX += this.torqueX; if(this.upsideDown) { this.upsideDown = false; this.emit('upsideDown', { upsideDown: this.upsideDown }); } } if(this.positionX > 360) { this.positionX -= 360; } else if(this.positionX < 0) { this.positionX += 360; } if(!(this.positionY >= 46 && this.positionY <= 130) && !(this.positionY >= 220 && this.positionY <= 308)) { if(this.upsideDown) { if(this.positionX >= 42 && this.positionX <= 130) { this.calculatedSide = 3; } else if(this.positionX >= 131 && this.positionX <= 223) { this.calculatedSide = 2; } else if(this.positionX >= 224 && this.positionX <= 314) { this.calculatedSide = 5; } else { this.calculatedSide = 4; } } else { if(this.positionX >= 42 && this.positionX <= 130) { this.calculatedSide = 5; } else if(this.positionX >= 131 && this.positionX <= 223) { this.calculatedSide = 4; } else if(this.positionX >= 224 && this.positionX <= 314) { this.calculatedSide = 3; } else { this.calculatedSide = 2; } } } else { if(this.positionY >= 46 && this.positionY <= 130) { this.calculatedSide = 6; } if(this.positionY >= 220 && this.positionY <= 308) { this.calculatedSide = 1; } } if(this.calculatedSide !== this.currentSide) { this.currentSide = this.calculatedSide; this.emit('sideChange'); } } this.element.style[userPrefix.js + 'Transform'] = 'rotateX(' + this.positionY + 'deg) rotateY(' + this.positionX + 'deg) rotateZ('+this.positionZ + 'deg)'; if(this.positionY != this.previousPositionY || this.positionX != this.previousPositionX || this.positionZ != this.previousPositionZ ) { this.previousPositionY = this.positionY; this.previousPositionX = this.positionX; this.previousPositionZ = this.positionZ; this.emit('rotate'); } } Viewport.prototype.setDirect = function( A, B, C ) { if( 1 ) { this.positionX = A; this.positionY = B; this.positionZ = C; if(this.positionY > 360) { this.positionY -= 360; } else if(this.positionY < 0) { this.positionY += 360; } if(this.positionY > 90 && this.positionY < 270) { if(!this.upsideDown) { this.upsideDown = true; this.emit('upsideDown', { upsideDown: this.upsideDown }); } } else { if(this.upsideDown) { this.upsideDown = false; this.emit('upsideDown', { upsideDown: this.upsideDown }); } } if(this.positionX > 360) { this.positionX -= 360; } else if(this.positionX < 0) { this.positionX += 360; } if(!(this.positionY >= 46 && this.positionY <= 130) && !(this.positionY >= 220 && this.positionY <= 308)) { if(this.upsideDown) { if(this.positionX >= 42 && this.positionX <= 130) { this.calculatedSide = 3; } else if(this.positionX >= 131 && this.positionX <= 223) { this.calculatedSide = 2; } else if(this.positionX >= 224 && this.positionX <= 314) { this.calculatedSide = 5; } else { this.calculatedSide = 4; } } else { if(this.positionX >= 42 && this.positionX <= 130) { this.calculatedSide = 5; } else if(this.positionX >= 131 && this.positionX <= 223) { this.calculatedSide = 4; } else if(this.positionX >= 224 && this.positionX <= 314) { this.calculatedSide = 3; } else { this.calculatedSide = 2; } } } else { if(this.positionY >= 46 && this.positionY <= 130) { this.calculatedSide = 6; } if(this.positionY >= 220 && this.positionY <= 308) { this.calculatedSide = 1; } } if(this.calculatedSide !== this.currentSide) { this.currentSide = this.calculatedSide; this.emit('sideChange'); } } this.element.style[userPrefix.js + 'Transform'] = 'rotateX(' + this.positionY + 'deg) rotateY(' + this.positionX + 'deg) rotateZ('+this.positionZ + 'deg)'; if(this.positionY != this.previousPositionY || this.positionX != this.previousPositionX || this.positionZ != this.previousPositionZ ) { this.previousPositionY = this.positionY; this.previousPositionX = this.positionX; this.previousPositionZ = this.positionZ; this.emit('rotate'); } } function Cube(data) { var self = this; this.element = data.element; this.sides = this.element.getElementsByClassName('side'); this.viewport = data.viewport; this.viewport.on('rotate', function() { self.rotateSides(); }); this.viewport.on('upsideDown', function(obj) { self.upsideDown(obj); }); this.viewport.on('sideChange', function() { self.sideChange(); }); } Cube.prototype.rotateSides = function() { var viewport = this.viewport; if(viewport.positionY > 90 && viewport.positionY < 270) { this.sides[0].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + (viewport.positionX + viewport.torqueX) + 'deg)'; this.sides[5].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + -(viewport.positionX + 180 + viewport.torqueX) + 'deg)'; } else { this.sides[0].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + (viewport.positionX - viewport.torqueX) + 'deg)'; this.sides[5].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + -(viewport.positionX + 180 - viewport.torqueX) + 'deg)'; } } Cube.prototype.upsideDown = function(obj) { var deg = (obj.upsideDown == true) ? '180deg' : '0deg'; var i = 5; while(i > 0 && --i) { this.sides[i].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + deg + ')'; } } Cube.prototype.sideChange = function() { for(var i = 0; i < this.sides.length; ++i) { this.sides[i].getElementsByClassName('cube-image')[0].className = 'cube-image'; } this.sides[this.viewport.currentSide - 1].getElementsByClassName('cube-image')[0].className = 'cube-image active'; } Cube.prototype.set = function( A, B, C ) { //C = C + 90.0; this.viewport.setDirect( A, B, C ); } //var viewport = new Viewport({ // element: document.getElementsByClassName('cube')[0], // fps: 20, // sensivity: .1, // sensivityFade: .93, // speed: 2, // touchSensivity: 1.5 //}); //new Cube({ // viewport: viewport, // element: document.getElementsByClassName('cube')[0] //}); var LRF3D_Icon = L.icon({ iconUrl: '/style/assets/5_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var LFS_Icon = L.icon({ iconUrl: '/style/assets/2_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var PLS200_Icon = L.icon({ iconUrl: '/style/assets/3_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var PLSNET200_Icon = L.icon({ iconUrl: '/style/assets/6_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var PLS360_Icon = L.icon({ iconUrl: '/style/assets/4_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var ALS_Icon = L.icon({ iconUrl: '/style/assets/1_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var PTZCAM_Icon = L.icon({ iconUrl: '/style/assets/12_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var FIXCAM_Icon = L.icon({ iconUrl: '/style/assets/11_node.png', //shadowUrl: 'leaf-shadow.png', iconSize: [64, 64], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [32, 32], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor }); var SITEZ_Icon = L.icon({ iconUrl: '/style/assets/centre_1.png', //shadowUrl: 'leaf-shadow.png', iconSize: [32, 32], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [16, 16], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor }); var SNAPE_Icon = L.icon({ iconUrl: '/style/assets/cursor.png', //shadowUrl: 'leaf-shadow.png', iconSize: [32, 32], // size of the icon //shadowSize: [50, 64], // size of the shadow iconAnchor: [16, 16], // point of the icon which will correspond to marker's location //shadowAnchor: [4, 62], // the same for the shadow popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor }); function loadLocationNodes(){ Ext.Ajax.request({ url: '/lib/controller/getLocationItems.php', params: { SITE: , UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( data!= null ){ var i = 0; var tall = Array(); for( ; i < data.length; i++){ switch( data[i].type ){ case 1:{ 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 ); break; }; case 2:{ 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 ); break; }; case 3:{ 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 ); break; }; case 4:{ 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 ); break; }; case 5:{ 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 ); break; }; case 6:{ 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 ); break; }; case 10: case 12:{ 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 ); break; }; case 11: case 13:{ 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 ); break; }; }; tall[i] = markers[i]; }; tall[i++] = ed_anchor; var cVisible = L.featureGroup( tall ); map_ed.flyToBounds( cVisible.getBounds() ); } else { map_ed.setView([SiteLat, SiteLon], 4 ); }; }, failure: function( response, opts ) { //var tPanel = Ext.getCmp('main_portal'); //tPanel.remove(0); //tPanel.add( { html: 'Failed to load dashboard!' } ); //tPanel.doLayout(); } }); }; var orientationEditorWindow = null; var cubeViewport = null; var cube = null; var curX = 0; var curY = 0; var curZ = 0; var bk_upd = false; function setCubeOrientation( A, B, C ){ if( bk_upd ) return; bk_upd = true; curX = A; curY = B; curZ = C; var t = Ext.getCmp('roll_sld'); t.setValue( A ); t = Ext.getCmp('roll'); t.setValue( A ); t = Ext.getCmp('pitch_sld'); t.setValue( B ); t = Ext.getCmp('pitch'); t.setValue( B ); t = Ext.getCmp('yaw_sld'); t.setValue( C ); t = Ext.getCmp('yaw'); t.setValue( C ); if( cube != null ) cube.set( curX, curY, curZ ); bk_upd = false; }; function orientationEditor(){ if( orientationEditorWindow == null ){ orientationEditorWindow = new Ext.Window({ modal: true, title: 'GetLabel('_ORIENTATION_');?>', closeAction: 'hide', width: 640, height: 500, items:[{ layout: 'table', defaults: { bodyStyle:'padding:5px' }, layoutConfig: { columns: 3 }, items:[{ html: 'Roll:' },{ xtype: 'textfield', id: 'roll', name: 'roll', value: 30.0029, listeners:{ change: function( sl, nv, tt ){ setCubeOrientation( nv / 1.0, curY, curZ ); } } },{ xtype: 'slider', id: 'roll_sld', width: 200, value: 30.0029, minValue: -180.0, maxValue: 180.0, listeners:{ change: function( sl, nv, tt ){ setCubeOrientation( nv, curY, curZ ); } } },{ html: 'Pitch:' },{ xtype: 'textfield', id: 'pitch', name: 'pitch', value: 30.0029, listeners:{ change: function( sl, nv, tt ){ setCubeOrientation( curX, nv / 1.0, curZ ); } } },{ xtype: 'slider', id: 'pitch_sld', width: 200, value: 30.0029, minValue: -180.0, maxValue: 180.0, listeners:{ change: function( sl, nv, tt ){ setCubeOrientation( curX, nv, curZ ); } } },{ html: 'Yaw:' },{ xtype: 'textfield', id: 'yaw', name: 'yaw', value: 30.0029, listeners:{ change: function( sl, nv, tt ){ //alert( nv ); setCubeOrientation( curX, curY, nv / 1.0 ); } } },{ xtype: 'slider', id: 'yaw_sld', width: 200, value: 30.0029, minValue: -180.0, maxValue: 180.0, listeners:{ change: function( sl, nv, tt ){ setCubeOrientation( curX, curY, nv ); } } }] },{ html: '
FRONT
TOP
RIGHT
BOTTOM
LEFT
BACK
' }], buttons:[{ text: 'Cancel', width: 200, handler: function(){ orientationEditorWindow.hide(); } },{ text: 'Apply', width: 200, handler: function(){ Ext.getCmp('sroll').setValue( Ext.getCmp('roll').getValue() ); Ext.getCmp('spitch').setValue( Ext.getCmp('pitch').getValue() ); Ext.getCmp('syaw').setValue( Ext.getCmp('yaw').getValue() ); orientationEditorWindow.hide(); } }] }); orientationEditorWindow.show(); cubeViewport = new Viewport({ element: document.getElementsByClassName('cube')[0], fps: 20, sensivity: .1, sensivityFade: .93, speed: 2, touchSensivity: 1.5 }); cube = new Cube({ viewport: cubeViewport, element: document.getElementsByClassName('cube')[0] }); } else { orientationEditorWindow.show(); }; setCubeOrientation( Ext.getCmp('sroll').getValue(), Ext.getCmp('spitch').getValue(), Ext.getCmp('syaw').getValue() ); }; var locationSelectedNode = 0; function loadLoactionProps( e ){ if( typeof e == 'number' ){ locationSelectedNode = e; } else { locationSelectedNode = e.sourceTarget.options.mycustomid; } loadNodeLocationProps( locationSelectedNode ); }; function loadNodeLocationProps( NodeID ){ //alert( 'Node: ' + NodeID ); Ext.Ajax.request({ url: '/lib/controller/getLocationNodeProps.php', params: { NID: , UID: , SID: '', NODE: NodeID }, success: function( response, opts ){ // If the response is JSON, you have to decode it var data = Ext.decode(response.responseText); var tPanel = Ext.getCmp('prop_content'); tPanel.remove(0); tPanel.add( data ); tPanel.doLayout(); }, failure: failureAJAXFunction }); }; function LoadNodesList(){ Ext.Ajax.request({ url: '/lib/controller/getLocationNodes.php', params: { SITE: , UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var tPanel = Ext.getCmp('prop_content'); tPanel.remove(0); tPanel.add( data ); tPanel.doLayout(); }, failure: failureAJAXFunction }); }; function reloadSiteMapData(){ Ext.Ajax.request({ url: '/lib/controller/getMapData.php', params: { SITE: , UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); MAP_ID = parseInt( data.selected_map ); MAP_IS_LOCAL = (MAP_ID)?data.local_binding:false; MAP_SET = data.maps; Ext.getCmp('lab_123').update( 'GetLabel('_SYS_ANCHORT_LBL_');?> '+((MAP_IS_LOCAL)?'Pos X':'GetLabel('_LON_SHORT_LBL_');?>')+':' ); Ext.getCmp('lab_124').update( ((MAP_IS_LOCAL)?'Pos Y':'GetLabel('_LAT_SHORT_LBL_');?>')+':' ); document.getElementById('lab_125').src = ((MAP_IS_LOCAL)?'/style/assets/map_mode_decart.png':'/style/assets/map_mode_wgs84.png'); loadLocationEditor('sys_location_map'); }, failure: failureAJAXFunction }); }; var ed_anchor = null; function loadLocationEditor( el_id , node_type, node_id, lat, lon ){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; if( node_type == undefined ) node_type = 0; if( lat == undefined ){ lat = SiteLat; lon = SiteLon; }; //var cMSET = mapListStore.getAt( MAP_ID ); //alert( MAP_SET.id ); var aK = true; if( MAP_SET.attribution == '' ) aK = false; var mapLayers = []; if( map_ed != undefined ){ map_ed.off(); map_ed.remove(); }; switch( MAP_SET.type ){ case 1:{ map_ed = L.map( el_id,{ attributionControl: aK, //preferCanvas: true, zoomControl: true, center: [SiteLat,SiteLon], /*zoomControl: false, zoom: 17, minZoom: 17, maxZoom: 17,*/ keyboard: false }); //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, { // attribution: MAP_SET.attribution, // maxNativeZoom: MAP_SET.maxNativeZoom, // maxZoom: MAP_SET.maxZoom //}); L.tileLayer( MAP_SET.layer_url, { attribution: MAP_SET.attribution, maxNativeZoom: MAP_SET.maxNativeZoom, minZoom: 0, maxZoom: MAP_SET.maxZoom }).addTo( map_ed ); break; }; case 2:{ map_ed = L.map( el_id,{ crs: L.CRS.Simple, attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat,SiteLon], /*zoomControl: false,*/ zoom: 0, minZoom: 0, maxZoom: 4, keyboard: false }); var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]]; var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map_ed ); break; }; case 3:{ map_ed = L.map( el_id,{ attributionControl: false, preferCanvas: true, zoomControl: true, center: [SiteLat,SiteLon], zoom: MAP_SET.maxZoom - 2, minZoom: MAP_SET.maxZoom - 4, maxZoom: MAP_SET.maxZoom, keyboard: false }); var bounds = [[MAP_SET.bounds_ly,MAP_SET.bounds_lx], [MAP_SET.bounds_ry,MAP_SET.bounds_rx]]; var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map_ed ); break; }; }; map_ed.setView([SiteLat,SiteLon], MAP_SET.maxZoom ); if( node_type ){ ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).bindPopup("GetLabel('_SYS_ANCHORT_LBL_');?>");//.openPopup(); } else { ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).on('click', LoadNodesList ).bindPopup("GetLabel('_SYS_ANCHORT_LBL_');?>");//.openPopup(); }; /* 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 }); 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_ed ); mapLayers["MyMap"].addTo( map_ed ); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo( map_ed ); */ if( node_type ){ switch( node_type ){ case 1:{ 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 ); break; }; case 2:{ 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 ); break; }; case 3:{ 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 ); break; }; case 4:{ 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 ); break; }; case 5:{ 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 ); break; }; case 6:{ 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 ); break; }; case 10: case 12:{ 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 ); break; }; case 11: case 13:{ 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 ); break; }; }; } else loadLocationNodes(); }; function updateSiteAnchor(){ SiteLat = Ext.getCmp('siteLat').getValue(); SiteLon = Ext.getCmp('siteLon').getValue(); SiteAlt = Ext.getCmp('siteAlt').getValue(); Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { SITE: , UID: , TYPE: 1, SID: '', LAT: SiteLat, LON: SiteLon, ALT: SiteAlt }, success: function(){ loadLocationEditor('sys_location_map'); }, failure: failureAJAXFunction }); }; function updateSiteMap(){ MAP_ID = Ext.getCmp('siteMap').getValue(); Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { SITE: , UID: , TYPE: 4, SID: '', MID: MAP_ID }, success: function( response, opts ){ reloadSiteMapData(); }, failure: failureAJAXFunction }); }; var mapDataLoadded = false; // Call this to prepare all data once in Session function prepareMapData(){ //if( ap_type == 1 ) return;//Metro No Map ... if( !mapDataLoadded ){ mapListStore.load(); }; }; function updateLocationOrientation(){ var tLat = Ext.getCmp('slat').getValue(); var tLon = Ext.getCmp('slon').getValue(); var tAlt = Ext.getCmp('salt').getValue(); var tRoll = Ext.getCmp('sroll').getValue(); var tPitch = Ext.getCmp('spitch').getValue(); var tYaw = Ext.getCmp('syaw').getValue(); Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, UID: , TYPE: 2, SID: '', LAT: tLat, LON: tLon, ALT: tAlt, YAW: tYaw, ROLL: tRoll, PITCH: tPitch }, failure: failureAJAXFunction }); }; var iconSaver = null; var markerSaver = null; function updateLocation( e ){ locationSelectedNode = e.target.options.mycustomid; Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, SITE: , UID: , TYPE: 0, SID: '', LAT: e.target._latlng.lat, LON: e.target._latlng.lng }, success: function( response, opts ){ loadNodeLocationProps( locationSelectedNode ); }, failure: failureAJAXFunction }); }; function markerDblClick( e ){ if( iconSaver == null ){ iconSaver = e.target.options.icon; markerSaver = e.target; e.target.setIcon( SNAPE_Icon ); for( i=0; i< markers.length; i++){ if( markers[i].options.mycustomid != e.target.options.mycustomid ){ markers[i].setOpacity( 0.1 ); } else { markers[i].setOpacity( 1.0 ); } }; } else { if( e.target.options.mycustomid == markerSaver.options.mycustomid ){ e.target.setIcon( iconSaver ); iconSaver = null; markerSaver = null; for( i=0; i< markers.length; i++){ markers[i].setOpacity( 1.0 ); }; } else { markerSaver.setIcon( iconSaver ); iconSaver = e.target.options.icon; markerSaver = e.target; e.target.setIcon( SNAPE_Icon ); for( i=0; i< markers.length; i++){ if( markers[i].options.mycustomid != e.target.options.mycustomid ){ markers[i].setOpacity( 0.1 ); } else { markers[i].setOpacity( 1.0 ); } }; }; }; }; /* function setNodeLocationToAnchor(){ Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, SITE: , UID: , TYPE: 0, SID: '', LAT: SiteLat, LON: SiteLon, ALT: SiteAlt }, success: function( response, opts ){ loadLocationEditor('sys_location_map'); }, failure: failureAJAXFunction }); }; function setNodeLocationByDelta(){ var dx = Ext.getCmp('dx').getValue(); var dy = Ext.getCmp('dy').getValue(); var dz = Ext.getCmp('dz').getValue(); Ext.Ajax.request({ url: '/lib/controller/updateLocation.php', params: { NODE: locationSelectedNode, SITE: , UID: , TYPE: 3, SID: '', LAT: dx, LON: dy, ALT: dz }, success: function( response, opts ){ loadLocationEditor(); }, failure: failureAJAXFunction }); }; */ var mapCreatorWindow = null; function createNewMap(){ if( mapCreatorWindow == null ){ mapCreatorWindow = new Ext.Window({ width: 800, height: 580, title: "GetLabel('_CREATE_CUSTOM_MAP_');?>", modal: true, frame: true, border: false, resizable: false, items: [{ xtype: 'tabpanel', id: 'mcr_tbp', activeTab: 0, items:[{ xtype: 'form', title: "GetLabel('_INTER_MAP_');?>", id: 'map_map_frm', fileUpload: true, labelWidth: 250, labelAlign: 'right', height: 490, items:[{ xtype: 'textfield', fieldLabel: "GetLabel('_NAME_MAP_');?>", name: 'map_name', width: 540, },{ xtype: 'hidden', name: 'ctype', value: 1 },{ xtype: 'textfield', fieldLabel: "GetLabel('_TILE_URL_MAP_');?>", name: 'map_url', width: 540, },{ xtype: 'textfield', fieldLabel: "GetLabel('_LAYER_ATTRIB_');?>", name: 'map_attr', width: 540, },{ xtype: 'textarea', fieldLabel: "GetLabel('_DESCRIPTION_');?>", name: 'map_desc', width: 540, },{ xtype: 'combo', fieldLabel: "GetLabel('_MAX_ZOOM_');?>", name: 'map_maxz', editable: false, typeAhead: true, triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '18', valueField: 'zoom_l', displayField: 'zoom_l' },{ xtype: 'combo', fieldLabel: "GetLabel('_MAX_NATURAL_ZOOM_');?>", name: 'map_maxnz', editable: false, typeAhead: true, triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '16', valueField: 'zoom_l', displayField: 'zoom_l' }] },{ xtype: 'form', title: "GetLabel('_LOCAL_PIC_MAP_');?>", id: 'map_pic_frm', fileUpload: true, height: 490, //autoHeight: true, //bodyStyle: 'padding: 10px 10px 0 10px;', labelWidth: 250, labelAlign: 'right', defaults: { //anchor: '95%', //allowBlank: false, msgTarget: 'side' }, items: [{ xtype: 'textfield', fieldLabel: "GetLabel('_MAP_NAME_');?>", id: 'map_name_2', name: 'map_name', width: 540 },{ xtype: 'hidden', name: 'ctype', value: 2 },{ xtype: 'fileuploadfield', id: 'form-file', emptyText: "GetLabel('_SELE_ANIMAGE_');?>", fieldLabel: "GetLabel('_MAP_PICTURE_');?>", width: 500, name: 'map_image', buttonText: "GetLabel('_BROWSE_');?>" },{ xtype: 'textfield', fieldLabel: "GetLabel('_LAYER_ATTRIB_');?>", name: 'map_attr', width: 540, },{ xtype: 'textarea', fieldLabel: "GetLabel('_DESCRIPTION_');?>", name: 'map_desc', width: 540, },{ xtype: 'combo', fieldLabel: "GetLabel('_MAX_ZOOM_');?>", editable: false, typeAhead: true, id: 'map_maxz', name: 'map_maxz', triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '4', valueField: 'zoom_l', displayField: 'zoom_l' },{ xtype: 'combo', fieldLabel: "GetLabel('_MAX_NATURAL_ZOOM_');?>", editable: false, typeAhead: true, id: 'map_maxnz', name: 'map_maxnz', triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '4', valueField: 'zoom_l', displayField: 'zoom_l' },{ xtype: 'numberfield', fieldLabel: "GetLabel('_TOP_PIC_BOUND_');?>", name: 'map_tpb', value: 0, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_LEFT_PIC_BOUND_');?>", name: 'map_lpb', value: 0, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_RIGHT_PIC_BOUND_');?>", name: 'map_rpb', value: 0, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_BOT_PIC_BOUND_');?>", name: 'map_bpb', value: 0, width: 540, },{ xtype: 'combo', fieldLabel: "GetLabel('_MAP_COORD_SYSTEM_');?>", editable: false, typeAhead: true, hiddenName: 'map_corsys', triggerAction: 'all', width: 540, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['C_SYS_V','C_SYS'], data: [[0,'Meters from map Centre'], [1,'WGS84(GPS)']] }), listeners:{ select: function( a, b, c ){ if( c ){ Ext.getCmp('map_height').hide(); Ext.getCmp('map_maxz').hide(); Ext.getCmp('map_maxnz').hide(); Ext.getCmp('map_width').hide(); Ext.getCmp('map_cpp').hide(); Ext.getCmp('map_cpb').show(); } else { Ext.getCmp('map_height').show(); Ext.getCmp('map_maxz').show(); Ext.getCmp('map_maxnz').show(); Ext.getCmp('map_width').show(); Ext.getCmp('map_cpp').show(); Ext.getCmp('map_cpb').hide(); }; } }, value: '0', valueField: 'C_SYS_V', displayField: 'C_SYS' },{ xtype: 'numberfield', fieldLabel: "GetLabel('_MAP_WIDTH_');?>", id: 'map_height', name: 'map_height', decimalPrecision: 2, value: 1000.00, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_MAP_HEIGHT_');?>", id: 'map_width', name: 'map_width', decimalPrecision: 2, value: 1000.00, width: 540, },{ xtype: 'panel', id: 'map_cpp', frame: false, border: false, layout: 'table', layoutConfig: { columns: 5 }, items:[{ xtype: 'spacer', width: 250, html: "

GetLabel('_MAP_CENTER_MODE_');?>:

" },{ xtype: 'radio', name: 'bounds_mode', inputValue: 0, checked: 1 },{ width: 80, html: '' },{ xtype: 'radio', name: 'bounds_mode', checked: 0, inputValue: 1 },{ html: '' }] },{ xtype: 'panel', id: 'map_cpb', frame: false, border: false, hidden: true, layout: 'table', layoutConfig: { columns: 5 }, items:[{ xtype: 'spacer', width: 250, html: "

GetLabel('_MAP_LEFT_CORCORD_');?>:

" },{ xtype: 'spacer', width: 100, html: "

GetLabel('_LAT_');?>

" },{ xtype: 'numberfield', id: 'map_lcclat', name: 'map_lcclat', decimalPrecision: 8, value: 32.0001, width: 150, },{ xtype: 'spacer', width: 100, html: "

GetLabel('_LON_');?>

" },{ xtype: 'numberfield', id: 'map_lcclon', name: 'map_lcclon', decimalPrecision: 8, value: 32.0001, width: 150, },{ xtype: 'spacer', width: 250, html: "

GetLabel('_MAP_RIGHT_CORCORD_');?>:

" },{ xtype: 'spacer', width: 100, html: "

GetLabel('_LAT_');?>

" },{ xtype: 'numberfield', id: 'map_rcclat', name: 'map_rcclat', decimalPrecision: 8, value: 32.0001, width: 150, },{ xtype: 'spacer', width: 100, html: "

GetLabel('_LON_');?>

" },{ xtype: 'numberfield', id: 'map_rcclon', name: 'map_rcclon', decimalPrecision: 8, value: 32.0001, width: 150, }] }] }] }], bbar:[ '->',{ text: 'GetLabel('_CANCEL_');?>', handler: function(){ //Ext.getCmp('map_map_frm').getForm().reset(); //Ext.getCmp('map_pic_frm').getForm().reset(); mapCreatorWindow.destroy(); } },{ text: 'GetLabel('_CREATE_NEW_LBL_');?>', handler: function(){ var tt = Ext.getCmp('mcr_tbp').getActiveTab(); if( tt.id == 'map_map_frm' ){ if( Ext.getCmp('map_map_frm').getForm().isValid()){ Ext.getCmp('map_map_frm').getForm().submit({ url: '/lib/controller/addMap.php', waitMsg: 'Uploading Data...', encoding: 'multipart/form-data', success: function(fp, o){ //msg('Success', 'Processed file "'+o.result.file+'" on the server'); //alert('Processed file on the server'); mapCreatorWindow.destroy(); } }); }; } else { if( Ext.getCmp('map_pic_frm').getForm().isValid()){ Ext.getCmp('map_pic_frm').getForm().submit({ url: '/lib/controller/addMap.php', waitMsg: 'Uploading Image...', encoding: 'multipart/form-data', success: function(fp, o){ //msg('Success', 'Processed file "'+o.result.file+'" on the server'); //alert('Processed file on the server'); mapCreatorWindow.destroy(); } }); }; }; } }], listeners:{ beforedestroy: function(){ mapCreatorWindow = null; } } }); }; mapCreatorWindow.show(); }; var mapEditorWindow = null; function deleteCurrentMap(){ Ext.Ajax.request({ url: '/lib/controller/delMapData.php', params: { SITE: , UID: , SID: '', MID: MAP_ID }, success: function( response, opts ){ location.reload(); } }); }; function editCurrentMap(){ Ext.Ajax.request({ url: '/lib/controller/getMapData.php', params: { SITE: , UID: , SID: '', MID: MAP_ID }, success: function( response, opts ){ var newMapData = Ext.decode( response.responseText ); if( mapEditorWindow == null ){ switch( newMapData.type ){ case 1:{ mapEditorWindow = new Ext.Window({ width: 800, height: 440, title: 'Edit Current Map', modal: true, //closeAction: 'hide', frame: true, border: false, resizable: false, items: [{ xtype: 'form', id: 'map_map_frm', labelWidth: 250, labelAlign: 'right', height: 350, items:[{ xtype: 'textfield', fieldLabel: 'Map Name', id: 'map_name_1', name: 'map_name', width: 540, },{ xtype: 'hidden', name: 'ctype', value: 1 },{ xtype: 'textfield', fieldLabel: 'Tiles URL Pattern', name: 'map_url', width: 540, },{ xtype: 'textfield', fieldLabel: 'Layer Attribution', name: 'map_attr', width: 540, },{ xtype: 'textarea', fieldLabel: 'Description', name: 'map_desc', width: 540, },{ xtype: 'combo', fieldLabel: 'Max Zoom', name: 'map_maxz', editable: false, typeAhead: true, triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '18', valueField: 'zoom_l', displayField: 'zoom_l' },{ xtype: 'combo', fieldLabel: 'Max Native Zoom', name: 'map_maxnz', editable: false, typeAhead: true, triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '16', valueField: 'zoom_l', displayField: 'zoom_l' }] }], bbar:[ '->',{ text: "GetLabel('_CANCEL_');?>", handler: function(){ mapEditorWindow.destroy(); } },{ text: "GetLabel('_APPLY_CHANGES_');?>", handler: function(){ var tt = Ext.getCmp('mcr_tbp').getActiveTab(); if( tt.id == 'map_map_frm' ){ if( Ext.getCmp('map_map_frm').getForm().isValid()){ Ext.getCmp('map_map_frm').getForm().submit({ url: '/lib/controller/updateMap.php', waitMsg: "GetLabel('_UPDATING_DATA_');?>...", clientValidation: false, encoding: 'multipart/form-data', success: function(f,a){ alert('Processed file on the server1'); //mapEditorWindow.hide(); //mapEditorWindow.destroy(); } }); }; } else { if( Ext.getCmp('map_pic_frm').getForm().isValid()){ Ext.getCmp('map_pic_frm').getForm().submit({ url: '/lib/controller/updateMap.php', clientValidation: false, waitMsg: "GetLabel('_UPDATING_DATA_');?>...", encoding: 'multipart/form-data', success: function( f, a ){ alert('Processed file on the server2'); //mapEditorWindow.hide(); //mapEditorWindow.destroy(); } }); }; }; } }], listeners: { beforedestroy: function(){ mapEditorWindow = null; } } }); break; }; default:{ mapEditorWindow = new Ext.Window({ width: 800, height: 540, title: "GetLabel('_EDIT_CUR_MAP_');?>", modal: true, frame: true, border: false, resizable: false, items: [{ xtype: 'form', id: 'map_edt_frm', height: 480, //autoHeight: true, //bodyStyle: 'padding: 10px 10px 0 10px;', labelWidth: 250, labelAlign: 'right', defaults: { //anchor: '95%', //allowBlank: false, msgTarget: 'side' }, items:[{ xtype: 'spacer', height: 6 },{ xtype: 'textfield', fieldLabel: "GetLabel('_MAP_NAME_');?>", name: 'map_name', value: newMapData.name, width: 540 },{ xtype: 'hidden', name: 'MID', value: newMapData.id },{ xtype: 'panel', frame: false, border: false, html: '
' },{ xtype: 'textfield', fieldLabel: "GetLabel('_LAYER_ATTRIB_');?>", name: 'map_attr', value: newMapData.attribution, width: 540, },{ xtype: 'textarea', fieldLabel: "GetLabel('_DESCRIPTION_');?>", name: 'map_desc', value: newMapData.desc, width: 540, },{ xtype: 'combo', fieldLabel: "GetLabel('_MAX_ZOOM_');?>", editable: false, typeAhead: true, name: 'map_maxz', value: newMapData.maxZoom, triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '16', valueField: 'zoom_l', displayField: 'zoom_l' },{ xtype: 'combo', fieldLabel: "GetLabel('_MAX_NATURAL_ZOOM_');?>", editable: false, typeAhead: true, name: 'map_maxnz', value: newMapData.maxNativeZoom, triggerAction: 'all', width: 100, lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['zoom_l'], data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']] }), value: '16', valueField: 'zoom_l', displayField: 'zoom_l' },{ xtype: 'numberfield', fieldLabel: "GetLabel('_TOP_PIC_BOUND_');?>", name: 'map_tpb', value: newMapData.img_tb, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_LEFT_PIC_BOUND_');?>", name: 'map_lpb', value: newMapData.img_lb, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_RIGHT_PIC_BOUND_');?>", name: 'map_rpb', value: newMapData.img_rb, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_BOT_PIC_BOUND_');?>", name: 'map_bpb', value: newMapData.img_bb, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_MAP_WIDTH_');?>", name: 'map_width', decimalPrecision: 2, value: newMapData.img_map_w, width: 540, },{ xtype: 'numberfield', fieldLabel: "GetLabel('_MAP_HEIGHT_');?>", name: 'map_height', decimalPrecision: 2, value: newMapData.img_map_h, width: 540, },{ xtype: 'panel', frame: false, border: false, layout: 'table', layoutConfig: { columns: 5 }, items:[{ xtype: 'spacer', width: 250, html: "

GetLabel('_MAP_CENTER_MODE_');?>:

" },{ xtype: 'radio', name: 'bounds_mode', inputValue: 0, checked: (newMapData.bounds_mode == 0) },{ width: 80, border: false, html: '' },{ xtype: 'radio', name: 'bounds_mode', inputValue: 1, checked: (newMapData.bounds_mode != 0) },{ html: '' }] }] }], bbar:[ '->',{ text: "GetLabel('_CANCEL_');?>", handler: function(){ mapEditorWindow.destroy(); } },{ text: 'GetLabel('_APPLY_CHANGES_');?>', handler: function(){ if( Ext.getCmp('map_edt_frm').getForm().isValid()){ Ext.getCmp('map_edt_frm').getForm().submit({ url: '/lib/controller/updateMap.php', waitMsg: "GetLabel('_UPDATING_DATA_');?>...", encoding: 'multipart/form-data', success: function(fp, o){ mapEditorWindow.destroy(); } }); }; } }], listeners: { beforedestroy: function(){ mapEditorWindow = null; } } }); break; }; }; }; mapEditorWindow.show(); }, failure: failureAJAXFunction }); };