Compare commits
2 Commits
a783e6d889
...
f7ecd4326a
Author | SHA1 | Date | |
---|---|---|---|
f7ecd4326a | |||
d36cdd4d17 |
9
geojson/arsenale_area.geojson
Normal file
9
geojson/arsenale_area.geojson
Normal file
File diff suppressed because one or more lines are too long
@ -63,7 +63,6 @@
|
|||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-background"></div>
|
<div class="modal-background"></div>
|
||||||
<div class="modal-content has-background-white">
|
<div class="modal-content has-background-white">
|
||||||
<!-- Any other Bulma elements you want -->
|
|
||||||
</div>
|
</div>
|
||||||
<button class="modal-close is-large" aria-label="close"></button>
|
<button class="modal-close is-large" aria-label="close"></button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -105,13 +105,16 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
|||||||
data = await GIS._fetchData(layer.id);
|
data = await GIS._fetchData(layer.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const marker = L.marker(coords)
|
// TODO: terrible!
|
||||||
.addTo(map)
|
if (!layer.id.includes('area')) {
|
||||||
.bindTooltip(Object.keys(archeo).find(k => archeo[k] === layer))
|
const marker = L.marker(coords)
|
||||||
.openTooltip();
|
.addTo(map)
|
||||||
|
.bindTooltip(Object.keys(archeo).find(k => archeo[k] === layer))
|
||||||
|
.openTooltip();
|
||||||
|
|
||||||
if (typeof data === 'object') {
|
if (typeof data === 'object') {
|
||||||
marker.on('click', () => UI.openModal(data));
|
marker.on('click', () => UI.openModal(data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -128,11 +131,14 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
|||||||
GIS.initLayers = async function(map) {
|
GIS.initLayers = async function(map) {
|
||||||
let layerMater = await this.loadLayer('matermania.geojson', optionsSiti, false);
|
let layerMater = await this.loadLayer('matermania.geojson', optionsSiti, false);
|
||||||
let layerArsenale = await this.loadLayer('arsenale.geojson', optionsSiti, false);
|
let layerArsenale = await this.loadLayer('arsenale.geojson', optionsSiti, false);
|
||||||
|
let layerArsenaleArea = await this.loadLayer('arsenale_area.geojson', optionsSiti, false);
|
||||||
let layerGradola = await this.loadLayer('gradola.geojson', optionsSiti, false);
|
let layerGradola = await this.loadLayer('gradola.geojson', optionsSiti, false);
|
||||||
|
|
||||||
layerMater.id = 'matermania';
|
layerMater.id = 'matermania';
|
||||||
layerGradola.id = 'gradola';
|
layerGradola.id = 'gradola';
|
||||||
layerArsenale.id = 'arsenale';
|
layerArsenale.id = 'arsenale';
|
||||||
|
layerArsenaleArea.id = 'arsenale_area';
|
||||||
|
|
||||||
let layerVincoli = await this.loadLayer('vincoli.geojson', optionsVincoli);
|
let layerVincoli = await this.loadLayer('vincoli.geojson', optionsVincoli);
|
||||||
// TODO named parameters??
|
// TODO named parameters??
|
||||||
let layerPaesistici = await this.loadLayer('paesistici.geojson', optionsPaesistici);
|
let layerPaesistici = await this.loadLayer('paesistici.geojson', optionsPaesistici);
|
||||||
@ -142,7 +148,7 @@ GIS.initLayers = async function(map) {
|
|||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
});
|
});
|
||||||
|
|
||||||
const sitesGroup = new L.LayerGroup([layerMater, layerGradola, layerArsenale]);
|
const sitesGroup = new L.LayerGroup([layerMater, layerGradola, layerArsenale, layerArsenaleArea]);
|
||||||
const baseGroup = new L.LayerGroup([osmap]);
|
const baseGroup = new L.LayerGroup([osmap]);
|
||||||
baseGroup.addTo(map);
|
baseGroup.addTo(map);
|
||||||
sitesGroup.addTo(map);
|
sitesGroup.addTo(map);
|
||||||
@ -152,7 +158,8 @@ GIS.initLayers = async function(map) {
|
|||||||
const archeo = {
|
const archeo = {
|
||||||
"Villa di Gradola" : layerGradola,
|
"Villa di Gradola" : layerGradola,
|
||||||
"Grotta di Matermania" : layerMater,
|
"Grotta di Matermania" : layerMater,
|
||||||
"Grotta dell'Arsenale" : layerArsenale,
|
"Grotta dell'Arsenale (planimetria)" : layerArsenale,
|
||||||
|
"Grotta dell'Arsenale (area)" : layerArsenaleArea,
|
||||||
"Vincoli archeologici" : layerVincoli,
|
"Vincoli archeologici" : layerVincoli,
|
||||||
"Vincoli paesistici" : layerPaesistici,
|
"Vincoli paesistici" : layerPaesistici,
|
||||||
};
|
};
|
12
js/index.js
12
js/index.js
@ -1,4 +1,4 @@
|
|||||||
import GIS from './caprigis.js';
|
import GIS from './gis.js';
|
||||||
import UI from './ui.js';
|
import UI from './ui.js';
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
@ -8,14 +8,4 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
UI.addCenterMapControl(map, GIS.CENTER_COORDS, GIS.INIT_ZOOM);
|
UI.addCenterMapControl(map, GIS.CENTER_COORDS, GIS.INIT_ZOOM);
|
||||||
UI.toggleMenu('siti');
|
UI.toggleMenu('siti');
|
||||||
UI.sitesMenu('.menu-list', map, sites);
|
UI.sitesMenu('.menu-list', map, sites);
|
||||||
|
|
||||||
/*
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
});
|
});
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"source": {
|
"source": {
|
||||||
"include": ["caprigis.js", "index.js"],
|
"include": ["gis.js", "ui.js", "index.js"],
|
||||||
"includePattern": ".js$",
|
"includePattern": ".js$",
|
||||||
"excludePattern": "(vendor/|docs)"
|
"excludePattern": "(vendor/|docs)"
|
||||||
},
|
},
|
||||||
|
8
js/ui.js
8
js/ui.js
@ -6,9 +6,9 @@
|
|||||||
const UI = {};
|
const UI = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a control to center the map
|
* Add a Leaflet control to center the map
|
||||||
* @param {Map} map
|
* @param {Map} map The Leaflet map object
|
||||||
* @param {LatLngExpression} centerCoords
|
* @param {LatLngExpression} centerCoords The coordinates to center the map
|
||||||
* @param {number} zoom Zoom level
|
* @param {number} zoom Zoom level
|
||||||
*/
|
*/
|
||||||
UI.addCenterMapControl = function (map, centerCoords, zoom) {
|
UI.addCenterMapControl = function (map, centerCoords, zoom) {
|
||||||
@ -51,7 +51,7 @@ UI.toggleMenu = function (triggerId) {
|
|||||||
menu.classList.toggle('is-hidden');
|
menu.classList.toggle('is-hidden');
|
||||||
menu.classList.toggle('is-2');
|
menu.classList.toggle('is-2');
|
||||||
document.querySelector('#map').parentElement.classList.toggle('is-full');
|
document.querySelector('#map').parentElement.classList.toggle('is-full');
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Open a modal with DB data
|
* Open a modal with DB data
|
||||||
|
Loading…
Reference in New Issue
Block a user