Browse Source

Bubble Analytics in Reports

master
Evgeny Gagua 10 months ago
parent
commit
36d1bfe446
  1. 2
      lib/1.json
  2. 1
      lib/ajax_asm.php
  3. 115
      lib/controller/getBubbleAnalysis.php
  4. 6
      lib/controller/getGrabberEritor.php
  5. 4
      lib/controller/getReportLayout.php
  6. 4
      lib/controller/getResourceEditor.php
  7. 63
      lib/controller/listMediaSources.php
  8. 75
      lib/controller/report/node_10.js
  9. 122
      lib/controller/setPermanentBubbles.php
  10. 305
      lib/javascript/jsapi_dynamic/mojo_reports.js
  11. 56
      lib/javascript/jsapi_dynamic/mojo_settings.js

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

1
lib/ajax_asm.php

@ -25,6 +25,7 @@ require_once('php/db/logio_class.php');
$LOG = new Logio( LOG_LVL_ALL );
require_once('php/db/user_class.php');
require_once('php/auth/web.php');
require_once('php/utm/gPoint.php');
//require_once('php/db/language_class.php');
require_once('php/db/language_json_class.php');
require_once('php/sys/r-goose_sys.php');

115
lib/controller/getBubbleAnalysis.php

@ -0,0 +1,115 @@
<?php
require_once('../ajax_asm.php');
$UID = intval( $CUser->Data['id'] );
$BID = intval( $_POST['BID'] );
$BS = floatval( $_POST['BS'] );
$EID = intval( $_POST['EID'] );
$DTS = intval( $_POST['TS'] );
$Data = array( 'status'=>'nok', 'msg'=>'Access Denied!' );
$Bubbles = array();
if( $BS < 0.2 ) $BS = 0.2;
function sphericalToCartesian( $radius, $theta, $phi ) {
global $Data;
// Ensure angles are in radians if they are not already.
// Use deg2rad() if your input angles are in degrees.
$theta = deg2rad($theta);
$phi = deg2rad($phi);
$x = $radius * cos($phi) * cos($theta);
$y = $radius * cos($phi) * sin($theta);
$z = $radius * sin($phi);
return array( 'x' => $x, 'y' => $y, 'z' => $z );
};
function serchInBubbles( $REC ){
global $Bubbles, $Data;
$CR = array();
$CR['range'] = floatval( $REC['range'] );
$CR['az'] = floatval( $REC['azimuth'] );
$CR['el'] = floatval( $REC['elevation'] );
$CC = sphericalToCartesian( $CR['range'], $CR['az'], $CR['el'] );
$CR['x'] = $CC['x'];
$CR['y'] = $CC['y'];
$CR['z'] = $CC['z'];
$idx = 0;
foreach( $Bubbles as $B ){
$CD = sqrt( pow( ( $B['x']-$CR['x'] ), 2 )+pow( ( $B['y']-$CR['y'] ), 2 )+pow( ( $B['z']-$CR['z'] ), 2 ) );
if( $CD < $B['size'] ) return $idx;
$idx++;
};
return -1;
};
function createBubble( $REC, $BSize = 0.5 ){
global $Bubbles, $Data;
$CR = array();
$CR['range'] = floatval( $REC['range'] );
$CR['az'] = floatval( $REC['azimuth'] );
$CR['el'] = floatval( $REC['elevation'] );
$CC = sphericalToCartesian( $CR['range'], $CR['az'], $CR['el'] );
$CR['x'] = $CC['x'];
$CR['y'] = $CC['y'];
$CR['z'] = $CC['z'];
$CR['count']=1;
$CR['size'] = $BSize;
//$Data['out'][]="R:{$CR['range']} Az:{$CR['az']} El:{$CR['el']} X:{$CR['x']} Y:{$CR['y']} Z:{$CR['z']}";
$Bubbles[] = $CR;
};
function updateBubble( $idx, $REC ){
global $Bubbles;
$CR = array();
$CR['range'] = floatval( $REC['range'] );
$CR['az'] = floatval( $REC['azimuth'] );
$CR['el'] = floatval( $REC['elevation'] );
$CC = sphericalToCartesian( $CR['range'], $CR['az'], $CR['el'] );
$CR['x'] = $CC['x'];
$CR['y'] = $CC['y'];
$CR['z'] = $CC['z'];
$Bubbles[$idx]['range'] = ($Bubbles[$idx]['range']+$CR['range'])/2.0;
$Bubbles[$idx]['az'] = ($Bubbles[$idx]['az']+$CR['az'])/2.0;
$Bubbles[$idx]['el'] = ($Bubbles[$idx]['el']+$CR['el'])/2.0;
$Bubbles[$idx]['x'] = ($Bubbles[$idx]['x']+$CR['x'])/2.0;
$Bubbles[$idx]['y'] = ($Bubbles[$idx]['y']+$CR['y'])/2.0;
$Bubbles[$idx]['z'] = ($Bubbles[$idx]['z']+$CR['z'])/2.0;
$Bubbles[$idx]['count']++;
};
if( $UID > 1 && $DTS ){
$DS = date("Y/m/d", $DTS );
$QS = "SELECT * FROM `events` WHERE ( `evt_type`=13 OR `evt_type`=14 ) AND `id`>={$BID} AND `id`<={$EID} ORDER BY `ts` ASC, `ts_ms` ASC";
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/'.$DS.'/report.db');
$LREC = $ZIZI->Query( $QS );
if( count( $LREC ) ){
foreach( $LREC as $REC ){
$bid = serchInBubbles( $REC );
if( $bid < 0 ){
createBubble( $REC, $BS );
} else {
updateBubble( $bid, $REC );
};
};
if( count( $Bubbles ) ){
$Data['status']='ok';
unset( $Data['msg'] );
$Data['bubbles'] = array();
$idx = 0;
foreach( $Bubbles as $B ){
$CR['id'] = $idx;
$CR['range'] = sprintf( "%0.2f", $B['range'] );
$CR['az'] = sprintf( "%0.2f", $B['az'] );
$CR['el'] = sprintf( "%0.2f", $B['el']);
$CD = sqrt( pow( $B['x'], 2 )+pow( $B['y'], 2 )+pow( $B['z'], 2 ) );
$CR['r'] = intval( ( $CD * 2048.0)/ 65.0 );
$CR['x'] = $B['x'];
$CR['y'] = $B['y'];
$CR['z'] = $B['z'];
$CR['count'] = $B['count'];
$Data['bubbles'][] = $CR;
$idx++;
};
};
} else {
$Data['msg']='No Target to Analyze!';
};
};
echo json_encode( $Data );
?>

