|
|
<?php require_once('../ajax_asm.php'); require_once('../php/utm/gPoint.php'); $PROP_TPL=<<<_DATA_BOUNDARY{ xtype: 'form', labelWidth: 40, // label settings here cascade unless overridden
frame: false, bodyStyle:'padding:5px 5px 0', defaultType: 'textfield', labelAlign: 'right', items: [{ xtype: 'panel', height: 100, html: '<p align="center"><img src="/style/assets/%%%TYPE%%%_node.png"><br/>%%%NAME%%%<br/></p>' },%%%LOCATION_PART%%%{ xtype:'fieldset', title: 'Orientation', collapsible: true, autoHeight:true, defaults: { //width: 168
}, defaultType: 'textfield', items :[{ fieldLabel: 'Roll', id: 'sroll', value: %%%ROLL%%%, name: 'sroll', allowBlank:false },{ fieldLabel: 'Pitch', id: 'spitch', value: %%%PITCH%%%, name: 'spitch', allowBlank:false },{ fieldLabel: 'Yaw', id: 'syaw', value: %%%YAW%%%, name: 'syaw', allowBlank:false },{ xtype: 'button', width: '100%', text: 'Edit Orientation', handler: orientationEditor }] },{ xtype:'fieldset', title: 'Diff Position', collapsible: true, autoHeight:true, defaults: { //width: 168
}, defaultType: 'numberfield', items :[{ fieldLabel: 'ΔX', id: 'dx', value: %%%DX%%%, name: 'dx', allowBlank:false },{ fieldLabel: 'ΔY', id: 'dy', value: %%%DY%%%, name: 'dy', allowBlank:false },{ fieldLabel: 'ΔZ', id: 'dz', value: %%%DZ%%%, name: 'dz', allowBlank:false },{ xtype: 'button', width: '100%', text: 'Set Position', handler: setNodeLocationByDelta }] },{ xtype: 'button', text: 'Update', width: '100%', handler: updateLocationOrientation }]}_DATA_BOUNDARY;$LOCA_TPL=<<<_DATA_BOUNDARY{ xtype:'fieldset', //checkboxToggle:true,
collapsible: true, title: 'Location', autoHeight: true, defaults: { //width: 180
}, defaultType: 'textfield', collapsed: false, items :[{ fieldLabel: 'Lat', name: 'slat', value: %%%LAT%%%, id: 'slat', allowBlank:false },{ fieldLabel: 'Lon', id: 'slon', value: %%%LON%%%, name: 'slon', allowBlank:false },{ fieldLabel: 'Alt', id: 'salt', value: %%%ALT%%%, name: 'salt', allowBlank:false },{ xtype: 'button', text: 'Set To Anchor Position', width: '100%', handler: setNodeLocationToAnchor }] },_DATA_BOUNDARY; if( $CUser->Data['id'] > 1 ){ $Node = intval( $_POST['NODE'] ); $QS = "SELECT * FROM `nodes` WHERE id = {$Node}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $Props = $Result[0]; $Type = intval( $Props['type'] ); $TName = 'props/loc_prop.js'; $QS = "SELECT * FROM `system_props`"; $R = $DATABASE->Query($QS); $GPS = ( $R[0]['local_binding'] == 0 ); if( $GPS ){ $PROP_TPL = str_replace('%%%LOCATION_PART%%%', $LOCA_TPL, $PROP_TPL ); } else { $PROP_TPL = str_replace('%%%LOCATION_PART%%%', '', $PROP_TPL ); }; $SLAT = $R[0]['anchor_lat']; $SLON = $R[0]['anchor_lon']; $SALT = $R[0]['anchor_alt']; $A = new gPoint(); $A->setLongLat( $SLON, $SLAT ); $A->convertLLtoTM(); $XC = $A->E(); $YC = $A->N(); $Zo = floatval( $SALT ); $ZC = $A->Z(); $Data = $PROP_TPL;//file_get_contents( $TName );
$Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); $Data = str_replace('%%%TYPE%%%', $Type, $Data ); $Data = str_replace('%%%NAME%%%', urldecode( $Props['name'] ), $Data ); switch( $Type ){ case 1: case 2: case 3: case 4: case ARGUS_3D_SENSOR: case 6:{ $QS = "SELECT * FROM lrf_sensors WHERE id={$Props['aux_id']}"; $RR = $DATABASE->Query( $QS ); $C = $RR[0]; break; }; case 10: case 11: case 12: case 13:{ $QS="SELECT * FROM cameras WHERE id={$Props['aux_id']}"; $RR = $DATABASE->Query( $QS ); $C = $RR[0]; break; }; default: $Data = '{}'; }; $DX = floatval( $C['x'] ); $DY = floatval( $C['y'] ); $DZ = floatval( $C['z'] ); $CC = new gPoint(); $CC->setUTM( $XC + $DX, $YC + $DY, $ZC ); $CC->convertTMtoLL(); $LAT = $CC->Lat(); $LON = $CC->Long(); $ALT = $Zo + $DZ; $ROLL = floatval( $C['x_rot'] ); $PITCH = floatval( $C['y_rot'] ); $YAW = floatval( $C['z_rot'] ); $Data = str_replace( '%%%LAT%%%', $LAT, $Data ); $Data = str_replace( '%%%LON%%%', $LON, $Data ); $Data = str_replace( '%%%ALT%%%', $ALT, $Data ); $Data = str_replace( '%%%ROLL%%%', $ROLL, $Data ); $Data = str_replace( '%%%PITCH%%%', $PITCH, $Data ); $Data = str_replace( '%%%YAW%%%', $YAW, $Data ); $Data = str_replace( '%%%DX%%%', $DX, $Data ); $Data = str_replace( '%%%DY%%%', $DY, $Data ); $Data = str_replace( '%%%DZ%%%', $DZ, $Data ); echo $Data; } else { echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}'; }; } else { header('location: /'); };?>
|