public class GeoMapUtil
extends java.lang.Object
Constructor and Description |
---|
GeoMapUtil() |
Modifier and Type | Method and 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.
|
public static PointD getLongitudeLatitude(org.eclipse.swt.graphics.Point position, int zoom)
position
- the positionzoom
- the zoom levelpublic static org.eclipse.swt.graphics.Point computePosition(PointD coords, int zoom)
coords
- the pair of longitude, latitudezoom
- the zoom levelpublic static double position2lon(int x, int z)
x
- position x coord (pixels in this swt control)z
- the current zoom level.public static double position2lat(int y, int z)
y
- position y coord (pixels in this swt control)z
- the current zoom level.public static int lon2position(double lon, int z)
lon
- the longitudez
- the zoom level.public static int lat2position(double lat, int z)
lat
- the latitudez
- the zoom level.public static void translateMapPosition(GeoMapPositioned geoMap, int tx, int ty)
geoMap
- the geoMaptx
- the relative distance in x-directionty
- the relative distance in y-directionpublic static void zoomIn(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point pivot)
geoMap
- the geoMappivot
- the point that will remain at the same screen location.public static void zoomOut(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point pivot)
geoMap
- the geoMappivot
- the point that will remain at the same screen location.public static void zoomTo(GeoMapPositioned geoMap, org.eclipse.swt.graphics.Point mapSize, org.eclipse.swt.graphics.Rectangle rect, int maxZoom)
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