commit 3b9bc01071f2b2939f5809c63d959509cb12693a
parent bdf2857657b5f202e3dd3473456aa661d6230f2c
Author: Katja (ctucx) <git@ctu.cx>
Date: Sun, 19 Jan 2025 15:34:41 +0100
parent bdf2857657b5f202e3dd3473456aa661d6230f2c
Author: Katja (ctucx) <git@ctu.cx>
Date: Sun, 19 Jan 2025 15:34:41 +0100
remove map feature
8 files changed, 2 insertions(+), 112 deletions(-)
diff --git a/package.json b/package.json @@ -17,8 +17,7 @@ "db-vendo-client": "https://github.com/yuyuyureka/db-vendo-client#main", "hafas-client": "https://github.com/yu-re-ka/hafas-client#main", "idb": "^8.0.1", - "lit-html": "^3.2.1", - "ol": "^10.3.1" + "lit-html": "^3.2.1" }, "devDependencies": { "copy-webpack-plugin": "^12.0.2",
diff --git a/src/app_functions.js b/src/app_functions.js @@ -56,7 +56,7 @@ const addJourneys = async data => { const mkSettings = () => { return { stopovers: true, - polylines: settings.showMap || false, + polylines: false, tickets: settings.showPrices || false, language: settings.language, };
diff --git a/src/journeysView.js b/src/journeysView.js @@ -23,12 +23,6 @@ const journeysTemplate = (data) => html` <div class="icon-canvas"></div> <span>${t('canvas-view')}</span> </a> - ${settings.showMap ? html` - <a href="#/${data.slug}/map" class="${settings.journeysViewMode === 'map' ? 'active' : ''}"> - <div class="icon-map"></div> - <span>${t('map-view')}</span> - </a> - ` : ''} </div> </div> </div> @@ -40,10 +34,6 @@ const journeysTemplate = (data) => html` <canvas id="canvas"></canvas> </div> ` : ''} - ${settings.journeysViewMode === 'map' ? html` - <div id="journeysMap"> - </div> - ` : ''} ${settings.journeysViewMode === 'table' ? html` ${data.earlierRef ? html` <a class="loadMore icon-arrow2 flipped" title="${t('label_earlier')}" @click=${() => moreJourneys(data.slug, 'earlier')}></a> @@ -156,10 +146,6 @@ export const journeysView = async (match, isUpdate) => { // if (!isUpdate) refreshJourneysView(slug); // update data in the background if (settings.journeysViewMode === 'canvas') return setupCanvas(data, isUpdate); - if (settings.journeysViewMode === 'map') { - const module = await import('./map.js'); - return module.setupMap(data, isUpdate); - } }; export const moreJourneys = async (slug, mode) => {
diff --git a/src/languages.js b/src/languages.js @@ -62,8 +62,6 @@ export const languages = { 'load-very-high': 'Sehr hohe Auslastung', 'load-exceptionally-high': 'Extrem hohe Auslastung', 'table-view': 'Tabelle', - 'map-view': 'Karte', - 'show-map': 'Karte anzeigen', 'experimental-features': 'Experimentelle Funktionen', 'show-prices': 'Preise anzeigen', }, @@ -131,8 +129,6 @@ export const languages = { 'load-very-high': 'Zéér druk', 'load-exceptionally-high': 'Extreem druk', 'table-view': 'Tabel', - 'map-view': 'Kaart', - 'show-map': 'Kaart tonen', 'experimental-features': 'Experimentele functies', 'show-prices': 'Prijzen tonen', }, @@ -201,8 +197,6 @@ export const languages = { 'load-exceptionally-high': 'Exceptionally high load', 'table-view': 'Table', 'canvas-view': 'Canvas', - 'map-view': 'Map', - 'show-map': 'Show geographical map view', 'experimental-features': 'Experimental features', 'show-prices': 'Show prices', 'price': 'Price',
diff --git a/src/map.js b/src/map.js @@ -1,72 +0,0 @@ -import Map from 'ol/Map'; -import View from 'ol/View'; -import { Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'; -import Feature from 'ol/Feature'; -import GeoJSON from 'ol/format/GeoJSON'; -import { XYZ as XYZSource, Vector as VectorSource } from 'ol/source'; -import { Circle as CircleStyle, Stroke, Style } from 'ol/style'; -import { getSquaredTolerance } from 'ol/renderer/vector'; - -import { moreJourneys } from './journeysView.js'; - -const vectorSource = new VectorSource({ }); -const view = new View({ - center: [0, 0], - zoom: 1, -}); - -const vectorLayer = new VectorLayer({ - source: vectorSource, - style: (feature) => feature.values_.style, -}); - -const map = new Map({ - layers: [ - new TileLayer({ - source: new XYZSource({ - url: 'https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', - }), - }), - vectorLayer, - ], - controls: [], - view, -}); - -export const setupMap = (data, isUpdate) => { - map.setTarget(document.getElementById('journeysMap')); - - const geojson = { - type: 'FeatureCollection', - features: [], - }; - - for (const journey of data.journeys) { - const i = data.journeys.indexOf(journey) / data.journeys.length; - const color = `hsl(${i * 360}, 50%, 50%)`; - const style = new Style({ - stroke: new Stroke({ - color, - width: 5, - }), - }); - for (const leg of journey.legs) { - if (!leg.polyline) continue; - geojson.features.push({ - type: 'Feature', - geometry: { - type: 'LineString', - coordinates: leg.polyline.features .map(point => point.geometry.coordinates), - }, - properties: { journey, style }, - }); - } - } - - vectorSource.clear(); - vectorSource.addFeatures(new GeoJSON({ - featureProjection: 'EPSG:3857', - }).readFeatures(geojson)); - - view.fit(vectorSource.getFeatures()[0].getGeometry().getExtent(), {size: [1000, 1000], padding: [420, 420, 420, 420]}); -};
diff --git a/src/settings.js b/src/settings.js @@ -27,7 +27,6 @@ const defaultSettings = { language: getDefaultLanguage(), travelynx: false, journeysViewMode: 'canvas', - showMap: false, showPrices: false, profile: "db", };
diff --git a/src/settingsView.js b/src/settingsView.js @@ -33,7 +33,6 @@ const settingsTemplate = () => html` <!--<label><input type="radio" name="profile" ?checked=${settings.profile === 'sncf'} value="sncf"> SNCF (${t("experimental")})</label><br>--> <br> <b>${t('experimental-features')}:</b><br> - <label><input type="checkbox" ?checked=${settings.showMap} id="feature-map"> ${t('show-map')}</label><br> <label><input type="checkbox" ?checked=${settings.showPrices} id="feature-prices"> ${t('show-prices')}</label><br> <button class="button" id="clear" @click=${clearDataStorage}><span>${t('clearstorage')}</span></button> @@ -67,9 +66,6 @@ const saveSettings = async () => { const profile = document.querySelector('input[name="profile"]:checked').value; settings.profile = profile; - const showMap = ElementById('feature-map').checked; - settings.showMap = showMap; - const showPrices = ElementById('feature-prices').checked; settings.showPrices = showPrices;
diff --git a/static/style.css b/static/style.css @@ -889,10 +889,6 @@ form>div.history { content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M5 13h14v-2H5v2zm-2 4h14v-2H3v2zM7 7v2h14V7H7z"/></svg>'); filter: invert(); } -/*.icon-map { - content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z"/></svg>'); - filter: invert(); -}*/ .mode-changers { display: flex; @@ -932,14 +928,6 @@ header h3 { margin: .4em 2em; } -#journeysMap { - flex-grow: 1; - display: flex; -} -.ol-viewport { - flex-grow: 1; - height: initial !important; -} #searchView { background-color: #222; flex-grow: 1;