Browse Source

TT22

master
Evgeny Gagua 3 years ago
parent
commit
5a84adb2e6
  1. 2
      lib/1.json
  2. 9
      lib/controller/addMap.php
  3. 8
      lib/controller/getLocationItems.php
  4. 258
      lib/javascript/jsapi_dynamic/mojo_map.js
  5. BIN
      style/assets/map_mode_decart.png

2
lib/1.json
File diff suppressed because it is too large
View File

9
lib/controller/addMap.php

@ -26,8 +26,8 @@
//$filePath = __DIR__ . DIRECTORY_SEPARATOR . "../../vault/working_dir/uploads";
$filePath = $SYSPath . 'lib/controller/data/assets/images';
if( !file_exists( $filePath ) ){
if (!mkdir($filePath, 0777, true)) {
verbose(0, "Failed to create $filePath" );
if( !mkdir($filePath, 0777, true ) ){
verbose( 0, "Failed to create $filePath" );
};
};
if( file_exists( $_FILES['map_image']['tmp_name'] ) ){
@ -48,14 +48,15 @@
$TB = intval( $_POST['map_tpb'] );
$LB = intval( $_POST['map_lpb'] );
$RB = intval( $_POST['map_rpb'] );
$BB = intval( $_POST['map_bpb'] );
$BB = intval( $_POST['map_bpb'] );
$BM = intval( $_POST['bounds_mode'] );
$K_X = $MA_WI / ( $width - $LB - $RB );
$K_Y = $MA_HE / ( $height - $TB - $BB );
$IBLX = (-$LB)*$K_X;
$IBLY = (-$TB)*$K_Y;
$IBRX = ( $width + $RB ) * $K_X;
$IBRY = ( $height + $BB ) * $K_Y;
$QS = "INSERT INTO `location_maps`(`type`,`name`,`layer_url`,`desc`,`maxNativeZoom`,`maxZoom`,`attribution`,`bounds_lx`,`bounds_ly`,`bounds_rx`,`bounds_ry`) values(2,'{$ENAME}','{$FNAME}','{$EDESC}',{$INZOOM},{$IZOOM},'{$EATTR}',{$IBLX},{$IBLY},{$IBRX},{$IBRY})";
$QS = "INSERT INTO `location_maps`(`type`,`name`,`layer_url`,`desc`,`maxNativeZoom`,`maxZoom`,`attribution`,`bounds_lx`,`bounds_ly`,`bounds_rx`,`bounds_ry`,`bounds_mode`,`img_w`,`img_h`,`img_map_w`,`img_map_h`,`img_lb`,`img_tb`,`img_rb`,`img_bb`) values(2,'{$ENAME}','{$FNAME}','{$EDESC}',{$INZOOM},{$IZOOM},'{$EATTR}',{$IBLX},{$IBLY},{$IBRX},{$IBRY},{$BM},{$width},{$height},{$MA_WI},{$MA_HE},{$LB},{$TB},{$RB},{$BB})";
$DATABASE->Query( $QS );
verbose( 1, "ALL IS OK" );
};

8
lib/controller/getLocationItems.php

@ -48,8 +48,8 @@
$cnode['lat'] = $CC->Lat();
$cnode['lon'] = $CC->Long();
} else {
$cnode['lat'] = $XC + floatval($RV[0]['y']);
$cnode['lon'] = $YC +floatval($RV[0]['x']);
$cnode['lon'] = $XC + floatval($RV[0]['x']);
$cnode['lat'] = $YC + floatval($RV[0]['y']);
};
//if( floatval($RV[0]['x']) == 0 && floatval($RV[0]['y']) == 0 ){
// $cnode['lat'] = $SLAT;
@ -74,8 +74,8 @@
$cnode['lat'] = $CC->Lat();
$cnode['lon'] = $CC->Long();
} else {
$cnode['lat'] = $XC + floatval($RV[0]['y']);
$cnode['lon'] = $YC + floatval($RV[0]['x']);
$cnode['lon'] = $XC + floatval($RV[0]['x']);
$cnode['lat'] = $YC + floatval($RV[0]['y']);
};
$PUPA = true;
break;

258
lib/javascript/jsapi_dynamic/mojo_map.js

