[gnome-maps/wip/mlundblad/additional-place-icons: 2/3] WIP: place: Return place icon based on osmType and osmValue




commit 93119e909186d22b154ec48784737005cf551921
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Apr 6 22:02:03 2021 +0200

    WIP: place: Return place icon based on osmType and osmValue

 src/place.js      | 10 ++++++++++
 src/placeIcons.js |  4 ++++
 2 files changed, 14 insertions(+)
---
diff --git a/src/place.js b/src/place.js
index 0ccb7c91..8dd499e7 100644
--- a/src/place.js
+++ b/src/place.js
@@ -22,11 +22,13 @@
 const _ = imports.gettext.gettext;
 
 const Geocode = imports.gi.GeocodeGlib;
+const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 
 const Location = imports.location;
 const Overpass = imports.overpass;
+const PlaceIcons = imports.placeIcons;
 const URLS = imports.urls;
 const Utils = imports.utils;
 
@@ -265,6 +267,14 @@ class Place extends Geocode.Place {
         return this._osmValue;
     }
 
+    get icon() {
+        return Gio.Icon.new_for_string(this._getIconName());
+    }
+
+    _getIconName() {
+        return PlaceIcons.getIconForPlace(this);
+    }
+
     toJSON() {
         let bounding_box = null;
 
diff --git a/src/placeIcons.js b/src/placeIcons.js
index 0160678a..727bf8d5 100644
--- a/src/placeIcons.js
+++ b/src/placeIcons.js
@@ -75,8 +75,11 @@ const TYPE_ICON_MAP = {
     },
     place: {
         city:             'city-symbolic',
+        city_block:       'building-symbolic',
         hamlet:           'town-symbolic',
+        isolated_dwelling:'building-symbolic',
         suburb:           'town-symbolic',
+        square:           'route-pedestrian-symbolic',
         town:             'town-symbolic',
         village:          'town-symbolic'
     },
@@ -96,6 +99,7 @@ const TYPE_ICON_MAP = {
         guest_house:      'bed-symbolic',
         hostel:           'bed-symbolic',
         hotel:            'bed-symbolic',
+        motel:            'bed-symbolic',
         museum:           'museum-symbolic'
     }
 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]