Browse Source

GeoZones Works in Mojo

master
Evgeny Gagua 3 years ago
parent
commit
14f956e481
  1. 6
      index.php
  2. 322
      lib/controller/dash/node_1.js
  3. BIN
      lib/controller/data/mysqlitedb.db
  4. 2
      lib/controller/doSensorOperation.php
  5. 74
      lib/controller/getDashBoardItems.php
  6. 63
      lib/controller/getGeoAlerts.php
  7. 647
      lib/controller/getGeoZones.php
  8. 3
      lib/controller/getSensorEditor.php
  9. 19
      lib/javascript/jsapi_dynamic/mojo_main.js
  10. 326
      lib/javascript/jsapi_dynamic/mojo_map.js
  11. 2
      lib/javascript/jsapi_dynamic/mojo_monitoring.js
  12. 227
      lib/javascript/jsapi_dynamic/mojo_reports.js
  13. 5
      lib/javascript/jsapi_dynamic/mojo_settings.js
  14. 0
      lib/javascript/jsapi_dynamic/rgoose_map.js
  15. 0
      style/assets/20f21b4f01f1b7587f728b05dfc9f4aa.png

6
index.php

@ -6,13 +6,13 @@
UI_PageHeaderExt(
'mojo_general.js',
array(
'mojo_global_vars.js',
'rgoose_map.js',
'mojo_global_vars.js',
'mojo_reports.js',
'rgoose_devices.js',
'rgoose_cameras.js',
'rgoose_modules.js',
'mojo_monitoring.js',
'mojo_map.js',
'rgoose_location_editor.js',
'mojo_dashboard.js',
'mojo_users.js',
@ -27,12 +27,12 @@
'mojo_general.js',
array(
'mojo_global_vars.js',
'rgoose_map.js',
'mojo_reports.js',
'rgoose_devices.js',
'rgoose_cameras.js',
'rgoose_modules.js',
'mojo_monitoring.js',
'mojo_map.js',
'mojo_dashboard.js',
'mojo_settings.js',
'mojo_main.js'

322
lib/controller/dash/node_1.js

@ -1,31 +1,267 @@
{
id: 'db_node_%%%NODEID%%%',
width: 258,
height: 320,
title: '%%%NODENAME%%%',
draggable: false,
collapsible: false,
tools: [{
id:'gear',
handler: function(){
//Ext.Msg.alert('Message', 'The Settings tool was clicked.');
showSensorToolBox( %%%NODEID%%% );
id:'toggle',
handler: function( a, b, p ){
fsDrawID = %%%NODEID%%%;
fullScreen( 'div_radar_%%%NODEID%%%' );
var el = document.getElementById('draw_svg_'+fsDrawID );
var nW = Math.floor( ( window.screen.height/window.screen.width ) * 100 );
el.removeAttribute("width");
el.setAttribute( "width", nW+'%' );
}
}],
listeners:{
afterrender: function(){
cleanup2DDraw( %%%NODEID%%% );
drawZoomLevels[%%%NODEID%%%]=100;
//Deffer
afterrender: function(p){
masks_statuses[%%%NODEID%%%] = 0;
masks_exist[%%%NODEID%%%] = 0;
var W=p.getWidth();
var H=9*(W/16);
p.setHeight( H + 32 );
Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 );
//document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 );
set2DZoomLevel( %%%NODEID%%%, 100 );
var el = document.getElementById('div_radar_%%%NODEID%%%');
el.addEventListener( "fullscreenchange", ( evt )=>{
if( document.fullscreenElement ){
} else {
if( fsDrawID ){
var el = document.getElementById('draw_svg_'+fsDrawID );
el.removeAttribute("width");
el.setAttribute( "width", '86%' );
fsDrawID = 0;
};
};
});
window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%% );
}
},
layout: 'hbox',
items:[{
html: '<center><img id="draw_img_%%%NODEID%%%" src="/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"><canvas id="targ_canvas_%%%NODEID%%%" style="display: none;" onclick="DrawClicker( %%%NODEID%%%, event );" width="200" height="210"></canvas></center>',
height: '260px'
id: 'cp_radar_%%%NODEID%%%',
html: '<div id="div_radar_%%%NODEID%%%" style="display: block; padding: 5px; width: \'100%\'; height: \'100%\';"><center><svg id="draw_svg_%%%NODEID%%%" opacity="0.3" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="86%" version="1.1" onclick="select2DROI( %%%NODEID%%%, event );" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd; cursor: crosshair;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><clipPath id="svg_mask_%%%NODEID%%%"><circle cx="287" cy="287" r="284"/></clipPath></defs><text id="g_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(0,35,35)" x="35" y="35" fill="#FFF212" style="font: 30px sans-serif">100 m.</text><circle fill="#00A859" stroke="none" cx="287" cy="287" r="284"/><circle id="border_%%%NODEID%%%" fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,245,245)" x="245" y="245" fill="#FFF212" style="font: 10px sans-serif">12.5</text><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/></svg></center></div>',
width: '56%'
},{
id: 'status_%%%NODEID%%%',
border: true,
frame: true,
height: 36,
html: ''
frame: false,
border: false,
width: '44%',
items:[{
xtype: 'button',
id: 'cp_clear_btn_%%%NODEID%%%',
width: '100%',
disabled: true,
text: 'Clear Alarm',
iconCls: 'ctrl_panel_clean_sm',
iconAlign: 'left',
handler: function(){
doDeviceOperation( 1, 125,'', true );
}
},{
xtype: 'spacer',
height: 3
},{
xtype: 'button',
id: 'cp_draw_btn_%%%NODEID%%%',
width: '100%',
text: 'Draw Background',
iconCls: 'ctrl_panel_drawscan_sm',
iconAlign: 'left',
disabled: true,
handler: function(){
doDeviceOperation( %%%NODEID%%%, 3,'', true );
}
},{
xtype: 'spacer',
height: 3
},{
xtype: 'button',
id: 'cp_study_btn_%%%NODEID%%%',
width: '100%',
text: 'Study Background',
iconCls: 'ctrl_panel_study_sm',
iconAlign: 'left',
disabled: true,
handler: function(){
doDeviceOperation( %%%NODEID%%%, 2,'', true );
}
},{
xtype: 'spacer',
height: 3
},{
xtype: 'panel',
title: 'Masking Management',
height: 145,
frame: true,
flex: 1,
layout: 'vbox',
items:[{
xtype: 'button',
text: 'Mask Editor',
id: 'DMED_%%%NODEID%%%',
width: '100%',
disabled: true,
handler: function(){
showMaskEditor( false, 0, %%%NODEID%%% );
}
},{
xtype: 'spacer',
height: 3
},{
xtype: 'panel',
id: 'DMEBB_%%%NODEID%%%',
frame: true,
border: false,
flex: 1,
width: '100%',
height: 53,
layout: 'hbox',
items:[{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',//scale: 'small',
id: 'mz_btn_%%%NODEID%%%_0',
iconCls: 'mask_zone1_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_0').pressed){
doMaskOperation( %%%NODEID%%%, 1, 0 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 0 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',
id: 'mz_btn_%%%NODEID%%%_1',
iconCls: 'mask_zone2_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_1').pressed){
doMaskOperation( %%%NODEID%%%, 1, 1 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 1 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '19%',
scale: 'medium',//scale: 'large',
id: 'mz_btn_%%%NODEID%%%_2',
iconCls: 'mask_zone3_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_2').pressed){
doMaskOperation( %%%NODEID%%%, 1, 2 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 2 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',//scale: 'large',
id: 'mz_btn_%%%NODEID%%%_3',
iconCls: 'mask_zone4_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_3').pressed){
doMaskOperation( %%%NODEID%%%, 1, 3 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 3 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',//scale: 'large',
id: 'mz_btn_%%%NODEID%%%_4',
iconCls: 'mask_zone5_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_4').pressed){
doMaskOperation( %%%NODEID%%%, 1, 4 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 4 );
};
}
}]
}]
},{
xtype: 'spacer',
height: 3
}/*,{
xtype: 'panel',
title: 'Detection Sensitivity',
height: 95,
frame: true,
flex: 1,
layout: 'hbox',
items:[{
xtype: 'button',
text: 'Factory',
id: 'DDSPBTN0',
width: 80,
iconCls: 'detection_btn_factory',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
},{
xtype: 'button',
text: 'Low',
id: 'DDSPBTN1',
width: 80,
iconCls: 'detection_btn_low',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
},{
xtype: 'button',
text: 'Meduim',
id: 'DDSPBTN2',
width: 80,
iconCls: 'detection_btn_medium',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
},{
xtype: 'button',
text: 'High',
id: 'DDSPBTN3',
width: 80,
iconCls: 'detection_btn_high',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
}]
}*/]
}],
bbar:[{
xtype: 'button',
@ -34,14 +270,9 @@
id: 'zoom_bt12_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=12;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
if( st ){
set2DZoomLevel( %%%NODEID%%%, 12 );
};
}
},{
xtype: 'button',
@ -50,14 +281,9 @@
id: 'zoom_bt25_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=25;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
if( st ){
set2DZoomLevel( %%%NODEID%%%, 25 );
};
}
},{
xtype: 'button',
@ -66,14 +292,9 @@
id: 'zoom_bt50_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=50;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
if( st ){
set2DZoomLevel( %%%NODEID%%%, 50 );
};
}
},{
xtype: 'button',
@ -83,14 +304,17 @@
id: 'zoom_bt100_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=100;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
if( st ){
set2DZoomLevel( %%%NODEID%%%, 100 );
};
}
},{
xtype: 'panel',
id: 'status_%%%NODEID%%%',
border: false,
frame: false,
width: 800,
height: 28,
html: ''
}]
}

BIN
lib/controller/data/mysqlitedb.db

Binary file not shown.

2
lib/controller/doSensorOperation.php

@ -27,7 +27,7 @@
};
case 2:{
$OPCODE = intval( $_POST['OPCODE'] );
$RANGES = array( 15, 35, 45, 65, 75, 150, 200, 300 );
$RANGES = array( 15, 35, 45, 65, 75, 150, 200, 300, 350 );
$VAL = $RANGES[$OPCODE];
if( $VAL ){
$QS = "UPDATE `lrf_sensors` SET `max_range`={$VAL} WHERE `id`={$SNID}";

74
lib/controller/getDashBoardItems.php

@ -88,10 +88,26 @@ jodjhowierewt;
}
}
kahkjahskfgkgkh;
$MAPIO=<<<lksdlfjlksdfhkjh
{
id: 'event_map',
height: 200,
html: '&nbsp;',
listeners:{
afterrender : function( t ){
var papa = Ext.getCmp('main_portal');
var jj = papa.getComponent( 0 ).getHeight();
t.setHeight( jj - 40 );
}
}
}
lksdlfjlksdfhkjh;
$DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
$DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Event Log', frame: true, /*height: 200,*/ border: true, draggable: false, items:[{$LOGIO}] }";
$DUMMY['map']="{xtype:'panel', title: 'Map', frame: true, border: true, draggable: false, items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9); initMapMonitoring();}} }";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Event Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
} else {
$DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
@ -335,9 +351,9 @@ kahkjahskfgkgkh;
$STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
$STA[3]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
$STA[4]="{ columnWidth: .5, stylde:'padding:10px 0 10px 10px', items:[";
$idx = 0;
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;
if( count( $R ) ){
foreach( $R as $DD ){
if( $idx < 3 ){
@ -435,29 +451,11 @@ kahkjahskfgkgkh;
case 3:{
$STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
$STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
$STA[2]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;
if( count( $R ) ){
foreach( $R as $DD ){
if( $idx < 1 ){
$TFN = 'dash/node_' . $DD['type'] . '.js';
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$OUT[]= $STA[$idx] . $TPL . $END;
} else break;
$idx++;
};
} else {
for( ;$idx<1;$idx++ ){
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
};
};
$STA[2]="{ columnWidth: .35, stylse:'padding:10px 0 10px 10px', items:[";
$STA[3]="{ columnWidth: .65, stylse:'padding:10px 0 10px 10px', items:[";
$OUT[]= $STA[0] . $DUMMY['map'] . $END;
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;
@ -518,7 +516,29 @@ kahkjahskfgkgkh;
$OUT[]= $STA[1+$idx] . $T . $END;
};
};
$OUT[]= $STA[2] . $DUMMY['log'] . /*','. $DUMMY['map'].*/ $END;
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;
if( count( $R ) ){
foreach( $R as $DD ){
if( $idx < 1 ){
$TFN = 'dash/node_' . $DD['type'] . '.js';
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$OUT[]= $STA[2+$idx] . $TPL . $END;
} else break;
$idx++;
};
} else {
for( ;$idx<1;$idx++ ){
$OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
};
};
$OUT[]= $STA[3] . $DUMMY['log'] . $END;
break;
};
case 4:

63
lib/controller/getGeoAlerts.php

@ -0,0 +1,63 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/utm/gPoint.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
$Data['evt'] = array();
$Data['other'] = array();
$SID = intval($_POST['SITE']);
//$QS = "SELECT ec.id, ec.lon, ec.lat, ls.lon as src_lon, ls.lat as src_lat, ls.max_range as max_range FROM events_cloud ec LEFT JOIN nodes nd ON ( nd.id = ec.node_id ) LEFT JOIN lrf_sensors ls ON ( ls.id = nd.aux_id ) WHERE ec.lat IS NOT NULL AND ec.lon IS NOT NULL ORDER BY ec.ts DESC, ec.ts_ms DESC LIMIT 20";
$QS = "SELECT ec.id, ec.lon, ec.lat FROM events_cloud ec WHERE ec.lat IS NOT NULL AND ec.lon IS NOT NULL ORDER BY ec.ts DESC, ec.ts_ms DESC LIMIT 20";
$Result = $DATABASE->Query( $QS, false );
date_default_timezone_set('UTC');
//foreach( array_reverse ( $Result ) as $CD ){
foreach( $Result as $CD ){
$Data['evt'][] = $CD;
};
$SSD = getServerNode( $SID );
$QS="SELECT * FROM target_filters WHERE server_id={$SSD}";
$Result = $DATABASE->Query( $QS, false );
foreach( $Result as $R ){
switch( $R['type'] ){
case 1:{
//APF
$QS = "SELECT * FROM `target_filter_apf` WHERE `id`={$R['aux_id']}";
$Juno = $DATABASE->Query( $QS, false );
if( count( $Juno ) ){
$CC = $Juno[0];
$A = new gPoint();
$A->setLongLat($CC['lon'],$CC['lat']);
$A->convertLLtoTM();
$XC = $A->E();
$YC = $A->N();
$Z = $A->Z();
$ANG = (pi()/180)*floatval( $CC['yaw'] );
$QS = "SELECT * FROM `target_filter_apf_boxes` WHERE `filter_id`={$R['aux_id']}";
$Obubu = $DATABASE->Query( $QS, false );
foreach( $Obubu as $G ){
$P['type']='circle';
$P['color']='#00FF00';
$TX = floatval($G['x']);
$TY = floatval($G['y']);
$CR = sqrt($TX*$TX+$TY*$TY);
if( $TX != 0 ){
$CA = atan( $TY/$TX );
} else {
$CA = 0;
};
$A->setUTM($XC+$CR*cos($CA+$ANG),$YC+$CR*sin($CA+$ANG),$Z);
$A->convertTMtoLL();
$P['loc']=array('lat'=>$A->Lat(),'lon'=>$A->Long());
$Data['other'][] = $P;
};
};
break;
};
};
};
echo json_encode( $Data );
} else {
header('location: /');
};
?>

647
lib/controller/getGeoZones.php

@ -0,0 +1,647 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/utm/gPoint.php');
$AC_imager_diag = array( 5.0, 5.68, 6.0, 6.592, 8.0, 8.933, 11.0, 16.0, 22.5, 30.1, 43.3, 69.7 );
$AC_imager_width= array( 4.0, 4.536, 4.8, 5.27, 6.4, 7.176, 8.8, 12.8, 18.0, 25.1, 36.0, 56.0 );
$AC_imager_height = array( 3.0, 3.416, 3.6, 3.96, 4.8, 5.319, 6.6, 9.6, 13.5, 16.7, 24.0, 41.5 );
$CAM_FOCAL_LENGTH_CNT = 49;
$cam_predef_focal_length=array(
2.7,
3.0,
3.2,
3.5,
3.7,
3.9,
4.0,
4.3,
4.8,
5.0,
5.1,
5.5,
5.8,
6.0,
6.2,
6.6,
7.0,
7.1,
7.5,
7.6,
8.0,
8.6,
8.9,
9.0,
9.2,
9.3,
10.0,
10.5,
10.6,
10.7,
11.0,
11.3,
12.0,
12.9,
13.0,
13.5,
13.6,
14.0,
14.6,
15.0,
15.1,
15.5,
16.0,
17.0,
17.5,
17.7,
18.0,
18.2,
19.0
);
/*
function ToLL($north, $east, $utmZone){
// This is the lambda knot value in the reference
$LngOrigin = Deg2Rad($utmZone * 6 - 183);
// The following set of class constants define characteristics of the
// ellipsoid, as defined my the WGS84 datum. These values need to be
// changed if a different dataum is used.
$FalseNorth = 0; // South or North?
//if (lat < 0.) FalseNorth = 10000000. // South or North?
//else FalseNorth = 0.
$Ecc = 0.081819190842622; // Eccentricity
$EccSq = $Ecc * $Ecc;
$Ecc2Sq = $EccSq / (1. - $EccSq);
$Ecc2 = sqrt($Ecc2Sq); // Secondary eccentricity
$E1 = ( 1 - sqrt(1-$EccSq) ) / ( 1 + sqrt(1-$EccSq) );
$E12 = $E1 * $E1;
$E13 = $E12 * $E1;
$E14 = $E13 * $E1;
$SemiMajor = 6378137.0; // Ellipsoidal semi-major axis (Meters)
$FalseEast = 500000.0; // UTM East bias (Meters)
$ScaleFactor = 0.9996; // Scale at natural origin
// Calculate the Cassini projection parameters
$M1 = ($north - $FalseNorth) / $ScaleFactor;
$Mu1 = $M1 / ( $SemiMajor * (1 - $EccSq/4.0 - 3.0*$EccSq*$EccSq/64.0 - 5.0*$EccSq*$EccSq*$EccSq/256.0) );
$Phi1 = $Mu1 + (3.0*$E1/2.0 - 27.0*$E13/32.0) * sin(2.0*$Mu1);
+ (21.0*$E12/16.0 - 55.0*$E14/32.0) * sin(4.0*$Mu1);
+ (151.0*$E13/96.0) * sin(6.0*$Mu1);
+ (1097.0*$E14/512.0) * sin(8.0*$Mu1);
$sin2phi1 = sin($Phi1) * sin($Phi1);
$Rho1 = ($SemiMajor * (1.0-$EccSq) ) / pow(1.0-$EccSq*$sin2phi1,1.5);
$Nu1 = $SemiMajor / sqrt(1.0-$EccSq*$sin2phi1);
// Compute parameters as defined in the POSC specification. T, C and D
$T1 = tan($Phi1) * tan($Phi1);
$T12 = $T1 * $T1;
$C1 = $Ecc2Sq * cos($Phi1) * cos($Phi1);
$C12 = $C1 * $C1;
$D = ($east - $FalseEast) / ($ScaleFactor * $Nu1);
$D2 = $D * $D;
$D3 = $D2 * $D;
$D4 = $D3 * $D;
$D5 = $D4 * $D;
$D6 = $D5 * $D;
// Compute the Latitude and Longitude and convert to degrees
$lat = $Phi1 - $Nu1*tan($Phi1)/$Rho1 * ( $D2/2.0 - (5.0 + 3.0*$T1 + 10.0*$C1 - 4.0*$C12 - 9.0*$Ecc2Sq)*$D4/24.0 + (61.0 + 90.0*$T1 + 298.0*$C1 + 45.0*$T12 - 252.0*$Ecc2Sq - 3.0*$C12)*$D6/720.0 );
$lat = Rad2Deg($lat);
$lon = $LngOrigin + ($D - (1.0 + 2.0*$T1 + $C1)*$D3/6.0 + (5.0 - 2.0*$C1 + 28.0*$T1 - 3.0*$C12 + 8.0*$Ecc2Sq + 24.0*$T12)*$D5/120.0) / cos($Phi1);
$lon = Rad2Deg($lon);
// Create a object to store the calculated Latitude and Longitude values
$PC_LatLon['lat'] = $lat;
$PC_LatLon['lon'] = $lon;
// Returns a PC_LatLon object
return $PC_LatLon;
};
$Z = new gPoint();
$Z->setUTM( 485962.4143066, 4919314.7793823, '32T' );
$Z->convertTMtoLL();
$Z->printUTM();
echo "\n\n";
$Z->printLatLong();
echo "\n\n";
exit();
*/
if( $CUser->Data['id'] > 1 ){
$Data = array();
if( 1 ){
$QS = "SELECT * FROM system_props LIMIT 1";
$SR = $DATABASE->Query( $QS, false );
if( count( $SR ) ){
$SS = $SR[0];
$ANCHOR = new gPoint();
$ANCHOR->setLongLat( floatval( $SS['anchor_lon'] ), floatval( $SS['anchor_lat'] ) );
$ANCHOR->convertLLtoTM();
$BASE_X = $ANCHOR->E();
$BASE_Y = $ANCHOR->N();
$BASE_Z = floatval( $SS['anchor_alt'] );
$BASE_ZONE = $ANCHOR->Z();
$QS = "SELECT * FROM nodes WHERE ((type!=0)AND(type!=20))";
$Result = $DATABASE->Query( $QS, false );
date_default_timezone_set('UTC');
//print_r( $Result );
foreach( $Result as $R ){
$Zone = array();
switch( $R['type'] ){
case 122:{
break;
// Lfs - MND
$QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range FROM lrf_sensors WHERE id={$R['aux_id']}";
$D = $DATABASE->Query( $QS, false );
if( count( $D ) ){
$CC = $D[0];
$A = new gPoint();
$A->setUTM( $CC['x'], $CC['y'] );
$A->convertTMtoLL();
$LAT = $A->Lat();
$LON = $A->Long();
//$A->setLongLat($CC['lon'],$CC['lat']);
//$A->convertLLtoTM();
$XC = $A->E();
$YC = $A->N();
$Z = $A->Z();
$RAN = floatval( $CC['max_range'] );
if( 1 ){
$K = pi()/18.0;//10 deg
$Points = array();
$Points[] = array( 'lat'=>$LAT, 'lon'=>$LON );
$SANG = ( pi() / 180 ) * floatval( $CC['yaw'] );
for( $i = 0; $i < 11; $i++ ){
$CA = $i * $K;
$B = new gPoint();
$B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
$B->convertTMtoLL();
$Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
};
if(1){
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
//$SANG = $SANG - ( pi() / 180 );
//$RAN = $RAN + 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
//$B->convertTMtoLL();
//$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
//$SANG = $SANG + ( pi() / 180 );
//$RAN = $RAN + 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
//$B->convertTMtoLL();
//$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
//$SANG = $SANG + ( pi() / 180 );
//$RAN = $RAN - 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
//$B->convertTMtoLL();
//$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
}
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#880000';
$Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON );
} else {
/*
$A->setUTM( $XC-$RAN, $YC+$RAN, $Z );
$A->convertTMtoLL();
$LTLAT = $A->Lat();
$LTLON = $A->Long();
$A->setUTM( $XC+$RAN, $YC-$RAN, $Z );
$A->convertTMtoLL();
$RBLAT = $A->Lat();
$RBLON = $A->Long();
$Zone['type']='image';
$Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id'];
$Zone['bounds']=array(array($LTLAT,$LTLON),array($RBLAT,$RBLON));
//*/
//*
$RA = sqrt( $RAN * $RAN * 2 );
$CA = ( pi() / 180 ) * floatval( $CC['yaw'] );
$SANG = pi()/4*3;
$A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z );
$A->convertTMtoLL();
$Zone['type']='image_rot';
$Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id'];
$Zone['topleft']=array($A->Lat(),$A->Long());
$SANG = pi() / 4;
$A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z );
$A->convertTMtoLL();
$Zone['topright']=array($A->Lat(),$A->Long());
$SANG = pi() / 4*5;
$A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z );
$A->convertTMtoLL();
$Zone['bottomleft']=array($A->Lat(),$A->Long());
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
//*/
};
$Zone['name'] = $R['name'];
$Data[] = $Zone;
};
break;
};
case 2:{
//LFS
$QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range, base_shift FROM lrf_sensors WHERE id={$R['aux_id']}";
$D = $DATABASE->Query( $QS, false );
$Zone['dev_is_source'] = true;
$Zone['dev_type'] = intval( $R['type'] );
$Zone['dev_id'] = intval( $R['id'] );
$Zone['dev_name'] = $R['name'];
if( count( $D ) ){
$CC = $D[0];
$A = new gPoint();
$A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
$A->convertTMtoLL();
$LAT = $A->Lat();
$LON = $A->Long();
$XC = $A->E();
$YC = $A->N();
$Z = $A->Z();
$RAN = floatval( $CC['max_range'] );
$K = pi()/ 36; // 5 deg//
$Points = array();
$Points[] = array( 'lat'=>$LAT, 'lon'=>$LON );
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ) + ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
for( $i = 0; $i < 20; $i++ ){
$CA = $i * $K;
$B = new gPoint();
$B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
$B->convertTMtoLL();
$Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
};
$ZMARK = array();
$B = new gPoint();
$SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#880000';
$Zone['center'] = array( 'lat'=>$LAT,'lon'=>$LON );
$Zone['name'] = $R['name'];
$Data[] = $Zone;
};
break;
};
case 3:{
// PLS 200
$QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range, base_shift FROM lrf_sensors WHERE id={$R['aux_id']}";
$D = $DATABASE->Query( $QS, false );
$Zone['dev_is_source'] = true;
$Zone['dev_type'] = 3;
$Zone['dev_id'] = intval( $R['id'] );
$Zone['dev_name'] = $R['name'];
if( count( $D ) ){
$CC = $D[0];
$A = new gPoint();
$A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
$A->convertTMtoLL();
$LAT = $A->Lat();
$LON = $A->Long();
//$A = new gPoint();
//$A->setLongLat($CC['lon'],$CC['lat']);
//$A->convertLLtoTM();
$XC = $A->E();
$YC = $A->N();
$Z = $A->Z();
$RAN = floatval( $CC['max_range'] );
if(1){
$K = pi()/ 36; // 10 deg//
$Points = array();
$Points[] = array( 'lat'=>$LAT, 'lon'=>$LON );
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ) + ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
for( $i = 0; $i < 40; $i++ ){
$CA = $i * $K;
$B = new gPoint();
$B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
$B->convertTMtoLL();
$Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
};
if(1){
$ZMARK = array();
$B = new gPoint();
// PLS
$SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
//$SANG = $SANG - ( pi() / 180 );
//$RAN = $RAN + 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
//$B->convertTMtoLL();
//$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
//$SANG = $SANG + ( pi() / 180 );
//$RAN = $RAN + 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
//$B->convertTMtoLL();
//$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
//$SANG = $SANG + ( pi() / 180 );
//$RAN = $RAN - 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
//$B->convertTMtoLL();
//$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
}
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#880000';
$Zone['center'] = array( 'lat'=>$LAT,'lon'=>$LON );
} else {
/*
$A->setUTM( $XC-$RAN, $YC+$RAN, $Z );
$A->convertTMtoLL();
$LTLAT = $A->Lat();
$LTLON = $A->Long();
$A->setUTM( $XC+$RAN, $YC-$RAN, $Z );
$A->convertTMtoLL();
$RBLAT = $A->Lat();
$RBLON = $A->Long();
$Zone['type']='image';
$Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id'];
$Zone['bounds']=array(array($LTLAT,$LTLON),array($RBLAT,$RBLON));
//*/
//*
$RA = sqrt( $RAN * $RAN * 2 );
$CA = ( pi() / 180 ) * floatval( $CC['yaw'] );
$SANG = pi()/4*3;
$A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z );
$A->convertTMtoLL();
$Zone['type']='image_rot';
$Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id'];
$Zone['topleft']=array($A->Lat(),$A->Long());
$SANG = pi() / 4;
$A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z );
$A->convertTMtoLL();
$Zone['topright']=array($A->Lat(),$A->Long());
$SANG = pi() / 4*5;
$A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z );
$A->convertTMtoLL();
$Zone['bottomleft']=array($A->Lat(),$A->Long());
//*/
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
};
$Zone['name'] = $R['name'];
$Data[] = $Zone;
};
break;
};
case 1://ALS
case 4://PLS360
case 5:{//3D
$QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range FROM lrf_sensors WHERE id={$R['aux_id']}";
$D = $DATABASE->Query( $QS, false );
$Zone['dev_is_source'] = true;
$Zone['dev_type'] = intval( $R['type'] );
$Zone['dev_id'] = intval( $R['id'] );
$Zone['dev_name'] = $R['name'];
if( count( $D ) ){
$CC = $D[0];
$A = new gPoint();
$A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
$A->convertTMtoLL();
$LAT = $A->Lat();
$LON = $A->Long();
//$A = new gPoint();
//$A->setLongLat($CC['lon'],$CC['lat']);
//$A->convertLLtoTM();
$YC = $A->N();
$XC = $A->E();
$Z = $A->Z();
$Zone['type']='circle';
$Zone['radius'] = floatval( $CC['max_range'] );
$Zone['color'] = '#8800FF';
$Zone['center'] = array('lat'=>$LAT,'lon'=>$LON);
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] );
$RAN = floatval( $CC['max_range'] );
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
$Zone['name'] = $R['name'];
$Data[] = $Zone;
};
break;
};
case 10:
case 12:{ // Camera Static
$QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range, imager_type, lens_f FROM cameras WHERE id={$R['aux_id']}";
$D = $DATABASE->Query( $QS, false );
if( count( $D ) ){
$CC = $D[0];
$A = new gPoint();
$A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
$A->convertTMtoLL();
$LAT = $A->Lat();
$LON = $A->Long();
$YC = $A->N();
$XC = $A->E();
$Z = $A->Z();
$CFOV = (2.0*atan($AC_imager_width[$CC['imager_type']]/(2.0*$cam_predef_focal_length[$CC['lens_f']])));
$Points = array();
$A = new gPoint();
$Points[] = array( 'lat'=>$LAT, 'lon'=>$LON );
$K = floatval( $CFOV ) / 40;
$SANG = (M_PI/180) * floatval( $CC['z_rot'] ) - ($CFOV/2.0);
$RAN = floatval( $CC['max_range'] );
for( $i = 0; $i < 41; $i++ ){
$CA = $i * $K;
$B = new gPoint();
$B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
$B->convertTMtoLL();
$Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
};
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#000088';
$Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON );
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG+( $CFOV / 2.0 ) ), $YC + $RAN * sin( $SANG +( $CFOV / 2.0 ) ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
$Zone['name'] = $R['name'];
$Data[] = $Zone;
};
break;
};
case 11:
case 13:{ // Camera PTZ
$QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range, pan_angles FROM cameras WHERE id={$R['aux_id']}";
$D = $DATABASE->Query( $QS, false );
if( count( $D ) ){
$CC = $D[0];
$A = new gPoint();
$A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
$A->convertTMtoLL();
$LAT = $A->Lat();
$LON = $A->Long();
$YC = $A->N();
$XC = $A->E();
$Z = $A->Z();
if( intval( $CC['pan_angles'] ) < 360 ){
$Points = array();
$A = new gPoint();
$Points[] = array( 'lat'=>$LAT, 'lon'=>$LON );
$K = ( pi()/180.0 ) * floatval($CC['pan_angles']) / 40;
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] );
$RAN = floatval( $CC['max_range'] );
for( $i = 0; $i < 41; $i++ ){
$CA = $i * $K;
$B = new gPoint();
$B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
$B->convertTMtoLL();
$Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
};
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#000088';
$Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON );
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
} else {
$Zone['type']='circle';
$Zone['radius'] = floatval( $CC['max_range'] );
$Zone['color'] = '#000088';
$Zone['center'] = array('lat'=>$LAT,'lon'=>$LON);
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] );
$RAN = floatval( $CC['max_range'] );
$ZMARK = array();
$B = new gPoint();
//$RAN = $RAN - 0.5;
$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
};
$Zone['name'] = $R['name'];
$Data[] = $Zone;
};
break;
};
};
};
/*
$SSD = getServerNode( $SID );
$QS="SELECT * FROM target_filters WHERE server_id={$SSD}";
$RF=array();//$DATABASE->Query( $QS, false );
foreach( $RF as $F ){
switch( intval($F['type']) ){
case 1:{
$QS="SELECT * FROM target_filter_apf WHERE id={$F['aux_id']}";
$SD=$DATABASE->Query( $QS, false );
$CC=$SD[0];
if( count($SD) ){
$Zone['type']='poly';
$Zone['color'] = '#FF00FF';
$Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']);
$QS="SELECT * FROM target_filter_apf_anchors WHERE filter_id={$F['aux_id']}";
$RA=$DATABASE->Query( $QS, false );
$Points = array();
$A = new gPoint();
$A->setLongLat($CC['lon'],$CC['lat']);
$A->convertLLtoTM();
$YC = $A->N();
$XC = $A->E();
$Z = $A->Z();
$ANG = (pi()/180)*floatval( $CC['yaw'] );
foreach( $RA as $G ){
$TX = floatval($G['x']);
$TY = floatval($G['y']);
$CR = sqrt($TX*$TX+$TY*$TY);
if( $TX != 0 ){
$CA = atan( $TY/$TX );
} else {
$CA = 0;
};
$A->setUTM($XC+$CR*cos($CA+$ANG),$YC+$CR*sin($CA+$ANG),$Z);
$A->convertTMtoLL();
$Points[]=array('lat'=>$A->Lat(),'lon'=>$A->Long());
};
$Zone['points']=$Points;
$Data[] = $Zone;
};
break;
};
};
};
*/
};
};
$ZZ['zones']=$Data;
$ZZ['totalCount'] = count( $Data );
echo json_encode( $ZZ );
} else {
header('location: /');
};
?>