@ -84,6 +84,9 @@ function turnAllGzOn(){
if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
};
var cVisible = L.featureGroup( tall );
//window.setTimeout(() => {
// map.flyToBounds( cVisible.getBounds() );
//}, 500);
map.flyToBounds( cVisible.getBounds() );
};
@ -276,7 +279,97 @@ function LoadMapEventsZ( Mode ){
}
});
};
function initMapMonitoring__00(){
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: '&copy; <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: '&copy; <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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; 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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; 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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; 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 &copy; <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: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <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 &copy; <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 &copy; <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 &copy; <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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxNativeZoom: 18,
maxZoom: 24,
}).addTo(map); */
//loadTimeLineGroups( selectedSite );
loadMapZones( 0 );
//getData( 'arch' );
};
function initMapMonitoring(){
var aK = true;
if( MAP_SET.attribution == '' ) aK = false;
@ -300,6 +393,7 @@ function initMapMonitoring(){
maxZoom: 17,*/
keyboard: false
});
map.setView([SiteLat, SiteLon], 17 );
//mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
// attribution: MAP_SET.attribution,
// maxNativeZoom: MAP_SET.maxNativeZoom,
@ -309,10 +403,9 @@ function initMapMonitoring(){
attribution: MAP_SET.attribution,
attributionControl: false,
maxNativeZoom: MAP_SET.maxNativeZoom,
minZoom: 0,
//minZoom: 0,
maxZoom: MAP_SET.maxZoom
}).addTo( map );
//map.setView([SiteLat, SiteLon], 17 );
} else {
map = L.map( 'event_map',{
crs: L.CRS.Simple,
@ -357,6 +450,7 @@ function initMapReporting(){
maxZoom: 17,*/
keyboard: false
});
map.setView([SiteLat, SiteLon], 17 );
//mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
// attribution: MAP_SET.attribution,
// maxNativeZoom: MAP_SET.maxNativeZoom,
@ -369,7 +463,6 @@ function initMapReporting(){
minZoom: 0,
maxZoom: MAP_SET.maxZoom
}).addTo( map );
//map.setView([SiteLat, SiteLon], 17 );
} else {
map = L.map( 'report_map',{
crs: L.CRS.Simple,
@ -391,98 +484,6 @@ function initMapReporting(){
loadMapZones( 0 );
};
function initMapMonitoring_00(){
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: '&copy; <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: '&copy; <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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; 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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; 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 &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; 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 &copy; <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: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <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 &copy; <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 &copy; <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 &copy; <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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxNativeZoom: 18,
maxZoom: 24,
}).addTo(map); */
//loadTimeLineGroups( selectedSite );
loadMapZones( 0 );
//getData( 'arch' );
};
var iconSaver = null;
var markerSaver = null;
@ -1300,8 +1301,8 @@ function createNewMap(){
if( mapCreatorWindow == null ){
mapCreatorWindow = new Ext.Window({
width: 800,
height: 440,
title: 'Creeate Custom Map',
height: 540,
title: '<?=$Labels->GetLabel('_CREATE_CUSTOM_MAP_');?>',
modal: true,
frame: true,
border: false,
@ -1316,7 +1317,7 @@ function createNewMap(){
id: 'map_map_frm',
labelWidth: 250,
labelAlign: 'right',
height: 350,
height: 450,
items:[{
xtype: 'textfield',
fieldLabel: '<?=$Labels->GetLabel('_NAME_MAP_');?>',
@ -1381,7 +1382,7 @@ function createNewMap(){
title: '<?=$Labels->GetLabel('_LOCAL_PIC_MAP_');?>',
id: 'map_pic_frm',
fileUpload: true,
height: 350,
height: 450,
//autoHeight: true,
//bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 250,
@ -1480,17 +1481,47 @@ function createNewMap(){
},{
xtype: 'numberfield',
fieldLabel: '<?=$Labels->GetLabel('_MAP_WIDTH_');?>',
name: 'map_width',
name: 'map_height',
decimalPrecision: 2,
value: 1000.00,
width: 540,
},{
xtype: 'numberfield',
fieldLabel: '<?=$Labels->GetLabel('_MAP_HEIGHT_');?>',
name: 'map_heigth',
name: 'map_width',
decimalPrecision: 2,
value: 1000.00,
width: 540,
},{
xtype: 'panel',
frame: false,
border: false,
layout: 'table',
layoutConfig: {
columns: 5
},
items:[{
xtype: 'spacer',
width: 250,
html: '<p style="text-align:right; margin-right: 5px;"><?=$Labels->GetLabel('_MAP_CENTER_MODE_');?>:</p>'
},{
xtype: 'radio',
name: 'bounds_mode',
value: 0,
checked: 1,
fieldLabel: '',
},{
width: 80,
html: '<img src="/style/assets/cust_map_cord_sys-0.png">'
},{
xtype: 'radio',
name: 'bounds_mode',
checked: 0,
value: 1,
fieldLabel: '',
},{
html: '<img src="/style/assets/cust_map_cord_sys-1.png">'
}]
}]
}]
}],
@ -1499,7 +1530,7 @@ function createNewMap(){
handler: function(){
//Ext.getCmp('map_map_frm').getForm().reset();
//Ext.getCmp('map_pic_frm').getForm().reset();
mapCreatorEditorWindow.destroy();
mapCreatorWindow.destroy();
}
},{
text: '<?=$Labels->GetLabel('_CREATE_NEW_LBL_');?>',
@ -1513,7 +1544,8 @@ function createNewMap(){
encoding: 'multipart/form-data',
success: function(fp, o){
//msg('Success', 'Processed file "'+o.result.file+'" on the server');
alert('Processed file on the server');
//alert('Processed file on the server');
mapCreatorWindow.destroy();
}
});
};
@ -1525,7 +1557,8 @@ function createNewMap(){
encoding: 'multipart/form-data',
success: function(fp, o){
//msg('Success', 'Processed file "'+o.result.file+'" on the server');
alert('Processed file on the server');
//alert('Processed file on the server');
mapCreatorWindow.destroy();
}
});
};
@ -1534,7 +1567,7 @@ function createNewMap(){
}],
listeners:{
beforedestroy: function(){
mapCreatorEditorWindow = null;
mapCreatorWindow = null;
}
}
});
@ -1649,7 +1682,8 @@ function editCurrentMap(){
encoding: 'multipart/form-data',
success: function(fp, o){
//msg('Success', 'Processed file "'+o.result.file+'" on the server');
alert('Processed file on the server');
//alert('Processed file on the server');
mapEditorWindow.destroy();
}
});
};
@ -1660,8 +1694,8 @@ function editCurrentMap(){
waitMsg: 'Uploading Image...',
encoding: 'multipart/form-data',
success: function(fp, o){
//msg('Success', 'Processed file "'+o.result.file+'" on the server');
alert('Processed file on the server');
//alert('Processed file on the server');
mapEditorWindow.destroy();
}
});
};
@ -1680,7 +1714,7 @@ function editCurrentMap(){
mapEditorWindow = new Ext.Window({
width: 800,
height: 540,
title: 'Edit Current Map',
title: '<?=$Labels->GetLabel('_EDIT_CUR_MAP_');?>',
modal: true,
//closeAction: 'hide',
frame: true,
@ -1842,15 +1876,17 @@ function editCurrentMap(){
}
},{
text: '<?=$Labels->GetLabel('_APPLY_CHANGES_');?>',
handler: function(){
handler: function(){
if( Ext.getCmp('map_edt_frm').getForm().isValid()){
Ext.getCmp('map_edt_frm').getForm().submit({
url: '/lib/controller/updateMap.php',
waitMsg: 'Uploading Image...',
encoding: 'multipart/form-data',
success: function(fp, o){
//msg('Success', 'Processed file "'+o.result.file+'" on the server');
alert('Processed file on the server');
//msg('Success', 'Processed file "'+o.result.file+'" on the server');
//alert('Processed file on the server');
mapEditorWindow.destroy();
}
});
};

BIN
style/assets/map_mode_decart.png

Binary file not shown.

Before

Width: 128  |  Height: 128  |  Size: 13 KiB

After

Width: 128  |  Height: 128  |  Size: 13 KiB

Loading…
Cancel
Save