[gnome-maps/wip/mlundblad/place-zoom-levels: 3/4] WIP: Add module for place zoom levels
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/place-zoom-levels: 3/4] WIP: Add module for place zoom levels
- Date: Sun, 12 Dec 2021 22:25:08 +0000 (UTC)
commit 40f022956ddf8487ede08d993a3ba967c6d0ee65
Author: Marcus Lundblad <ml update uu se>
Date: Mon Nov 29 22:47:27 2021 +0100
WIP: Add module for place zoom levels
Add utility module to define default
zoom levels for place types.
src/org.gnome.Maps.src.gresource.xml.in | 1 +
src/placeZoom.js | 62 +++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml.in b/src/org.gnome.Maps.src.gresource.xml.in
index 2338a132..da8266e7 100644
--- a/src/org.gnome.Maps.src.gresource.xml.in
+++ b/src/org.gnome.Maps.src.gresource.xml.in
@@ -68,6 +68,7 @@
<file>placeStore.js</file>
<file>placeView.js</file>
<file>placeViewImage.js</file>
+ <file>placeZoom.js</file>
<file>printLayout.js</file>
<file>printOperation.js</file>
<file>route.js</file>
diff --git a/src/placeZoom.js b/src/placeZoom.js
new file mode 100644
index 00000000..5cf38a35
--- /dev/null
+++ b/src/placeZoom.js
@@ -0,0 +1,62 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2021 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+const TYPE_ZOOM_MAP = {
+ amenity: {
+ _: 17
+ },
+ highway: {
+ bus_stop: 17
+ },
+ place: {
+ continent: 4,
+ ocean: 4,
+ sea: 5,
+ country: 6,
+ state: 7,
+ region: 8,
+ province: 8,
+ county: 8,
+ municipality: 8,
+ island: 9,
+ city: 10,
+ town: 12,
+ borough: 12,
+ village: 15,
+ suburb: 15,
+ hamlet: 15,
+ _: 17
+
+ },
+ railway: {
+ halt: 16,
+ station: 14,
+ tram_stop: 16
+ },
+ shop: {
+ _: 17
+ }
+}
+
+function getZoomLevelForPlace(place) {
+ return TYPE_ZOOM_MAP?.[place.osmKey]?.[place.osmValue] ??
+ TYPE_ZOOM_MAP?.[place.osmKey]?.['_'];
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]