001 package com.google.gwt.maps.client.overlays; 002 003 import com.google.gwt.core.client.JavaScriptObject; 004 import com.google.gwt.maps.client.MapImpl; 005 import com.google.gwt.maps.client.MapWidget; 006 import com.google.gwt.maps.client.base.LatLng; 007 import com.google.gwt.maps.client.streetview.StreetViewPanoramaImpl; 008 import com.google.gwt.maps.client.streetview.StreetViewPanoramaWidget; 009 010 /** 011 * create Marker Options 012 * <br><br> 013 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions">MarkerOptions API Doc</a> 014 */ 015 public class MarkerOptions extends JavaScriptObject { 016 017 /** 018 * create Marker Options 019 * use newInstance(); 020 */ 021 protected MarkerOptions() {} 022 023 /** 024 * create Marker Options 025 */ 026 public final static MarkerOptions newInstance() { 027 return JavaScriptObject.createObject().cast(); 028 } 029 030 /** 031 * sets Which animation to play when marker is added to a map. 032 * @param animation 033 */ 034 public final native void setAnimation(Animation animation) /*-{ 035 this.animation = animation; 036 }-*/; 037 038 /** 039 * gets Which animation to play when marker is added to a map. 040 */ 041 public final native Animation getAnimation() /*-{ 042 return this.animation; 043 }-*/; 044 045 /** 046 * sets If true, the marker receives mouse and touch events. Default value is true. 047 * @param clickable 048 */ 049 public final native void setClickable(boolean clickable) /*-{ 050 this.clickable = clickable; 051 }-*/; 052 053 /** 054 * gets If true, the marker receives mouse and touch events. Default value is true. 055 */ 056 public final native boolean getClickable() /*-{ 057 return this.clickable; 058 }-*/; 059 060 /** 061 * sets Mouse cursor to show on hover 062 * @param cursor 063 */ 064 public final native void setCursor(String cursor) /*-{ 065 this.cursor = cursor; 066 }-*/; 067 068 /** 069 * gets Mouse cursor to show on hover 070 */ 071 public final native String getCursor() /*-{ 072 return this.cursor; 073 }-*/; 074 075 /** 076 * sets If true, the marker can be dragged. Default value is false. 077 * @param draggable 078 */ 079 public final native void setDraggable(boolean draggable) /*-{ 080 this.draggable = draggable; 081 }-*/; 082 083 /** 084 * gets If true, the marker can be dragged. Default value is false. 085 */ 086 public final native boolean getDraggable() /*-{ 087 return this.draggable; 088 }-*/; 089 090 /** 091 * sets If true, the marker shadow will not be displayed. 092 * @param flat 093 */ 094 public final native void setFlat(boolean flat) /*-{ 095 this.flat = flat; 096 }-*/; 097 098 /** 099 * gets If true, the marker shadow will not be displayed. 100 */ 101 public final native boolean getFlat() /*-{ 102 return this.flat; 103 }-*/; 104 105 /** 106 * sets Icon for the foreground 107 * @param icon 108 */ 109 public final native void setIcon(String icon) /*-{ 110 this.icon = icon; 111 }-*/; 112 113 /** 114 * gets Icon for the foreground 115 */ 116 public final native String getIcon_String() /*-{ 117 return this.icon; 118 }-*/; 119 120 /** 121 * sets Map on which to display Marker. 122 * @param icon 123 */ 124 public final native void setIcon(MarkerImage icon) /*-{ 125 this.icon = icon; 126 }-*/; 127 128 /** 129 * gets Map on which to display Marker. 130 */ 131 public final native MarkerImage getIcon_MarkerImage() /*-{ 132 return this.icon; 133 }-*/; 134 135 /** 136 * sets Map on which to display Polyline. 137 * @param mapWidget 138 */ 139 public final void setMap(MapWidget mapWidget) { 140 setMapImpl(mapWidget.getJso()); 141 } 142 143 private final native void setMapImpl(MapImpl map) /*-{ 144 this.map = map; 145 }-*/; 146 147 /** 148 * gets Map on which to display Polyline. 149 */ 150 public final MapWidget getMapWidget() { 151 return MapWidget.newInstance(getMapImpl()); 152 } 153 154 private final native MapImpl getMapImpl() /*-{ 155 return this.map; 156 }-*/; 157 158 public final void setMap(StreetViewPanoramaWidget streetViewPanoramaWidget) { 159 setMapImpl(streetViewPanoramaWidget.getJso()); 160 } 161 162 private final native void setMapImpl(StreetViewPanoramaImpl map) /*-{ 163 this.map = map; 164 }-*/; 165 166 /** 167 * gets Map on which to display Marker. 168 */ 169 public final StreetViewPanoramaWidget getMapStreetViewPanoramaWidget() { 170 return StreetViewPanoramaWidget.newInstance(getMapImpl_Street()); 171 } 172 173 private final native StreetViewPanoramaImpl getMapImpl_Street() /*-{ 174 return this.map; 175 }-*/; 176 177 /** 178 * sets Optimization renders many markers as a single static element. Optimized rendering is enabled by default. Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered as a separate DOM element (advanced usage only). 179 * @param optimized 180 */ 181 public final native void setOptimized(boolean optimized) /*-{ 182 this.optimized = optimized; 183 }-*/; 184 185 /** 186 * gets Optimization renders many markers as a single static element. Optimized rendering is enabled by default. Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered as a separate DOM element (advanced usage only). 187 */ 188 public final native boolean getOptimized() /*-{ 189 return this.optimized; 190 }-*/; 191 192 /** 193 * sets Marker position. Required. 194 * @param position 195 */ 196 public final native void setPosition(LatLng position) /*-{ 197 this.position = position; 198 }-*/; 199 200 /** 201 * gets Marker position. Required. 202 */ 203 public final native LatLng getPosition() /*-{ 204 return this.position; 205 }-*/; 206 207 /** 208 * sets If false, disables raising and lowering the marker on drag. This option is true by default. 209 * @param raiseOnDrag 210 */ 211 public final native void setRaiseOnDrag(boolean raiseOnDrag) /*-{ 212 this.raiseOnDrag = raiseOnDrag; 213 }-*/; 214 215 /** 216 * gets If false, disables raising and lowering the marker on drag. This option is true by default. 217 */ 218 public final native boolean getRaiseOnDrag() /*-{ 219 return this.raiseOnDrag; 220 }-*/; 221 222 /** 223 * sets Shadow image 224 * @param shadow 225 */ 226 public final native void setShadow(String shadow) /*-{ 227 this.shadow = shadow; 228 }-*/; 229 230 /** 231 * gets Shadow image 232 */ 233 public final native String getShadow_String() /*-{ 234 return this.shadow; 235 }-*/; 236 237 /** 238 * sets Shadow image 239 * @param shadow 240 */ 241 public final native void setShadow(MarkerImage shadow) /*-{ 242 this.shadow = shadow; 243 }-*/; 244 245 /** 246 * gets Shadow image 247 */ 248 public final native MarkerImage getShadow_MarkerImage() /*-{ 249 return this.shadow; 250 }-*/; 251 252 /** 253 * sets Image map region definition used for drag/click. 254 * @param shape 255 */ 256 public final native void setShape(MarkerShape shape) /*-{ 257 this.shape = shape; 258 }-*/; 259 260 /** 261 * gets Image map region definition used for drag/click. 262 */ 263 public final native MarkerShape getShape() /*-{ 264 return this.shape; 265 }-*/; 266 267 /** 268 * sets Rollover text 269 * @param title 270 */ 271 public final native void setTitle(String title) /*-{ 272 this.title = title; 273 }-*/; 274 275 /** 276 * gets Rollover text 277 */ 278 public final native String getTitle() /*-{ 279 return this.title; 280 }-*/; 281 282 /** 283 * sets If true, the marker is visible 284 * @param visible 285 */ 286 public final native void setVisible(boolean visible) /*-{ 287 this.visible = visible; 288 }-*/; 289 290 /** 291 * gets If true, the marker is visible 292 */ 293 public final native boolean getVisible() /*-{ 294 return this.visible; 295 }-*/; 296 297 /** 298 * sets All markers are displayed on the map in order of their zIndex, with higher values displaying in front of markers with lower values. By default, markers are displayed according to their vertical position on screen, with lower markers appearing in front of markers further up the screen. 299 * @param zIndex 300 */ 301 public final native void setZindex(int zIndex) /*-{ 302 this.zIndex = zIndex; 303 }-*/; 304 305 /** 306 * gets All markers are displayed on the map in order of their zIndex, with higher values displaying in front of markers with lower values. By default, markers are displayed according to their vertical position on screen, with lower markers appearing in front of markers further up the screen. 307 */ 308 public final native int getZindex() /*-{ 309 return this.zIndex; 310 }-*/; 311 312 } 313 314 315 316 317 318