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, latitudestatic PointD
getLongitudeLatitude(org.eclipse.swt.graphics.Point position, int zoom)
Returns the pair of longitude, latitude for a position at a certain zoom levelstatic 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.
-
Constructor Details
-
GeoMapUtil
public GeoMapUtil()
-
-
Method Details
-
getLongitudeLatitude
Returns the pair of longitude, latitude for a position at a certain zoom level- Parameters:
position
- the positionzoom
- the zoom level- Returns:
- the pair of longitude, latitude as a PointD
-
computePosition
Returns the position at a certain zoom level for a pair of longitude, latitude- Parameters:
coords
- the pair of longitude, latitudezoom
- 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 longitudez
- the zoom level.- Returns:
- the x position
-
lat2position
public static int lat2position(double lat, int z)Converts latitude to y position.- Parameters:
lat
- the latitudez
- the zoom level.- Returns:
- the y position
-
translateMapPosition
Translates the position of the upper left corner of this GeoMap, without any panning effect.- Parameters:
geoMap
- the geoMaptx
- the relative distance in x-directionty
- the relative distance in y-direction
-
zoomIn
Zooms in, while ensuring that the pivot point remains at the same screen location.- Parameters:
geoMap
- the geoMappivot
- the point that will remain at the same screen location.
-
zoomOut
Zooms out, while ensuring that the pivot point remains at the same screen location.- Parameters:
geoMap
- the geoMappivot
- 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 geoMapmapSize
- the size of the map, containes the zoom rectanglerect
- the rectanglemaxZoom
- the maximum level to zoom to, or -1 to default to the geoMap's max zoom
-