6
lib/controller/getGrabberEritor.php

@ -46,7 +46,7 @@
$ctrl = array();
$RR = explode( ':', $CL );
$TArr=explode( ' ', $CL );
if( stripos( $CL, 'int' )!== false ){
if( stripos( $CL, 'int' )!== false ){
$ctrl['type'] = 'slider';
$ctrl['name'] = trim( $TArr[0] );
$ctrl['name_cod'] = md5( $ctrl['name'] );
@ -121,7 +121,7 @@
$ll .="]
}),
valueField: 'fmt',
displayField: 'fmt_txt'
displayField: 'fmt_txt'
}";
$OUT[$CCC] = $ll;
$CCC++;
@ -178,7 +178,7 @@
};
break;
};
case 'combo':{
case 'combo':{
$llt = 'select: function(t,r,n)';
$ll .= "lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({
fields: ['{$CC['id']}_id','{$CC['id']}_txt'],

4
lib/controller/getReportLayout.php

@ -76,6 +76,10 @@ $LOGIO=<<<_DATA_BOUNDARY
lazyRender: true,
height: 210,
ds: rep_store,
tbar:[{
text: 'Analyze Bubbles',
handler: doBubbleAnalyze
}],
cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
viewConfig: {

4
lib/controller/getResourceEditor.php

@ -525,7 +525,7 @@ EFUFU;
$Sizes = array();
$Formats = array();
//If Source not assigned or not active
if( $CS['source_id'] == 0 || $CR['active'] == 0 ){
if( $CS['source_id'] == 0 || $CR['valid'] == 0 ){
$CMD="v4l2-ctl -d {$CS['mrl']} --list-formats-ext";
$Data = `$CMD`;
$TArr = explode( "\n", $Data );
@ -724,7 +724,7 @@ JUJUAS;
if( count( $OUT ) ){
$CCA = $TOPLER . implode( ',', $OUT );
} else {
$CCA = $TOPLER . '{}';
$CCA = $TOPLER . '{ html: "-Device-Enquiry-Failure-" }';
};
echo "{ xtype: 'form', id:'an_str_edit', frame: false, autoScroll: true, border: false, layout: 'form', labelAlign: 'right', labelWidth: 150, items: [". $CCA ."] }";
} else {

63
lib/controller/listMediaSources.php

@ -0,0 +1,63 @@
<?php
require_once('../ajax_asm.php');
//require_once('../php/onvif/toto.php');
if( $CUser->Data['id'] > 1 ){
if( isset( $_POST['cam_sources'] ) ){
if( $_POST['cam_sources'] == 'ipv' ){
$QS = "SELECT * FROM `cameras` WHERE `node_id`=0";
$Result = $DATABASE->Query($QS,false);
foreach( $Result as $CD ){
$cnode['id'] = $CD['id'];
$cnode['status'] = $CD['status'];
$cnode['login'] = $CD['access_login'];
$cnode['password']= $CD['access_pass'];
$cnode['name'] = urldecode($CD['name']);
$cnode['hardware']= urldecode($CD['hardware']);
$cnode['caps'] = 'IP';
$cnode['ip'] = $CD['ip'];
$cnode['mac'] = $CD['mac'];
$cnode['ena'] = 1;
$Data['nodes'][] = $cnode;
};
} else {
// Update Current Analog Sources
$CDATA = `v4l2-ctl --list-devices`;
$LU = explode( "\n", $CDATA );
$CDEVS = array();
foreach( $LU as $U ){
$CL = trim( $U );
if( substr( $CL, 0, 10 ) == '/dev/video' ){
$CN = getV4L2DeviceName( $CL );
$RR = array( 'name'=>$CN, 'mrl'=>$CL );
$QS = "SELECT * FROM `media_streams` WHERE `source_type`='A' AND `mrl`='{$CL}'";
$KO = $DATABASE->Query( $QS );
if( count( $KO ) == 0 ){
$CDEVS[] = $RR;
//$QS = "INSERT INTO `media_streams`(
};
};
};
$QS = "SELECT `ms`.* , `re`.`node_id` FROM `media_streams` `ms` LEFT JOIN `resources` `re` ON ( `re`.`aux_id` = `ms`.`id` ) WHERE `ms`.`source_type`='A' AND `ms`.`source_id`=0";
$Result = $DATABASE->Query($QS,false);
foreach( $Result as $CD ){
$cnode['id'] = $CD['id'];
$cnode['server'] = getServerID( $CD['node_id'] );//'local';
$T = getV4L2DeviceName($CD['mrl']);
$cnode['name'] = $T['name'];
$cnode['hardware']= $T['dev'];
$cnode['caps'] = 'Analog';
$cnode['ip'] = '['.$CD['img_width'] .'x' . $CD['img_height'] .']';
$cnode['mac'] = $CD['mrl'];
if( $T['dev']=='unknown') $cnode['ena'] = 0; else $cnode['ena'] = 1;
$Data['nodes'][] = $cnode;
};
};
echo json_encode( $Data );
} else {
header('location: /');
};
} else {
header('location: /');
};
?>

75
lib/controller/report/node_10.js

@ -1,39 +1,80 @@
{
id: 'db_node_%%%NODEID%%%',
//xtype: 'portlet',
layout:'fit',
//width: 258,
//height: %%%HEIGHT%%%+40,
layout:'vbox',
tools: [{
id:'gear',
handler: function(){
//editAnalogStream( %%%STREAMID%%%, 1 );
}
}],
id:'gear',
handler: function(){
}
}],
frame: true,
draggable: false,
collapsible: false,
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
items:[{
id: 'db_node_%%%NODEID%%%_pic',
html: '',
border: true,
width: '100%',
html: '<div id="video-%%%STREAMID%%%" style="display: flex;align-items: center;" ><img id="video-img-%%%STREAMID%%%" ondblclick="fullScreen(\'video-%%%STREAMID%%%\');" style="cursor: zoom-in" src="/style/assets/no-signal.png" width="100%" /><div id="video-ctl-%%%STREAMID%%%" style="float: left; position: absolute; left: 30px; bottom: 30px; z-index: 1000;"></div></div>'
}],
sukaMineWidth: -1,
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
if( p.sukaMineWidth != adjWidth ){
p.sukaMineWidth = adjWidth;
var XX = 32 + p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX );
var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX + 32 );
var z = document.getElementById( 'video-%%%STREAMID%%%' );
z.height = XX;
};
};
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.update('<img data-enlargeable000 ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" id="img-%%%NODEID%%%" src="%%%SELURL%%%" width="100%" />');
},
afterrender: function( p ){
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx+32 );
var xx = p.getWidth() * ( %%%HEIGHT%%% / %%%WIDTH%%% );
p.setHeight( xx + 32 );
videoElements[videoElements.length] = %%%STREAMID%%%;
var xx = new Ext.Panel({
id: 'video-ctl-panel-%%%STREAMID%%%',
renderTo: 'video-ctl-%%%STREAMID%%%',
border: false,
hidden: true,
frame: false,
width: 400,
height: 42,
layout: 'hbox',
items:[{
xtype: 'button',
width: 32,
iconCls: 'download',
scale: 'medium',
id: 'video-btn-download-%%%STREAMID%%%',
handler: function(){
downloadCurrentVideo( %%%STREAMID%%% );
}
},{
xtype: 'spacer',
width: 20
},{
xtype: 'slider',
width: 250,
id: 'video-slider-%%%STREAMID%%%',
value: 0,
minValue: 0,
maxValue: 100,
listeners:{
change: function( t, b, o ){
setVideoSource( %%%STREAMID%%%, b );
}
}
}]
});
},
beforedestroy: function(){
var oldPlayer = document.getElementById( 'video-%%%STREAMID%%%' );
/*
videojs( oldPlayer ).dispose();
*/
}
}
}

122
lib/controller/setPermanentBubbles.php

@ -0,0 +1,122 @@
<?php
require_once('../ajax_asm.php');
$UID = intval( $CUser->Data['id'] );
$BID = intval( $_POST['BID'] );
$BS = floatval( $_POST['BS'] );
$EID = intval( $_POST['EID'] );
$DTS = intval( $_POST['TS'] );
$SBID = $_POST['SBID'];
$Data = array( 'status'=>'nok', 'msg'=>'Access Denied!','out'=>array() );
$Bubbles = array();
if( $BS < 0.2 ) $BS = 0.2;
function sphericalToCartesian( $radius, $theta, $phi ) {
global $Data;
// Ensure angles are in radians if they are not already.
// Use deg2rad() if your input angles are in degrees.
$theta = deg2rad($theta);
$phi = deg2rad($phi);
$x = $radius * cos($phi) * cos($theta);
$y = $radius * cos($phi) * sin($theta);
$z = $radius * sin($phi);
return array( 'x' => $x, 'y' => $y, 'z' => $z );
};
function serchInBubbles( $REC ){
global $Bubbles, $Data;
$CR = array();
$CR['range'] = floatval( $REC['range'] );
$CR['az'] = floatval( $REC['azimuth'] );
$CR['el'] = floatval( $REC['elevation'] );
$CC = sphericalToCartesian( $CR['range'], $CR['az'], $CR['el'] );
$CR['x'] = $CC['x'];
$CR['y'] = $CC['y'];
$CR['z'] = $CC['z'];
$idx = 0;
foreach( $Bubbles as $B ){
$CD = sqrt( pow( ( $B['x']-$CR['x'] ), 2 )+pow( ( $B['y']-$CR['y'] ), 2 )+pow( ( $B['z']-$CR['z'] ), 2 ) );
if( $CD < $B['size'] ) return $idx;
$idx++;
};
return -1;
};
function createBubble( $REC, $BSize = 0.5 ){
global $Bubbles, $Data;
$CR = array();
$CR['range'] = floatval( $REC['range'] );
$CR['az'] = floatval( $REC['azimuth'] );
$CR['el'] = floatval( $REC['elevation'] );
$CC = sphericalToCartesian( $CR['range'], $CR['az'], $CR['el'] );
$CR['x'] = $CC['x'];
$CR['y'] = $CC['y'];
$CR['z'] = $CC['z'];
$CR['count']=1;
$CR['size'] = $BSize;
//$Data['out'][]="R:{$CR['range']} Az:{$CR['az']} El:{$CR['el']} X:{$CR['x']} Y:{$CR['y']} Z:{$CR['z']}";
$Bubbles[] = $CR;
};
function updateBubble( $idx, $REC ){
global $Bubbles;
$CR = array();
$CR['range'] = floatval( $REC['range'] );
$CR['az'] = floatval( $REC['azimuth'] );
$CR['el'] = floatval( $REC['elevation'] );
$CC = sphericalToCartesian( $CR['range'], $CR['az'], $CR['el'] );
$CR['x'] = $CC['x'];
$CR['y'] = $CC['y'];
$CR['z'] = $CC['z'];
$Bubbles[$idx]['range'] = ($Bubbles[$idx]['range']+$CR['range'])/2.0;
$Bubbles[$idx]['az'] = ($Bubbles[$idx]['az']+$CR['az'])/2.0;
$Bubbles[$idx]['el'] = ($Bubbles[$idx]['el']+$CR['el'])/2.0;
$Bubbles[$idx]['x'] = ($Bubbles[$idx]['x']+$CR['x'])/2.0;
$Bubbles[$idx]['y'] = ($Bubbles[$idx]['y']+$CR['y'])/2.0;
$Bubbles[$idx]['z'] = ($Bubbles[$idx]['z']+$CR['z'])/2.0;
$Bubbles[$idx]['count']++;
};
if( $UID > 1 && $DTS ){
$DS = date("Y/m/d", $DTS );
$QS = "SELECT * FROM `events` WHERE ( `evt_type`=13 OR `evt_type`=14 ) AND `id`>={$BID} AND `id`<={$EID} ORDER BY `ts` ASC, `ts_ms` ASC";
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/'.$DS.'/report.db');
$LREC = $ZIZI->Query( $QS );
if( count( $LREC ) ){
foreach( $LREC as $REC ){
$bid = serchInBubbles( $REC );
if( $bid < 0 ){
createBubble( $REC, $BS );
} else {
updateBubble( $bid, $REC );
};
};
if( count( $Bubbles ) ){
$Data['status']='ok';
$TArr = explode(',', $SBID );
$SEID = array();
foreach( $TArr as $T ){
$Z = intval( $T );
if( $Z > -1 ) $SEID[] = $Z;
};
$idx = 0;
$cr_cnt = 0;
$ex_cnt = 0;
foreach( $Bubbles as $B ){
if( in_array( $idx, $SEID ) ){
//check if allready exists
$QS = "SELECT `id` FROM `target_bubbles` WHERE ( ABS(`CENTER_X`-({$B['x']})) < `BOUNDARY` ) AND ( ABS(`CENTER_Y`-({$B['y']})) < `BOUNDARY` ) AND ( ABS(`CENTER_Z`-({$B['z']})) < `BOUNDARY` ) LIMIT 1";
$J = $DATABASE->Query( $QS );
if( count( $J ) == 0 ){
$QS="INSERT INTO `target_bubbles`(`CENTER_X`,`CENTER_Y`,`CENTER_Z`,`BOUNDARY`,`BLOCK_COUNS`) VALUES({$B['x']},{$B['y']},{$B['z']},{$BS},255)";
$cr_cnt++;
$DATABASE->Query( $QS );
} else $ex_cnt++;
};
$idx++;
};
$Data['msg'] = "<center>Created {$cr_cnt} Permanent Bubble(s)<br/>{$ex_cnt} Permanent Bubbles already Existed on Same Place(s)</center>";
};
} else {
$Data['msg']='No Target to Analyze!';
};
};
echo json_encode( $Data );
?>

