Change how site layers are added (draft)
This commit is contained in:
parent
0e3e5b19ac
commit
533bbb373f
28
geojson/arsenale_planim.geojson
Normal file
28
geojson/arsenale_planim.geojson
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"name": "arsenale_planim",
|
||||
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
|
||||
"features": [
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbCircle:AcDbArc", "Linetype": null, "EntityHand": "3CF", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.24310829176984, 40.546755614394961 ], [ 14.243114573730999, 40.546751622482248 ], [ 14.243120489555736, 40.546747317343183 ], [ 14.243126012459861, 40.546742718469446 ], [ 14.243131117438159, 40.546737846682781 ], [ 14.243135781377589, 40.546732724040467 ], [ 14.243139983162045, 40.546727373735607 ], [ 14.24314370376776, 40.546721819992008 ], [ 14.243146926349604, 40.546716087954607 ], [ 14.243149636317252, 40.546710203575529 ], [ 14.243151821401344, 40.546704193496559 ], [ 14.243153471708935, 40.546698084928792 ], [ 14.243154579768284, 40.546691905528988 ], [ 14.243155140562767, 40.546685683274767 ], [ 14.243155151553491, 40.546679446337713 ], [ 14.243154612690839, 40.546673222955803 ], [ 14.243153526414728, 40.546667041305788 ], [ 14.243151897643466, 40.546660929375342 ], [ 14.24314973375151, 40.546654914836552 ], [ 14.243147044536141, 40.546649024920448 ], [ 14.243143842173058, 40.546643286293985 ], [ 14.243140141161186, 40.546637724938968 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "3D1", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243140141161211, 40.546637724938968 ], [ 14.243140606803118, 40.54663681193319 ], [ 14.243141692800693, 40.546635504503911 ], [ 14.243142551393133, 40.54663526607245 ], [ 14.243143004121404, 40.546635367130911 ], [ 14.243143472827509, 40.546635251458383 ], [ 14.243144254146285, 40.546635648945113 ], [ 14.243144615563045, 40.546635309810732 ], [ 14.243145026789149, 40.546635108928143 ], [ 14.243146434503743, 40.546636449450638 ], [ 14.243178059564386, 40.546617123880132 ], [ 14.243155034098839, 40.546595197452163 ], [ 14.243122450868443, 40.546614837004128 ], [ 14.243120423052092, 40.546615078024793 ], [ 14.243119513433147, 40.546615156535566 ], [ 14.243117485664607, 40.546613317513945 ], [ 14.243117398272304, 40.54661203658533 ], [ 14.24311718809667, 40.546609720474834 ], [ 14.243117640346913, 40.546608677522279 ], [ 14.243117983758756, 40.546606768715243 ], [ 14.243118310448667, 40.546606344742742 ], [ 14.243119291587243, 40.546601747091344 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "8597", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242990490504376, 40.546766247383147 ], [ 14.242947321573368, 40.546745938457356 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "85C6", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242995433582006, 40.54677212815627 ], [ 14.242988671045627, 40.546768497915998 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "8601", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242922928582333, 40.546756217306289 ], [ 14.242907616991245, 40.546774030069535 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbCircle:AcDbArc", "Linetype": null, "EntityHand": "861A", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243082401776219, 40.546769091631688 ], [ 14.243087966920527, 40.546766856691896 ], [ 14.243093355744806, 40.546764383057905 ], [ 14.243098550674585, 40.546761678796969 ], [ 14.24310353476776, 40.546758752728415 ], [ 14.24310829176984, 40.546755614394961 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "861B", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243158825370681, 40.546642709202501 ], [ 14.243145766421719, 40.546646604144101 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "864B", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243007195778189, 40.546801581254272 ], [ 14.243008450901833, 40.54678141823468 ], [ 14.243008841790552, 40.546780074722072 ], [ 14.243010450335905, 40.546779325295432 ], [ 14.243011835109542, 40.546778883689662 ], [ 14.243013144748172, 40.546778936458729 ], [ 14.24301417879856, 40.546779349635713 ], [ 14.243015270167604, 40.5467813373971 ], [ 14.243015864104208, 40.546782006979804 ], [ 14.243014319083818, 40.546806827107076 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbCircle:AcDbArc", "Linetype": null, "EntityHand": "8696", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243111000812073, 40.546758272142732 ], [ 14.243117645924869, 40.546754043288963 ], [ 14.243123894593355, 40.546749476260288 ], [ 14.243129717305571, 40.54674459262651 ], [ 14.243135086561475, 40.546739415452528 ], [ 14.243139977002581, 40.546733969189816 ], [ 14.24314436553183, 40.546728279560554 ], [ 14.24314823142274, 40.546722373436445 ], [ 14.243151556417173, 40.546716278711564 ], [ 14.24315432481156, 40.5467100241708 ], [ 14.243156523531223, 40.546703639353836 ], [ 14.243158142191936, 40.546697154415519 ], [ 14.243159173149067, 40.546690599983727 ], [ 14.243159611533724, 40.546684007014377 ], [ 14.243159455275592, 40.546677406645451 ], [ 14.243158705112839, 40.546670830049955 ], [ 14.243157364588578, 40.546664308288427 ], [ 14.243155440034178, 40.546657872162605 ], [ 14.243152940539254, 40.546651552069598 ], [ 14.243149877908852, 40.546645377858603 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "86A8", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243082401776219, 40.546769091631688 ], [ 14.24308059749546, 40.546769800447287 ], [ 14.243079497306253, 40.546770313310283 ], [ 14.243078942515332, 40.546771328513458 ], [ 14.243078534643086, 40.546771862552539 ], [ 14.243077370882352, 40.546772061479231 ], [ 14.243076349740411, 40.546772202322771 ], [ 14.243075238046172, 40.546772362248362 ], [ 14.243074783492036, 40.546772615001693 ], [ 14.243073609705377, 40.546772558130307 ], [ 14.243072707075818, 40.546772709513029 ], [ 14.243072371586633, 40.54677305861798 ], [ 14.243071264047394, 40.54677302670509 ], [ 14.243069464708837, 40.546773346956734 ], [ 14.243067337314892, 40.546774036155654 ], [ 14.243067110214636, 40.546774627611399 ], [ 14.243066199047703, 40.546774937874439 ], [ 14.24306473283133, 40.546774754929849 ], [ 14.243064231255085, 40.546774596955977 ], [ 14.243063687408274, 40.546774587203025 ], [ 14.243062341569463, 40.546775022660469 ], [ 14.243061666085573, 40.546775074010888 ], [ 14.243060242208722, 40.54677515143797 ], [ 14.243059833126159, 40.546775444268313 ], [ 14.243059017904324, 40.546775457562163 ], [ 14.243058715378258, 40.546775542545078 ], [ 14.24305819786575, 40.546775899443396 ], [ 14.243057440122261, 40.546775875840396 ], [ 14.243056929535605, 40.546775617806418 ], [ 14.243056397777396, 40.546775648587527 ], [ 14.24305568360977, 40.546775998539523 ], [ 14.243055163731238, 40.546776635239361 ], [ 14.243054734872649, 40.546776962693293 ], [ 14.243054610823638, 40.546777775874425 ], [ 14.243054559573782, 40.546779588389313 ], [ 14.243053640552455, 40.546780928149779 ], [ 14.243052418139724, 40.546781208519498 ], [ 14.24305147241021, 40.54678118630212 ], [ 14.24305074104436, 40.54678079699827 ], [ 14.243049734959319, 40.546780534064048 ], [ 14.243047689065024, 40.546779270997561 ], [ 14.243047339085694, 40.546778922992594 ], [ 14.243047287746757, 40.546778494609683 ], [ 14.243046505358294, 40.54677814704651 ], [ 14.243046119257176, 40.546777903200173 ], [ 14.243045045719313, 40.54677772050637 ], [ 14.243044421080814, 40.546777472440553 ], [ 14.243043769518389, 40.546777341304427 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D2ED", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242949306945777, 40.546743628768674 ], [ 14.242945565716196, 40.546747981138687 ], [ 14.242938220414722, 40.546744306987563 ], [ 14.242910937255964, 40.546776046902323 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D30D", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242988671045627, 40.546768497915998 ], [ 14.242992390326451, 40.546763897446773 ], [ 14.242949306945777, 40.546743628768674 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D30F", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242976033539449, 40.546808012044288 ], [ 14.242995433582006, 40.54677212815627 ], [ 14.243000299413788, 40.546773653583742 ], [ 14.24297932201727, 40.546812455076491 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D334", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242904359028072, 40.546665724217178 ], [ 14.242905668688786, 40.546642591243632 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D335", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242911675969509, 40.54670592406989 ], [ 14.242907125842306, 40.546687663499277 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbCircle:AcDbArc", "Linetype": null, "EntityHand": "D336", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242904359028072, 40.546665724217178 ], [ 14.242904467508065, 40.54667124377459 ], [ 14.242904965958843, 40.546676750841229 ], [ 14.242905852930358, 40.546682229395614 ], [ 14.242907125842306, 40.546687663499242 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D337", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242901934012119, 40.546642220929058 ], [ 14.242903301411582, 40.546642492890612 ], [ 14.242903705959257, 40.546642465484197 ], [ 14.242905431661919, 40.546642439225543 ], [ 14.242905668688786, 40.546642591243632 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbCircle:AcDbArc", "Linetype": null, "EntityHand": "D345", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.243000180415956, 40.546773873691919 ], [ 14.243008745201408, 40.546775419940971 ], [ 14.243017422444021, 40.546776543579632 ], [ 14.243026176347366, 40.546777239972613 ], [ 14.243034970798814, 40.546777506247018 ], [ 14.243043769518414, 40.546777341304427 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D450", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242892063115628, 40.546729949095258 ], [ 14.242914622058302, 40.546750419104335 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D7C8", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242994501207161, 40.546454337231303 ], [ 14.242994086414614, 40.546448364941334 ], [ 14.242994310182358, 40.546433777154007 ], [ 14.242991438698079, 40.546417368931287 ], [ 14.242985952443842, 40.546397842743524 ], [ 14.242981698856369, 40.546373461458693 ], [ 14.242970871880207, 40.546342256821099 ], [ 14.242966736967954, 40.546327518624516 ], [ 14.242965677407867, 40.54631951222288 ] ] ] } },
|
||||
{ "type": "Feature", "properties": { "Layer": "PLANIMETRIA", "PaperSpace": null, "SubClasses": "AcDbEntity:AcDbPolyline", "Linetype": null, "EntityHand": "D7F6", "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.242957862841118, 40.546455817999551 ], [ 14.242957385299917, 40.546448942184718 ], [ 14.242957591900913, 40.546435474007886 ], [ 14.242955262070844, 40.546422160861859 ], [ 14.242949774264369, 40.546402629111761 ], [ 14.242945636212632, 40.5463789099976 ], [ 14.24293517861642, 40.546348769910054 ], [ 14.242930436139579, 40.54633186611958 ], [ 14.242928769225957, 40.546319270293424 ] ] ] } }
|
||||
]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"name": "siti",
|
||||
"name": "matermania",
|
||||
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
|
||||
"features": [
|
||||
{ "type": "Feature", "properties": { "Layer": "1", "PaperSpace": null, "SubClasses": null, "Linetype": null, "EntityHand": null, "Text": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.255510982332186, 40.549235083726821 ], [ 14.255488653309849, 40.549272340839408 ] ] ] } },
|
@ -58,7 +58,8 @@ function capitalize(text) {
|
||||
*/
|
||||
GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
let layerVincoli = await this.loadLayer('vincoli.geojson', optionsVincoli);
|
||||
let layerSiti = await this.loadLayer('siti.geojson', optionsSiti, false);
|
||||
let layerMater = await this.loadLayer('matermania.geojson', optionsSiti, false);
|
||||
let layerArsenale = await this.loadLayer('arsenale_planim.geojson', optionsSiti, false);
|
||||
// TODO named parameters??
|
||||
let layerPaesistici = await this.loadLayer('paesistici.geojson', optionsPaesistici);
|
||||
let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
@ -69,7 +70,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
let map = L.map(mapId, {
|
||||
attributionControl: false,
|
||||
minZoom: 11,
|
||||
layers: [osmap, layerVincoli, layerSiti, layerPaesistici]
|
||||
layers: [osmap, layerVincoli, layerMater, layerArsenale, layerPaesistici]
|
||||
}).setView(this.CENTER_COORDS, zoomLevel);
|
||||
|
||||
map.crs = L.CRS.EPSG4326;
|
||||
@ -78,7 +79,8 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
"Mappa di base (OpenStreetMap)" : osmap
|
||||
};
|
||||
const archeo = {
|
||||
"Siti indagati" : layerSiti,
|
||||
"Grotta di Matermania" : layerMater,
|
||||
"Grotta dell'Arsenale" : layerArsenale,
|
||||
"Vincoli archeologici" : layerVincoli,
|
||||
"Vincoli paesistici" : layerPaesistici,
|
||||
};
|
||||
@ -86,7 +88,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
||||
let layerControl = L.control.layers(baseMap, archeo).addTo(map);
|
||||
|
||||
// TODO Horrible?
|
||||
return {map: map, sites: layerSiti};
|
||||
return {map: map, sites: archeo};
|
||||
}
|
||||
/**
|
||||
* @todo Distinguere tipo di geojson per contenuto popup
|
||||
@ -125,11 +127,11 @@ GIS.loadLayer = async function (geoJSON, options, popup = true) {
|
||||
GIS.featurePopup = function (layerName, feature) {
|
||||
const html = `
|
||||
<table class="table m-2">
|
||||
<tr><td class="text-bold">Oggetto</td><td>${feature.properties.OGGETTO}</td></tr>
|
||||
<tr><td class="text-bold">Anno</td><td>${feature.properties.ANNO}</td></tr>
|
||||
<tr><td class="text-bold">Comune</td><td>${capitalize(feature.properties.COMUNE)}</td></tr>
|
||||
<tr><td class="text-bold">Località</td><td>${capitalize(feature.properties.LOCALITA)}</td></tr>
|
||||
<tr><td class="text-bold">Proprietà</td><td>${capitalize(feature.properties.PROPRIETA)}</td></tr>
|
||||
<tr><td class="text-bold">Oggetto</td><td>${feature.properties.OGGETTO}</td></tr>
|
||||
<tr><td class="text-bold">Anno</td><td>${feature.properties.ANNO}</td></tr>
|
||||
<tr><td class="text-bold">Comune</td><td>${capitalize(feature.properties.COMUNE)}</td></tr>
|
||||
<tr><td class="text-bold">Località</td><td>${capitalize(feature.properties.LOCALITA)}</td></tr>
|
||||
<tr><td class="text-bold">Proprietà</td><td>${capitalize(feature.properties.PROPRIETA)}</td></tr>
|
||||
</table>
|
||||
`;
|
||||
const content = {
|
||||
|
@ -7,6 +7,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
|
||||
UI.addCenterMapControl(map, GIS.CENTER_COORDS, GIS.INIT_ZOOM);
|
||||
|
||||
const centerCoords = sites.getBounds().getCenter();
|
||||
UI.addSitesControl(map, centerCoords, 'Grotta di Matermania');
|
||||
for (let site of Object.keys(sites)) {
|
||||
if (!site.includes('Vincoli')) {
|
||||
let layer = sites[site];
|
||||
const centerCoords = layer.getBounds().getCenter();
|
||||
UI.addSitesControl(map, centerCoords, site, GIS.INIT_ZOOM);
|
||||
}
|
||||
}
|
||||
});
|
28
js/ui.js
28
js/ui.js
@ -5,6 +5,25 @@
|
||||
*/
|
||||
const UI = {};
|
||||
|
||||
const centerIcon = `<svg
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
style="margin-top: 3px"
|
||||
>
|
||||
<path
|
||||
d="M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M12 3C12.5523 3 13 3.44772 13 4V5.07089C16.0657 5.5094 18.4906 7.93431 18.9291 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H18.9291C18.4906 16.0657 16.0657 18.4906 13 18.9291V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V18.9291C7.93431 18.4906 5.5094 16.0657 5.07089 13H4C3.44772 13 3 12.5523 3 12C3 11.4477 3.44772 11 4 11H5.07089C5.5094 7.93431 7.93431 5.5094 11 5.07089V4C11 3.44772 11.4477 3 12 3ZM7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>`;
|
||||
const siteIcon = `<svg
|
||||
width="24"
|
||||
height="24"
|
||||
@ -47,7 +66,7 @@ UI.addCenterMapControl = function (map, centerCoords, zoom) {
|
||||
let controlUI = L.DomUtil.create('a', 'leaflet-draw-edit-remove', controlDiv);
|
||||
controlUI.title = 'Centra la mappa';
|
||||
controlUI.href = '#';
|
||||
controlUI.innerHTML = siteIcon;
|
||||
controlUI.innerHTML = centerIcon;
|
||||
return controlDiv;
|
||||
}
|
||||
});
|
||||
@ -59,9 +78,9 @@ UI.addCenterMapControl = function (map, centerCoords, zoom) {
|
||||
*
|
||||
* @param {Map} map
|
||||
* @param {LatLng} coordinates
|
||||
* @param {string} popupContent
|
||||
* @param {string} popupContent The site's name
|
||||
*/
|
||||
UI.addSitesControl = function (map, coordinates, popupContent) {
|
||||
UI.addSitesControl = function (map, coordinates, popupContent, initZoom = 15) {
|
||||
const popUpCoords = L.latLng(coordinates.lat + 0.0001, coordinates.lng);
|
||||
L.Control.SiteControl = L.Control.extend({
|
||||
options: {
|
||||
@ -73,6 +92,7 @@ UI.addSitesControl = function (map, coordinates, popupContent) {
|
||||
.addListener(controlDiv, 'click', L.DomEvent.stopPropagation)
|
||||
.addListener(controlDiv, 'click', L.DomEvent.preventDefault)
|
||||
.addListener(controlDiv, 'click', function () {
|
||||
map.setZoom(initZoom);
|
||||
map.setView(
|
||||
coordinates,
|
||||
19,
|
||||
@ -85,7 +105,7 @@ UI.addSitesControl = function (map, coordinates, popupContent) {
|
||||
});
|
||||
|
||||
let controlUI = L.DomUtil.create('a', 'leaflet-draw-edit-remove site-control', controlDiv);
|
||||
controlUI.title = 'Vai al sito';
|
||||
controlUI.title = `Vai a ${popupContent}`;
|
||||
controlUI.href = '#';
|
||||
controlUI.innerHTML = siteIcon;
|
||||
return controlDiv;
|
||||
|
Loading…
Reference in New Issue
Block a user