001 package com.google.gwt.maps.client.overlays;
002
003 import com.google.gwt.core.client.JavaScriptObject;
004 import com.google.gwt.core.client.JsArrayInteger;
005
006 /**
007 * This object defines the marker shape to use in determination of a marker's clickable region. The shape consists of two properties ° type and coord ° which define the general type of marker and coordinates specific to that type of marker.
008 * <br><br>
009 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#MarkerShape">MarkerShape API Doc</a>
010 */
011 public class MarkerShape extends JavaScriptObject {
012
013 /**
014 * This object defines the marker shape to use in determination of a marker's clickable region. The shape consists of two properties ° type and coord ° which define the general type of marker and coordinates specific to that type of marker.
015 * use newInstance();
016 */
017 protected MarkerShape() {}
018
019 /**
020 * creates This object defines the marker shape to use in determination of a marker's clickable region. The shape consists of two properties ° type and coord ° which define the general type of marker and coordinates specific to that type of marker.
021 */
022 public final static MarkerShape newInstance() {
023 return JavaScriptObject.createObject().cast();
024 }
025
026 /**
027 * sets The format of this attribute depends on the value of the type and follows the w3 AREA coords specification found at <br><br>
028 * See <a href="http://www.w3.org/TR/REC-html40/struct/objects.html#adef-coords">adef-coords API Doc</a>.
029 * The coords attribute is an array of integers that specify the pixel position of the shape relative to the top-left corner of the target image. The coordinates depend on the value of type as follows:
030 * - circle: coords is [x1,y1,r] where x1,y2 are the coordinates of the center of the circle, and r is the radius of the circle.
031 * - poly: coords is [x1,y1,x2,y2...xn,yn] where each x,y pair contains the coordinates of one vertex of the polygon.
032 * - rect: coords is [x1,y1,x2,y2] where x1,y1 are the coordinates of the upper-left corner of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle.
033 * @param coords array of coords
034 */
035 public final native void setCoordinates(JsArrayInteger coords) /*-{
036 this.coords = coords;
037 }-*/;
038
039 /**
040 * gets coords (refer to setter)
041 */
042 public final native JsArrayInteger getCoordinates() /*-{
043 return this.coords;
044 }-*/;
045
046 /**
047 * sets Describes the shape's type and can be circle, poly or rect.
048 * @param type
049 */
050 public final void setType(MarkerShapeType type) {
051 setType(type.value());
052 }
053
054 /**
055 * sets Describes the shape's type and can be circle, poly or rect.
056 * @param type
057 */
058 private final native void setType(String type) /*-{
059 this.type = type;
060 }-*/;
061
062 /**
063 * gets gets Describes the shape's type and can be circle, poly or rect.
064 */
065 public final MarkerShapeType getType() {
066 return MarkerShapeType.fromValue(getTypeImpl());
067 }
068
069 /**
070 * gets Describes the shape's type and can be circle, poly or rect.
071 */
072 private final native String getTypeImpl() /*-{
073 return this.type;
074 }-*/;
075
076 }