23 changed files with 2240 additions and 1279 deletions
-
9index.php
-
2lib/1.json
-
2lib/controller/dash/node_3.js
-
19lib/controller/doApplicationOperation.php
-
17lib/controller/doCameraOperation.php
-
4lib/controller/doFilterOperation.php
-
495lib/controller/getApplicationSettings.php
-
28lib/controller/getCameraEditor.php
-
2lib/controller/getHistoryEvents.php
-
54lib/controller/getMetroFusionEditor.php
-
10lib/controller/getStatus.php
-
3lib/controller/uploadDeviceMask.php
-
12lib/javascript/jsapi_dynamic/mojo_dashboard.js
-
3lib/javascript/jsapi_dynamic/mojo_global_vars.js
-
546lib/javascript/jsapi_dynamic/mojo_main.js
-
752lib/javascript/jsapi_dynamic/mojo_masks.js
-
8lib/javascript/jsapi_dynamic/mojo_reports.js
-
374lib/javascript/jsapi_dynamic/mojo_settings.js
-
188lib/javascript/jsapi_dynamic/mojo_windows.js
-
745lib/javascript/jsapi_dynamic/rgoose_devices.js
-
5lib/javascript/jsapi_static/mojo_general.js
-
239lib/javascript/jsapi_static/mojo_portal.js
-
2lib/version.var
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,495 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
ob_start(); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $UID > 1 ){ |
|||
$Data['status']='na'; |
|||
$TY = intval( $_POST['TYP'] ); |
|||
$QS="SELECT * FROM system_props LIMIT 1"; |
|||
$RV = $DATABASE->Query( $QS ); |
|||
if( count( $RV ) ){ |
|||
$AP_DATA = $RV[0]; |
|||
if( $AP_DATA['hw_info'] == '' ) $AP_DATA['hw_info'] = 'MUST_DO_DETECTION'; |
|||
if( $AP_DATA['os_info'] == '' ) $AP_DATA['os_info'] = 'MUST_RESTART_SERVER'; |
|||
} else { |
|||
$AP_DATA = array( |
|||
'anchor_lat'=>0, |
|||
'anchor_lon'=>0, |
|||
'anchor_alt'=>0, |
|||
'type'=>0, |
|||
'name'=>'INITIAL_SETUP_MODE', |
|||
'os_info'=>'MUST_RESTART_SERVER', |
|||
'hw_info'=>'MUST_DO_DETECTION' |
|||
); |
|||
}; |
|||
$QS="SELECT `site_id`, `version_string` FROM `servers` LIMIT 1"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
if( count( $RR ) ){ |
|||
$AP_DATA['site_id'] = intval( $RR[0]['site_id']); |
|||
$AP_DATA['build'] = $RR[0]['version_string']; |
|||
} else { |
|||
$AP_DATA['site_id'] = 1; |
|||
$AP_DATA['build'] = 'undefined-build'; |
|||
}; |
|||
switch( $TY ){ |
|||
case 0:{ |
|||
|
|||
$Data['status']='ok'; |
|||
$QS = "SELECT `identity` FROM `servers` LIMIT 1"; |
|||
$TT = $DATABASE->Query( $QS ); |
|||
if( count( $TT ) ){ |
|||
$IDT = $TT[0]['identity']; |
|||
} else { |
|||
$IDT = "----No-Identity-Set---"; |
|||
}; |
|||
$Data['content']=<<<DATA_BOUNDARY |
|||
[{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'panel', |
|||
frame: false, |
|||
border: true, |
|||
bodyStyle: 'background-color: white;', |
|||
html: '<center><img height=\"120px\" src=\"/style/assets/{$AP_DATA['oem_logo']}.png\"></center>', |
|||
height: 130 |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'textfield', |
|||
fieldLabel: "{$Labels->GetLabel( '_INSTANCE_ID_' )}", |
|||
width: 300, |
|||
value: '{$IDT}' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'button', |
|||
text: "{$Labels->GetLabel( '_GEN_INSTANCE_ID_' )}", |
|||
width: 550, |
|||
handler: function(){ |
|||
doApplicationOperation( 3, 0 ); |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: "{$Labels->GetLabel('_DEBUGGING_MODE_')}", |
|||
editable: false, |
|||
typeAhead: true, |
|||
width: 300, |
|||
triggerAction: 'all', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['sid', 'snam'], |
|||
data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]] |
|||
}), |
|||
value: '{$AP_DATA['work_mode']}', |
|||
valueField: 'sid', |
|||
displayField: 'snam', |
|||
listeners:{ |
|||
select: function( t, r, i ){ |
|||
doApplicationOperation( 1, i ); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: "{$Labels->GetLabel('_USE_REMOTE_SERVER_')}", |
|||
editable: false, |
|||
typeAhead: true, |
|||
width: 300, |
|||
triggerAction: 'all', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['sid', 'snam'], |
|||
data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]] |
|||
}), |
|||
value: '{$AP_DATA['use_remote_server']}', |
|||
valueField: 'sid', |
|||
displayField: 'snam', |
|||
listeners:{ |
|||
select: function( t, r, i ){ |
|||
doApplicationOperation( 10, i ); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'textfield', |
|||
fieldLabel: "{$Labels->GetLabel('_REMOTE_SERVER_ADDRESS_')}", |
|||
width: 300, |
|||
value: '{$AP_DATA['remote_ip']}', |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doApplicationOperation( 8, c ); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'numberfield', |
|||
fieldLabel: "{$Labels->GetLabel('_REMOTE_SERVER_PORT_')}", |
|||
width: 300, |
|||
value: '{$AP_DATA['remote_port']}', |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doApplicationOperation( 9, c ); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'textfield', |
|||
fieldLabel: "{$Labels->GetLabel('_BACKUP_SERVER_ADDRESS_')}", |
|||
width: 300, |
|||
value: '{$AP_DATA['remote_backup_ip']}', |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doApplicationOperation( 12, c ); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'numberfield', |
|||
fieldLabel: "{$Labels->GetLabel('_BACKUP_SERVER_PORT_')}", |
|||
width: 300, |
|||
value: '{$AP_DATA['remote_backup_port']}', |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doApplicationOperation( 13, c ); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: "{$Labels->GetLabel('_SKIP_LOCAL_REPORTS_')}", |
|||
editable: false, |
|||
typeAhead: true, |
|||
width: 300, |
|||
triggerAction: 'all', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['sid', 'snam'], |
|||
data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]] |
|||
}), |
|||
value: '{$AP_DATA['skip_local_report']}', |
|||
valueField: 'sid', |
|||
displayField: 'snam', |
|||
listeners:{ |
|||
select: function( t, r, i ){ |
|||
doApplicationOperation( 11, i ); |
|||
} |
|||
} |
|||
}] |
|||
DATA_BOUNDARY; |
|||
break; |
|||
}; |
|||
case 1:{ |
|||
$Data['status']='ok'; |
|||
$Data['content']=<<<DATA_BOUNDARY |
|||
[{ |
|||
columnWidth: 0.83, |
|||
frame: false, |
|||
border: false, |
|||
items: [{ |
|||
xtype: 'panel', |
|||
id: 'sys_location_map', |
|||
height: PanelH-170, |
|||
html: ' ', |
|||
listeners:{ |
|||
afterrender: function( t, state ){ |
|||
loadLocationEditor('sys_location_map'); |
|||
} |
|||
} |
|||
},{ |
|||
layout: 'table', |
|||
title: "{$Labels->GetLabel('_SITE_PROP_LBL_')}", |
|||
flex: 1, |
|||
defaults: { |
|||
bodyStyle:'padding:20px' |
|||
}, |
|||
layoutConfig: { |
|||
columns: 8, |
|||
textAlign: 'center' |
|||
}, |
|||
items:[{ |
|||
border: false, |
|||
id: 'lab_123', |
|||
html: "{$Labels->GetLabel('_SYS_ANCHORT_LBL_')} "+((MAP_IS_LOCAL)?'Pos X':"{$Labels->GetLabel('_LON_SHORT_LBL_')}")+':' |
|||
},{ |
|||
xtype: 'numberfield', |
|||
width: 100, |
|||
decimalPrecision: 8, |
|||
id: 'siteLon', |
|||
value: SiteLon |
|||
},{ |
|||
border: false, |
|||
id: 'lab_124', |
|||
html: ((MAP_IS_LOCAL)?'Pos Y':"{$Labels->GetLabel('_LAT_SHORT_LBL_')}")+':' |
|||
},{ |
|||
xtype: 'numberfield', |
|||
id: 'siteLat', |
|||
decimalPrecision: 8, |
|||
width: 100, |
|||
value: SiteLat |
|||
},{ |
|||
border: false, |
|||
html: "{$Labels->GetLabel('_ALT_SHORT_LBL_')}:" |
|||
},{ |
|||
xtype: 'numberfield', |
|||
decimalPrecision: 2, |
|||
width: 100, |
|||
id: 'siteAlt', |
|||
value: SiteAlt |
|||
},{ |
|||
xtype: 'button', |
|||
text: "{$Labels->GetLabel('_UPDATE_LBL_')}", |
|||
handler: updateSiteAnchor |
|||
},{ |
|||
xtype: 'panel', |
|||
frame: false, |
|||
border: false, |
|||
rowspan: 2, |
|||
html: ((MAP_IS_LOCAL)?'<img id="lab_125" height="64px" src="/style/assets/map_mode_decart.png">':'<img id="lab_125" height="64px" src="/style/assets/map_mode_wgs84.png">') |
|||
},{ |
|||
border: false, |
|||
html: "{$Labels->GetLabel('_MAP_TYP_LBL_')}:" |
|||
},{ |
|||
xtype: 'combo', |
|||
disabled: false, |
|||
typeAhead: true, |
|||
triggerAction: 'all', |
|||
id: 'siteMap', |
|||
lazyRender:true, |
|||
colspan: 3, |
|||
mode: 'local', |
|||
store: mapListStore, |
|||
value: MAP_ID, |
|||
valueField: 'map_id', |
|||
displayField: 'map_name', |
|||
listeners:{ |
|||
select: function(){ |
|||
updateSiteMap(); |
|||
LoadNodesList(); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'button', |
|||
disabled: false, |
|||
text: "{$Labels->GetLabel('_DELETE_')}", |
|||
handler: function(){ |
|||
deleteCurrentMap(); |
|||
} |
|||
},{ |
|||
|
|||
xtype: 'button', |
|||
id: 'add-c_map-btn', |
|||
disabled: false, |
|||
text: "{$Labels->GetLabel('_CREATE_NEW_LBL_')}", |
|||
handler: function(){ |
|||
createNewMap(); |
|||
} |
|||
}] |
|||
}] |
|||
},{ |
|||
frame: true, |
|||
border: false, |
|||
xtype: 'panel', |
|||
flex: 1, |
|||
height: PanelH, |
|||
columnWidth: 0.17, |
|||
layout: 'fit', |
|||
id: 'prop_content', |
|||
items:[{ |
|||
html: "<div class='setEd_infoPanel' id='NUNU'>{$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_')}</div>" |
|||
}] |
|||
}] |
|||
DATA_BOUNDARY; |
|||
break; |
|||
}; |
|||
case 4:{ |
|||
$Data['status']='ok'; |
|||
$Data['content']=<<<DATA_BOUNDARY |
|||
[{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: "{$Labels->GetLabel('_MULTYDIS_ENA_')}", |
|||
editable: false, |
|||
typeAhead: true, |
|||
width: 300, |
|||
triggerAction: 'all', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
disabled: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['sid', 'snam'], |
|||
data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]] |
|||
}), |
|||
value: '{$AP_DATA['skip_local_report']}', |
|||
valueField: 'sid', |
|||
displayField: 'snam', |
|||
listeners:{ |
|||
select: function( t, r, i ){ |
|||
if( i ){ |
|||
showMultyLayoutEditor(); |
|||
}; |
|||
//doApplicationOperation( 11, i );
|
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'panel', |
|||
layout: 'fit', |
|||
height: PanelH - 190, |
|||
id: 'mui_editor', |
|||
border: true, |
|||
frame: false, |
|||
disabled: true, |
|||
items:[{ |
|||
xtype:'portal', |
|||
region:'center', |
|||
margins:'35 5 5 0', |
|||
items:[{ |
|||
columnWidth:.33, |
|||
style:'padding:10px 0 10px 10px', |
|||
items:[/*{ |
|||
title: 'Grid in a Portlet', |
|||
layout:'fit', |
|||
rowspan: 2, |
|||
tools: [{ |
|||
id:'gear', |
|||
handler: function(){ |
|||
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
|||
} |
|||
},{ |
|||
id:'close', |
|||
handler: function(e, target, panel){ |
|||
panel.ownerCt.remove(panel, true); |
|||
} |
|||
}], |
|||
html: 'chucha' |
|||
},{ |
|||
title: 'Another Panel 1', |
|||
tools: [{ |
|||
id:'gear', |
|||
handler: function(){ |
|||
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
|||
} |
|||
},{ |
|||
id:'close', |
|||
handler: function(e, target, panel){ |
|||
panel.ownerCt.remove(panel, true); |
|||
} |
|||
}], |
|||
html: 'chucha' |
|||
}] |
|||
},{ |
|||
columnWidth:.33, |
|||
style:'padding:10px 0 10px 10px', |
|||
items:[{ |
|||
title: 'Panel 2', |
|||
tools: [{ |
|||
id:'gear', |
|||
handler: function(){ |
|||
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
|||
} |
|||
},{ |
|||
id:'close', |
|||
handler: function(e, target, panel){ |
|||
panel.ownerCt.remove(panel, true); |
|||
} |
|||
}], |
|||
html: 'chucha' |
|||
},{ |
|||
title: 'Another Panel 2', |
|||
tools: [{ |
|||
id:'gear', |
|||
handler: function(){ |
|||
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
|||
} |
|||
},{ |
|||
id:'close', |
|||
handler: function(e, target, panel){ |
|||
panel.ownerCt.remove(panel, true); |
|||
} |
|||
}], |
|||
html: 'chucha' |
|||
}] |
|||
},{ |
|||
columnWidth:.33, |
|||
style:'padding:10px', |
|||
items:[{ |
|||
title: 'Panel 3', |
|||
tools: [{ |
|||
id:'gear', |
|||
handler: function(){ |
|||
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
|||
} |
|||
},{ |
|||
id:'close', |
|||
handler: function(e, target, panel){ |
|||
panel.ownerCt.remove(panel, true); |
|||
} |
|||
}], |
|||
html: 'chucha' |
|||
},{ |
|||
title: 'Another Panel 3', |
|||
colspan: 2, |
|||
tools: [{ |
|||
id:'gear', |
|||
handler: function(){ |
|||
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
|||
} |
|||
},{ |
|||
id:'close', |
|||
handler: function(e, target, panel){ |
|||
panel.ownerCt.remove(panel, true); |
|||
} |
|||
}], |
|||
html: 'chucha' |
|||
}*/] |
|||
}] |
|||
|
|||
/* |
|||
* Uncomment this block to test handling of the drop event. You could use this |
|||
* to save portlet position state for example. The event arg e is the custom |
|||
* event defined in Ext.ux.Portal.DropZone. |
|||
*/ |
|||
// ,listeners: {
|
|||
// 'drop': function(e){
|
|||
// Ext.Msg.alert('Portlet Dropped', e.panel.title + '<br />Column: ' +
|
|||
// e.columnIndex + '<br />Position: ' + e.position);
|
|||
// }
|
|||
// }
|
|||
}] |
|||
}] |
|||
DATA_BOUNDARY; |
|||
break; |
|||
}; |
|||
}; |
|||
$Data['messages'] = ob_get_clean(); |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,752 @@ |
|||
//<?php require_once('../../js_asm.php'); ?>
|
|||
|
|||
|
|||
|
|||
var ME_max_range = 100; |
|||
var absDrawMapSizes = [[4096,4096],[2304,288]]; |
|||
var deviceMapScaling = 1.0; |
|||
var deviceMapTopShift = 100; |
|||
var deviceMapLeftShift = 100; |
|||
var cMapImageWidth = 0; |
|||
var cMapImageHeight = 0; |
|||
var cMapCanvasWidth = 0; |
|||
var cMapCanvasHeight = 0; |
|||
var cMapType = 0; |
|||
var cMaskLRF = 0; |
|||
var cMaskID = 0; |
|||
var maskEditorDiv = null; |
|||
var MEPanel = null; |
|||
function handleFSMaskEditorClose( event ){ |
|||
if ( document.fullscreenElement || |
|||
document.webkitFullscreenElement || |
|||
document.mozFullScreenElement || |
|||
document.msFullscreenElement ){ |
|||
} else { |
|||
MEPanel.destroy(); |
|||
maskEditorDiv.remove(); |
|||
MaskEditorActive = false; |
|||
maskEditorDiv = null; |
|||
MEPanel = null; |
|||
document.removeEventListener( 'fullscreenchange', handleFSMaskEditorClose ); |
|||
}; |
|||
}; |
|||
|
|||
function hideMaskEditor(){ |
|||
MaskEditorActive = false; |
|||
if( |
|||
document.fullscreenElement || |
|||
document.webkitFullscreenElement || |
|||
document.mozFullScreenElement || |
|||
document.msFullscreenElement |
|||
){ |
|||
if( document.exitFullscreen ){ |
|||
document.exitFullscreen(); |
|||
}else if( document.mozCancelFullScreen ){ |
|||
document.mozCancelFullScreen(); |
|||
}else if( document.webkitExitFullscreen ){ |
|||
document.webkitExitFullscreen(); |
|||
}else if( document.msExitFullscreen ){ |
|||
document.msExitFullscreen(); |
|||
}; |
|||
// Removal Done by event!
|
|||
//maskEditorDiv.remove();
|
|||
//maskEditorDiv = null;
|
|||
//document.removeEventListener( 'fullscreenchange', handleFSMaskEditorClose );
|
|||
}; |
|||
}; |
|||
var values = { |
|||
paths: 50, |
|||
minPoints: 5, |
|||
maxPoints: 15, |
|||
minRadius: 30, |
|||
maxRadius: 90 |
|||
}; |
|||
|
|||
var hitOptions = { |
|||
segments: true, |
|||
stroke: true, |
|||
fill: true, |
|||
tolerance: 10 |
|||
}; |
|||
|
|||
var polycolors = new Array(); |
|||
var polyindex = 0; |
|||
var poligones = new Array(); |
|||
|
|||
var segment = null; |
|||
var path = null; |
|||
var MaskProject = null; |
|||
var MaskEditorMode = 0; |
|||
|
|||
function onMouseDown(event) { |
|||
segment = path = null; |
|||
var hitResult = MaskProject.hitTest( event.point, hitOptions ); |
|||
if (!hitResult) return; |
|||
|
|||
if( event.modifiers.shift ){ |
|||
if (hitResult.type == 'segment') { |
|||
hitResult.segment.remove(); |
|||
}; |
|||
return; |
|||
}; |
|||
if( hitResult ){ |
|||
path = hitResult.item; |
|||
if( hitResult.type == 'segment' ){ |
|||
segment = hitResult.segment; |
|||
path.fullySelected = false; |
|||
segment.selected = true; |
|||
} else if( hitResult.type == 'stroke' ){ |
|||
var location = hitResult.location; |
|||
segment = path.insert(location.index + 1, event.point); |
|||
//path.smooth();
|
|||
path.fullySelected = false; |
|||
segment.selected = true; |
|||
} else if ( hitResult.type == 'fill' ){ |
|||
path.fullySelected = true; |
|||
}; |
|||
} |
|||
//movePath = ;
|
|||
//if( movePath ) MaskProject.activeLayer.addChild(hitResult.item);
|
|||
} |
|||
var c_m_X = 0; |
|||
var c_m_Y = 0; |
|||
function onMouseMove( e ) { |
|||
//e.preventDefault();
|
|||
//e.stopPropagation();
|
|||
var mx = parseInt( e.offsetX - deviceMapLeftShift ); |
|||
var my = parseInt( e.offsetY - deviceMapTopShift ); |
|||
console.log( "e.ox:"+cMapImageWidth+" e.oy:"+cMapCanvasWidth+" mx:"+mx+" my:"+my ); |
|||
if( ( mx != c_m_X ) || ( my!= c_m_Y ) ){ |
|||
c_m_X = mx; |
|||
c_m_Y = my; |
|||
var t = Ext.getCmp('me_coords_panel'); |
|||
if( t!= undefined ){ |
|||
var k = 2048 / ( cMapImageWidth ); |
|||
var j = 2048 / ( cMapImageHeight ); |
|||
var jaja = parseInt( mx * k - 1024 ); |
|||
var juju = parseInt( my * j - 1024 ); |
|||
if( juju != 0 ){ |
|||
if( juju < 0 ){ |
|||
az = ( Math.atan( jaja / juju ) * ( 180 / Math.PI )+90).toFixed(1); |
|||
} else { |
|||
az = ( Math.atan( jaja / juju ) * ( 180 / Math.PI )+270).toFixed(1); |
|||
}; |
|||
} else { |
|||
if( jaja < 0 ) { |
|||
az = 90; |
|||
} else { |
|||
az = 270; |
|||
}; |
|||
}; |
|||
range = ( ( ME_max_range / 1024 ) * Math.sqrt( Math.pow( jaja, 2 ) + Math.pow( juju, 2 ) )).toFixed(2); |
|||
t.update('<b>Range:' + range + ' m. Azimuth:' + az + '°</b>'); |
|||
}; |
|||
}; |
|||
} |
|||
function onPathMouseMove( event ) { |
|||
//event.preventDefault();
|
|||
//event.stopPropagation();
|
|||
var mx = event.point.x;// - deviceMapLeftShift;
|
|||
var my = event.point.y;// - deviceMapTopShift;
|
|||
if( ( mx != c_m_X ) || ( my != c_m_Y ) ){ |
|||
c_m_X = mx; |
|||
c_m_Y = my; |
|||
var t = Ext.getCmp('me_coords_panel'); |
|||
if( t!= undefined ){ |
|||
t.update('<b>'+c_m_X+'x'+c_m_Y+'</b>'); |
|||
}; |
|||
}; |
|||
//MaskProject.activeLayer.selected = false;
|
|||
//if( event.item ) {
|
|||
//event.item.selected = true;
|
|||
// event.item.fullySelected = true;
|
|||
//};
|
|||
} |
|||
|
|||
function onMouseDrag(event) { |
|||
var mx = event.point.x - deviceMapLeftShift; |
|||
var my = event.point.y - deviceMapTopShift; |
|||
//var mx = parseInt( event.offsetX - deviceMapLeftShift );
|
|||
//var my = parseInt( event.offsetY - deviceMapTopShift );
|
|||
if( ( mx != c_m_X ) || ( my != c_m_Y ) ){ |
|||
c_m_X = mx; |
|||
c_m_Y = my; |
|||
var t = Ext.getCmp('me_coords_panel'); |
|||
if( t!= undefined ){ |
|||
var k = 2048 / ( cMapImageWidth ); |
|||
var j = 2048 / ( cMapImageHeight ); |
|||
var jaja = parseInt( c_m_X * k - 1024 ); |
|||
var juju = parseInt( c_m_Y * j - 1024 ); |
|||
if( juju != 0 ){ |
|||
if( juju < 0 ){ |
|||
az = ( Math.atan( jaja / juju ) * ( 180 / Math.PI )+90).toFixed(1); |
|||
} else { |
|||
az = ( Math.atan( jaja / juju ) * ( 180 / Math.PI )+270).toFixed(1); |
|||
}; |
|||
} else { |
|||
if( jaja < 0 ) { |
|||
az = 90; |
|||
} else { |
|||
az = 270; |
|||
}; |
|||
}; |
|||
range = ( ( ME_max_range / 1024 ) * Math.sqrt( Math.pow( jaja, 2 ) + Math.pow( juju, 2 ) )).toFixed(2); |
|||
t.update('<b>Range:' + range + ' m. Azimuth:' + az + '°</b>'); |
|||
}; |
|||
}; |
|||
if( segment ){ |
|||
//segment.point += event.delta;
|
|||
segment.point = event.point; |
|||
//path.smooth();
|
|||
}; |
|||
//else if (path) {
|
|||
// path.position += event.delta;
|
|||
//}
|
|||
} |
|||
|
|||
function SaveCurrentMask( NodeID, MaskID, LRFID ){ |
|||
var serial = MaskProject.exportJSON(); |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/uploadDeviceMask.php', |
|||
params: { |
|||
NID: NodeID, |
|||
UID: '<?=$CUser->Data['id'];?>', |
|||
SID: '<?=$Session;?>', |
|||
MID: MaskID, |
|||
LID: LRFID, |
|||
MDTA: serial, |
|||
MIH: cMapImageHeight, |
|||
MIW: cMapImageWidth, |
|||
MSHX: deviceMapLeftShift, |
|||
MSHY: deviceMapTopShift, |
|||
DSTD: 1 |
|||
}, |
|||
success: function( response, opts ){ |
|||
//var data = Ext.decode(response.responseText);
|
|||
//hideMaskEditor();
|
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
} |
|||
|
|||
|
|||
function doMaskOperation( NodeID, Cmd, Mid = 0, LRFID = 0 ){ |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/doMaskOperation.php', |
|||
params: { |
|||
NID: NodeID, |
|||
UID: '<?=$CUser->Data['id'];?>', |
|||
SID: '<?=$Session;?>', |
|||
CMD: Cmd, |
|||
MID: Mid, |
|||
LID: LRFID |
|||
}, |
|||
success: function( response, opts ){ |
|||
load2DMasks( NodeID ); |
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
} |
|||
|
|||
function showMaskEditor( fromDevTool, DevType, NodeID ){ |
|||
//alert( "DevType: "+DevType + " Dev Map size: "+ absDrawMapSizes[DevType][0]+"x"+absDrawMapSizes[DevType][1] );
|
|||
cMapType = DevType; |
|||
//alert( "Scale:"+ window.screen.height +" "+ window.screen.width );
|
|||
if( cMapType == 1 ){ |
|||
deviceMapScaling = ( window.screen.height * window.devicePixelRatio - 130 - ( deviceMapTopShift * 2 )) / absDrawMapSizes[cMapType][1]; |
|||
} else { |
|||
deviceMapScaling = ( window.screen.width * window.devicePixelRatio - 30 - ( deviceMapLeftShift * 2 )) / absDrawMapSizes[cMapType][0]; |
|||
}; |
|||
cMapImageHeight = deviceMapScaling * absDrawMapSizes[cMapType][1]; |
|||
cMapImageWidth = deviceMapScaling * absDrawMapSizes[cMapType][0]; |
|||
cMapCanvasWidth = cMapImageWidth + (deviceMapLeftShift * 2); |
|||
cMapCanvasHeight = cMapImageHeight + (deviceMapTopShift * 2); |
|||
//alert( "Scale:"+ deviceMapScaling );
|
|||
if( fromDevTool ){ |
|||
detectionProfileWindow.hide(); |
|||
}; |
|||
if( |
|||
document.fullscreenElement || |
|||
document.webkitFullscreenElement || |
|||
document.mozFullScreenElement || |
|||
document.msFullscreenElement |
|||
){ |
|||
//fs mode allready
|
|||
hideMaskEditor(); |
|||
}else{ |
|||
if( maskEditorDiv == null ){ |
|||
maskEditorDiv = document.createElement("div"); |
|||
maskEditorDiv.style.height="200px"; |
|||
maskEditorDiv.style.width="200px"; |
|||
maskEditorDiv.style.position="relative"; |
|||
//var svg = document.getElementById('draw_svg_'+parseInt( NodeID ) );
|
|||
//var svgCode = window.btoa(svg.outerHTML);
|
|||
//maskEditorDiv.style.background = "url(data:image/svg+xml;base64," + svgCode + ")";
|
|||
//maskEditorDiv.style.background = 'solid red;';
|
|||
//maskEditorDiv.style.backgroundImage = "url('style/wicons/011.png')";
|
|||
//append div as a child to body
|
|||
document.body.appendChild( maskEditorDiv ); |
|||
//var elem = document.createElement("img"); 'getDeviceMap.php?NID='+NodeID
|
|||
//elem.setAttribute("src", "/lib/controller/data/device_draws/75c85fec4be204fc0bc0452f53b5a3df_map.png");
|
|||
//elem.setAttribute("height", "80%");
|
|||
//elem.setAttribute("width", "130");
|
|||
//maskEditorDiv.appendChild( elem );
|
|||
//alert( window.screen.width * window.devicePixelRatio + "x" + window.screen.height * window.devicePixelRatio);
|
|||
if( MEPanel == null ){ |
|||
var ww = window.screen.width * window.devicePixelRatio; |
|||
var hh = window.screen.height * window.devicePixelRatio; |
|||
MEPanel = new Ext.Panel( { |
|||
title: 'Mask Editor', |
|||
renderTo: maskEditorDiv, |
|||
width: ww, |
|||
height: hh, |
|||
frame: true, |
|||
autoScroll: true, |
|||
items:[{ |
|||
xtype: 'panel', |
|||
width: cMapCanvasWidth, |
|||
//html: '<div id=\'popomas\' style="display: block; width: '+cMapCanvasWidth+'px; height: '+cMapCanvasHeight+ 'px; background: orange; background-position-x: '+deviceMapLeftShift+'px; background-position-y: '+deviceMapTopShift+'px; background-size: '+cMapImageWidth+'px '+cMapImageHeight+'px; background-image: url(\'/lib/controller/getDeviceDraw.php?MAP=1&NID='+NodeID+'\'); background-repeat: no-repeat; z-index:10;"><canvas id="mask_canvas" width="'+cMapCanvasWidth+'px" height="'+cMapCanvasHeight+'px"></canvas></dvi>',
|
|||
html: '<div id="popomas" style="display: block; width: '+cMapCanvasWidth+'px; height: '+cMapCanvasHeight+ 'px; position: relative; top:0; left:0; z-index: 1000;"><canvas id="mask_canvas" width="'+cMapCanvasWidth+'px" height="'+cMapCanvasHeight+'px"></canvas></div><div id="baka" style="background:orange;display:block;width: '+cMapCanvasWidth+'px; height: '+cMapCanvasHeight+ 'px; position:absolute;top:0; left:0; z-index:0;"><svg id="draw_svg_me" opacity="1.0" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="'+cMapImageWidth+'" height="'+cMapImageHeight+'" version="1.1" style="position: relative; top:'+deviceMapTopShift+'px; left:'+deviceMapLeftShift+'px; z-index:0; 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"><defs><clipPath id="me_mask"><circle cx="287" cy="287" r="284"/></clipPath></defs><circle fill="#00A859" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><line fill="none" stroke="#FFF212" stroke-width="1" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="1" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="1" cx="287" cy="287" r="284"/></svg></div>', |
|||
listeners:{ |
|||
afterrender: function(){ |
|||
//Doing a custom svg here for background!
|
|||
var chicha = document.getElementById( 'popomas' ); |
|||
var cSensor = getSensorByNodeId( NodeID ); |
|||
if( cSensor!= null ){ |
|||
ME_max_range = cSensor.max_range; |
|||
} else { |
|||
ME_max_range = 100; |
|||
}; |
|||
//var svg = document.getElementById('draw_svg_'+parseInt( NodeID ) );
|
|||
//var svgCode = window.btoa(svg.outerHTML);
|
|||
//chicha.style.backgroundImage = "url(data:image/svg+xml;base64," + svgCode + ")";
|
|||
//chicha.style.backgroundImage = "url('style/wicons/011.png')";
|
|||
$("#mask_canvas").mousemove( onMouseMove ); |
|||
MaskEditorActive = true; |
|||
MaskEditorDevice = NodeID; |
|||
loadMaskEditorDraw( MaskEditorDevice ); |
|||
} |
|||
} |
|||
}], |
|||
tbar:[{ |
|||
text:'New Polygone', |
|||
id: 'me_b_newp', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_topbar_grp', |
|||
pressed: false, |
|||
handler: function( btn ){ |
|||
if( btn.pressed ) setMaskEditorMode( 0 ); |
|||
} |
|||
},{ |
|||
text:'Clear Mask', |
|||
id: 'me_b_delm', |
|||
handler: function(){ |
|||
if( MaskProject!= null ){ |
|||
doMaskOperation( NodeID, 3, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
setMaskEditorMode( 0 ); |
|||
} |
|||
},{ |
|||
text:'1', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_maskbar_grp', |
|||
pressed: (cMaskID == 0 ), |
|||
handler: function(){ |
|||
if( cMaskID != 0 ){ |
|||
SaveCurrentMask( NodeID, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
cMaskID = 0; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
} |
|||
},{ |
|||
text:'2', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_maskbar_grp', |
|||
pressed: ( cMaskID == 1 ), |
|||
handler: function(){ |
|||
if( cMaskID != 1 ){ |
|||
SaveCurrentMask( NodeID, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
cMaskID = 1; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
} |
|||
},{ |
|||
text:'3', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_maskbar_grp', |
|||
pressed: ( cMaskID == 2 ), |
|||
handler: function(){ |
|||
if( cMaskID != 2 ){ |
|||
SaveCurrentMask( NodeID, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
cMaskID = 2; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
} |
|||
},{ |
|||
text:'4', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_maskbar_grp', |
|||
pressed: ( cMaskID == 3 ), |
|||
handler: function(){ |
|||
if( cMaskID != 3 ){ |
|||
SaveCurrentMask( NodeID, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
cMaskID = 3; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
} |
|||
},{ |
|||
text:'5', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_maskbar_grp', |
|||
pressed: ( cMaskID == 4 ), |
|||
handler: function(){ |
|||
if( cMaskID != 4 ){ |
|||
SaveCurrentMask( NodeID, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
cMaskID = 4; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
} |
|||
},{ |
|||
text:'Acknowladge Mask', |
|||
enableToggle: true, |
|||
toggleGroup: 'me_maskbar_grp', |
|||
pressed: ( cMaskID == 5 ), |
|||
handler: function(){ |
|||
if( cMaskID != 5 ){ |
|||
SaveCurrentMask( NodeID, cMaskID ); |
|||
}; |
|||
MaskProject = new paper.Project( canvas ); |
|||
paper.view.draw(); |
|||
cMaskID = 5; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
} |
|||
},'->',{ |
|||
xtype: 'panel', |
|||
frame: 'false', |
|||
id: 'me_coords_panel', |
|||
border: true, |
|||
width: 230, |
|||
height: 30, |
|||
html: '<p style="color: white;"></p>' |
|||
}], |
|||
buttons:[{ |
|||
text: 'Cancel', |
|||
handler: function(){ |
|||
hideMaskEditor(); |
|||
} |
|||
},{ |
|||
text:'Save Mask and Close', |
|||
handler: function(){ |
|||
var serial = MaskProject.exportJSON(); |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/uploadDeviceMask.php', |
|||
params: { |
|||
NID: NodeID, |
|||
UID: '<?=$CUser->Data['id'];?>', |
|||
SID: '<?=$Session;?>', |
|||
MID: cMaskID, |
|||
LID: 0, |
|||
MDTA: serial, |
|||
MIH: cMapImageHeight, |
|||
MIW: cMapImageWidth, |
|||
//MSF: deviceMapScaling,
|
|||
MSHX: deviceMapLeftShift, |
|||
MSHY: deviceMapTopShift, |
|||
DSTD: 0 |
|||
}, |
|||
success: function( response, opts ){ |
|||
var data = Ext.decode(response.responseText); |
|||
hideMaskEditor(); |
|||
load2DMasks( NodeID ); |
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
} |
|||
}] |
|||
}); |
|||
}; |
|||
MEPanel.doLayout(); |
|||
//if( MaskProject == null ){
|
|||
var canvas = document.getElementById('mask_canvas'); |
|||
paper.settings.handleSize = 10; |
|||
MaskProject = new paper.Project( canvas ); |
|||
//canvas.addEventListener( 'mousemove', onMaskMouseMove );
|
|||
canvas.addEventListener( 'mousedown', onMaskMouseDown ); |
|||
//canvas.addEventListener( 'mouseup', onMaskMouseUp );
|
|||
//canvas.addEventListener( 'mousedrag', onMaskMouseMove );
|
|||
//};
|
|||
cMaskID = 0; |
|||
loadDeviceMask( NodeID, cMaskID ); |
|||
}; |
|||
//maskEditorDiv = $('#container').get(0);
|
|||
//var maskEditorDiv = document.getElementById( id ); //Ext.getCmp( id );
|
|||
if( maskEditorDiv.requestFullscreen ){ |
|||
maskEditorDiv.requestFullscreen(); |
|||
}else if( maskEditorDiv.mozRequestFullScreen ){ |
|||
maskEditorDiv.mozRequestFullScreen(); |
|||
}else if( maskEditorDiv.webkitRequestFullscreen ){ |
|||
maskEditorDiv.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); |
|||
}else if( maskEditorDiv.msRequestFullscreen ){ |
|||
maskEditorDiv.msRequestFullscreen(); |
|||
}; |
|||
document.addEventListener( 'fullscreenchange', handleFSMaskEditorClose ); |
|||
}; |
|||
}; |
|||
|
|||
function loadMaskEditorDraw( a ){ |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/getDeviceDraw.php', |
|||
params: { |
|||
UID: <?=$UserID;?>, |
|||
SID: '<?=$Session;?>', |
|||
NID: a |
|||
}, |
|||
success: function( response, opts ){ |
|||
var data = Ext.decode(response.responseText); |
|||
if( data.count > 0 ){ |
|||
//draws_2d[a] = data.data;
|
|||
var csvg = document.getElementById( 'draw_svg_me' ); |
|||
|
|||
if( csvg != undefined ){ |
|||
var draw = csvg.getElementById( "draw" ); |
|||
if( draw != null ) csvg.removeChild( draw ); |
|||
|
|||
var p2 = 2.0*Math.PI; |
|||
var so = 0;//-10 * p2 / 360.0;
|
|||
|
|||
var bBox = csvg.getBBox(); |
|||
var newpath = document.createElementNS('http://www.w3.org/2000/svg', "polygon"); |
|||
var ak = 2.0*Math.PI/draws_2d[a].length; |
|||
var cpx = 4+bBox.width / 2.0 -1; |
|||
var cpy = 4+bBox.height / 2.0-1; |
|||
var mr = ( bBox.width - 4.0 ) / 2.0; |
|||
var max = 1024; |
|||
//switch( drawZoomLevels[a] ){
|
|||
// case 50: max = 512; break;
|
|||
// case 25: max = 256; break;
|
|||
// case 12: max = 128; break;
|
|||
//};
|
|||
var rk = mr / max; |
|||
var pp = ''; |
|||
var jj = ''; |
|||
for( i=0;i<data.data.length;i++){ |
|||
var cc = Math.cos( p2 - ak * i - so ); |
|||
var cs = Math.sin( p2 - ak * i - so ); |
|||
za = cpx + mr * cc; |
|||
zb = cpy + mr * cs; |
|||
if( data.data[i].M == 0 ){ |
|||
x = za; y = zb; |
|||
} else { |
|||
if( data.data[i].M < max ){ |
|||
x = cpx + data.data[i].M * rk * cc; |
|||
y = cpy + data.data[i].M * rk * cs; |
|||
} else { |
|||
x = za; y = zb; |
|||
}; |
|||
}; |
|||
pp += ' '+za+','+zb; |
|||
jj += ' '+x+','+y; |
|||
}; |
|||
pp += jj; |
|||
newpath.setAttributeNS(null, "points", pp ); |
|||
newpath.setAttributeNS(null, "fill", "#F44B94" ); |
|||
newpath.setAttributeNS(null, "fill-opacity", "0.4"); |
|||
newpath.setAttributeNS(null, "id", "draw" ); |
|||
csvg.appendChild( newpath ); |
|||
/* |
|||
// Centre point
|
|||
var dr = csvg.getElementById( "CE_PE" ); |
|||
if( dr != null ) csvg.removeChild( dr ); |
|||
var CE_PE = document.createElementNS('http://www.w3.org/2000/svg', "polygon"); |
|||
CE_PE.setAttributeNS(null, "points", ''+(cpx-3)+','+(cpy-3)+','+(cpx+3)+','+(cpy-3)+','+(cpx+3)+','+(cpy+3)+','+(cpx-3)+','+(cpy+3) ); |
|||
CE_PE.setAttributeNS(null, "fill", "#FF0000" ); |
|||
CE_PE.setAttributeNS(null, "fill-opacity", "1.0"); |
|||
CE_PE.setAttributeNS(null, "id", "CE_PE" ); |
|||
csvg.appendChild( CE_PE ); |
|||
*/ |
|||
}; |
|||
}; |
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
}; |
|||
|
|||
function setMaskEditorMode( nM ){ |
|||
switch( nM ){ |
|||
case 0:{ |
|||
var MEP = Ext.getCmp('me_b_newp'); |
|||
if( !MEP.pressed ) MEP.toggle( true ); |
|||
var caca = document.getElementById('mask_canvas'); |
|||
caca.style.cursor = 'crosshair'; |
|||
break; |
|||
}; |
|||
case 1:{ |
|||
var MEP = Ext.getCmp('me_b_newp'); |
|||
if( !MEP.pressed ) MEP.toggle( false ); |
|||
//MEP = Ext.getCmp('me_b_delp');
|
|||
//if( !MEP.pressed ) MEP.toggle( false );
|
|||
//MEP = Ext.getCmp('me_b_delpo');
|
|||
//if( !MEP.pressed ) MEP.toggle( false );
|
|||
if( MaskProject!= null ){ |
|||
if( MaskProject.isEmpty() ){ |
|||
//MEP = Ext.getCmp('me_b_delp');
|
|||
//MEP.disable();
|
|||
//MEP = Ext.getCmp('me_b_delpo');
|
|||
//MEP.disable();
|
|||
MEP = Ext.getCmp('me_b_delm'); |
|||
MEP.disable(); |
|||
setMaskEditorMode( 0 ); |
|||
} else { |
|||
//MEP = Ext.getCmp('me_b_delp');
|
|||
//MEP.enable();
|
|||
//MEP = Ext.getCmp('me_b_delpo');
|
|||
//MEP.enable();
|
|||
MEP = Ext.getCmp('me_b_delm'); |
|||
MEP.enable(); |
|||
}; |
|||
}; |
|||
var caca = document.getElementById('mask_canvas'); |
|||
caca.style.cursor = 'default'; |
|||
break; |
|||
}; |
|||
case 2:{ |
|||
//var MEP = Ext.getCmp('me_b_delp');
|
|||
//if( !MEP.pressed ) MEP.toggle( true );
|
|||
break; |
|||
}; |
|||
case 3:{ |
|||
//var MEP = Ext.getCmp('me_b_delpo');
|
|||
//if( !MEP.pressed ) MEP.toggle( true );
|
|||
break; |
|||
}; |
|||
case 4:{ |
|||
|
|||
}; |
|||
}; |
|||
MaskEditorMode = nM; |
|||
}; |
|||
|
|||
function loadDeviceMask( NodeID, LayerID = 0, LrfID = 0 ){ |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/getDeviceMask.php', |
|||
params: { |
|||
NID: NodeID, |
|||
UID: '<?=$CUser->Data['id'];?>', |
|||
SID: '<?=$Session;?>', |
|||
MID: LayerID, |
|||
LID: LrfID |
|||
}, |
|||
success: function( response, opts ){ |
|||
var data = Ext.decode(response.responseText); |
|||
|
|||
if( data.length > 0 ){ |
|||
for( i = 0; i < data.length; i++ ){ |
|||
//var
|
|||
path = new paper.Path(); |
|||
path.strokeColor = 'black'; |
|||
//var lightness = (Math.random() - 0.5) * 0.4 + 0.4;
|
|||
//var hue = Math.random() * 360;
|
|||
//path.fillColor = { hue: hue, saturation: 1, lightness: lightness };
|
|||
path.fillColor = data[i].colour; |
|||
path.closed = true; |
|||
path.opacity = 0.5; |
|||
//path.onMouseMove = onPathMouseMove;
|
|||
path.onMouseDown = onMouseDown; |
|||
path.onMouseDrag = onMouseDrag; |
|||
//path.onMouseUp = function( event ){
|
|||
// path.add(event.point);
|
|||
//}
|
|||
if( data[i].points.length > 2 ){ |
|||
if( cMapType == 1 ){ |
|||
var tX = data[i].points[0][0] * deviceMapScaling + deviceMapLeftShift; |
|||
var tY = data[i].points[0][1] * deviceMapScaling + deviceMapTopShift; |
|||
path.moveTo( [tX,tY] ); |
|||
for(k = 1; k < data[i].points.length; k++ ){ |
|||
tX = data[i].points[k][0] * deviceMapScaling + deviceMapLeftShift; |
|||
tY = data[i].points[k][1] * deviceMapScaling + deviceMapTopShift; |
|||
path.lineTo( [tX,tY] ); |
|||
}; |
|||
} else { |
|||
var tX = ( 2047 + parseInt( data[i].points[0][0]) ) * deviceMapScaling + deviceMapLeftShift; |
|||
var tY = ( 2047 + parseInt( data[i].points[0][1]) ) * deviceMapScaling + deviceMapTopShift; |
|||
path.moveTo( [tX,tY] ); |
|||
for(k = 1; k < data[i].points.length; k++ ){ |
|||
tX = ( 2047 + parseInt(data[i].points[k][0]) ) * deviceMapScaling + deviceMapLeftShift; |
|||
tY = ( 2047 + parseInt(data[i].points[k][1]) ) * deviceMapScaling + deviceMapTopShift; |
|||
path.lineTo( [tX,tY] ); |
|||
}; |
|||
}; |
|||
path.fullySelected = true; |
|||
paper.view.draw(); |
|||
}; |
|||
poligones.push(path); |
|||
setMaskEditorMode( 4 ); |
|||
}; |
|||
} else { |
|||
setMaskEditorMode( 0 ); |
|||
}; |
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
}; |
|||
|
|||
function onMaskMouseDown( evt ){ |
|||
switch( MaskEditorMode ){ |
|||
case 0:{ |
|||
path = new paper.Path(); |
|||
path.strokeColor = 'black'; |
|||
path.fillColor = '#ff8020'; |
|||
path.onMouseDown = onMouseDown; |
|||
path.onMouseDrag = onMouseDrag; |
|||
//path.onMouseMove = onPathMouseMove;
|
|||
path.fullySelected = true; |
|||
path.closed = true; |
|||
path.opacity = 0.5; |
|||
path.moveTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] ); |
|||
setMaskEditorMode( 1 ); |
|||
break; |
|||
}; |
|||
case 1:{ |
|||
path.lineTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] ); |
|||
if( path.segments.length == 3 ){ |
|||
setMaskEditorMode( 4 ); |
|||
}; |
|||
}; |
|||
}; |
|||
//if( MaskEditorMode == 0 ){
|
|||
//
|
|||
//} else {
|
|||
// path.lineTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] );
|
|||
//};
|
|||
}; |
|||
|
|||
function onMaskMouseUp( evt ){ |
|||
if( MaskEditorMode == 4 ){ |
|||
//path.lineTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] );
|
|||
path.fullySelected = true; |
|||
path.onMouseDown = onMouseDown; |
|||
path.onMouseDrag = onMouseDrag; |
|||
//path.onMouseMove = onPathMouseMove;
|
|||
paper.view.draw(); |
|||
//poligones.push( path );
|
|||
setMaskEditorMode( 1 ); |
|||
}; |
|||
}; |
|||
|
|||
function onMaskMouseMove( event ){ |
|||
if( MaskEditorMode == 4 ){ |
|||
//paper.view.draw();
|
|||
}; |
|||
}; |
|||
@ -0,0 +1,188 @@ |
|||
//<?php require_once('../../js_asm.php'); ?>
|
|||
|
|||
var mWindowID = <?=(isset($_GET['w']))?intval($_GET['w']):0;?>; |
|||
var mAuxWindows = []; |
|||
|
|||
function isMasterWindow(){ |
|||
var cWindowSessionID = window.localStorage.getItem("cWindowSID"); |
|||
if( cWindowSessionID == undefined ){ |
|||
window.localStorage.clear(); |
|||
window.localStorage.setItem("cWindowSID", '<?=$Session;?>' ); |
|||
} else { |
|||
if( cWindowSessionID != '<?=$Session;?>' ){ |
|||
window.localStorage.clear(); |
|||
window.localStorage.setItem("cWindowSID", '<?=$Session;?>' ); |
|||
} else { |
|||
|
|||
return false; |
|||
}; |
|||
}; |
|||
return true; |
|||
}; |
|||
|
|||
function refreshAuxWindows(){ |
|||
|
|||
}; |
|||
function closeAuxWindows(){ |
|||
|
|||
}; |
|||
function isFullScreen() { |
|||
return document.fullscreenElement !== null; |
|||
} |
|||
|
|||
let previousX = window.screenX; |
|||
let previousY = window.screenY; |
|||
|
|||
setInterval(() => { |
|||
const currentX = window.screenX; |
|||
const currentY = window.screenY; |
|||
if (currentX !== previousX || currentY !== previousY) { |
|||
// Window has moved
|
|||
console.log("Window moved!"); |
|||
console.log("New Position X:", currentX, "Y:", currentY); |
|||
previousX = currentX; |
|||
previousY = currentY; |
|||
} |
|||
}, 700); // Check every 700 milliseconds
|
|||
|
|||
/* |
|||
if (!('getScreenDetails' in window)) { |
|||
// Returning a one-element array with the current screen,
|
|||
// noting that there might be more.
|
|||
window.getScreenDetails = async () => [window.screen]; |
|||
// Set to `false`, noting that this might be a lie.
|
|||
window.screen.isExtended = false; |
|||
} |
|||
*/ |
|||
async function getDisplayInfo() { |
|||
if (window.screen.isExtended) { |
|||
console.log("Multiple displays detected."); |
|||
} else { |
|||
console.log("Single display detected."); |
|||
} |
|||
|
|||
if ('getScreenDetails' in window) { |
|||
try { |
|||
const screenDetails = await window.getScreenDetails(); |
|||
screenDetails.screens.forEach((screen, index) => { |
|||
console.log(`Display ${index + 1}:`); |
|||
console.log(` Width: ${screen.width}`); |
|||
console.log(` Height: ${screen.height}`); |
|||
console.log(` Left: ${screen.left}`); |
|||
console.log(` Top: ${screen.top}`); |
|||
}); |
|||
} catch (error) { |
|||
console.error("Error getting screen details:", error); |
|||
} |
|||
} else { |
|||
console.log("window.getScreenDetails() is not supported."); |
|||
console.log(`Display 0:`); |
|||
console.log(` Width: ${window.screen.width}`); |
|||
console.log(` Height: ${window.screen.height}`); |
|||
console.log(` Left: ${window.screen.left}`); |
|||
console.log(` Top: ${window.screen.top}`); |
|||
} |
|||
}; |
|||
|
|||
function doCheckWindowSize(){ |
|||
//var zz = window.getScreenDetails();
|
|||
|
|||
if ('getScreenDetails' in window) { |
|||
screenDetails = window.getScreenDetails(); |
|||
screenDetails.addEventListener('screenschange', (event) => { |
|||
if (screenDetails.screens.length !== currentScreenLength) { |
|||
currentScreenLength = screenDetails.screens.length; |
|||
//updateScreenInfo();
|
|||
} |
|||
}); |
|||
try { |
|||
permission = |
|||
((navigator.permissions.query({ name: 'window-management' })).state === 'granted') |
|||
? 'Granted' |
|||
: 'No Permission'; |
|||
} catch (err) { |
|||
console.error(err); |
|||
} |
|||
currentScreenLength = screenDetails.screens.length; |
|||
//updateScreenInfo();
|
|||
} else { |
|||
screenDetails = window.screen; |
|||
permission = 'Window Management API - NOT SUPPORTED'; |
|||
currentScreenLength = 1; |
|||
//updateScreenInfo();
|
|||
}; |
|||
|
|||
getDisplayInfo(); |
|||
|
|||
if( isMasterWindow() ){ |
|||
//window.open('/?w=1', 'app_second', 'location=0,menubar=0,status=0,titlebar=0,toolbar=0,left=20,top=20,width=' + screen.availWidth + ',height=' + screen.availHeight);
|
|||
if (parseInt(navigator.appVersion)>3) { |
|||
if (navigator.appName=="Netscape") { |
|||
winW2 = window.innerWidth; |
|||
winH2 = window.innerHeight; |
|||
if ( winH2<700 ) winH2=700; |
|||
}; |
|||
if (navigator.appName.indexOf("Microsoft")!=-1) { |
|||
winW2 = document.body.offsetWidth; |
|||
winH2 = document.body.offsetHeight; |
|||
if ( winH2<700 ) winH2=700; |
|||
}; |
|||
}; |
|||
if ( winW2 != winW || winH2!=winH ){ |
|||
updateUserScreenResolution( winW2, winH2 ); |
|||
}; |
|||
} else { |
|||
//requestBodyFullscreen();
|
|||
//alert( "AUX Window:"+mWindowID );
|
|||
}; |
|||
}; |
|||
function requestBodyFullscreen() { |
|||
const body = document.body; |
|||
if (body.requestFullscreen) { |
|||
body.requestFullscreen(); |
|||
} else if (body.mozRequestFullScreen) { /* Firefox */ |
|||
body.mozRequestFullScreen(); |
|||
} else if (body.webkitRequestFullscreen) { /* Chrome, Safari, Opera */ |
|||
body.webkitRequestFullscreen(); |
|||
} else if (body.msRequestFullscreen) { /* IE/Edge */ |
|||
body.msRequestFullscreen(); |
|||
} |
|||
}; |
|||
function exitBodyFullscreen() { |
|||
if (document.exitFullscreen) { |
|||
document.exitFullscreen(); |
|||
} else if (document.mozCancelFullScreen) { /* Firefox */ |
|||
document.mozCancelFullScreen(); |
|||
} else if (document.webkitExitFullscreen) { /* Chrome, Safari, Opera */ |
|||
document.webkitExitFullscreen(); |
|||
} else if (document.msExitFullscreen) { /* IE/Edge */ |
|||
document.msExitFullscreen(); |
|||
} |
|||
}; |
|||
|
|||
function initMultiWindows(){ |
|||
return; |
|||
document.addEventListener('fullscreenchange', function() { |
|||
if (isFullScreen()) { |
|||
console.log("Fullscreen mode activated."); |
|||
} else { |
|||
console.log("Fullscreen mode deactivated."); |
|||
} |
|||
}); |
|||
document.addEventListener("fullscreenerror", (event) => { |
|||
console.log("Fullscreen Error."); |
|||
}); |
|||
if( mWindowID == 0 ){ |
|||
|
|||
} else { |
|||
//Unreg Windows
|
|||
mAuxWindows = undefined; |
|||
|
|||
window.addEventListener('beforeunload', function(event) { |
|||
console.log("BeforeUnload Woerks!"); |
|||
//event.preventDefault();
|
|||
//event.returnValue = null;
|
|||
}); |
|||
}; |
|||
doCheckWindowSize(); |
|||
}; |
|||
@ -0,0 +1,239 @@ |
|||
/*! |
|||
* Ext JS Library 3.3.1 |
|||
* Copyright(c) 2006-2010 Sencha Inc. |
|||
* licensing@sencha.com |
|||
* http://www.sencha.com/license
|
|||
*/ |
|||
Ext.ux.Portal = Ext.extend(Ext.Panel, { |
|||
layout : 'column', |
|||
autoScroll : true, |
|||
cls : 'x-portal', |
|||
defaultType : 'portalcolumn', |
|||
|
|||
initComponent : function(){ |
|||
Ext.ux.Portal.superclass.initComponent.call(this); |
|||
this.addEvents({ |
|||
validatedrop:true, |
|||
beforedragover:true, |
|||
dragover:true, |
|||
beforedrop:true, |
|||
drop:true |
|||
}); |
|||
}, |
|||
|
|||
initEvents : function(){ |
|||
Ext.ux.Portal.superclass.initEvents.call(this); |
|||
this.dd = new Ext.ux.Portal.DropZone(this, this.dropConfig); |
|||
}, |
|||
|
|||
beforeDestroy : function() { |
|||
if(this.dd){ |
|||
this.dd.unreg(); |
|||
} |
|||
Ext.ux.Portal.superclass.beforeDestroy.call(this); |
|||
} |
|||
}); |
|||
|
|||
Ext.reg('portal', Ext.ux.Portal); |
|||
|
|||
Ext.ux.Portal.DropZone = Ext.extend(Ext.dd.DropTarget, { |
|||
|
|||
constructor : function(portal, cfg){ |
|||
this.portal = portal; |
|||
Ext.dd.ScrollManager.register(portal.body); |
|||
Ext.ux.Portal.DropZone.superclass.constructor.call(this, portal.bwrap.dom, cfg); |
|||
portal.body.ddScrollConfig = this.ddScrollConfig; |
|||
}, |
|||
|
|||
ddScrollConfig : { |
|||
vthresh: 50, |
|||
hthresh: -1, |
|||
animate: true, |
|||
increment: 200 |
|||
}, |
|||
|
|||
createEvent : function(dd, e, data, col, c, pos){ |
|||
return { |
|||
portal: this.portal, |
|||
panel: data.panel, |
|||
columnIndex: col, |
|||
column: c, |
|||
position: pos, |
|||
data: data, |
|||
source: dd, |
|||
rawEvent: e, |
|||
status: this.dropAllowed |
|||
}; |
|||
}, |
|||
|
|||
notifyOver : function(dd, e, data){ |
|||
var xy = e.getXY(), portal = this.portal, px = dd.proxy; |
|||
|
|||
// case column widths
|
|||
if(!this.grid){ |
|||
this.grid = this.getGrid(); |
|||
} |
|||
|
|||
// handle case scroll where scrollbars appear during drag
|
|||
var cw = portal.body.dom.clientWidth; |
|||
if(!this.lastCW){ |
|||
this.lastCW = cw; |
|||
}else if(this.lastCW != cw){ |
|||
this.lastCW = cw; |
|||
portal.doLayout(); |
|||
this.grid = this.getGrid(); |
|||
} |
|||
|
|||
// determine column
|
|||
var col = 0, xs = this.grid.columnX, cmatch = false; |
|||
for(var len = xs.length; col < len; col++){ |
|||
if(xy[0] < (xs[col].x + xs[col].w)){ |
|||
cmatch = true; |
|||
break; |
|||
} |
|||
} |
|||
// no match, fix last index
|
|||
if(!cmatch){ |
|||
col--; |
|||
} |
|||
|
|||
// find insert position
|
|||
var p, match = false, pos = 0, |
|||
c = portal.items.itemAt(col), |
|||
items = c.items.items, overSelf = false; |
|||
|
|||
for(var len = items.length; pos < len; pos++){ |
|||
p = items[pos]; |
|||
var h = p.el.getHeight(); |
|||
if(h === 0){ |
|||
overSelf = true; |
|||
} |
|||
else if((p.el.getY()+(h/2)) > xy[1]){ |
|||
match = true; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
pos = (match && p ? pos : c.items.getCount()) + (overSelf ? -1 : 0); |
|||
var overEvent = this.createEvent(dd, e, data, col, c, pos); |
|||
|
|||
if(portal.fireEvent('validatedrop', overEvent) !== false && |
|||
portal.fireEvent('beforedragover', overEvent) !== false){ |
|||
|
|||
// make sure proxy width is fluid
|
|||
px.getProxy().setWidth('auto'); |
|||
px.getProxy().colspan = 2; |
|||
//px.getProxy().setHeight(400);
|
|||
if(p){ |
|||
px.moveProxy(p.el.dom.parentNode, match ? p.el.dom : null); |
|||
}else{ |
|||
px.moveProxy(c.el.dom, null); |
|||
} |
|||
|
|||
this.lastPos = {c: c, col: col, p: overSelf || (match && p) ? pos : false}; |
|||
this.scrollPos = portal.body.getScroll(); |
|||
|
|||
portal.fireEvent('dragover', overEvent); |
|||
|
|||
return overEvent.status; |
|||
}else{ |
|||
return overEvent.status; |
|||
} |
|||
|
|||
}, |
|||
|
|||
notifyOut : function(){ |
|||
delete this.grid; |
|||
}, |
|||
|
|||
notifyDrop : function(dd, e, data){ |
|||
delete this.grid; |
|||
if(!this.lastPos){ |
|||
return; |
|||
} |
|||
var c = this.lastPos.c, |
|||
col = this.lastPos.col, |
|||
pos = this.lastPos.p, |
|||
panel = dd.panel, |
|||
dropEvent = this.createEvent(dd, e, data, col, c, |
|||
pos !== false ? pos : c.items.getCount()); |
|||
|
|||
if(this.portal.fireEvent('validatedrop', dropEvent) !== false && |
|||
this.portal.fireEvent('beforedrop', dropEvent) !== false){ |
|||
|
|||
dd.proxy.getProxy().remove(); |
|||
panel.el.dom.parentNode.removeChild(dd.panel.el.dom); |
|||
|
|||
if(pos !== false){ |
|||
c.insert(pos, panel); |
|||
}else{ |
|||
c.add(panel); |
|||
} |
|||
|
|||
c.doLayout(); |
|||
|
|||
this.portal.fireEvent('drop', dropEvent); |
|||
|
|||
// scroll position is lost on drop, fix it
|
|||
var st = this.scrollPos.top; |
|||
if(st){ |
|||
var d = this.portal.body.dom; |
|||
setTimeout(function(){ |
|||
d.scrollTop = st; |
|||
}, 10); |
|||
} |
|||
|
|||
} |
|||
delete this.lastPos; |
|||
}, |
|||
|
|||
// internal cache of body and column coords
|
|||
getGrid : function(){ |
|||
var box = this.portal.bwrap.getBox(); |
|||
box.columnX = []; |
|||
this.portal.items.each(function(c){ |
|||
box.columnX.push({x: c.el.getX(), w: c.el.getWidth()}); |
|||
}); |
|||
return box; |
|||
}, |
|||
|
|||
// unregister the dropzone from ScrollManager
|
|||
unreg: function() { |
|||
Ext.dd.ScrollManager.unregister(this.portal.body); |
|||
Ext.ux.Portal.DropZone.superclass.unreg.call(this); |
|||
} |
|||
}); |
|||
|
|||
/*! |
|||
* Ext JS Library 3.3.1 |
|||
* Copyright(c) 2006-2010 Sencha Inc. |
|||
* licensing@sencha.com |
|||
* http://www.sencha.com/license
|
|||
*/ |
|||
Ext.ux.PortalColumn = Ext.extend(Ext.Container, { |
|||
layout : 'anchor', |
|||
//layout : 'table',
|
|||
//autoEl : 'div',//already defined by Ext.Component
|
|||
defaultType : 'portlet', |
|||
cls : 'x-portal-column' |
|||
}); |
|||
|
|||
Ext.reg('portalcolumn', Ext.ux.PortalColumn); |
|||
|
|||
|
|||
/*! |
|||
* Ext JS Library 3.3.1 |
|||
* Copyright(c) 2006-2010 Sencha Inc. |
|||
* licensing@sencha.com |
|||
* http://www.sencha.com/license
|
|||
*/ |
|||
Ext.ux.Portlet = Ext.extend(Ext.Panel, { |
|||
anchor : '100%', |
|||
frame : true, |
|||
colspan: 2, |
|||
collapsible : true, |
|||
draggable : true, |
|||
cls : 'x-portlet' |
|||
}); |
|||
|
|||
Ext.reg('portlet', Ext.ux.Portlet); |
|||
@ -1 +1 @@ |
|||
20240219 |
|||
20250810 |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue