001 package com.google.gwt.maps.client.base;
002
003 import com.google.gwt.core.client.JavaScriptObject;
004
005 /**
006 * Two-dimensional size, where width is the distance on the x-axis, and height is the distance on the y-axis.
007 * <br><br>
008 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#Size">Size API Doc</a>
009 */
010 public class Size extends JavaScriptObject {
011
012 /**
013 * creates Two-dimensional size, where width is the distance on the x-axis, and height is the distance on the y-axis.
014 * use newInstance();
015 */
016 protected Size() {}
017
018 /**
019 * creates Two-dimensional size, where width is the distance on the x-axis, and height is the distance on the y-axis.
020 * @param width
021 * @param height
022 * @param widthUnit
023 * @param heightUnit
024 * @return {@link Size}
025 */
026 public final static Size newInstance(double width, double height, String widthUnit, String heightUnit) {
027 return createJso(width, height, widthUnit, heightUnit).cast();
028 }
029
030 /**
031 * creates Two-dimensional size, where width is the distance on the x-axis, and height is the distance on the y-axis.
032 * @param width
033 * @param height
034 * @return {@link Size}
035 */
036 public final static Size newInstance(double width, double height) {
037 return createJso(width, height).cast();
038 }
039
040 private final static native Size createJso(double width, double height, String widthUnit, String heightUnit) /*-{
041 return new $wnd.google.maps.Size(width, height, widthUnit, heightUnit);
042 }-*/;
043
044 private final static native Size createJso(double width, double height) /*-{
045 return new $wnd.google.maps.Size(width, height);
046 }-*/;
047
048 /**
049 * Compares two Sizes.
050 * @param other
051 * @return boolean
052 */
053 public final native boolean equals(Size other) /*-{
054 return this.equals(other);
055 }-*/;
056
057 /**
058 * Returns a string representation of this Size.
059 */
060 public final native String getToString() /*-{
061 return this.toString();
062 }-*/;
063
064 /**
065 * sets The height along the y-axis, in pixels.
066 * @param height
067 */
068 public final native void setHeight(double height) /*-{
069 this.height = height;
070 }-*/;
071
072 /**
073 * gets The height along the y-axis, in pixels.
074 */
075 public final native double getHeight() /*-{
076 return this.height;
077 }-*/;
078
079 /**
080 * sets The width along the x-axis, in pixels.
081 * @param width
082 */
083 public final native void setWidth(double width) /*-{
084 this.width = width;
085 }-*/;
086
087 /**
088 * gets The width along the x-axis, in pixels.
089 */
090 public final native double getWidth() /*-{
091 return this.width;
092 }-*/;
093 }