Commits

Ralph Bean committed 0ba66aa

Opening hook for moksha widgets

Comments (0)

Files changed (2)

 
 setup(
     name='tw2.polymaps',
-    version='0.1.a1',
+    version='0.1.a2',
     description='toscawidgets2 wrapper for polymaps - amazing javascript maps',
     long_description=long_description,
     author='Ralph Bean',

tw2/polymaps/static/custom/js/tw2.polymaps.js

         if ( zoom ) { map.zoom(zoom); }
         if ( zoom_range ) { map.zoomRange(zoom_range); }
 
+        // Singleton:
+        if ( window._polymapwidgets === undefined ) {
+                window._polymapwidgets = {};
+        }
+        window._polymapwidgets[args.id] = map;
+
         return map;
 }
 
                 }, interval );
         }
 }
+
+function addGeoJsonToPolymap(id, json) {
+        var map = window._polymapwidgets[id];
+        var layer = po.geoJson().features(json['features']);
+        map.add(layer);
+        return map
+}