[Commits] r1491 - sandbox/cmoullet/ux/StreetViewPanel/ux/widgets

commits at geoext.org commits at geoext.org
Wed Nov 25 20:26:24 CET 2009


Author: cmoullet
Date: 2009-11-25 20:26:24 +0100 (Wed, 25 Nov 2009)
New Revision: 1491

Added:
   sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
Log:
Add street view panel


Added: sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	                        (rev 0)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2009-11-25 19:26:24 UTC (rev 1491)
@@ -0,0 +1,69 @@
+Ext.namespace('GeoExt.ux');
+
+GeoExt.ux.StreetViewPanel = Ext.extend(Ext.Panel, {
+    initComponent : function() {
+
+        var defConfig = {
+            plain: true,
+            zoomLevel: 3,
+            yaw: 180,
+            pitch: 0,
+            zoom: 0,
+            border: false
+        }
+
+        Ext.applyIf(this, defConfig);
+
+        GeoExt.ux.StreetViewPanel.superclass.initComponent.call(this);
+    },
+    afterRender : function() {
+
+        var wh = this.ownerCt.getSize();
+
+        Ext.applyIf(this, wh);
+
+        GeoExt.ux.StreetViewPanel.superclass.afterRender.call(this);
+
+        this.panorama = new GStreetviewPanorama(this.body.dom);
+        this.streetviewclient = new GStreetviewClient();
+
+        var clickControl = new GeoExt.ux.Click({
+            handlerOptions: {
+                "single": true
+            },
+            panorama: this.panorama,
+            streetviewclient: this.streetviewclient
+        });
+
+        this.map.addControl(clickControl);
+        clickControl.activate();
+    },
+    beforeDestroy: function() {
+        this.panorama.remove();
+        delete this.panorama;
+        GeoExt.ux.StreetViewPanel.superclass.beforeDestroy.apply(this, arguments);
+    },
+    onResize : function(w, h) {
+        GeoExt.ux.StreetViewPanel.superclass.onResize.call(this, w, h);
+        if (typeof this.panorama == 'object') {
+            this.panorama.checkResize();
+        }
+    },
+    setSize : function(width, height, animate) {
+        GeoExt.ux.StreetViewPanel.superclass.setSize.call(this, width, height, animate);
+        if (typeof this.panorama == 'object') {
+            this.panorama.checkResize();
+        }
+    },
+    getMap: function() {
+        return this.panorama;
+    },
+    // http://stackoverflow.com/questions/183214/javascript-callback-scope
+    bind: function(scope, fn) {
+        return function () {
+            fn.apply(scope, arguments);
+        };
+    }
+});
+
+Ext.reg('gxux_streetviewpanel', GeoExt.ux.StreetViewPanel);
\ No newline at end of file



More information about the Commits mailing list