3
lib/controller/getSensorEditor.php

@ -180,7 +180,8 @@ JOJOKA;
[75,'75 Meters'],
[150,'150 Meters'],
[200,'200 Meters'],
[300,'300 Meters']
[300,'300 Meters'],
[350,'350 Meters']
]
}),
valueField: 'range',

19
lib/javascript/jsapi_dynamic/mojo_main.js

@ -121,7 +121,7 @@ function failureAJAXFunction( responce, opts ){
window.clearInterval( tlInterval );
tlInterval = null;
};
playSound();
//playSound();
//Ext.Msg.show({
// title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
// msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
@ -338,7 +338,7 @@ Ext.onReady(function(){
layout: 'table',
baseCls: 'x-plain',
layoutConfig: {
columns: 11
columns: 13
},
frame: false,
border: true,
@ -406,7 +406,7 @@ Ext.onReady(function(){
frame: false,
border: false,
margins: {top:5, right:0, bottom:0, left:0},
width: PanelW-700,
width: PanelW - <?=($AP_DATA['type'] == 1)?'700':'800';?>,
html: '<p style="font-family: \'Ubuntu\', \'Arial\';font-size: 24px;">'+ap_title+'</p>'
},{
xtype: 'spacer',
@ -438,7 +438,18 @@ Ext.onReady(function(){
};
Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode );
}
}<?php
},{
xtype: 'spacer',
width: 10
},{
xtype: 'button',
id: 'logout_btn',
text: 'Logout',
iconCls: 'lout',
scale: 'large',
style:'text-align: right;',
handler: doLogout
}<?php
};
?>
]

