[gnome-maps] geoJSONSource: Add support for MultiPoint
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] geoJSONSource: Add support for MultiPoint
- Date: Tue, 1 Dec 2015 19:06:41 +0000 (UTC)
commit 1c7f1c560a3c99e306642d231eaf2af4a9e43425
Author: alafazam <alafazam gmail com>
Date: Sun Nov 29 23:56:04 2015 +0530
geoJSONSource: Add support for MultiPoint
https://bugzilla.gnome.org/show_bug.cgi?id=757143
src/geoJSONSource.js | 45 ++++++++++++++++++++++++++-------------------
1 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/src/geoJSONSource.js b/src/geoJSONSource.js
index 77ac28f..8ae6297 100644
--- a/src/geoJSONSource.js
+++ b/src/geoJSONSource.js
@@ -119,6 +119,28 @@ const GeoJSONSource = new Lang.Class({
}).bind(this));
},
+ _parsePoint: function(coordinates, properties) {
+ let name = null;
+ if (properties)
+ name = properties.name;
+
+ this._validate(coordinates);
+ this._bbox.extend(coordinates[1],
+ coordinates[0]);
+
+ let location = new Location.Location({
+ latitude: coordinates[1],
+ longitude: coordinates[0]
+ });
+
+ let place = new Place.Place({ name: name,
+ store: false,
+ location: location });
+ let placeMarker = new PlaceMarker.PlaceMarker({ place: place,
+ mapView: this._mapView });
+ this._markerLayer.add_marker(placeMarker);
+ },
+
_parseGeometry: function(geometry, properties) {
if(!geometry)
throw new Error(_("parse error"));
@@ -145,28 +167,13 @@ const GeoJSONSource = new Lang.Class({
break;
case 'Point':
- let name = null;
- if (properties)
- name = properties.name;
-
- this._validate(geometry.coordinates);
- this._bbox.extend(geometry.coordinates[1],
- geometry.coordinates[0]);
-
- let location = new Location.Location({
- latitude: geometry.coordinates[1],
- longitude: geometry.coordinates[0]
- });
-
- let place = new Place.Place({ name: name,
- store: false,
- location: location });
- let placeMarker = new PlaceMarker.PlaceMarker({ place: place,
- mapView: this._mapView });
- this._markerLayer.add_marker(placeMarker);
+ this._parsePoint(geometry.coordinates, properties);
break;
case 'MultiPoint':
+ geometry.coordinates.forEach((function(coordinate, properties) {
+ this._parsePoint(coordinate,properties);
+ }).bind(this));
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]