Class GeoMapUtil

java.lang.Object
org.eclipse.nebula.widgets.geomap.GeoMapUtil

public class GeoMapUtil
extends java.lang.Object
Since:
3.3
  • Constructor Summary

    Constructors 
    Constructor Description
    GeoMapUtil()  
  • Method Summary

    Modifier and Type Method Description
    static org.eclipse.swt.graphics.Point computePosition​(PointD coords, int zoom)
    Returns the position at a certain zoom level for a pair of longitude, latitude
    static PointD getLongitudeLatitude​(org.eclipse.swt.graphics.Point position, int zoom)
    Returns the pair of longitude, latitude for a position at a certain zoom level
    static int lat2position​(double lat, int z)
    Converts latitude to y position.
    static int lon2position​(double lon, int z)
    Converts longitude to x position.
    static double position2lat​(int y, int z)
    Converts position to latitude.
    static double position2lon​(int x, int z)
    Converts position to longitude.
    static void translateMapPosition​(GeoMapPositioned geoMap, int tx, int ty)
    Translates the position of the upper left corner of this GeoMap, without any panning effect.
    static void zoomIn​(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point pivot)
    Zooms in, while ensuring that the pivot point remains at the same screen location.
    static void zoomOut​(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point pivot)
    Zooms out, while ensuring that the pivot point remains at the same screen location.
    static void zoomTo​(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point mapSize, org.eclipse.swt.graphics.Rectangle rect, int maxZoom)
    Zooms into and centers on the specified rectangle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getLongitudeLatitude

      public static PointD getLongitudeLatitude​(org.eclipse.swt.graphics.Point position, int zoom)
      Returns the pair of longitude, latitude for a position at a certain zoom level
      Parameters:
      position - the position
      zoom - the zoom level
      Returns:
      the pair of longitude, latitude as a PointD
    • computePosition

      public static org.eclipse.swt.graphics.Point computePosition​(PointD coords, int zoom)
      Returns the position at a certain zoom level for a pair of longitude, latitude
      Parameters:
      coords - the pair of longitude, latitude
      zoom - the zoom level
      Returns:
      the position as a Point
    • position2lon

      public static double position2lon​(int x, int z)
      Converts position to longitude.
      Parameters:
      x - position x coord (pixels in this swt control)
      z - the current zoom level.
      Returns:
      the longitude
    • position2lat

      public static double position2lat​(int y, int z)
      Converts position to latitude.
      Parameters:
      y - position y coord (pixels in this swt control)
      z - the current zoom level.
      Returns:
      the latitude
    • lon2position

      public static int lon2position​(double lon, int z)
      Converts longitude to x position.
      Parameters:
      lon - the longitude
      z - the zoom level.
      Returns:
      the x position
    • lat2position

      public static int lat2position​(double lat, int z)
      Converts latitude to y position.
      Parameters:
      lat - the latitude
      z - the zoom level.
      Returns:
      the y position
    • translateMapPosition

      public static void translateMapPosition​(GeoMapPositioned geoMap, int tx, int ty)
      Translates the position of the upper left corner of this GeoMap, without any panning effect.
      Parameters:
      geoMap - the geoMap
      tx - the relative distance in x-direction
      ty - the relative distance in y-direction
    • zoomIn

      public static void zoomIn​(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point pivot)
      Zooms in, while ensuring that the pivot point remains at the same screen location.
      Parameters:
      geoMap - the geoMap
      pivot - the point that will remain at the same screen location.
    • zoomOut

      public static void zoomOut​(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point pivot)
      Zooms out, while ensuring that the pivot point remains at the same screen location.
      Parameters:
      geoMap - the geoMap
      pivot - the point that will remain at the same screen location.
    • zoomTo

      public static void zoomTo​(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point mapSize, org.eclipse.swt.graphics.Rectangle rect, int maxZoom)
      Zooms into and centers on the specified rectangle.
      Parameters:
      geoMap - the geoMap
      mapSize - the size of the map, containes the zoom rectangle
      rect - the rectangle
      maxZoom - the maximum level to zoom to, or -1 to default to the geoMap's max zoom