Groovy Documentation

org.jdesktop.swingx.mapviewer.util
[Java] Class GeoUtil

java.lang.Object
  org.jdesktop.swingx.mapviewer.util.GeoUtil

public final class GeoUtil
extends Object

These are math utilities for converting between pixels, tiles, and geographic coordinates. Implements a Google Maps style mercator projection.

Authors:
joshy


Constructor Summary
GeoUtil()

 
Method Summary
static Point2D getBitmapCoordinate(GeoPosition c, int zoomLevel, TileFactoryInfo info)

Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in pixels.

static Point2D getBitmapCoordinate(double latitude, double longitude, int zoomLevel, TileFactoryInfo info)

static GeoBounds getMapBounds(JXMapViewer mapViewer)

Gets the map bounds.

private static Set getMapGeoBounds(JXMapViewer mapViewer)

static Dimension getMapSize(int zoom, TileFactoryInfo info)

@return the size of the map at the given zoom, in tiles (num tiles tall by num tiles wide)

static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info)

static GeoPosition getPositionForAddress(String[] fields)

static GeoPosition getPositionForAddress(String street, String city, String state)

static boolean isValidTile(int x, int y, int zoomLevel, TileFactoryInfo info)

returns:
true if this point in tiles is valid at this zoom level.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

GeoUtil

GeoUtil()


 
Method Detail

getBitmapCoordinate

public static Point2D getBitmapCoordinate(GeoPosition c, int zoomLevel, TileFactoryInfo info)
Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in pixels. The zoom level is necessary because pixel coordinates are in terms of the zoom level
Parameters:
c - A lat/lon pair
zoomLevel - the zoom level to extract the pixel coordinate for


getBitmapCoordinate

public static Point2D getBitmapCoordinate(double latitude, double longitude, int zoomLevel, TileFactoryInfo info)


getMapBounds

public static GeoBounds getMapBounds(JXMapViewer mapViewer)
Gets the map bounds.
Parameters:
mapViewer - The map viewer.
Returns:
Returns the bounds.


getMapGeoBounds

private static Set getMapGeoBounds(JXMapViewer mapViewer)


getMapSize

public static Dimension getMapSize(int zoom, TileFactoryInfo info)
Returns:
the size of the map at the given zoom, in tiles (num tiles tall by num tiles wide)


getPosition

public static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info)


getPositionForAddress

public static GeoPosition getPositionForAddress(String[] fields)


getPositionForAddress

public static GeoPosition getPositionForAddress(String street, String city, String state)


isValidTile

public static boolean isValidTile(int x, int y, int zoomLevel, TileFactoryInfo info)
returns:
true if this point in tiles is valid at this zoom level. For example, if the zoom level is 0 (zoomed all the way out, where there is only one tile), then x,y must be 0,0


 

Groovy Documentation