[Commits] r1513 - in sandbox/cmoullet/ux/StreetViewPanel: examples resources ux/widgets

commits at geoext.org commits at geoext.org
Sat Nov 28 23:33:22 CET 2009


Author: cmoullet
Date: 2009-11-28 23:33:21 +0100 (Sat, 28 Nov 2009)
New Revision: 1513

Modified:
   sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js
   sandbox/cmoullet/ux/StreetViewPanel/resources/link.png
   sandbox/cmoullet/ux/StreetViewPanel/resources/link_selected.png
   sandbox/cmoullet/ux/StreetViewPanel/resources/tool.png
   sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
Log:
Add new graphics, test modes


Modified: sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js	2009-11-28 21:12:00 UTC (rev 1512)
+++ sandbox/cmoullet/ux/StreetViewPanel/examples/StreetViewPanelExample.js	2009-11-28 22:33:21 UTC (rev 1513)
@@ -57,7 +57,10 @@
     var streetViewPanelItem = {
         xtype: 'gxux_streetviewpanel',
         id: 'streetViewPanelItem',
-        map: map        
+        map: map,
+        videoMode: true,
+        showLinks: true,
+        showTool: true
     };
 
     viewport = new Ext.Viewport({

Modified: sandbox/cmoullet/ux/StreetViewPanel/resources/link.png
===================================================================
(Binary files differ)

Modified: sandbox/cmoullet/ux/StreetViewPanel/resources/link_selected.png
===================================================================
(Binary files differ)

Modified: sandbox/cmoullet/ux/StreetViewPanel/resources/tool.png
===================================================================
(Binary files differ)

Modified: sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2009-11-28 21:12:00 UTC (rev 1512)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2009-11-28 22:33:21 UTC (rev 1513)
@@ -49,6 +49,14 @@
      */
     videoMode: true,
 
+    /** api: config[videoTimeInterval]
+     *  ``Boolean``  Defines the time in millisecond between the move
+     */
+    /** private: property[videoTimeInterval]
+     *  ``Boolean``  videoInterval
+     */
+    videoTimeInterval: 2000,
+
     /** api: config[showTool]
      *  ``Boolean``  Defines if the 2D tool is shown in the map
      */
@@ -133,6 +141,8 @@
         this.panorama.videoMode = this.videoMode;
         this.panorama.streetviewclient = this.streetviewclient;
         this.panorama.videoPlay = false;
+        this.panorama.videoReady = true;
+        this.panorama.videoTimeInterval = this.videoTimeInterval;
 
         // Draw navigation tool in map
         this.panorama.drawNavigationTool = function(panorama, position) {
@@ -198,9 +208,19 @@
             if (data) {
                 if (data.code == 600) {
                     this.deleteFeatures();
+                    if (this.panorama.videoMode && this.panorama.videoPlay) {
+                        this.panorama.videoReady = true;
+                        this.panorama.videoPlay = false;
+                        clearInterval(this.panorama.videoInterval);
+                    }
                     alert(OpenLayers.i18n('Google Street View: No panorama found near this position. You have to click elsewhere ;-)'));
                 } else if (data.code == 500) {
-                    this.deleteFeatures()
+                    this.deleteFeatures();
+                    if (this.panorama.videoMode && this.panorama.videoPlay) {
+                        this.panorama.videoReady = true;
+                        this.panorama.videoPlay = false;
+                        clearInterval(this.panorama.videoInterval);
+                    }
                     alert(OpenLayers.i18n('Google Street View: Server error'));
                 } else if (data.code == 200) {
                     var POV = {yaw: this.panorama.yaw,  pitch: this.panorama.pitch, zoom: this.panorama.zoom};
@@ -232,15 +252,22 @@
                                         this.panorama.nextFeature = this.panorama.navigationLinks[i];
                                     }
                                 }
+                                this.panorama.videoReady = true;
                                 //console.log("callback: previousDifferenceVideo" + this.panorama.previousDifferenceVideo)
                                 //console.log("callback: nextYaw: "+ this.panorama.nextFeature.attributes.angle);
                             } else {
+                                this.panorama.videoReady = true;
                                 clearInterval(this.panorama.videoInterval);
                             }
                         }
                     }
                 } else {
                     this.deleteFeatures();
+                    if (this.panorama.videoMode && this.panorama.videoPlay) {
+                        this.panorama.videoReady = true;
+                        this.panorama.videoPlay = false;
+                        clearInterval(this.panorama.videoInterval);
+                    }
                     alert(OpenLayers.i18n('Google Street View: Unexpected problem'));
                 }
             }
@@ -311,7 +338,9 @@
                     styleMap: new OpenLayers.StyleMap({
                         "default": {
                             externalGraphic: "../resources/tool.png",
-                            graphicHeight: 40,
+                            graphicHeight: 32,
+                            graphicWidth: 32,
+                            graphicOpacity: 0.8,
                             rotation: "${yaw}"
                         },
                         "select": {
@@ -343,6 +372,7 @@
                             externalGraphic: "../resources/link.png",
                             graphicHeight: 24,
                             graphicYOffset: -44,
+                            graphicOpacity: 0.8,
                             rotation: "${angle}"
                         },
                         "select": {
@@ -365,12 +395,15 @@
                                     this.panorama.previousYawVideo = feature.attributes.angle;
                                 }
                                 //console.log("PlayVideo: previousYawVideo: "+ this.panorama.previousYawVideo);
-                                this.streetviewclient.getPanoramaById(feature.attributes.panoId, this.panorama.callback.createDelegate(this));
+                                if (this.panorama.videoReady) {
+                                    this.streetviewclient.getPanoramaById(feature.attributes.panoId, this.panorama.callback.createDelegate(this));
+                                    this.panorama.videoReady = false;
+                                }
                             }
                             // Manage the start and stop of the video
                             if (!this.panorama.videoPlay) {
                                 //console.log("Start Play Video");
-                                this.panorama.videoInterval = setInterval(this.playVideo.createDelegate(this), 3000);
+                                this.panorama.videoInterval = setInterval(this.playVideo.createDelegate(this), this.panorama.videoTimeInterval);
                                 this.playVideo();
                                 this.panorama.videoPlay = true;
                             } else {



More information about the Commits mailing list