15 changed files with 1382 additions and 314 deletions
-
6index.php
-
322lib/controller/dash/node_1.js
-
BINlib/controller/data/mysqlitedb.db
-
2lib/controller/doSensorOperation.php
-
74lib/controller/getDashBoardItems.php
-
63lib/controller/getGeoAlerts.php
-
647lib/controller/getGeoZones.php
-
3lib/controller/getSensorEditor.php
-
19lib/javascript/jsapi_dynamic/mojo_main.js
-
326lib/javascript/jsapi_dynamic/mojo_map.js
-
2lib/javascript/jsapi_dynamic/mojo_monitoring.js
-
227lib/javascript/jsapi_dynamic/mojo_reports.js
-
5lib/javascript/jsapi_dynamic/mojo_settings.js
-
0lib/javascript/jsapi_dynamic/rgoose_map.js
-
0style/assets/20f21b4f01f1b7587f728b05dfc9f4aa.png
Binary file not shown.
@ -0,0 +1,63 @@ |
|||||
|
<?php |
||||
|
require_once('../ajax_asm.php'); |
||||
|
require_once('../php/utm/gPoint.php'); |
||||
|
|
||||
|
if( $CUser->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: /'); |
||||
|
}; |
||||
|
?>
|
||||
@ -0,0 +1,647 @@ |
|||||
|
<?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(); |
||||
|
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: /'); |
||||
|
}; |
||||
|
?>
|
||||
@ -0,0 +1,326 @@ |
|||||
|
//<?php require_once('../../js_asm.php'); ?>
|
||||
|
|
||||
|
|
||||
|
|
||||
|
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: <?=$UserID;?>, |
||||
|
SID: '<?=$Session;?>' |
||||
|
}, |
||||
|
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 © <a href='http://www.ign.es'>Instituto Geogr?fico Nacional de Espa?a</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: '<div id="'+data.zones[i].dev_id+'_div" class="'+sty+'" onclick="clickDeviceSelector('+data.zones[i].dev_id+');"><img id="'+data.zones[i].dev_id+'_ind" width="16px" src="/style/assets/led_green_blink_300ms.gif"><center><img src="/style/assets/'+data.zones[i].dev_type+'_node.png"><br/><p class="dev_name">'+data.zones[i].dev_name+'</p></center></div>' |
||||
|
}); |
||||
|
}; |
||||
|
}; |
||||
|
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: <?=$SiteID;?>, |
||||
|
UID: <?=$UserID;?>, |
||||
|
SID: '<?=$Session;?>', |
||||
|
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("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
|
||||
|
|
||||
|
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: '© <a href="https://bing.com/maps" target="_blank">Bing Maps</a>', |
||||
|
detectRetina: true |
||||
|
});*/ |
||||
|
mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
||||
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> 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 © <a href="https://www.esri.com" target="_blank">Esri</a> — 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 © <a href="https://www.esri.com" target="_blank">Esri</a> — 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 © <a href="https://www.esri.com" target="_blank">Esri</a> — 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 © <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors', |
||||
|
maxZoom: 19 |
||||
|
}); |
||||
|
|
||||
|
mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", { |
||||
|
attribution: 'Kartendaten: © <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: © <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ', |
||||
|
maxZoom: 19 |
||||
|
}); |
||||
|
/* |
||||
|
mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { |
||||
|
attribution: 'Maps © <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>', |
||||
|
maxZoom: 22 |
||||
|
}); |
||||
|
mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { |
||||
|
attribution: 'Maps © <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>', |
||||
|
maxZoom: 22 |
||||
|
}); |
||||
|
mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { |
||||
|
attribution: 'Maps © <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>', |
||||
|
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: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', |
||||
|
maxNativeZoom: 18, |
||||
|
maxZoom: 24, |
||||
|
}).addTo(map); */ |
||||
|
//loadTimeLineGroups( selectedSite );
|
||||
|
loadMapZones( 0 ); |
||||
|
//getData( 'arch' );
|
||||
|
}; |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue