[gnome-maps/wip/mlundblad/simplify-place-init: 2/3] photonParser: Inititate Place directly
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/simplify-place-init: 2/3] photonParser: Inititate Place directly
- Date: Tue, 3 Nov 2020 22:17:47 +0000 (UTC)
commit 456073e12dd991a7db66e684e160721eea86d730
Author: Marcus Lundblad <ml update uu se>
Date: Thu Oct 29 10:37:55 2020 +0100
photonParser: Inititate Place directly
src/photonParser.js | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/src/photonParser.js b/src/photonParser.js
index 4ae3e42c..17aff883 100644
--- a/src/photonParser.js
+++ b/src/photonParser.js
@@ -55,40 +55,38 @@ function parsePlace(latitude, longitude, properties) {
name = streetAddress;
}
- let place = new Geocode.Place({ name: name,
- place_type: type,
- location: location });
+ let params = { name: name, place_type: type, location: location };
if (streetAddress)
- place.street_address = streetAddress;
+ params.street_address = streetAddress;
if (properties.osm_id && properties.osm_type) {
- place.osm_id = properties.osm_id + ''; // Geocode-glib needs this as a string
- place.osm_type = _parseOsmType(properties.osm_type);
+ params.osm_id = properties.osm_id + ''; // Geocode-glib needs this as a string
+ params.osm_type = _parseOsmType(properties.osm_type);
}
if (properties.street)
- place.street = properties.street;
+ params.street = properties.street;
if (properties.city)
- place.town = properties.city;
+ params.town = properties.city;
if (properties.postcode)
- place.postal_code = properties.postcode;
+ params.postal_code = properties.postcode;
if (properties.state)
- place.state = properties.state;
+ params.state = properties.state;
if (countryCode)
- place.country_code = countryCode;
+ params.country_code = countryCode;
if (!countryCode && properties.country)
- place.country = properties.country;
+ params.country = properties.country;
if (properties.extent)
- place.bounding_box = _parseBoundingBox(properties.extent);
+ params.bounding_box = _parseBoundingBox(properties.extent);
- return new Place.Place({ place: place });
+ return new Place.Place(params);
}
function _parseName(properties) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]