Browse Source

Frozen Bubbles

master
Evgeny Gagua 10 months ago
parent
commit
35edcad173
  1. 2
      lib/1.json
  2. 46
      lib/controller/dash/node_3.js
  3. 39
      lib/controller/doMaskOperation.php
  4. 5
      lib/controller/downloadVideo.php
  5. 2
      lib/controller/getDashBoardItems.php
  6. 1
      lib/controller/getHistoryEvents.php
  7. 52
      lib/controller/getStatus.php
  8. 329
      lib/javascript/jsapi_dynamic/mojo_dashboard.js
  9. 27
      lib/javascript/jsapi_dynamic/mojo_reports.js
  10. 12
      style/style.css

2
lib/1.json
File diff suppressed because it is too large
View File

46
lib/controller/dash/node_3.js

@ -265,6 +265,52 @@
doAckOperation( %%%NODEID%%%, 0 );
};
}
},{
xtype: 'spacer',
height: 3
},{
xtype: 'panel',
height: 95,
frame: false,
border: true,
flex: 1,
layout: 'hbox',
items:[{
xtype: 'button',
width: 80,// 201 202
enableToggle: false,
id: 'cp_dbf_btn_%%%NODEID%%%',
text: '%%%LABEL%%%FREZBUBLE%%%',
iconCls: 'ctrl_panel_freeze_bf_sm',
iconAlign: 'left',
disabled: false,
handler: function(){
doNodeNCQ( 1, 210, '' );
//if( Ext.getCmp('cp_dbf_btn_%%%NODEID%%%').pressed){
//doMaskOperation( %%%NODEID%%%, 1, 4 );
// doAckOperation( %%%NODEID%%%, 1 );
//} else {
//doMaskOperation( %%%NODEID%%%, 0, 4 );
// doAckOperation( %%%NODEID%%%, 0 );
//};
}
},{
xtype: 'button',
width: 80,// 201 202
enableToggle: true,
id: 'cp_daf_btn_%%%NODEID%%%',
text: '%%%LABEL%%%DELBUBLE%%%',
iconCls: 'ctrl_panel_delete_bf_sm',
iconAlign: 'left',
disabled: false,
handler: function(){
if( Ext.getCmp('cp_daf_btn_%%%NODEID%%%').pressed){
selectROI_mode = 2;
} else {
selectROI_mode = 0;
};
}
}],
}/*,{
xtype: 'panel',
title: 'Detection Sensitivity',

39
lib/controller/doMaskOperation.php

@ -197,6 +197,45 @@
break;
};
case 5:{
// Pop Frozen Bubble for designated sensor space
// toggle Frozen Bubble
if( isset( $_POST['R'] ) ){
$RANGE = intval( $_POST['R'] );
} else {
$RANGE = 0;
};
if( isset( $_POST['A'] ) ){
$ANGLE = -1 * intval( $_POST['A'] );
} else {
$ANGLE = 0;
};
$QS = "SELECT `max_range`, `x`, `y`, `z`, `x_rot`, `y_rot`, `z_rot` FROM `lrf_sensors` WHERE `id`={$SenID}";
$RJ = $DATABASE->Query( $QS );
$MR = floatval( $RJ[0]['max_range'] );
if( $MR != 0 ){
$PR = $MR / 2048.0;
} else {
$PR = 120.0 / 2048.0;
}
// calc center
// ToDo Make calclation with Rotation of the sensor!!
$J = ( M_PI * 2.0 )/ 6000.0;
$CX = floatval( $RJ[0]['x'] ) + $PR * $RANGE * cos( $J*(6000-$ANGLE) );
$CY = floatval( $RJ[0]['y'] ) + $PR * $RANGE * sin( $J*(6000-$ANGLE) );
//$QS = "SELECT `id` FROM `target_bubbles` WHERE ( ABS(`CENTER_X` - {$CX}) < `BOUNDARY` ) AND ( ABS(`CENTER_Y` - {$CY}) < `BOUNDARY` ) LIMIT 1";
$QS = "SELECT `id` FROM `target_bubbles` WHERE ( ABS(`CENTER_X` - {$CX}) < 10 ) AND ( ABS(`CENTER_Y` - {$CY}) < 10 ) LIMIT 1";
$RR = $DATABASE->Query( $QS );
if( count( $RR ) ){
//Exists -> Delete
$QS = "DELETE FROM `target_bubbles` WHERE `id`={$RR[0]['id']}";
} else {
//Not Exists -> Create
$QS = "INSERT INTO `target_bubbles`(`CENTER_X`,`CENTER_Y`,`BOUNDARY`,`BLOCK_COUNS`) VALUES({$CX},{$CY},1.5,255)";
};
$DATABASE->Query( $QS );
$Data['query'] = $QS;
};
};
};
echo json_encode( $Data );

5
lib/controller/downloadVideo.php

@ -18,12 +18,14 @@
$SRC = 'data/reports/' . date("Y/m/d", $DTS ) . '/'. $MD5. '.mjpeg';
$FPS = intval( $_POST['FPS'] );
if( file_exists( $SRC ) ){
echo "/lib/controller/".$SRC;
/*
//$DST = '../tmp/' . $MD5 . '.mp4';
$DST = '../tmp/' . $MD5 . '.avi';
//echo $SRC . "->" . $DST . "\n\n"; exit();
//$COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -pix_fmt yuvj420p -b:v 4000k -c:v libx264 {$DST} 2>&1";
$COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -vcodec copy {$DST} 2>&1";
$JUJA = `rm -f ../tmp/*`;//*/
$JUJA = `rm -f ../tmp/*`;
$JUJA = `$COM`;
if( file_exists( $DST ) ){
//header( 'location: /lib/tmp/' . $MD5 . '.mp4' );
@ -33,6 +35,7 @@
//unlink( $DST );
} else //output_dummy( '../../style/assets/nosignal.mp4' );
echo '/style/assets/nosignal.mp4';
*/
} else //output_dummy( '../../style/assets/nosignal.mp4' );
echo '/style/assets/nosignal.mp4';
} else // output_dummy( '../../style/assets/nosignal.mp4' );

2
lib/controller/getDashBoardItems.php

@ -10,6 +10,8 @@
$TPL = str_replace('%%%LABEL%%%MASKEDITOR%%%', $Labels->GetLabel('_MASK_EDITOR_') , $TPL );
$TPL = str_replace('%%%LABEL%%%MASKMNGR%%%', $Labels->GetLabel('_MASK_MANAGER_') , $TPL );
$TPL = str_replace('%%%LABEL%%%ACKNOLAGE%%%', $Labels->GetLabel('_DEV_ACK_BTN_') , $TPL );
$TPL = str_replace('%%%LABEL%%%FREZBUBLE%%%', $Labels->GetLabel('_DEV_FRZ_BBL_BTN_') , $TPL );
$TPL = str_replace('%%%LABEL%%%DELBUBLE%%%', $Labels->GetLabel('_DEV_DEL_BBL_BTN_') , $TPL );
return $TPL;
};

1
lib/controller/getHistoryEvents.php

@ -29,6 +29,7 @@
$CR['ms'] = sprintf( "%03d",intval( $REC['ts_ms'] ));
$CR['dts'] = date( "Y-m-d H:i:s.{$CR['ms']}", $CR['ts'] );
$CR['type'] = intval( $REC['evt_type'] );
$CR['bid'] = intval( $REC['lrf_id'] );
$CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] ));
$CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] ));
$CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));

52
lib/controller/getStatus.php

@ -30,7 +30,7 @@
$result = $DATABASE->Query( $QS, false );
$NodeNames = array();
foreach( $result as $R ) $NodeNames[$R['id']] = $R['name'];
$QS = "SELECT `id`,`node_id`, `evt_type`, `ts`, `ts_ms`, `range_digital`, `azimuth`, `elevation`, `range`, `area` FROM `events` WHERE `id` > {$LLID} ORDER BY `ts` DESC, `ts_ms` DESC LIMIT 32";
$QS = "SELECT `id`,`node_id`, `evt_type`, `ts`, `ts_ms`, `range_digital`, `azimuth`, `elevation`, `range`, `area`, `lrf_id` FROM `events` WHERE `id` > {$LLID} ORDER BY `ts` DESC, `ts_ms` DESC LIMIT 32";
$LREC = $ZIZI->Query( $QS );
foreach( $LREC as $REC ){
$CR['id'] = intval( $REC['id'] );
@ -40,6 +40,7 @@
$CR['ms'] = sprintf( "%03d", intval( $REC['ts_ms'] ));
$CR['dts'] = date( "Y-m-d H:i:s.{$CR['ms']}", $CR['ts'] );
$CR['type'] = intval( $REC['evt_type'] );
$CR['bid'] = intval( $REC['lrf_id'] );
$CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] ));
$CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] ));
$CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));
@ -62,7 +63,7 @@
$CN['id'] = $R['id'];
$CN['type'] = intval($R['type']);
$CN['status'] = intval($R['online']);
if( $CN['status'] ){
if( $CN['status'] || 1 ){
switch( $R['type'] ){
case ARGUS_SERVER:{
/*
@ -95,7 +96,7 @@
case ARGUS_PLS_200_SENSOR:
case ARGUS_PLS_360_SENSOR:
case ARGUS_NET_PLS_200:{
$QS = "SELECT `data_status` FROM `lrf_sensors` WHERE `id`={$R['aux_id']}";
$QS = "SELECT `data_status`,`max_range`,`x`,`y`,`z` FROM `lrf_sensors` WHERE `id`={$R['aux_id']}";
$JJ = $DATABASE->Query( $QS );
$CS = $JJ[0];
$CN['status'] = $CS['data_status'];
@ -119,10 +120,40 @@
} else {
$CN['reload_draw'] = true;
};
$SENSORRANGE = floatval( $CS['max_range'] );
//Check Frozen Bubbles in any state of sensor
$QS = "SELECT `CENTER_X`,`CENTER_Y`, `BLOCK_COUNS` FROM `target_bubbles`";
$UJ = $DATABASE->Query( $QS );
$CN['bubbles'] = array();
if( count( $UJ ) ){
$SX = floatval( $CS['x'] );
$SY = floatval( $CS['y'] );
foreach( $UJ as $FB ){
$BC = intval( $FB['BLOCK_COUNS'] );
$C_X = floatval( $FB['CENTER_X'] ) - $SX;
$C_Y = floatval( $FB['CENTER_Y'] ) - $SY;
$DFC = sqrt( pow( $C_X, 2 ) + pow( $C_Y, 2 ) );
if( $DFC < $SENSORRANGE || 1 ){
$azimuth = rad2deg( atan2( $C_Y , $C_X ) );
if( $azimuth < 0 ) $azimuth += 360.0;
$CT = array();
$CT['digital'] = intval( 2048.0 * $DFC / $SENSORRANGE );
$CT['az'] = $azimuth;
if( $BC < 3 ){
$CT['color'] = '0F0FFF';
$CT['stroke'] = '080880';
} else {
$CT['color'] = 'FFFFFF';
$CT['stroke'] = '808080';
};
$CN['bubbles'][] = $CT;
};
};
};
if( ( $CN['status'] == 5 ) || 1 ){
// check Targets
$CN['targets'] = array();
$QS="SELECT * FROM events WHERE ( node_id={$CN['id']} OR node_id=1 ) AND ( evt_type=10 OR evt_type=11 OR evt_type=12 OR evt_type=13 OR evt_type=14 OR evt_type=52 OR evt_type=53 OR evt_type=54 OR evt_type=39 OR evt_type=40 OR evt_type=41 OR evt_type=42 OR evt_type=43 OR evt_type=44 OR evt_type=45 OR evt_type=46 OR evt_type=47 OR evt_type=48 OR evt_type=49 OR evt_type=85 ) ORDER BY ts DESC, ts_ms DESC LIMIT 32";
$QS="SELECT * FROM events WHERE ( node_id={$CN['id']} OR node_id=1 ) AND ( evt_type=10 OR evt_type=11 OR evt_type=12 OR evt_type=13 OR evt_type=14 OR evt_type=52 OR evt_type=53 OR evt_type=54 OR evt_type=39 OR evt_type=40 OR evt_type=41 OR evt_type=42 OR evt_type=43 OR evt_type=44 OR evt_type=45 OR evt_type=46 OR evt_type=47 OR evt_type=48 OR evt_type=49 OR evt_type=86 OR evt_type=87 ) ORDER BY ts DESC, ts_ms DESC LIMIT 32";
//$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) AND (UNIX_TIMESTAMP(NOW())-ts)<60 ORDER BY id DESC LIMIT 32";
//$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY ts, ts_ms DESC LIMIT 32";
//echo $QS . "\n\n";
@ -135,7 +166,7 @@
//if( !( $TT == 10 || $TT == 11 ||$TT == 12 ||$TT == 13 || $TT == 14 || $TT == 36 ) ) continue;
//$CT['type'] = $TT;
if( $TT == 85 ){
$CT['digital'] = intval( 2048.0 * floatval( $Z['range'] ) / 65.0 );
$CT['digital'] = intval( 2048.0 * floatval( $Z['range'] ) / $SENSORRANGE );
} else {
$CT['digital'] = intval( $Z['range_digital']);
};
@ -148,9 +179,14 @@
};
$CT['az'] = floatval( $Z['azimuth'] );
if( $TT > 38 ){
if( $TT == 85 ){
$CT['color'] = 'FFFF00';
$CT['stroke'] = '808000';
if( $TT == 86 || $TT == 87 ){
if( $TT == 86 ){
$CT['color'] = '00FFFF';
$CT['stroke'] = '008080';
} else {
$CT['color'] = 'FFFF00';
$CT['stroke'] = '808000';
};
} else {
$CT['color'] = 'ff00ff';
$CT['stroke'] = '800080';

329
lib/javascript/jsapi_dynamic/mojo_dashboard.js

@ -26,6 +26,7 @@ var log_store = new Ext.data.JsonStore({
{name: 'ts', type: 'int'},
{name: 'ms', type: 'string'},
{name: 'type', type: 'int'},
{name: 'bid', type: 'int'},
{name: 'range', type: 'string'},
{name: 'az', type: 'string'},
{name: 'el', type: 'string'},
@ -88,13 +89,16 @@ function log_et_Renderer( value, meta, record ){
case 76: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_EXPIRED_');?>"; break;
case 77: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_TD_EXPIRED_');?>"; break;
case 78: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_SUSP_EXPIRED_');?>"; break;
case 85: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_POPPED_');?>"; break;
case 86: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_CREATED_');?>"; break;
case 87: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_POPPED_');?>"; break;
case 93: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_BLOCK_T_');?>"; break;
case 94: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_BLOCK_P_');?>"; break;
default: ov = "<?=$Labels->GetLabel('_EVENT_');?> ["+value+"]";
};
return '<div class="log_line_' + kaka + '">'+ov+'</div>';
};
function no_target_filter( value, meta, record ){
if( record.data.type >9 && record.data.type < 52 || record.data.type == 85 ) return value;
if( record.data.type >9 && record.data.type < 52 || record.data.type == 86 || record.data.type == 87 || record.data.type == 93 || record.data.type == 94 ) return value;
return '';
};
var log_ColModel_ops = {
@ -102,6 +106,7 @@ var log_ColModel_ops = {
{header: "<?=$Labels->GetLabel('_TIME_');?>", width: 180, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' },
{header: "<?=$Labels->GetLabel('_SOURCE_');?>", width: 100, renderer: log_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' },
{header: "<?=$Labels->GetLabel('_TYPE_');?>", width: 180, renderer: log_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' },
{header: "<?=$Labels->GetLabel('_BUBBLE_ID_');?>", width: 100, dataIndex: 'bid', renderer: no_target_filter },
{header: "<?=$Labels->GetLabel('_RANGE_');?>", width: 100, dataIndex: 'range', renderer: no_target_filter },
{header: "<?=$Labels->GetLabel('_AZIMUTH_');?>", width: 100, dataIndex: 'az', renderer: no_target_filter },
{header: "<?=$Labels->GetLabel('_ELEVATION_');?>", width: 100, dataIndex: 'el', renderer: no_target_filter },
@ -189,120 +194,117 @@ var selectROI_mode = 0;
function select2DROI( id, event ){
var x = event.offsetX-100;
var y = event.offsetY-100;
if( selectROI_mode == 0 ){
var csvg = document.getElementById( 'draw_svg_' + id );
if( csvg!= undefined ){
var roi = csvg.getElementById( "roi" );
if( roi != null ) csvg.removeChild( roi );
var x = ( 287.0 / csvg.clientWidth ) * event.offsetX;
var y = ( 287.0 / csvg.clientHeight ) * event.offsetY;
var dx= x - ( 287.0 / 2 );
var dy= y - ( 287.0 / 2 );
var hr = Math.sqrt( dx*dx + dy*dy ) * 2;
if( hr > ( 284.0 ) ) hr = 284.0 ;
var zat = -1.0 * Math.atan2( dy, dx );
if( zat < 0.0 ) zat += Math.PI * 2.0;
var lts = -1;
var r = -1;
if( targets_lts_2d[ id ] != undefined ) lts = targets_lts_2d[ id ];
switch( drawZoomLevels[ id ] ){
case 100:{
r = Math.round( hr * ( 2048.0 / 284.0 ) );
if( r > 2048 ) r = 2048;
break;
};
case 50:{
r = Math.round( hr * ( 1024.0 / 284.0 ) );
if( r > 1024 ) r = 1024;
break;
};
case 25:{
r = Math.round( hr * ( 512.0 / 284.0 ) );
if( r > 512 ) r = 512;
break;
};
case 12:{
r = Math.round( hr * ( 256.0 / 284.0 ) );
if( r > 256 ) r = 256;
break;
};
var csvg = document.getElementById( 'draw_svg_' + id );
if( csvg!= undefined ){
var roi = csvg.getElementById( "roi" );
if( roi != null ) csvg.removeChild( roi );
var x = ( 287.0 / csvg.clientWidth ) * event.offsetX;
var y = ( 287.0 / csvg.clientHeight ) * event.offsetY;
var dx= x - ( 287.0 / 2 );
var dy= y - ( 287.0 / 2 );
var hr = Math.sqrt( dx*dx + dy*dy ) * 2;
if( hr > ( 284.0 ) ) hr = 284.0 ;
var zat = -1.0 * Math.atan2( dy, dx );
if( zat < 0.0 ) zat += Math.PI * 2.0;
var lts = -1;
var r = -1;
if( targets_lts_2d[ id ] != undefined ) lts = targets_lts_2d[ id ];
switch( drawZoomLevels[ id ] ){
case 100:{
r = Math.round( hr * ( 2048.0 / 284.0 ) );
if( r > 2048 ) r = 2048;
break;
};
roi_2d[id]={ range: r, az: zat, ts: lts };
//alert('R:'+r+' AZ:'+zat+' TS:'+lts );
if( r > -1 ){
set2DZoomLevel( id, drawZoomLevels[ id ] );
var z = Math.round( zat * 3000 / Math.PI );
if( z < 0 ) z += 6000 ;
doDeviceOperation( id, 42, r+':'+z, true );
case 50:{
r = Math.round( hr * ( 1024.0 / 284.0 ) );
if( r > 1024 ) r = 1024;
break;
};
case 25:{
r = Math.round( hr * ( 512.0 / 284.0 ) );
if( r > 512 ) r = 512;
break;
};
case 12:{
r = Math.round( hr * ( 256.0 / 284.0 ) );
if( r > 256 ) r = 256;
break;
};
default:{
r = -1;
break;
};
};
} else {
var csvg = document.getElementById( 'draw_svg_' + id );
if( csvg!= undefined ){
var x = ( 287.0 / csvg.clientWidth ) * event.offsetX;
var y = ( 287.0 / csvg.clientHeight ) * event.offsetY;
var dx= x - ( 287.0 / 2 );
var dy= y - ( 287.0 / 2 );
var hr = Math.sqrt( dx*dx + dy*dy ) * 2;
if( hr > ( 284.0 ) ) hr = 284.0 ;
var zat = -1.0 * Math.atan2( dy, dx );
if( zat < 0.0 ) zat += Math.PI * 2.0;
var r = -1;
switch( drawZoomLevels[ id ] ){
case 100:{
r = Math.round( hr * ( 2048.0 / 284.0 ) );
if( r > 2048 ) r = 2048;
break;
roi_2d[id]={ range: r, az: zat, ts: lts };
//alert('R:'+r+' AZ:'+zat+' TS:'+lts );
switch( selectROI_mode ){
case 0:{
if( r > -1 ){
set2DZoomLevel( id, drawZoomLevels[ id ] );
var z = Math.round( zat * 3000 / Math.PI );
if( z < 0 ) z += 6000 ;
doDeviceOperation( id, 42, r+':'+z, true );
};
case 50:{
r = Math.round( hr * ( 1024.0 / 284.0 ) );
if( r > 1024 ) r = 1024;
break;
};
case 25:{
r = Math.round( hr * ( 512.0 / 284.0 ) );
if( r > 512 ) r = 512;
break;
break;
};
case 1:{
if( r > -1 ){
var z = Math.round( zat * 3000 / Math.PI );
if( z < 0 ) z += 6000 ;
Ext.Ajax.request({
url: '/lib/controller/doMaskOperation.php',
params: {
NID: id,
UID: '<?=$CUser->Data['id'];?>',
SID: '<?=$Session;?>',
CMD: 4,
R: r,
A: z
},
success: function( response, opts ){
load2DMasks( id );
},
failure: failureAJAXFunction
});
};
case 12:{
r = Math.round( hr * ( 256.0 / 284.0 ) );
if( r > 256 ) r = 256;
break;
t = Ext.getCmp('cp_radar_'+id );
if( t != undefined ){
t.removeClass( 'yellow_bg' );
};
default:{
r = -1;
break;
t = document.getElementById('draw_svg_'+id );
if( t != undefined ){
t.style.cursor = 'crosshair';
};
selectROI_mode = 0;
break;
};
if( r > -1 ){
var z = Math.round( zat * 3000 / Math.PI );
if( z < 0 ) z += 6000 ;
Ext.Ajax.request({
url: '/lib/controller/doMaskOperation.php',
params: {
NID: id,
UID: '<?=$CUser->Data['id'];?>',
SID: '<?=$Session;?>',
CMD: 4,
R: r,
A: z
},
success: function( response, opts ){
load2DMasks( id );
},
failure: failureAJAXFunction
});
};
t = Ext.getCmp('cp_radar_'+id );
if( t != undefined ){
t.removeClass( 'yellow_bg' );
};
t = document.getElementById('draw_svg_'+id );
if( t != undefined ){
t.style.cursor = 'crosshair';
case 2:{
if( r > -1 ){
var z = Math.round( zat * 3000 / Math.PI );
if( z < 0 ) z += 6000 ;
Ext.Ajax.request({
url: '/lib/controller/doMaskOperation.php',
params: {
NID: id,
UID: '<?=$CUser->Data['id'];?>',
SID: '<?=$Session;?>',
CMD: 5,
R: r,
A: z
},
success: function( response, opts ){
//Ext.getCmp('cp_daf_btn_'+id).toggle( false );
//selectROI_mode = 0;
doNodeNCQ( 1, 212, '' );//Reload Bubbles
},
failure: failureAJAXFunction
});
} else alert( 'Range is Negative' );
Ext.getCmp('cp_daf_btn_'+id).toggle( false );
selectROI_mode = 0;
break;
};
selectROI_mode = 0;
};
};
};
@ -736,6 +738,8 @@ var drawZoomLevels = [];
var targets_2d=[];
var targets_lts_2d=[];
var targets_2d_el=[];
var bubbles_2d=[];
var bubbles_2d_el=[];
var roi_2d=[];
var draws_2d=[];
var masks_2d=[];
@ -761,6 +765,21 @@ function cleanup2DDraw( a , zzz = '' ){
};
};
};
function cleanup2DBubbles( a, zzz = '' ){
if( zzz == '') zzz = 'draw_svg_';
var csvg = document.getElementById( zzz + a );
if( csvg!= undefined ){
if( bubbles_2d_el[a] != undefined ){
if( bubbles_2d_el[a] ){
for( idx = 0; idx < bubbles_2d_el[a]; idx++ ){
var juja = csvg.getElementById( "bubble_"+a+"_"+idx );
if( juja != null ) csvg.removeChild( juja );
};
};
bubbles_2d_el[a] = 0;
};
};
};
var MaskEditorActive = false;
var MaskEditorDevice = -1;
function draw2DTargets( a ){
@ -792,7 +811,7 @@ function draw2DTargets( a ){
playSound( 1 );
var ak = 2.0*Math.PI/360;
var ok = 1.0/35;
for( idx = targets_2d[a].length-1; idx > 0; idx-- ){
for( idx = targets_2d[a].length-1; idx > -1; idx-- ){
if( targets_2d[a][idx].range < max ){
x = cpx + rk * targets_2d[a][idx].range * Math.cos( targets_2d[a][idx].az*ak );
y = cpy - rk * targets_2d[a][idx].range * Math.sin( targets_2d[a][idx].az*ak );
@ -837,6 +856,50 @@ function draw2DTargets( a ){
};
};
function draw2DBubbles( a ){
cleanup2DBubbles( a );
var csvg = document.getElementById( 'draw_svg_' + a );
if( csvg!= undefined ){
var cpath = csvg.getElementById( "svg_mask_"+a );
var max = 2048.0;
switch( drawZoomLevels[a] ){
case 50: max = 1024.0; break;
case 25: max = 512.0; break;
case 12: max = 256.0; break;
};
//var rk = bBox.width / ( max * 2 );
var cpx= 287.0;
var cpy= 287.0;
var rk = 284.0 / max;
//console.log( '2 box: '+ bBox.width+'x'+bBox.height );
if( bubbles_2d[a] != undefined ){
if( bubbles_2d[a].length ) {
var ak = 2.0*Math.PI/360;
var ok = 1.0/35;
for( idx = bubbles_2d[a].length-1; idx > -1; idx-- ){
if( bubbles_2d[a][idx].range < max ){
x = cpx + rk * bubbles_2d[a][idx].range * Math.cos( bubbles_2d[a][idx].az*ak );
y = cpy - rk * bubbles_2d[a][idx].range * Math.sin( bubbles_2d[a][idx].az*ak );
var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle");
var rz = 574 / csvg.clientWidth;
cc.setAttributeNS(null, "cx", x );
cc.setAttributeNS(null, "cy", y );
cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
cc.setAttributeNS(null, "stroke", "#"+bubbles_2d[a][idx].stroke );
cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
cc.setAttributeNS(null, "stroke-opacity", "1.0" );//+(1.0-ok*idx));
cc.setAttributeNS(null, "fill", "#"+bubbles_2d[a][idx].color );
cc.setAttributeNS(null, "fill-opacity", ""+(1.0-ok*idx));
cc.setAttributeNS(null, "id", "bubble_"+a+"_"+idx );
csvg.appendChild( cc );
};
};
bubbles_2d_el[a] = bubbles_2d[a].length;
};
};
};
};
function cleanup2DMasks( a ){
var csvg = document.getElementById( 'draw_svg_' + a );
if( csvg!= undefined ){
@ -1019,6 +1082,7 @@ function draw2DDraw( a, zzz = '' ){
};
};
draw2DTargets( a );
draw2DBubbles( a );
};
function load2DDraw( a, id='' ){
@ -1195,6 +1259,7 @@ function set2DZoomLevel( a, zl ){
};
draw2DTargets( a );
draw2DBubbles( a );
};
@ -1649,13 +1714,17 @@ function fetchSiteStatus(){
for( idx = 0; idx < data.nodes[i].targets.length; idx++)
targets_2d[data.nodes[i].id][idx]={ range: data.nodes[i].targets[idx].digital, az: data.nodes[i].targets[idx].az, color: data.nodes[i].targets[idx].color, stroke: data.nodes[i].targets[idx].stroke };
draw2DTargets( data.nodes[i].id );
} else {
cleanup2DDraw( data.nodes[i].id );
}
} else {
cleanup2DDraw( data.nodes[i].id );
};
};
} else cleanup2DDraw( data.nodes[i].id );
} else cleanup2DDraw( data.nodes[i].id );
};
if( data.nodes[i].bubbles !== undefined ){
if( data.nodes[i].bubbles.length ){
bubbles_2d[data.nodes[i].id]=[];
for( idx = 0; idx < data.nodes[i].bubbles.length; idx++)
bubbles_2d[data.nodes[i].id][idx]={ range: data.nodes[i].bubbles[idx].digital, az: data.nodes[i].bubbles[idx].az, color: data.nodes[i].bubbles[idx].color, stroke: data.nodes[i].bubbles[idx].stroke };
draw2DBubbles( data.nodes[i].id );
} else cleanup2DBubbles( data.nodes[i].id );
} else cleanup2DBubbles( data.nodes[i].id );
setStatus2D( data.nodes[i].id, data.nodes[i].status, data.nodes[i].masks_exist, data.nodes[i].masks_status );
break;
};
@ -2033,6 +2102,34 @@ function clear2DACK( a ){
};
function doNodeNCQ( nodeId, CMD, param ){
Ext.Ajax.request({
url: '/lib/controller/doNodeOperation.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
CMD: CMD,
CCMD: 0,
NID: nodeId,
PARAM: param
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
//loadAttachedSensors();
} else {
Ext.Msg.show({
title:'Error!',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.WARNING
});
};
},
failure: failureAJAXFunction
});
};
function doAckOperation( NodeID, Cmd ){
if( Cmd ){
Ext.Msg.show({
@ -2072,7 +2169,7 @@ function doAckOperation( NodeID, Cmd ){
buttons: Ext.Msg.YESNOCANCEL,
fn: function( btn ){
if( btn == 'yes' ){
if( selectROI_mode ){
if( selectROI_mode == 1 ){
t = Ext.getCmp('cp_radar_'+NodeID );
if( t != undefined ){
t.removeClass( 'yellow_bg' );

27
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -27,6 +27,7 @@ var rep_store = new Ext.data.JsonStore({
{name: 'ts', type: 'int'},
{name: 'ms', type: 'string'},
{name: 'type', type: 'int'},
{name: 'bid', type: 'int'},
{name: 'range', type: 'string'},
{name: 'az', type: 'string'},
{name: 'el', type: 'string'},
@ -93,13 +94,16 @@ function rep_et_Renderer( value, meta, record ){
case 76: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_EXPIRED_');?>"; break;
case 77: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_TD_EXPIRED_');?>"; break;
case 78: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_SUSP_EXPIRED_');?>"; break;
case 85: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_POPPED_');?>"; break;
case 86: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_CREATED_');?>"; break;
case 87: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_POPPED_');?>"; break;
case 93: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_BLOCK_T_');?>"; break;
case 94: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_BLOCK_P_');?>"; break;
default: ov = "<?=$Labels->GetLabel('_EVENT_');?> ["+value+"]";
};
return '<div class="log_line_' + kaka + '">'+ov+'</div>';
};
function r_no_target_filter( value, meta, record ){
if( record.data.type >9 && record.data.type < 52 || record.data.type == 85 ) return value;
if( record.data.type >9 && record.data.type < 52 || record.data.type == 86 || record.data.type == 87 || record.data.type == 93 || record.data.type == 94 ) return value;
return '';
};
var rep_ColModel_ops = {
@ -108,6 +112,7 @@ var rep_ColModel_ops = {
{header: "<?=$Labels->GetLabel('_SOURCE_');?>", width: 100, renderer: rep_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' },
{header: "",width: 28,fixed:true,renderer: rep_hv_Renderer, center: 'left', css: 'vertical-align: middle;', dataIndex: 'video' },
{header: "<?=$Labels->GetLabel('_TYPE_');?>", width: 180, renderer: rep_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' },
{header: "<?=$Labels->GetLabel('_BUBBLE_ID_');?>", width: 100, dataIndex: 'bid', renderer: r_no_target_filter },
{header: "<?=$Labels->GetLabel('_RANGE_');?>", width: 100, dataIndex: 'range', renderer: r_no_target_filter },
{header: "<?=$Labels->GetLabel('_AZIMUTH_');?>", width: 100, dataIndex: 'az', renderer: r_no_target_filter },
{header: "<?=$Labels->GetLabel('_WIDTH_');?>", width: 100, dataIndex: 'width', renderer: r_no_target_filter }
@ -694,11 +699,19 @@ function loadEventData( record ){
ReportSelectionMode = 3; // Just One Event
cEventTSS = record.ts+record.ms/1000;
clearAllRadars();
if( record.type == 13 || record.type == 14 || record.type == 36 || record.type == 39 || record.type == 40 || record.type == 41 || record.type == 42|| record.type == 43|| record.type == 44|| record.type == 45|| record.type == 46|| record.type == 47|| record.type == 48|| record.type == 49 || record.type == 85 ){
if( record.type == 13 || record.type == 14 || record.type == 36 || record.type == 39 || record.type == 40 || record.type == 41 || record.type == 42|| record.type == 43|| record.type == 44|| record.type == 45|| record.type == 46|| record.type == 47|| record.type == 48|| record.type == 49 || record.type == 86 || record.type == 87 ){
if( record.r == 0 && record.range > 0 ){
record.r = (2048*record.range)/65;
};
markEventOnRadar( record.node_id, record.az, record.r );
if( record.type == 86 || record.type == 87 ){
if( record.type == 86 ){
markEventOnRadar( record.node_id, record.az, record.r, "#00ffff", "#008080" );
} else {
markEventOnRadar( record.node_id, record.az, record.r, "#ffff00", "#808000" );
};
} else {
markEventOnRadar( record.node_id, record.az, record.r, "#ff0000", "#800000" );
};
};
if( record.video ){
if( record.video == 2 ){
@ -778,7 +791,7 @@ function clearAllRadars(){
};
};
function markEventOnRadar( rid, az, range ){
function markEventOnRadar( rid, az, range, color, stroke ){
var csvg = document.getElementById( 'draw_svgr_' + rid );
if( csvg!= undefined ){
var roi = csvg.getElementById( "roi" );
@ -805,10 +818,10 @@ function markEventOnRadar( rid, az, range ){
cc.setAttributeNS(null, "cx", x );
cc.setAttributeNS(null, "cy", y );
cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
cc.setAttributeNS(null, "stroke", "#800000" );
cc.setAttributeNS(null, "stroke", stroke );
cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
cc.setAttributeNS(null, "stroke-opacity", ""+(1.0));
cc.setAttributeNS(null, "fill", "#ff0000" );
cc.setAttributeNS(null, "fill", color );
cc.setAttributeNS(null, "fill-opacity", ""+(1.0));
cc.setAttributeNS(null, "id", "roi" );
csvg.appendChild( cc );

12
style/style.css

@ -451,6 +451,18 @@ object:hover {
background-image: url(wicons/046.png) !important;
background-size: 16px 16px !important;
}
.ctrl_panel_freeze_bf_sm{
width: 100% !important;
text-align:left !important;
background-image: url(wicons/043.png) !important;
background-size: 16px 16px !important;
}
.ctrl_panel_delete_bf_sm{
width: 100% !important;
text-align:left !important;
background-image: url(wicons/038.png) !important;
background-size: 16px 16px !important;
}
.ctrl_panel_study_sm{
width: 100% !important;
text-align:left !important;

Loading…
Cancel
Save