326
lib/javascript/jsapi_dynamic/mojo_map.js

@ -0,0 +1,326 @@
//<?php require_once('../../js_asm.php'); ?>
var ActiveZones = null;
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 &copy; <a href='http://www.ign.es'>Instituto Geogr?fico Nacional de Espa?a</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: '<div id="'+data.zones[i].dev_id+'_div" class="'+sty+'" onclick="clickDeviceSelector('+data.zones[i].dev_id+');"><img id="'+data.zones[i].dev_id+'_ind" width="16px" src="/style/assets/led_green_blink_300ms.gif"><center><img src="/style/assets/'+data.zones[i].dev_type+'_node.png"><br/><p class="dev_name">'+data.zones[i].dev_name+'</p></center></div>'
});
};
};
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();
//LoadMapEvents( SelectedSite );
//tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite );
},
failure: function( response, opts ) {
//Ext.fly('some_div').update('Fail!');
}
});
};
var cevt = Array();
var coz = Array();
function showEventsOnMap( data, 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 zz = ( 1.0 / ( data.log.length + 0 ) );
var idx = 0;
for( i=0; i < data.log.length; i++ ){
if( data.log[i].has_geo ){
var cp_color='#FF0000';
switch( data.log[i].event ){
case 36: cp_color='#0000FF'; break;
};
cevt[idx] = L.circleMarker( [data.log[i].geo.lat, data.log[i].geo.lon], {id:data.log[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } ).on('click', function( e, a ){
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: <?=$SiteID;?>,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
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(){
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("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
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: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
detectRetina: true
});*/
mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> 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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
maxZoom: 19
});
mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
maxZoom: 19
});
mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
maxZoom: 24
});
mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
maxZoom: 19
});
mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
maxZoom: 19
});
/*
mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
maxZoom: 22
});
mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
maxZoom: 22
});
mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxNativeZoom: 18,
maxZoom: 24,
}).addTo(map); */
//loadTimeLineGroups( selectedSite );
loadMapZones( 0 );
//getData( 'arch' );
};

