[gnome-maps/wip/osm-edit: 9/47] osmApi: Implement fetching OSM ways.



commit 685dc3f63b15d217cb2321d032ed30d7cfed8a8d
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Jan 28 22:31:05 2015 +0100

    osmApi: Implement fetching OSM ways.

 src/mapBubble.js     |    4 ++--
 src/osmConnection.js |    6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 9d977b8..d77ba82 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -192,10 +192,10 @@ const MapBubble = new Lang.Class({
                osmType = 'node';
                break;
            case 2:
-               osmType = 'way';
+               osmType = 'relation';
                break;
            case 3:
-               osmType = 'relation';
+               osmType = 'way';
                break;
            default:
                debug ('Unknown OSM type: ' + this._place.osm_type);
diff --git a/src/osmConnection.js b/src/osmConnection.js
index def01d4..a34a25e 100644
--- a/src/osmConnection.js
+++ b/src/osmConnection.js
@@ -21,6 +21,8 @@
  */
 
 const OSMNode = imports.osmNode;
+const OSMRelation = imports.osmRelation;
+const OSMWay = imports.osmWay;
 
 const Lang = imports.lang;
 const Maps = imports.gi.GnomeMaps;
@@ -75,9 +77,13 @@ const OSMConnection = new Lang.Class({
        case 'node':
            jsonString = Maps.osm_parse_node(body.data, body.length);
            break;
+       case 'way':
+           jsonString = Maps.osm_parse_way(body.data, body.length);
        default:
        }
 
+       print ('parsed XML to JSON: ' + jsonString);
+       
        return JSON.parse(jsonString);
     },
 


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