|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.free.garminimg.utils.MapTransformer<T>
public class MapTransformer<T>
Generic class used to do the conversion between 4 different coordinate systems:
Since this class is heavily used, a lot of care has been taken to avoid performance problems (mainly memory allocation).
Nested Class Summary | |
---|---|
static interface |
MapTransformer.Converter<T2>
Interface for the class converting from/to the user defined coordinate system and datum to/from WGS84. |
Constructor Summary | |
---|---|
MapTransformer(MapTransformer.Converter<T> converter,
int margin)
|
Method Summary | |
---|---|
void |
adjustAutoScaleFromWgs84(double lon,
double lat)
takes a radian WGS84 coordinate and adjust the scale/position to include this coordinate. |
void |
changeDimensions(int width,
int height)
Use it to change the dimensions of the display area (in screen pixel). |
MapTransformer<T> |
clone()
|
T |
createTempCoord()
|
boolean |
equals(java.lang.Object o)
|
void |
fixAspectRatio()
Once several calls to adjustAutoScale have been done, call this to make sure the aspect ratio is correct. |
void |
garminGeo2Map(int[] longitudes,
int[] latitudes,
int[] xPoints,
int[] yPoints,
int nbPoints,
java.awt.geom.Point2D.Double tempXY,
T tempCoord)
Convert a set of garmin coordinate into map positions (pixels). |
void |
geo2map(T coord,
java.awt.geom.Point2D.Double result)
Convert a geographic coordinate into a map position (pixels) |
java.awt.Rectangle |
getGarminBoundingBox()
|
int |
getHeight()
|
java.awt.geom.Point2D.Double |
getNorthEastWGS84()
|
java.awt.geom.Point2D.Double |
getNorthWestWGS84()
|
double |
getPixelsPerMeter()
|
java.awt.geom.Point2D.Double |
getSouthEastWGS84()
|
java.awt.geom.Point2D.Double |
getSouthWestWGS84()
|
int |
getWidth()
|
int |
hashCode()
|
boolean |
isSetupDone()
|
T |
map2geo(int x,
int y)
convert the map position (pixels) into geographic coordinates. |
T |
map2geoNoScale(double x,
double y)
|
void |
map2wgs84(int x,
int y,
java.awt.geom.Point2D.Double result)
convert the map position (pixels) into WGS84 (radians). |
void |
moveMapPosition(double deltaX,
double deltaY)
Move the visible area by some delta given in map coordinates (pixels) |
void |
resetAutoScale()
Must be called before the first call to adjustAutoScaleFromWgs84. |
void |
scale(java.awt.geom.Point2D.Double xy,
java.awt.geom.Point2D.Double result)
|
boolean |
setDimensions(int width,
int height)
Use it to change the dimensions of the display area (in screen pixel) without changing the details (more/less of the map will be shown. |
void |
setFrom(MapTransformer<T> other)
|
java.lang.String |
toString()
|
void |
unscale(java.awt.geom.Point2D xy,
java.awt.geom.Point2D.Double result)
|
void |
wgs84ToMap(double lon,
double lat,
T temp,
java.awt.geom.Point2D.Double result)
Convert a WGS84 coordinate (radians) into a map position (pixels) |
void |
wgs84ToMapNoScale(double lon,
double lat,
T temp,
java.awt.geom.Point2D.Double result)
|
void |
zoom(double factor)
If factor>1 zoom in, otherwise zoom out. |
void |
zoom(double factor,
int x,
int y)
If factor>1 zoom in, otherwise zoom out. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MapTransformer(MapTransformer.Converter<T> converter, int margin)
Method Detail |
---|
public boolean setDimensions(int width, int height)
public void changeDimensions(int width, int height)
public void resetAutoScale()
public void adjustAutoScaleFromWgs84(double lon, double lat)
public void fixAspectRatio()
public void geo2map(T coord, java.awt.geom.Point2D.Double result)
public void wgs84ToMap(double lon, double lat, T temp, java.awt.geom.Point2D.Double result)
public T map2geo(int x, int y)
public void map2wgs84(int x, int y, java.awt.geom.Point2D.Double result)
public java.awt.geom.Point2D.Double getSouthWestWGS84()
public java.awt.geom.Point2D.Double getSouthEastWGS84()
public java.awt.geom.Point2D.Double getNorthEastWGS84()
public java.awt.geom.Point2D.Double getNorthWestWGS84()
public java.awt.Rectangle getGarminBoundingBox()
public void garminGeo2Map(int[] longitudes, int[] latitudes, int[] xPoints, int[] yPoints, int nbPoints, java.awt.geom.Point2D.Double tempXY, T tempCoord)
longitudes
- the input longitudeslatitudes
- the output latitudesxPoints
- the output X positionsyPoints
- the output Y positionsnbPoints
- the number of points to concidertempXY
- some temporary variable (avoid to do too many allocations for perf purpose)tempCoord
- some other temporary variable (avoid to do too many allocations for perf purpose)public boolean isSetupDone()
public void moveMapPosition(double deltaX, double deltaY)
public void zoom(double factor, int x, int y)
public void zoom(double factor)
public T map2geoNoScale(double x, double y)
public void scale(java.awt.geom.Point2D.Double xy, java.awt.geom.Point2D.Double result)
public void unscale(java.awt.geom.Point2D xy, java.awt.geom.Point2D.Double result)
public void wgs84ToMapNoScale(double lon, double lat, T temp, java.awt.geom.Point2D.Double result)
public java.lang.String toString()
toString
in class java.lang.Object
public int getWidth()
public int getHeight()
public T createTempCoord()
public double getPixelsPerMeter()
public MapTransformer<T> clone()
clone
in class java.lang.Object
public void setFrom(MapTransformer<T> other)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |