diff --git a/index.php b/index.php index 9a8a060..a30ce22 100644 --- a/index.php +++ b/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' diff --git a/lib/controller/dash/node_1.js b/lib/controller/dash/node_1.js index d93f46c..a17ba5f 100644 --- a/lib/controller/dash/node_1.js +++ b/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: '
', - height: '260px' + id: 'cp_radar_%%%NODEID%%%', + html: '
100 m.502512.5
', + 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: '' }] } \ No newline at end of file diff --git a/lib/controller/data/mysqlitedb.db b/lib/controller/data/mysqlitedb.db index 7f7b133..a20e4be 100644 Binary files a/lib/controller/data/mysqlitedb.db and b/lib/controller/data/mysqlitedb.db differ diff --git a/lib/controller/doSensorOperation.php b/lib/controller/doSensorOperation.php index 97c98d2..e874b1d 100644 --- a/lib/controller/doSensorOperation.php +++ b/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}"; diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php index d3d1767..ab96881 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/getDashBoardItems.php @@ -88,10 +88,26 @@ jodjhowierewt; } } kahkjahskfgkgkh; + +$MAPIO=<<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: diff --git a/lib/controller/getGeoAlerts.php b/lib/controller/getGeoAlerts.php new file mode 100644 index 0000000..c68ab8e --- /dev/null +++ b/lib/controller/getGeoAlerts.php @@ -0,0 +1,63 @@ +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: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getGeoZones.php b/lib/controller/getGeoZones.php new file mode 100644 index 0000000..179c325 --- /dev/null +++ b/lib/controller/getGeoZones.php @@ -0,0 +1,647 @@ +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: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getSensorEditor.php b/lib/controller/getSensorEditor.php index 283923e..b0cdef6 100644 --- a/lib/controller/getSensorEditor.php +++ b/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', diff --git a/lib/javascript/jsapi_dynamic/mojo_main.js b/lib/javascript/jsapi_dynamic/mojo_main.js index dec6f72..1c44bff 100644 --- a/lib/javascript/jsapi_dynamic/mojo_main.js +++ b/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:'GetLabel('_REQ_FAILURE_');?>', // msg: '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 - , html: '

'+ap_title+'

' },{ xtype: 'spacer', @@ -438,7 +438,18 @@ Ext.onReady(function(){ }; Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode ); } - } ] diff --git a/lib/javascript/jsapi_dynamic/mojo_map.js b/lib/javascript/jsapi_dynamic/mojo_map.js new file mode 100644 index 0000000..80149ea --- /dev/null +++ b/lib/javascript/jsapi_dynamic/mojo_map.js @@ -0,0 +1,326 @@ +// + + + +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: , + 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(); + //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: , + 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(){ + 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' ); +}; diff --git a/lib/javascript/jsapi_dynamic/mojo_monitoring.js b/lib/javascript/jsapi_dynamic/mojo_monitoring.js index 5a23cbb..4709caf 100644 --- a/lib/javascript/jsapi_dynamic/mojo_monitoring.js +++ b/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); diff --git a/lib/javascript/jsapi_dynamic/mojo_reports.js b/lib/javascript/jsapi_dynamic/mojo_reports.js index db317bf..fd105ed 100644 --- a/lib/javascript/jsapi_dynamic/mojo_reports.js +++ b/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: , - 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(); - //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: , - 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 loadEventPropertiesByID( id ){ var d = eventsListStore.findExact( 'id', id ); diff --git a/lib/javascript/jsapi_dynamic/mojo_settings.js b/lib/javascript/jsapi_dynamic/mojo_settings.js index aac5179..46db0fc 100644 --- a/lib/javascript/jsapi_dynamic/mojo_settings.js +++ b/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(){ }Data['sipi_enable'] ) ){ + if( 0 && intval( $CUser->Data['sipi_enable'] ) ){ ?> { xtype: 'button', diff --git a/lib/javascript/jsapi_dynamic/rgoose_map.js b/lib/javascript/jsapi_dynamic/rgoose_map.js deleted file mode 100644 index e69de29..0000000 diff --git a/style/assets/mer-big-1.png b/style/assets/20f21b4f01f1b7587f728b05dfc9f4aa.png similarity index 100% rename from style/assets/mer-big-1.png rename to style/assets/20f21b4f01f1b7587f728b05dfc9f4aa.png