305
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -38,6 +38,8 @@ var rep_store = new Ext.data.JsonStore({
{name: 'lon', type: 'float'}
]
});
function rep_sn_Renderer( value, meta, record ){
//Must be set according to events
var kaka = record.data.node_id % 3;
@ -102,10 +104,12 @@ function rep_et_Renderer( value, meta, record ){
};
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 == 86 || record.data.type == 87 || record.data.type == 93 || record.data.type == 94 ) return value;
return '';
};
var rep_ColModel_ops = {
columns: [
{header: "<?=$Labels->GetLabel('_TIME_');?>", width: 180, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' },
@ -124,6 +128,7 @@ var rep_ColModel_ops = {
width: 100
}
};
var cRowSelected = -1;
var rep_SelModel_ops = {
singleSelect: true,
@ -159,6 +164,58 @@ var rep_SelModel_ops = {
}
};
var bubble_store = new Ext.data.JsonStore({
autoDestroy: false,
storeId: 'bubble_store',
//idIndex: 0,
idProperty: 'id',
fields: [
{name: 'id', type: 'int' },
{name: 'range', type: 'string'},
{name: 'az', type: 'string'},
{name: 'el', type: 'string'},
{name: 'r', type: 'int'},
{name: 'count', type: 'int'},
{name: 'x', type: 'float'},
{name: 'y', type: 'float'},
{name: 'z', type: 'float'}
]
});
var bubble_ColModel_ops = {
columns: [
{header: "<?=$Labels->GetLabel('_BUBBLE_ID_');?>", width: 100, dataIndex: 'id' },
{header: "<?=$Labels->GetLabel('_TARGET_COUNT_');?>", sortable: true, width: 100, dataIndex: 'count' },
{header: "<?=$Labels->GetLabel('_RANGE_');?>", dataIndex: 'range' },
{header: "<?=$Labels->GetLabel('_AZIMUTH_');?>", dataIndex: 'az' },
{header: "<?=$Labels->GetLabel('_ELEVATION_');?>", dataIndex: 'el' }
],
defaults: {
sortable: false,
fixed: true,
menuDisabled: true,
width: 100
}
};
var bubble_SelectedRows = null;
var bubble_SelModel_ops = {
singleSelect: false,
listeners: {
rowselect: function(sm, row, rec ) {
Ext.getCmp('sbaw_sbp_btn').enable();
loadBubbleData( rec.data );
},
rowdeselect: function(sm, row, rec ) {
if(!sm.hasSelection()){
Ext.getCmp('sbaw_sbp_btn').disable();
}
}
}
};
var cevt = Array();
var coz = Array();
@ -499,6 +556,232 @@ function showEventPanel(){
EventPanelWindow .show();
};
var bubbleAnalyticsWindow = null;
var bubbleFilterSize = 0.5
function doBubbleAnalyze(){
Ext.Ajax.request({
url: '/lib/controller/getBubbleAnalysis.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
BS: bubbleFilterSize,
TS: currentHistoryTS,
BID: currentHistoryBeginId,
EID: currentHistoryEndId
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
if( data.status == 'nok' ){
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_FAILURE_');?>',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
} else {
showBubbleAnalytics( data.bubbles );
};
},
failure: function( response, opts ) {
}
});
};
function showBubbleAnalytics( data ){
if( bubbleAnalyticsWindow == null ){
bubbleAnalyticsWindow = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel("_BUBBLE_ANALYSIS_");?>',
width: winW*0.66,
height: winH*0.66,
layout: 'fit',
resizable: false,
closeAction: 'hide',
tbar:[{
id: 'sbaw_ubs_btn',
text: 'Update Bubble Size',
disabled: true,
handler: function(){
bubbleFilterSize = Ext.getCmp('sbaw_ubs_num').getValue();
doBubbleAnalyze();
}
},'-',{
id: 'sbaw_ubs_num',
xtype: 'numberfield',
style: {
fontSize: '12px'
},
width: 50,
value: bubbleFilterSize,
listeners:{
change: function( t, n, o ){
var rr=Ext.getCmp('sbaw_ubs_btn');
rr.enable();
rr=Ext.getCmp('sbaw_ubs_sld');
rr.suspendEvents( false );
rr.setValue( n*10, true );
rr.resumeEvents();
}
}
},'-',{
id: 'sbaw_ubs_sld',
xtype: 'slider',
value: (bubbleFilterSize * 10),
increment: 5,
minValue: 0,
width: 250,
maxValue: 100,
listeners: {
change: function( t, b, o ){
var rr=Ext.getCmp('sbaw_ubs_btn');
rr.enable();
rr=Ext.getCmp('sbaw_ubs_num');
rr.suspendEvents( false );
rr.setValue( b/10, true );
rr.resumeEvents();
}
}
}],
bbar:['->',{
text: 'Cancel',
handler: function(){
bubbleAnalyticsWindow.hide();
}
},{
id: 'sbaw_sbp_btn',
text: 'Set Selected Bubbles as Permanent',
disabled: true,
handler: function(){
var sm = Ext.getCmp('bubble_grid').getSelectionModel();
var ada = sm.getSelections();
var ids ='';
for( i=0; i<ada.length; i++ ) ids += ada[i].id+',';
ids += '-1';
Ext.Ajax.request({
url: '/lib/controller/setPermanentBubbles.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
BS: bubbleFilterSize,
TS: currentHistoryTS,
BID: currentHistoryBeginId,
EID: currentHistoryEndId,
SBID: ids
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
bubbleAnalyticsWindow.hide();
if( data.status == 'nok' ){
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_FAILURE_');?>',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
};
},
failure: failureAJAXFunction
});
}
}],
items:[{
id: 'bubble_a_container',
frame: false,
border: false,
layout: 'table',
layoutConfig: {
columns: 2
},
items:[{
id: 'bubble_map',
frame: false,
border: false,
draggable: false,
collapsible: false,
listeners:{
afterrender: function(p){
var W = Ext.getCmp( 'bubble_a_container' ).getHeight();
var H = W;
Ext.getCmp( 'bubble_map' ).setWidth( W );
p.setHeight( H );
Ext.getCmp( 'cp_radar_bubble' ).setHeight( H );
Ext.getCmp( 'cp_radar_bubble' ).setWidth( H );
document.getElementById('draw_svgr_bubble').setAttribute("width", H-80 );
/*var el = document.getElementById('div_radar_bubble');
el.addEventListener( "fullscreenchange", ( evt )=>{
if( document.fullscreenElement ){
} else {
if( fsDrawID ){
var el = document.getElementById('draw_svgr_'+fsDrawID );
el.removeAttribute("width");
el.setAttribute( "width", H-80 );
fsDrawID = 0;
};
};
});*/
//window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%%, 'draw_svgr_' );
}
},
layout: 'hbox',
items:[{
id: 'cp_radar_bubble',
html: '<div id="div_radar_bubble" style="display: block; padding: 5px; width: \'100%\'; height: \'100%\';"><center><svg id="draw_svgr_bubble" opacity="1.0" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><text id="g_txt_bubble" 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_bubble" fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_bubble" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_bubble" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_bubble" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_bubble" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_bubble" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_bubble" 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: '100%'
}]
},{
xtype: 'grid',
id: 'bubble_grid',
border: false,
frame: false,
autoScroll: true,
//width: '100%',
lazyRender: true,
height: 210,
ds: bubble_store,
cm: new Ext.grid.ColumnModel( bubble_ColModel_ops ),
sm: new Ext.grid.RowSelectionModel( bubble_SelModel_ops ),
viewConfig: {
forceFit: true,
getRowClass: function( record, rowIndex, rowParams, store){
switch( record.get('id')%5 ){
case 0: return 'row-level01';
case 1: return 'row-level02';
case 2: return 'row-level03';
case 3: return 'row-level04';
case 4: return 'row-level05';
};
return '';
}
},
listeners:{
afterrender : function( t ){
var H = Ext.getCmp( 'bubble_a_container' ).getHeight();
var W = Ext.getCmp( 'bubble_a_container' ).getWidth() - H -5;
t.setHeight( H );
t.setWidth( W );
}
}
}]
}]
});
};
bubbleAnalyticsWindow.show();
var csvg = document.getElementById( 'draw_svgr_bubble' );
if( csvg!= undefined ){
var roi = csvg.getElementById( "roi" );
if( roi != null ) csvg.removeChild( roi );
};
bubble_store.removeAll();
bubble_store.loadData( data );
};
function ModeRenderer(val){
var p1, p2, p3;
if( ( val & 1 ) == 1 ){
@ -781,6 +1064,15 @@ function loadEventData( record ){
};
};
function loadBubbleData(record){
var csvg = document.getElementById( 'draw_svgr_bubble' );
if( csvg!= undefined ){
var roi = csvg.getElementById( "roi" );
if( roi != null ) csvg.removeChild( roi );
};
markEventOnRadar( 'bubble', record.az, record.r, "#00ffff", "#008080" );
};
function clearAllRadars(){
for( i=1; i< 1000; i++ ){
var csvg = document.getElementById( 'draw_svgr_' + i );
@ -1406,18 +1698,23 @@ function loadReportSegment( ts, bid, eid ){
loadReportData( ts, bid, eid );
};
};
var currentHistoryTS = 0;
var currentHistoryBeginId = 0;
var currentHistoryEndId = 0;
function loadReportData( ts, bid, eid ){
ReportSelectionMode = 2; // Session Selected
hideVideos();
currentHistoryTS = ts;
currentHistoryBeginId = bid;
currentHistoryEndId = eid;
Ext.Ajax.request({
url: '/lib/controller/getHistoryEvents.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
TS: ts,
BID: bid,
EID: eid,
TS: currentHistoryTS,
BID: currentHistoryBeginId,
EID: currentHistoryEndId,
},
success: function(response, opts ){
var data = Ext.decode( response.responseText );

56
lib/javascript/jsapi_dynamic/mojo_settings.js

@ -1457,7 +1457,7 @@ function addSensor(){
};
addSensorDialog.hide();
},
failure: failureAJAXFunction
failure: failureAJAXFunction
});
} else {
Ext.Msg.show({
@ -1476,7 +1476,56 @@ function addSensor(){
};
var addDetCamDialog = null;
var addDetACamDialog = null;
var addDetCamWM = null;
function addDetectedAnalogCam(){
if( addDetACamDialog == null ){
addDetACamDialog = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel('_ANAL_SOURCES_LST_');?>',
width: 800,
height: 600,
layout: 'fit',
closeAction: 'hide',
items:[{
xtype: 'grid',
frame: false,
border: false,
ds: cameraListStore,
cm: AnalogCameraListColModel,
sm: AnalogCameraListSelModel,
viewConfig: {
forceFit: true
}
}],
bbar: [{
text: '<?=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
addDetACamDialog.hide();
}
},'->',{
id: 'cha_an_strim_set',
text: '<?=$Labels->GetLabel('_SETTINGS_');?>',
disabled: ( SelectedSource == 0 ),
handler: function(){
editAnalogStream( SelectedSource );
}
},{
id: 'con_to_anal_src',
text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
disabled: ( SelectedSource == 0 ),
handler: function(){
//alert( 'Cam Type:'+SelectedCamTYPE );
showAnalCamPropDialog();
}
}]
});
};
addDetACamDialog.show();
cameraListStore.load({params:{cam_sources:'anal'}});
};
function addDetectedIPCam(){
if( addDetCamDialog == null ){
addDetCamDialog = new Ext.Window({
@ -2413,6 +2462,11 @@ function showSettingsVideo(){
handler: function(){
addDetectedIPCam();
}
},{
text: "<?=$Labels->GetLabel( '_MANUADD_ACAMERA_' );?>",
handler: function(){
addDetectedAnalogCam();
}
}],
items:[]
},{

Loading…
Cancel
Save