diff --git a/fonts/dinnextw1g-bold-webfont.woff b/fonts/dinnextw1g-bold-webfont.woff new file mode 100644 index 0000000..292a30f Binary files /dev/null and b/fonts/dinnextw1g-bold-webfont.woff differ diff --git a/fonts/dinnextw1g-bold-webfont.woff2 b/fonts/dinnextw1g-bold-webfont.woff2 new file mode 100644 index 0000000..e59b9ef Binary files /dev/null and b/fonts/dinnextw1g-bold-webfont.woff2 differ diff --git a/fonts/dinnextw1g-bolditalic-webfont.woff b/fonts/dinnextw1g-bolditalic-webfont.woff new file mode 100644 index 0000000..e39a609 Binary files /dev/null and b/fonts/dinnextw1g-bolditalic-webfont.woff differ diff --git a/fonts/dinnextw1g-bolditalic-webfont.woff2 b/fonts/dinnextw1g-bolditalic-webfont.woff2 new file mode 100644 index 0000000..ae0a62b Binary files /dev/null and b/fonts/dinnextw1g-bolditalic-webfont.woff2 differ diff --git a/fonts/dinnextw1g-italic-webfont.woff b/fonts/dinnextw1g-italic-webfont.woff new file mode 100644 index 0000000..9f62e5a Binary files /dev/null and b/fonts/dinnextw1g-italic-webfont.woff differ diff --git a/fonts/dinnextw1g-italic-webfont.woff2 b/fonts/dinnextw1g-italic-webfont.woff2 new file mode 100644 index 0000000..7f2fa39 Binary files /dev/null and b/fonts/dinnextw1g-italic-webfont.woff2 differ diff --git a/fonts/dinnextw1g-light-webfont.woff b/fonts/dinnextw1g-light-webfont.woff new file mode 100644 index 0000000..b6e3d8d Binary files /dev/null and b/fonts/dinnextw1g-light-webfont.woff differ diff --git a/fonts/dinnextw1g-light-webfont.woff2 b/fonts/dinnextw1g-light-webfont.woff2 new file mode 100644 index 0000000..c894a2e Binary files /dev/null and b/fonts/dinnextw1g-light-webfont.woff2 differ diff --git a/fonts/dinnextw1g-lightitalic-webfont.woff b/fonts/dinnextw1g-lightitalic-webfont.woff new file mode 100644 index 0000000..b03c1b7 Binary files /dev/null and b/fonts/dinnextw1g-lightitalic-webfont.woff differ diff --git a/fonts/dinnextw1g-lightitalic-webfont.woff2 b/fonts/dinnextw1g-lightitalic-webfont.woff2 new file mode 100644 index 0000000..ef6e0b4 Binary files /dev/null and b/fonts/dinnextw1g-lightitalic-webfont.woff2 differ diff --git a/fonts/dinnextw1g-medium-webfont.woff b/fonts/dinnextw1g-medium-webfont.woff new file mode 100644 index 0000000..5f091ec Binary files /dev/null and b/fonts/dinnextw1g-medium-webfont.woff differ diff --git a/fonts/dinnextw1g-medium-webfont.woff2 b/fonts/dinnextw1g-medium-webfont.woff2 new file mode 100644 index 0000000..54e5907 Binary files /dev/null and b/fonts/dinnextw1g-medium-webfont.woff2 differ diff --git a/fonts/dinnextw1g-mediumitalic-webfont.woff b/fonts/dinnextw1g-mediumitalic-webfont.woff new file mode 100644 index 0000000..902238f Binary files /dev/null and b/fonts/dinnextw1g-mediumitalic-webfont.woff differ diff --git a/fonts/dinnextw1g-mediumitalic-webfont.woff2 b/fonts/dinnextw1g-mediumitalic-webfont.woff2 new file mode 100644 index 0000000..d60eff9 Binary files /dev/null and b/fonts/dinnextw1g-mediumitalic-webfont.woff2 differ diff --git a/fonts/dinnextw1g-regular-webfont.woff b/fonts/dinnextw1g-regular-webfont.woff new file mode 100644 index 0000000..d3b1a8e Binary files /dev/null and b/fonts/dinnextw1g-regular-webfont.woff differ diff --git a/fonts/dinnextw1g-regular-webfont.woff2 b/fonts/dinnextw1g-regular-webfont.woff2 new file mode 100644 index 0000000..270a24f Binary files /dev/null and b/fonts/dinnextw1g-regular-webfont.woff2 differ diff --git a/fonts/fonts.css b/fonts/fonts.css new file mode 100644 index 0000000..e6680d7 --- /dev/null +++ b/fonts/fonts.css @@ -0,0 +1,57 @@ +/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on September 18, 2023 */ +@font-face { + font-family: 'din_next_w1gregular'; + src: url('dinnextw1g-regular-webfont.woff2') format('woff2'), + url('dinnextw1g-regular-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1gbold'; + src: url('dinnextw1g-bold-webfont.woff2') format('woff2'), + url('dinnextw1g-bold-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1gbold_italic'; + src: url('dinnextw1g-bolditalic-webfont.woff2') format('woff2'), + url('dinnextw1g-bolditalic-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1gitalic'; + src: url('dinnextw1g-italic-webfont.woff2') format('woff2'), + url('dinnextw1g-italic-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1glight'; + src: url('dinnextw1g-light-webfont.woff2') format('woff2'), + url('dinnextw1g-light-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1glight_italic'; + src: url('dinnextw1g-lightitalic-webfont.woff2') format('woff2'), + url('dinnextw1g-lightitalic-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1gmedium'; + src: url('dinnextw1g-medium-webfont.woff2') format('woff2'), + url('dinnextw1g-medium-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'din_next_w1gmedium_italic'; + src: url('dinnextw1g-mediumitalic-webfont.woff2') format('woff2'), + url('dinnextw1g-mediumitalic-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} \ No newline at end of file diff --git a/js/caprigis.js b/js/caprigis.js index a9552cb..0ac86c1 100644 --- a/js/caprigis.js +++ b/js/caprigis.js @@ -5,18 +5,58 @@ */ const GIS = {}; -const BASE_URL = location.href; +const optionsVincoli = { + color: '#222', + opacity: 0.8, + weight: 1, + fillColor: '#987db7', + fillOpacity: 0.8 +}; +const optionsSiti = { + color: '#800040', + opacity: 1, + weight: 2.5, + fillColor: '#800040', + fillOpacity: 0.8 +}; +const optionsPaesistici = { + color: '#222', + opacity: 1, + weight: 1.5, + fillColor: '#ff8000', + fillOpacity: 0.8 +}; +const BASE_URL = location.href; +/** + * + * @param {?string} text + */ +function capitalize(text) { + let capital = text; + if (text) { + let words = text.split(' '); + capital = ''; + + for (let w of words) { + w = w[0].toUpperCase() + w.slice(1); + capital += w + ' '; + } + capital.trimEnd(); + } + + return capital; +} /** * @param {string} mapId * @param {number} zoomLevel * @returns {Map} */ GIS.initMap = async function (mapId, zoomLevel = 15) { - let layerSiti = await this.loadLayer('siti.geojson', '#800040'); - let layerVincoli = await this.loadLayer('vincoli.geojson'); + let layerVincoli = await this.loadLayer('vincoli.geojson', optionsVincoli); + let layerSiti = await this.loadLayer('siti.geojson', optionsSiti, false); // TODO named parameters?? - let layerPaesistici = await this.loadLayer('paesistici.geojson', '#222', '#ff8000'); + let layerPaesistici = await this.loadLayer('paesistici.geojson', optionsPaesistici); let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { maxNativeZoom : 22, maxZoom: 22, @@ -40,37 +80,28 @@ GIS.initMap = async function (mapId, zoomLevel = 15) { }; let layerControl = L.control.layers(baseMap, archeo).addTo(map); - - //DEBUG - // Il sistema di riferimento per i livelli geoJSON è EPSG3857 } /** * @todo Distinguere tipo di geojson per contenuto popup * @param {string} geoJSON - * @param {Map} map + * @param {{color, opacity, weight, fillColor, fillOpacity}} options Style options for features + * @param {boolean} popup Should the features have a popup? */ -GIS.loadLayer = async function (geoJSON, color = '#222', fillColor = '#987db7') { +GIS.loadLayer = async function (geoJSON, options, popup = true) { const data = await fetch(`${BASE_URL}/geojson/${geoJSON}`) .then(res => res.json()) .catch(error => console.error(`Can't load layer ${geoJSON}. Reason: ${error}`)); - // DEBUG - console.log(data.features); - // Show data from feature in popUp? const layer = new L.geoJson(data, { style: function (feature) { - let style = { - color: color, - opacity: 0.8, - weight: 1, - fillColor: fillColor, - fillOpacity: 0.8 - }; + let style = options; return style; }, onEachFeature: function (feature, layer) { - layer.bindPopup(GIS.featurePopup(geoJSON, feature)); + if (popup) { + layer.bindPopup(GIS.featurePopup(geoJSON, feature)); + } } }); @@ -85,23 +116,17 @@ GIS.loadLayer = async function (geoJSON, color = '#222', fillColor = '#987db7') * @returns {string} The popup's content */ GIS.featurePopup = function (layerName, feature) { + const html = ` + + + + + +
Oggetto${feature.properties.OGGETTO}
Anno${feature.properties.ANNO}
Comune${capitalize(feature.properties.COMUNE)}
Proprietà${capitalize(feature.properties.PROPRIETA)}
+ `; const content = { - 'vincoli.geojson' : ` - - - - - -
Oggetto${feature.properties.OGGETTO}
Anno${feature.properties.ANNO}
Comune${feature.properties.COMUNE}
Proprietà${feature.properties.PROPRIETA}
- `, - 'paesistici.geojson' : ` - - - - - -
Oggetto${feature.properties.OGGETTO}
Anno${feature.properties.ANNO}
Comune${feature.properties.COMUNE}
Proprietà${feature.properties.PROPRIETA}
- `, + 'vincoli.geojson' : html, + 'paesistici.geojson' : html, }; return content[layerName]; diff --git a/js/jsdoc.json b/js/jsdoc.json new file mode 100644 index 0000000..e28d726 --- /dev/null +++ b/js/jsdoc.json @@ -0,0 +1,19 @@ +{ + "source": { + "include": ["caprigis.js", "index.js"], + "includePattern": ".js$", + "excludePattern": "(vendor/|docs)" + }, + + "plugins": ["plugins/markdown"], + + "opts": { + "encoding": "utf8", + "destination": "docs/", + "recurse": true, + "verbose": true, + "theme_opts": { + "theme": "light" + } + } +}