001    package com.google.gwt.maps.client.geometrylib;
002    
003    import com.google.gwt.core.client.JsArray;
004    import com.google.gwt.maps.client.base.LatLng;
005    import com.google.gwt.maps.client.mvc.MVCArray;
006    
007    public class SphericalUtils {
008    
009      /**
010       * Computes the area of the given loop. Loops must be closed.
011       * @param loop
012       */
013      public static final native double computeArea(JsArray<LatLng> loop) /*-{
014        return $wnd.google.maps.geometry.spherical.computeArea(loop);
015      }-*/;
016      
017      /**
018       * Computes the area of the given loop. Loops must be closed.
019       * @param loop
020       */
021      public static final native double computeArea(MVCArray<LatLng> loop) /*-{
022        return $wnd.google.maps.geometry.spherical.computeArea(loop);
023      }-*/;
024      
025      /**
026       * Computes the area of the given loop. Loops must be closed.
027       * @param loop
028       * @param radius
029       */
030      public static final native double computeArea(JsArray<LatLng> loop, int radius) /*-{
031        return $wnd.google.maps.geometry.spherical.computeArea(loop, radius);
032      }-*/;
033      
034      /**
035       * Computes the area of the given loop. Loops must be closed.
036       * @param loop
037       * @param radius
038       */
039      public static final native double computeArea(MVCArray<LatLng> loop, int radius) /*-{
040        return $wnd.google.maps.geometry.spherical.computeArea(loop, radius);
041      }-*/;
042      
043      /**
044       * Computes the distance between two LatLngs.
045       * @param from
046       * @param to
047       */
048      public static final native double computeDistanceBetween(LatLng from, LatLng to) /*-{
049        return $wnd.google.maps.geometry.spherical.computeDistanceBetween(from, to);
050      }-*/;
051      
052      /**
053       * Computes the distance between two LatLngs.
054       * @param from
055       * @param to
056       * @param radius
057       */
058      public static final native double computeDistanceBetween(LatLng from, LatLng to, int radius) /*-{
059        return $wnd.google.maps.geometry.spherical.computeDistanceBetween(from, to, radius);
060      }-*/;
061      
062      /**
063       * Computes the heading from one LatLng to another LatLng.
064       * @param from
065       * @param to
066       */
067      public static final native double computeHeading(LatLng from, LatLng to) /*-{
068        return $wnd.google.maps.geometry.spherical.computeHeading(from, to);
069      }-*/;
070      
071      /**
072       * Computes the length of the given path.
073       * @param path
074       */
075      public static final native double computeLength(JsArray<LatLng> path) /*-{
076        return $wnd.google.maps.geometry.spherical.computeLength(path);
077      }-*/;
078      
079      /**
080       * Computes the length of the given path.
081       * @param path
082       */
083      public static final native double computeLength(MVCArray<LatLng> path) /*-{
084        return $wnd.google.maps.geometry.spherical.computeLength(path);
085      }-*/;
086      
087      /**
088       * Computes the length of the given path.
089       * @param path
090       * @param radius
091       */
092      public static final native double computeLength(JsArray<LatLng> path, int radius) /*-{
093        return $wnd.google.maps.geometry.spherical.computeLength(path, radius);
094      }-*/;
095      
096      /**
097       * Computes the length of the given path.
098       * @param path
099       * @param radius
100       */
101      public static final native double computeLength(MVCArray<LatLng> path, int radius) /*-{
102        return $wnd.google.maps.geometry.spherical.computeLength(path, radius);
103      }-*/;
104      
105      /**
106       * Computes the LatLng produced by starting from a given LatLng and heading a given distance.
107       * @param from
108       * @param distance
109       * @param heading
110       */
111      public static final native LatLng computeOffset(LatLng from, int distance, int heading) /*-{
112        return $wnd.google.maps.geometry.spherical.computeOffset(from, distance, heading);
113      }-*/;
114      
115      /**
116       * Computes the LatLng produced by starting from a given LatLng and heading a given distance.
117       * @param from
118       * @param distance
119       * @param heading
120       * @param radius
121       */
122      public static final native LatLng computeOffset(LatLng from, int distance, int heading, int radius) /*-{
123        return $wnd.google.maps.geometry.spherical.computeOffset(from, distance, heading, radius);
124      }-*/;
125      
126      /**
127       * Computes the signed area of the given loop. Loops must be closed. The signed area may be used to determine the orientation of a loop.
128       * @param loop
129       */
130      public static final native double computeSignedArea(JsArray<LatLng> loop) /*-{
131        return $wnd.google.maps.geometry.spherical.computeSignedArea(loop);
132      }-*/;
133      
134      /**
135       * Computes the signed area of the given loop. Loops must be closed. The signed area may be used to determine the orientation of a loop.
136       * @param loop
137       */
138      public static final native double computeSignedArea(MVCArray<LatLng> loop) /*-{
139        return $wnd.google.maps.geometry.spherical.computeSignedArea(loop);
140      }-*/;
141      
142      /**
143       * Computes the signed area of the given loop. Loops must be closed. The signed area may be used to determine the orientation of a loop.
144       * @param loop
145       * @param radius
146       */
147      public static final native double computeSignedArea(JsArray<LatLng> loop, int radius) /*-{
148        return $wnd.google.maps.geometry.spherical.computeSignedArea(loop, radius);
149      }-*/;
150      
151      /**
152       * Computes the signed area of the given loop. Loops must be closed. The signed area may be used to determine the orientation of a loop.
153       * @param loop
154       * @param radius
155       */
156      public static final native double computeSignedArea(MVCArray<LatLng> loop, int radius) /*-{
157        return $wnd.google.maps.geometry.spherical.computeSignedArea(loop, radius);
158      }-*/;
159      
160      /**
161       * Travels a fraction of the way from one LatLng to another LatLng.
162       * @param from
163       * @param to
164       * @param fraction
165       */
166      public static final native LatLng interpolate(LatLng from, LatLng to, double fraction) /*-{
167        return $wnd.google.maps.geometry.spherical.interpolate(from, to, fraction);
168      }-*/;
169    
170    }