001    package com.google.gwt.maps.client.streetview;
002    
003    import com.google.gwt.core.client.JavaScriptObject;
004    import com.google.gwt.maps.client.base.LatLng;
005    import com.google.gwt.maps.client.controls.PanControlOptions;
006    import com.google.gwt.maps.client.controls.ZoomControlOptions;
007    import com.google.gwt.maps.client.workaround.WorkAroundUtils;
008    
009    /**
010     * Options defining the properties of a StreetViewPanorama object.
011     * <br><br>
012     * See <a href="https://developers.google.com/maps/documentation/javascript/reference#StreetViewPanoramaOptions">StreetViewPanoramaOptions API Doc</a> 
013     */
014    public class StreetViewPanoramaOptions extends JavaScriptObject {
015      
016      /**
017       * Options defining the properties of a StreetViewPanorama object.
018       * use newInstance();
019       */
020      protected StreetViewPanoramaOptions() {}
021      
022      /**
023       * creates Options defining the properties of a StreetViewPanorama object.
024       * @return {@link StreetViewPanoramaOptions}
025       */
026      public final static StreetViewPanoramaOptions newInstance() {
027        JavaScriptObject jso = JavaScriptObject.createObject();
028        WorkAroundUtils.removeGwtObjectId(jso);
029        return jso.cast(); 
030      }
031    
032      /**
033       * sets The enabled/disabled state of the address control.
034       * @param addressControl
035       */
036      public final native void setAddressControl(boolean addressControl) /*-{
037        this.addressControl = addressControl
038      }-*/;
039      
040      /**
041       * gets The enabled/disabled state of the address control.
042       */
043      public final native boolean getAddressControl() /*-{
044        return this.addressControl;
045      }-*/;
046      
047      /**
048       * sets The display options for the address control.
049       * @param addressControlOptions {@link StreetViewAddressControlOptions}
050       */
051      public final native void setAddressControlOptions(StreetViewAddressControlOptions addressControlOptions) /*-{
052        this.addressControlOptions = addressControlOptions;
053      }-*/;
054      
055      /**
056       * gets The display options for the address control.
057       * @return {@link StreetViewAddressControlOptions}
058       */
059      public final native StreetViewAddressControlOptions getAddressControlOptions() /*-{
060        return this.addressControlOptions;
061      }-*/;
062      
063      /**
064       * sets Enables/disables zoom on double click. Enabled by default.
065       * @param disableDoubleClickZoom
066       */
067      public final native void setDisableDoubleClickZoom(boolean disableDoubleClickZoom) /*-{
068        this.disableDoubleClickZoom = disableDoubleClickZoom;
069      }-*/;
070      
071      /**
072       * gets Enables/disables zoom on double click. Enabled by default.
073       */
074      public final native boolean getDisableDoubleClickZoom() /*-{
075        return this.disableDoubleClickZoom;
076      }-*/;
077      
078      /**
079       * sets If true, the close button is displayed. Disabled by default.
080       * @param enableCloseButton
081       */
082      public final native void setEnableCloseButton(boolean enableCloseButton) /*-{
083        this.enableCloseButton = enableCloseButton;
084      }-*/;
085      
086      /**
087       * gets If true, the close button is displayed. Disabled by default.
088       */
089      public final native boolean getEnableCloseButton() /*-{
090        return this.enableCloseButton;
091      }-*/;
092      
093      /**
094       * sets The enabled/disabled state of the links control.
095       * @param linksControl
096       */
097      public final native void setLinksControl(boolean linksControl) /*-{
098        this.linksControl = linksControl;
099      }-*/;
100      
101      /**
102       * gets The enabled/disabled state of the links control.
103       */
104      public final native boolean getLinksControl() /*-{
105        return this.linksControl;
106      }-*/;
107      
108      /**
109       * sets The enabled/disabled state of the pan control.
110       * @param panControl
111       */
112      public final native void setPanControl(boolean panControl) /*-{
113        this.panControl = panControl;
114      }-*/;
115      
116      /**
117       * gets The enabled/disabled state of the pan control.
118       */
119      public final native boolean getPanControl() /*-{
120        return this.panControl;
121      }-*/;
122      
123      /**
124       * sets The display options for the pan control.
125       * @param panControlOptions {@link PanControlOptions}
126       */
127      public final native void setPanControlOptions(PanControlOptions panControlOptions) /*-{
128        this.panControlOptions = panControlOptions;
129      }-*/;
130      
131      /**
132       * gets The display options for the pan control.
133       * @return {@link PanControlOptions}
134       */
135      public final native PanControlOptions getPanControlOptions() /*-{
136        return this.panControlOptions;
137      }-*/;
138      
139      /**
140       * sets The panorama ID, which should be set when specifying a custom panorama.
141       * @param pano
142       */
143      public final native void setPano(String pano) /*-{
144        this.pano = pano;
145      }-*/;
146      
147      /**
148       * gets The panorama ID, which should be set when specifying a custom panorama.
149       */
150      public final native String getPano() /*-{
151        return this.pano;
152      }-*/;
153      
154      /**
155       * sets Custom panorama provider, which takes a string pano id and returns an object defining the panorama given that id. This function must be defined to specify custom panorama imagery.
156       * @param provider
157       */
158      public final native void setPanoProvider(StreetViewPanoramaProvider provider) /*-{
159        this.panoProvider = function(pano, zoom, tileX, tileY) {
160          var z = zoom ? zoom : -1;
161          var x = tileX ? tileX : -1;
162          var y = tileY ? tileY : -1;
163          //alert('panoProvider= pano' + pano + ' zoom=' + z + ' tileX=' + x + ' tileY=' + y);
164          return @com.google.gwt.maps.client.streetview.StreetViewPanoramaOptions::setPanoProviderImpl(Ljava/lang/String;IIILcom/google/gwt/maps/client/streetview/StreetViewPanoramaProvider;)(pano, z, x, y, provider);
165        }
166      }-*/;
167      
168      private static StreetViewPanoramaData setPanoProviderImpl(String pano, int zoom, int tileX, int tileY, StreetViewPanoramaProvider provider) {
169        StreetViewPanoramaData svpd = provider.getPanoData(pano, zoom, tileX, tileY);
170        return svpd;
171      }
172      
173      /** 
174       * gets Custom panorama provider, which takes a string pano id and returns an object defining the panorama given that id. This function must be defined to specify custom panorama imagery.
175       */
176      public final native StreetViewPanoramaProvider getPanoProvider() /*-{
177        return this.panoProvider;
178      }-*/;
179      
180      /**
181       * sets The LatLng position of the Street View panorama.
182       * @param position {@link LatLng}
183       */
184      public final native void setPosition(LatLng position) /*-{
185        this.position = position;
186      }-*/;
187      
188      /**
189       * gets The LatLng position of the Street View panorama.
190       * @return {@link LatLng}
191       */
192      public final native LatLng getPosition() /*-{
193        return this.position;
194      }-*/;
195      
196      /**
197       * The camera orientation, specified as heading, pitch, and zoom, for the panorama.
198       * @param pov {@link StreetViewPov}
199       */
200      public final native void setStreeViewPov(StreetViewPov pov) /*-{
201        this.pov = pov;
202      }-*/;
203      
204      /**
205       * gets The camera orientation, specified as heading, pitch, and zoom, for the panorama.
206       */
207      public final native StreetViewPov getStreetViewPov() /*-{
208        return this.pov;
209      }-*/;
210      
211      /**
212       * sets If false, disables scrollwheel zooming in Street View. The scrollwheel is enabled by default.
213       * @param scrollwheel
214       */
215      public final native void setScrollWheel(boolean scrollwheel) /*-{
216        this.scrollwheel = scrollwheel;
217      }-*/;
218      
219      /**
220       * gets If false, disables scrollwheel zooming in Street View. The scrollwheel is enabled by default.
221       */
222      public final native boolean getsScrollWheel() /*-{
223        return this.scrollwheel;
224      }-*/;
225      
226      /**
227       * sets If true, the Street View panorama is visible on load.
228       * @param visible
229       */
230      public final native void setVisibile(boolean visible) /*-{
231        this.visible = visible;
232      }-*/;
233      
234      /**
235       * gets If true, the Street View panorama is visible on load.
236       */
237      public final native boolean getVisible() /*-{
238        return this.visible;
239      }-*/;
240      
241      /**
242       * sets The enabled/disabled state of the zoom control.
243       * @param zoomControl
244       */
245      public final native void setZoomControl(boolean zoomControl) /*-{
246        this.zoomControl = zoomControl;
247      }-*/;
248      
249      /**
250       * gets The enabled/disabled state of the zoom control.
251       */
252      public final native boolean getZoomControl() /*-{
253        return this.zoomControl;
254      }-*/;
255      
256      /**
257       * sets The display options for the zoom control.
258       * @param zoomControlOptions
259       */
260      public final native void setZoomControlOptions(ZoomControlOptions zoomControlOptions) /*-{
261        this.zoomControlOptions = zoomControlOptions;
262      }-*/;
263      
264      /**
265       * gets The display options for the zoom control.
266       */
267      public final native ZoomControlOptions getZoomControlOptions() /*-{
268        return this.zoomControlOptions;
269      }-*/;
270      
271    }