11 changed files with 725 additions and 28 deletions
-
2lib/1.json
-
1lib/ajax_asm.php
-
115lib/controller/getBubbleAnalysis.php
-
6lib/controller/getGrabberEritor.php
-
4lib/controller/getReportLayout.php
-
4lib/controller/getResourceEditor.php
-
63lib/controller/listMediaSources.php
-
75lib/controller/report/node_10.js
-
122lib/controller/setPermanentBubbles.php
-
305lib/javascript/jsapi_dynamic/mojo_reports.js
-
56lib/javascript/jsapi_dynamic/mojo_settings.js
2
lib/1.json
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -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 ); |
|||
?>
|
|||
@ -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: /'); |
|||
}; |
|||
?>
|
|||
@ -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(); |
|||
*/ |
|||
} |
|||
} |
|||
} |
|||
@ -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 ); |
|||
?>
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue