Web UI for ARGUS server
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.
 
 
 
 

1051 lines
28 KiB

//<?php require_once('../../js_asm.php');
$QS="SELECT * FROM sites WHERE id={$SiteID}";
$RV = $DATABASE->Query( $QS );
?>
var SiteLat=<?=$RV[0]['anchor_lat'];?>;
var SiteLon=<?=$RV[0]['anchor_lon'];?>;
var SiteAlt=<?=$RV[0]['anchor_alt'];?>;
var map = null;
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 locationSelectedNode = 0;
function loadLoactionProps( e ){
locationSelectedNode = e.sourceTarget.options.mycustomid;
loadNodeLocationProps( locationSelectedNode );
};
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: <?=$SiteID;?>,
UID: <?=$UserID;?>,
TYPE: 1,
SID: '<?=$Session;?>',
LAT: SiteLat,
LON: SiteLon,
ALT: SiteAlt
},
failure: function(){
alert( 'Error' );
}
});
};
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: <?=$UserID;?>,
TYPE: 2,
SID: '<?=$Session;?>',
LAT: tLat,
LON: tLon,
ALT: tAlt,
YAW: tYaw,
ROLL: tRoll,
PITCH: tPitch
},
failure: function(){
alert( 'Error' );
}
});
};
function updateLocation( e ){
locationSelectedNode = e.target.options.mycustomid;
Ext.Ajax.request({
url: '/lib/controller/updateLocation.php',
params: {
NODE: locationSelectedNode,
SITE: <?=$SiteID;?>,
UID: <?=$UserID;?>,
TYPE: 0,
SID: '<?=$Session;?>',
LAT: e.target._latlng.lat,
LON: e.target._latlng.lng
},
success: function( response, opts ){
//var data = Ext.decode(response.responseText);
loadNodeLocationProps( locationSelectedNode );
}
});
};
function loadLocationNodes(){
Ext.Ajax.request({
url: '/lib/controller/getLocationItems.php',
params: {
SITE: <?=$SiteID;?>,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
for( i=0; i < data.length; i++){
switch( data[i].type ){
case 1:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: ALS_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 2:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LFS_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 3:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS200_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 4:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS360_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 5:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LRF3D_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 6:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLSNET200_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 10:
case 12:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: FIXCAM_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
case 11:
case 13:{
L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PTZCAM_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dragend', updateLocation );
break;
};
};
//bindPopup('A pretty CSS3 popup.<br> Easily customizable.');//.openPopup();
};
},
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: '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: '<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>'
}],
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() );
};
function loadNodeLocationProps( NodeID ){
//alert( 'Node: ' + NodeID );
Ext.Ajax.request({
url: '/lib/controller/getLocationNodeProps.php',
params: {
NID: <?=$SiteID;?>,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
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: function( response, opts ) {
//Ext.fly('some_div').update('Fail!');
}/*,
callback: function(options,success,response){
// use this if you need to perform your own success/failure checking
}*/
});
};
function loadLocationEditor(){
if( tlInterval!= null ){
window.clearInterval( tlInterval );
tlInterval = null;
timelineObj = null;
};
var tPanel = Ext.getCmp('main_portal');
tPanel.removeAll( true );
Ext.getCmp('main_content').setTitle( 'Location Map' );
tPanel.add({
columnWidth: 0.83,
frame: false,
border: false,
items: [{
layout: 'fit',
height: PanelH-150,
flex: 1,
//border: true,
items:{
id: 'location_map'
}
},{
layout: 'table',
title: 'Site Properties',
fileUpload: true,
flex: 1,
defaults: {
bodyStyle:'padding:20px'
},
layoutConfig: {
// The total column count must be specified here
columns: 7
},
items:[{
html: 'System Anchor Lat:'
},{
xtype: 'textfield',
id: 'siteLat',
value: SiteLat
},{
html: 'Lon:'
},{
xtype: 'textfield',
id: 'siteLon',
value: SiteLon
},{
html: 'Alt:'
},{
xtype: 'textfield',
id: 'siteAlt',
value: SiteAlt
},{
xtype: 'button',
text: 'Update',
handler: updateSiteAnchor
},{
html: 'Map Type:'
},{
xtype: 'radio',
name: 'map_type',
boxLabel: 'Regular WGS84 Map',
checked: true,
value: 0
},{
xtype: 'radio',
name: 'map_type',
boxLabel: 'Custom Image',
value: 1
},{
xtype: 'combo',
disabled: true,
typeAhead: true,
triggerAction: 'all',
lazyRender:true,
mode: 'local',
store: new Ext.data.ArrayStore({
id: 0,
fields: ['myId', 'displayText' ],
data: [[1, 'item1'], [2, 'item2']]
}),
valueField: 'myId',
displayField: 'displayText'
},{
colspan: 2,
xtype: 'fileuploadfield',
id: 'form-file',
disabled: true,
emptyText: 'Select an image',
fieldLabel: 'Photo',
name: 'photo-path',
buttonText: 'UPLOAD',
buttonCfg: {
iconCls: 'upload-icon'
}
}]
}]
});
tPanel.add({
title: 'Properties',
xtype: 'panel',
flex: 1,
height: 700,
columnWidth: 0.17,
layout: 'fit',
id: 'prop_content',
items:{
html: '<center>Select Item From Map</center>'
}
});
tPanel.doLayout();
map = L.map('location_map').setView([SiteLat, SiteLon], 17);
L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).bindPopup("<b>System Anchor!</b>");//.openPopup();
/*
var map = L.map('map', {
crs: L.CRS.Simple
});
var map = L.map('map', {
crs: L.CRS.Simple,
minZoom: -5
});
var bounds = [[0,0], [1000,1000]];
var image = L.imageOverlay('uqm_map_full.png', bounds).addTo(map);
var bounds = [[-26.5,-25], [1021.5,1023]];
var image = L.imageOverlay('uqm_map_full.png', bounds).addTo(map);
map.fitBounds(bounds);
var sol = L.latLng([ 145, 175.2 ]);
L.marker(sol).addTo(map);
map.setView( [70, 120], 1);
var travel = L.polyline([sol, deneb]).addTo(map);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'your.mapbox.access.token'
}).addTo(mymap);
var circle = L.circle([51.508, -0.11], {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5,
radius: 500
}).addTo(mymap);
var polygon = L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
]).addTo(mymap);
marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();
circle.bindPopup("I am a circle.");
polygon.bindPopup("I am a polygon.");
function onMapClick(e) {
alert("You clicked the map at " + e.latlng);
}
mymap.on('click', onMapClick);
*/
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
loadLocationNodes();
};