diff --git a/webgis/geojson/murarie/incerta.geojson b/webgis/geojson/murarie/incerta.geojson deleted file mode 100644 index c5b3e63..0000000 --- a/webgis/geojson/murarie/incerta.geojson +++ /dev/null @@ -1,9 +0,0 @@ -{ -"type": "FeatureCollection", -"name": "incerta", -"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, -"features": [ -{ "type": "Feature", "properties": { "id": 9, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera incerta", "Materiale": "Calcare", "Funzione": "Sostruttiva", "Descrizione": "Muro di terrazzamento", "Tipologia": "Alzato", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229125962859451, 40.559293424754848 ], [ 14.229077232408146, 40.559276332411883 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 10, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera incerta", "Materiale": "Calcare", "Funzione": "Sostruttiva", "Descrizione": "Muro di terrazzamento", "Tipologia": "Alzato", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229106793580016, 40.559279154383496 ], [ 14.22906711717304, 40.55926567389912 ] ] ] } } -] -} diff --git a/webgis/geojson/murarie/mista.geojson b/webgis/geojson/murarie/mista.geojson deleted file mode 100644 index 68b0c23..0000000 --- a/webgis/geojson/murarie/mista.geojson +++ /dev/null @@ -1,13 +0,0 @@ -{ -"type": "FeatureCollection", -"name": "mista", -"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, -"features": [ -{ "type": "Feature", "properties": { "id": 11, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera mista", "Materiale": "Tufo, laterizio", "Funzione": "Rappresentativa, sostruttiva", "Descrizione": "esedra-ninfeo semicircolare", "Tipologia": "Alzato", "Componenti": "Opera reticolata, ricorsi in laterizi" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229125962859451, 40.559293424754848 ], [ 14.229119027504554, 40.559307701077607 ], [ 14.229114255687017, 40.559332778429557 ], [ 14.229115817714645, 40.559333786240899 ], [ 14.229144094287724, 40.559334581743741 ], [ 14.229144075228009, 40.559329644329374 ], [ 14.22914238860027, 40.559329648116645 ], [ 14.229142854399703, 40.55932506109832 ], [ 14.229143737666657, 40.559320509930103 ], [ 14.229145034117105, 40.559316016685713 ], [ 14.229146737463013, 40.559311603157909 ], [ 14.229148839442852, 40.559307290752869 ], [ 14.229151329861718, 40.559303100386281 ], [ 14.229154196640712, 40.559299052381945 ], [ 14.229157425875538, 40.559295166373083 ], [ 14.229161001903952, 40.559291461207394 ], [ 14.229164907381776, 40.559287954855279 ], [ 14.229169123366898, 40.55928466432303 ], [ 14.229173629411305, 40.55928160557005 ], [ 14.229178403660082, 40.559278793431716 ], [ 14.22918342295757, 40.559276241547124 ], [ 14.229188662959576, 40.559273962293268 ], [ 14.229194098251455, 40.559271966724772 ], [ 14.229199702471446, 40.559270264520407 ], [ 14.229205448438432, 40.559268863935969 ], [ 14.2292113082838, 40.559267771764546 ], [ 14.229217253586681, 40.55926699330324 ], [ 14.229223255511652, 40.559266532327676 ], [ 14.229229284948701, 40.559266391073635 ], [ 14.229235312654435, 40.559266570226242 ], [ 14.229241309393782, 40.559267068916604 ], [ 14.229247246081862, 40.559267884725962 ], [ 14.229253093925117, 40.559269013697552 ], [ 14.229258824560809, 40.559270450355783 ], [ 14.229264410194732, 40.559272187732709 ], [ 14.229269823735891, 40.559274217401757 ], [ 14.229275038928018, 40.559276529518939 ], [ 14.229280030476794, 40.559279112870129 ], [ 14.229284774172603, 40.559281954925815 ], [ 14.229289247007975, 40.559285041901717 ], [ 14.229293427289056, 40.559288358825597 ], [ 14.229297294741009, 40.559291889610009 ], [ 14.229300830606165, 40.559295617130253 ], [ 14.22930401773508, 40.559299523307416 ], [ 14.22930684066977, 40.559303589196105 ], [ 14.22930928571861, 40.55930779507618 ], [ 14.229311341022688, 40.559312120548711 ], [ 14.229312996613533, 40.559316544634584 ], [ 14.229314244461188, 40.559321045876466 ], [ 14.229315078513386, 40.559325602442762 ], [ 14.229315494724741, 40.559330192233595 ], [ 14.229315491076568, 40.559334792987883 ], [ 14.229313827244397, 40.559334789300671 ], [ 14.229313481939895, 40.559334971251047 ], [ 14.229313378802191, 40.559339282217891 ], [ 14.22931381492308, 40.559339441320432 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 12, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera mista", "Materiale": "Tufo, laterizio", "Funzione": "Sostruttiva", "Descrizione": "Lungo muro del fronte marittimo", "Tipologia": "Alzato", "Componenti": "Opera reticolata, ricorsi di laterizi" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.22931381492308, 40.559339441320432 ], [ 14.229613569774694, 40.559348683093816 ], [ 14.229613968474398, 40.559344390331141 ], [ 14.229327505424274, 40.55933511780519 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 13, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera mista", "Materiale": "Calcare, tufo", "Funzione": "Sostruttiva", "Descrizione": "Muro di terrazzamento", "Tipologia": "Alzato", "Componenti": "Opera incerta, ricorsi in blocchetti di tufo" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229340046536493, 40.559298014560952 ], [ 14.229343907872899, 40.559328271382768 ], [ 14.229587901628449, 40.559310158238176 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 14, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera mista", "Materiale": "Calcare, laterizio", "Funzione": "Idraulica, sostruttiva", "Descrizione": "Ambiente voltato lungo la costa", "Tipologia": "Cisterna", "Componenti": "Opera incerta, ricorsi in laterizi" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.228740514577398, 40.559290678797417 ], [ 14.228757030245625, 40.559290779453839 ], [ 14.22876137586751, 40.559260087003814 ], [ 14.228706013346551, 40.559255527343105 ], [ 14.228701209787104, 40.559254725198137 ], [ 14.228698621277488, 40.559252496985891 ], [ 14.228696999384187, 40.559249239971592 ], [ 14.228695965772054, 40.55924535245277 ], [ 14.228694321397244, 40.559243013607407 ], [ 14.228691151596756, 40.559240553904196 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 15, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera mista", "Materiale": "Calcare, laterizio", "Funzione": "Sostruttiva", "Descrizione": "Muro di terrazzamento in proprietà privata", "Tipologia": "Alzato", "Componenti": "Opera incerta, ricorsi in laterizi" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.228779522966455, 40.559227158947138 ], [ 14.228691151596756, 40.559240553904196 ], [ 14.228687830297289, 40.559239868051606 ], [ 14.228678247916699, 40.559235419418592 ], [ 14.228672545215792, 40.559229395833363 ], [ 14.228669880011246, 40.559223247005228 ], [ 14.228668188451788, 40.559217635170157 ], [ 14.228665233319962, 40.559209985080962 ], [ 14.228665314958571, 40.559206680087918 ], [ 14.228666225418504, 40.5591999355929 ], [ 14.228667704943051, 40.559196072053702 ], [ 14.228670966908966, 40.559194107458204 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 16, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera mista", "Materiale": "Calcare, laterizio", "Funzione": "Sostruttiva", "Descrizione": "Muro di terrazzamento in proprietà privata", "Tipologia": "Alzato", "Componenti": "Opera incerta, ricorsi in laterizi" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.228721778590458, 40.559193425798206 ], [ 14.228722624818966, 40.559196088497167 ], [ 14.228894920776289, 40.559164236351336 ] ] ] } } -] -} diff --git a/webgis/geojson/murarie/reticolata.geojson b/webgis/geojson/murarie/reticolata.geojson deleted file mode 100644 index 0c08815..0000000 --- a/webgis/geojson/murarie/reticolata.geojson +++ /dev/null @@ -1,14 +0,0 @@ -{ -"type": "FeatureCollection", -"name": "reticolata", -"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, -"features": [ -{ "type": "Feature", "properties": { "id": 1, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": null, "Descrizione": "Murature di fondo e divisorie degli ambienti prospicienti il mare, posti all’estremità orientale del complesso dei Bagni di Tiberio", "Tipologia": "Alzati", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229777980072088, 40.559287936017519 ], [ 14.229767127017078, 40.559288012101483 ], [ 14.22976727121063, 40.559297587195999 ], [ 14.229760323645737, 40.559297626052299 ], [ 14.229760154396285, 40.559286387060112 ], [ 14.229750772025486, 40.559286469247525 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 3, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": null, "Descrizione": "Lacerto murario in giacitura secondaria, riferibile a una struttura con fondazione in opera cementizia e alzato in opera reticolata", "Tipologia": "alzato, attacco di fondazione", "Componenti": "Cubilia, scapoli di calcare, scapoli di tufo" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229748638716192, 40.559312774822097 ], [ 14.229749854780234, 40.559313917882307 ], [ 14.229749311598642, 40.559316242764893 ], [ 14.229747641045932, 40.559318431170922 ], [ 14.229745404602166, 40.559318825800922 ], [ 14.229707320793663, 40.559318057726777 ], [ 14.229688319593144, 40.559316631832786 ], [ 14.229687414956194, 40.55931462813308 ], [ 14.229689070847257, 40.559311784892955 ], [ 14.229707054884152, 40.559311704425618 ], [ 14.22973485378067, 40.5593122650738 ], [ 14.229745138689067, 40.559312472499833 ], [ 14.229748638716192, 40.559312774822097 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 4, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": null, "Descrizione": "Due murature, rispettivamente di fondo e laterale, pertinenti a un ambiente prospiciente il mare nell’area orientale del complesso dei Bagni di Tiberio", "Tipologia": "Alzati", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229694021609493, 40.55930762924018 ], [ 14.229694082338904, 40.559310341259078 ], [ 14.229682272612358, 40.559310495088383 ], [ 14.229616809841877, 40.559314335557936 ], [ 14.229615693144396, 40.559336306937055 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 5, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": null, "Descrizione": "Due murature pertinenti a un ambiente ubicato sul livello superiore dell’area occidentale del complesso dei Bagni di Tiberio.", "Tipologia": "Alzati", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229012969950622, 40.559279324646354 ], [ 14.22901299762786, 40.559273288155325 ], [ 14.228949305222281, 40.559271595449403 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 6, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": null, "Descrizione": "Muratura in pessimo stato di conservazione, inglobata in costruzione moderna", "Tipologia": "Alzato", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.228945620292212, 40.559244814778907 ], [ 14.228945097860407, 40.559260882019025 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 7, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": "Sostruttiva", "Descrizione": "Fondazione del terrazzamento prospiciente il mare, con porticato soprastante", "Tipologia": "Fondazione", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.22932061572207, 40.559368986602642 ], [ 14.229319898205036, 40.559370575004976 ], [ 14.229315830697367, 40.559373603453658 ], [ 14.229313913113851, 40.559377741595505 ] ] ] } }, -{ "type": "Feature", "properties": { "id": 8, "Comune": "Capri", "Località": "Bagni di Tiberio", "Categoria": "USM", "Tecnica": "Opera reticolata", "Materiale": "Tufo", "Funzione": "Sostruttiva", "Descrizione": "Fondazione del porticato antistante l'esedra", "Tipologia": "Fondazione", "Componenti": null }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 14.229137040051352, 40.55937329635141 ], [ 14.229116998093058, 40.559372712138945 ] ] ] } } -] -} diff --git a/webgis/geojson/murarie/tiberio/elementi.geojson b/webgis/geojson/murarie/tiberio/elemento.geojson similarity index 100% rename from webgis/geojson/murarie/tiberio/elementi.geojson rename to webgis/geojson/murarie/tiberio/elemento.geojson diff --git a/webgis/geojson/murarie/tiberio/rivestimenti.geojson b/webgis/geojson/murarie/tiberio/rivestimento.geojson similarity index 100% rename from webgis/geojson/murarie/tiberio/rivestimenti.geojson rename to webgis/geojson/murarie/tiberio/rivestimento.geojson diff --git a/webgis/index.html b/webgis/index.html index a313008..6bdc89d 100644 --- a/webgis/index.html +++ b/webgis/index.html @@ -626,10 +626,9 @@ diff --git a/webgis/js/controllers/bview_controller.js b/webgis/js/controllers/bview_controller.js index de0a92f..7d35afd 100644 --- a/webgis/js/controllers/bview_controller.js +++ b/webgis/js/controllers/bview_controller.js @@ -1,13 +1,41 @@ import { Controller } from "@hotwired/stimulus" import { GisState } from '../state.js'; +import { TECH_LAYERS } from "../map.js"; + +const LEGEND_DEF = [ + "puntatore", + "icona", +]; export default class extends Controller { static targets = ['bar', 'legend']; openView() { + const map = GisState.map; + // Remove all other layers first! + for (const key of Object.keys(GisState.layers)) { + if (GisState.layers[key] instanceof L.Layer && key !== 'geometries') { + map.removeLayer(GisState.layers[key]); + } + } + /** + * @type {string[]} + */ + const currentTechs = [...TECH_LAYERS[GisState.currentBView], ...LEGEND_DEF]; this.barTarget.classList.remove('is-hidden'); - this.legendTarget.classList.remove('is-hidden'); - GisState.map._container.classList.add('bview-active'); + + /** + * @type {HTMLDivElement} + */ + const legend = this.legendTarget; + const items = legend.querySelectorAll('li'); + + for (let item of items) { + if (!currentTechs.includes(item.id)) item.classList.add('is-hidden'); + } + + legend.classList.remove('is-hidden'); + map._container.classList.add('bview-active'); } closeView(event) { @@ -15,13 +43,13 @@ export default class extends Controller { // is not fired from the building view if (event instanceof KeyboardEvent && !GisState.bViewActive) return; - this.resetMap(); + this.reset(); this.barTarget.classList.add('is-hidden'); this.legendTarget.classList.add('is-hidden'); GisState.bViewActive = false; } - resetMap() { + reset() { // Restore previous map state before closing view const map = GisState.map; // Hard-coded... @@ -29,6 +57,14 @@ export default class extends Controller { const walls = GisState.layers.walls; + // Re-add all layers first (except techniques)! (TODO: Should this be filtered by map state??) + for (const key of Object.keys(GisState.layers)) { + if (GisState.layers[key] instanceof L.Layer + && key !== 'geometries' + && key !== 'buildingTechs') { + map.addLayer(GisState.layers[key]); + } + } // map.removeLayer(GisState.layers.walls) doesn't work, i.e. // it doesn't remove the layer group (fails silently) walls.eachLayer(layer => map.removeLayer(layer)); @@ -41,5 +77,14 @@ export default class extends Controller { GisState.currentMapState.zoom ); map._container.classList.remove('bview-active'); + /** + * @type {HTMLDivElement} + */ + const legend = this.legendTarget; + const items = legend.querySelectorAll('li'); + + for (let item of items) { + item.classList.remove('is-hidden'); + } } } diff --git a/webgis/js/gis.js b/webgis/js/gis.js index da43d87..9569cc3 100644 --- a/webgis/js/gis.js +++ b/webgis/js/gis.js @@ -133,14 +133,14 @@ GIS.activateBuildingView = async function(layerId) { map.addLayer(GisState.baseLayers['Limiti amministrativi']); geometries.addTo(map); - // TODO: move to function in Map module?? + // TODO: move to function in separate module?? const wallLayers = []; // Cache! for (let tech of TECH_LAYERS[layerId]) { try { const wallLayer = await this.loadGeoJSON( `murarie/${layerId}/${tech}.geojson`, - Options.walls[tech] ?? {...Options.site, weight: 3}, + Options.walls[tech] ?? {...Options.site, weight: 2.5}, true ); @@ -161,9 +161,10 @@ GIS.activateBuildingView = async function(layerId) { ); map.setMinZoom(this.BVIEW_MIN_ZOOM); map.setMaxZoom(this.BVIEW_MAX_ZOOM); + GisState.bViewActive = true; + GisState.currentBView = layerId; // Global event for Stimulus document.dispatchEvent(new Event('bview-active')); - GisState.bViewActive = true; } /** * Fetches references to cartography layers diff --git a/webgis/js/layer_options.js b/webgis/js/layer_options.js index df88658..a49bfb9 100644 --- a/webgis/js/layer_options.js +++ b/webgis/js/layer_options.js @@ -58,21 +58,35 @@ Options.walls = { fillColor: '#10ee47', fillOpacity: 1, opacity: 1, - weight: 3, + weight: 2.5 }, "mista" : { - color: '#f0280f', - fillColor: '#f0280f', + color: '#9b7fe9', + fillColor: '#9b7fe9', fillOpacity: 1, opacity: 1, - weight: 3, + weight: 2.5, }, "incerta" : { color: '#133cee', fillColor: '#133cee', fillOpacity: 1, opacity: 1, - weight: 3, + weight: 2.5, + }, + "rivestimento" : { + color: '#62646e', + fillColor: '#62646e', + fillOpacity: 1, + opacity: 1, + weight: 2.5, + }, + "elemento" : { + color: '#e9d948', + fillColor: '#e9d948', + fillOpacity: 1, + opacity: 1, + weight: 2.5, }, }; Options.cluster = { diff --git a/webgis/js/map.js b/webgis/js/map.js index b17c81d..21fcd9c 100644 --- a/webgis/js/map.js +++ b/webgis/js/map.js @@ -10,8 +10,8 @@ export const TECH_LAYERS = { "incerta", "mista", "reticolata", - "elementi", - "rivestimenti", + "elemento", + "rivestimento", "nulla", ], }; diff --git a/webgis/js/state.js b/webgis/js/state.js index 6a52c4d..dc88272 100644 --- a/webgis/js/state.js +++ b/webgis/js/state.js @@ -24,6 +24,7 @@ * @property {{string: L.Layer}|null} baseLayers * @property {?MapState} currentMapState * @property {boolean} bViewActive + * @property {?string} currentBView * @property {MarkerLookup} markers * @property {LayerGroupLookup} layers * @property {Object|null} bibliography @@ -37,6 +38,7 @@ export const GisState = { baseLayers: null, currentMapState: null, bViewActive: false, + currentBView: null, markers: { sites: {}, notConserved: {},