2
lib/javascript/jsapi_dynamic/mojo_monitoring.js

@ -52,7 +52,7 @@ function initMonitoring(){
updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
}
}
});
});
Ext.getCmp('main_content').doLayout();
var tPanel = Ext.getCmp('main_portal');
tPanel.removeAll(true);

227
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -8,7 +8,7 @@ var tlGroups = new vis.DataSet();
var tlItems = new vis.DataSet();
var selecredActiveSourceFilter = 0;
var ActiveZones = null;
var rep_store_id = 0;
var rep_array = new Array();
@ -561,232 +561,7 @@ function clickDeviceSelector( id ){
};
};
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 &copy; <a href='http://www.ign.es'>Instituto Geográfico Nacional de España</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: '<div id="'+data.zones[i].dev_id+'_div" class="'+sty+'" onclick="clickDeviceSelector('+data.zones[i].dev_id+');"><img id="'+data.zones[i].dev_id+'_ind" width="16px" src="/style/assets/led_green_blink_300ms.gif"><center><img src="/style/assets/'+data.zones[i].dev_type+'_node.png"><br/><p class="dev_name">'+data.zones[i].dev_name+'</p></center></div>'
});
};
};
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();
//LoadMapEvents( SelectedSite );
//tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite );
},
failure: function( response, opts ) {
//Ext.fly('some_div').update('Fail!');
}
});
};
var cevt = Array();
var coz = Array();
function showEventsOnMap( data, 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 zz = ( 1.0 / ( data.log.length + 0 ) );
var idx = 0;
for( i=0; i < data.log.length; i++ ){
if( data.log[i].has_geo ){
var cp_color='#FF0000';
switch( data.log[i].event ){
case 36: cp_color='#0000FF'; break;
};
cevt[idx] = L.circleMarker( [data.log[i].geo.lat, data.log[i].geo.lon], {id:data.log[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } ).on('click', function( e, a ){
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: <?=$SiteID;?>,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
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 loadEventPropertiesByID( id ){
var d = eventsListStore.findExact( 'id', id );

5
lib/javascript/jsapi_dynamic/mojo_settings.js

@ -1073,7 +1073,8 @@ function addSensor(){
[75,'75 Meters'],
[150,'150 Meters'],
[200,'200 Meters'],
[300,'300 Meters']
[300,'300 Meters'],
[350,'350 Meters']
]
}),
valueField: 'range',
@ -2649,7 +2650,7 @@ function initSettingsView(){
}<?php
} else {
if( 1 || intval( $CUser->Data['sipi_enable'] ) ){
if( 0 && intval( $CUser->Data['sipi_enable'] ) ){
?>
{
xtype: 'button',

0
lib/javascript/jsapi_dynamic/rgoose_map.js

style/assets/mer-big-1.png → style/assets/20f21b4f01f1b7587f728b05dfc9f4aa.png

Loading…
Cancel
Save