Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

648 lines
22 KiB

<?php
require_once('../ajax_asm.php');
require_once('../php/utm/gPoint.php');
$AC_imager_diag = array( 5.0, 5.68, 6.0, 6.592, 8.0, 8.933, 11.0, 16.0, 22.5, 30.1, 43.3, 69.7 );
$AC_imager_width= array( 4.0, 4.536, 4.8, 5.27, 6.4, 7.176, 8.8, 12.8, 18.0, 25.1, 36.0, 56.0 );
$AC_imager_height = array( 3.0, 3.416, 3.6, 3.96, 4.8, 5.319, 6.6, 9.6, 13.5, 16.7, 24.0, 41.5 );
$CAM_FOCAL_LENGTH_CNT = 49;
$cam_predef_focal_length=array(
2.7,
3.0,
3.2,
3.5,
3.7,
3.9,
4.0,
4.3,
4.8,
5.0,
5.1,
5.5,
5.8,
6.0,
6.2,
6.6,
7.0,
7.1,
7.5,
7.6,
8.0,
8.6,
8.9,
9.0,
9.2,
9.3,
10.0,
10.5,
10.6,
10.7,
11.0,
11.3,
12.0,
12.9,
13.0,
13.5,
13.6,
14.0,
14.6,
15.0,
15.1,
15.5,
16.0,
17.0,
17.5,
17.7,
18.0,
18.2,
19.0
);
/*
function ToLL($north, $east, $utmZone){
// This is the lambda knot value in the reference
$LngOrigin = Deg2Rad($utmZone * 6 - 183);
// The following set of class constants define characteristics of the
// ellipsoid, as defined my the WGS84 datum. These values need to be
// changed if a different dataum is used.
$FalseNorth = 0; // South or North?
//if (lat < 0.) FalseNorth = 10000000. // South or North?
//else FalseNorth = 0.
$Ecc = 0.081819190842622; // Eccentricity
$EccSq = $Ecc * $Ecc;
$Ecc2Sq = $EccSq / (1. - $EccSq);
$Ecc2 = sqrt($Ecc2Sq); // Secondary eccentricity
$E1 = ( 1 - sqrt(1-$EccSq) ) / ( 1 + sqrt(1-$EccSq) );
$E12 = $E1 * $E1;
$E13 = $E12 * $E1;
$E14 = $E13 * $E1;
$SemiMajor = 6378137.0; // Ellipsoidal semi-major axis (Meters)
$FalseEast = 500000.0; // UTM East bias (Meters)
$ScaleFactor = 0.9996; // Scale at natural origin
// Calculate the Cassini projection parameters
$M1 = ($north - $FalseNorth) / $ScaleFactor;
$Mu1 = $M1 / ( $SemiMajor * (1 - $EccSq/4.0 - 3.0*$EccSq*$EccSq/64.0 - 5.0*$EccSq*$EccSq*$EccSq/256.0) );
$Phi1 = $Mu1 + (3.0*$E1/2.0 - 27.0*$E13/32.0) * sin(2.0*$Mu1);
+ (21.0*$E12/16.0 - 55.0*$E14/32.0) * sin(4.0*$Mu1);
+ (151.0*$E13/96.0) * sin(6.0*$Mu1);
+ (1097.0*$E14/512.0) * sin(8.0*$Mu1);
$sin2phi1 = sin($Phi1) * sin($Phi1);
$Rho1 = ($SemiMajor * (1.0-$EccSq) ) / pow(1.0-$EccSq*$sin2phi1,1.5);
$Nu1 = $SemiMajor / sqrt(1.0-$EccSq*$sin2phi1);
// Compute parameters as defined in the POSC specification. T, C and D
$T1 = tan($Phi1) * tan($Phi1);
$T12 = $T1 * $T1;
$C1 = $Ecc2Sq * cos($Phi1) * cos($Phi1);
$C12 = $C1 * $C1;
$D = ($east - $FalseEast) / ($ScaleFactor * $Nu1);
$D2 = $D * $D;
$D3 = $D2 * $D;
$D4 = $D3 * $D;
$D5 = $D4 * $D;
$D6 = $D5 * $D;
// Compute the Latitude and Longitude and convert to degrees
$lat = $Phi1 - $Nu1*tan($Phi1)/$Rho1 * ( $D2/2.0 - (5.0 + 3.0*$T1 + 10.0*$C1 - 4.0*$C12 - 9.0*$Ecc2Sq)*$D4/24.0 + (61.0 + 90.0*$T1 + 298.0*$C1 + 45.0*$T12 - 252.0*$Ecc2Sq - 3.0*$C12)*$D6/720.0 );
$lat = Rad2Deg($lat);
$lon = $LngOrigin + ($D - (1.0 + 2.0*$T1 + $C1)*$D3/6.0 + (5.0 - 2.0*$C1 + 28.0*$T1 - 3.0*$C12 + 8.0*$Ecc2Sq + 24.0*$T12)*$D5/120.0) / cos($Phi1);
$lon = Rad2Deg($lon);
// Create a object to store the calculated Latitude and Longitude values
$PC_LatLon['lat'] = $lat;
$PC_LatLon['lon'] = $lon;
// Returns a PC_LatLon object
return $PC_LatLon;
};
$Z = new gPoint();
$Z->setUTM( 485962.4143066, 4919314.7793823, '32T' );
$Z->convertTMtoLL();
$Z->printUTM();
echo "\n\n";
$Z->printLatLong();
echo "\n\n";
exit();
*/
if( $CUser->Data['id'] > 1 ){
$Data = array();
$SID = intval( $_POST['SITE'] );
if( $SID ){
$QS = "SELECT * FROM `sites` WHERE `id`={$SID}";
$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 site_id={$SID} AND NOT ((type=0)OR(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: /');
};
?>