public class Navigation
extends java.lang.Object
Constructor and Description |
---|
Navigation()
Create a new navigation.
|
Modifier and Type | Method and Description |
---|---|
void |
addNewMapAreaListener(NewMapAreaListener l)
Add a
NewMapAreaListener . |
java.awt.geom.AffineTransform |
calcTransform(boolean rotate,
double displayX,
double displayY,
double displayWidth,
double displayHeight)
Calculate an affine transform based on the display size parameters
- used for printing.
|
void |
flipMapArea(ucar.unidata.geoloc.ProjectionRect ma)
Flip the map area
|
ucar.unidata.geoloc.ProjectionRect |
getMapArea(ucar.unidata.geoloc.ProjectionRect rect)
Get current MapArea .
|
double |
getScreenHeight()
Get the screen height
|
double |
getScreenWidth()
Get the screen width
|
java.awt.geom.AffineTransform |
getTransform()
Get the affine transform based on screen size and world bounding box
|
void |
moveDown()
Move down
|
void |
moveDown(double factor)
Move down
|
void |
moveLeft()
Move left.
|
void |
moveLeft(double factor)
Move left.
|
void |
moveRight()
Move right.
|
void |
moveRight(double factor)
Move right.
|
void |
moveUp()
Move up.
|
void |
moveUp(double factor)
Move up.
|
void |
pan(double deltax,
double deltay)
Call this to change the center of the screen's world coordinates.
|
void |
removeNewMapAreaListener(NewMapAreaListener l)
Remove a
NewMapAreaListener . |
ucar.unidata.geoloc.ProjectionPointImpl |
screenToWorld(java.awt.geom.Point2D p)
Convert a display point to a world coordinate
|
ucar.unidata.geoloc.ProjectionPointImpl |
screenToWorld(java.awt.geom.Point2D p,
ucar.unidata.geoloc.ProjectionPointImpl w)
Convert a display point to a world coordinate
|
java.awt.geom.Rectangle2D |
screenToWorld(ucar.unidata.geoloc.ProjectionRect screenRect)
Convert a display region to a world coordinate
|
ucar.unidata.geoloc.ProjectionRect |
screenToWorld(java.awt.geom.Rectangle2D rect2D)
Convert a display region to a world coordinate
|
void |
setMapArea(ucar.unidata.geoloc.ProjectionRect ma)
Set the map area
|
void |
setScreenSize(double pwidth,
double pheight)
Set the screen size
|
boolean |
wantRotate(double displayWidth,
double displayHeight)
Calculate if we want to rotate based on aspect ratio
|
java.awt.geom.Point2D |
worldToScreen(ucar.unidata.geoloc.ProjectionPointImpl w)
Convert a world coordinate to a display point
|
java.awt.geom.Point2D |
worldToScreen(ucar.unidata.geoloc.ProjectionPointImpl w,
java.awt.geom.Point2D p)
Convert a world coordinate to a display point
|
java.awt.geom.Rectangle2D |
worldToScreen(ucar.unidata.geoloc.ProjectionRect screenRect)
Convert a world coordinate to screen
|
void |
zoom(double scale)
Zoom to a default scale.
|
void |
zoom(double startx,
double starty,
double width,
double height)
Call this to zoom into a subset of the screen.
|
void |
zoomIn()
Zoom in default amount.
|
void |
zoomIn(double x,
double y)
Zoom in to a point.
|
void |
zoomOut()
Zoom out default amount.
|
void |
zoomOut(double x,
double y)
Zoom out from a point.
|
void |
zoomPrevious()
Zoom to the previous zoom.
|
public void addNewMapAreaListener(NewMapAreaListener l)
NewMapAreaListener
.l
- listener to addpublic void removeNewMapAreaListener(NewMapAreaListener l)
NewMapAreaListener
.l
- listener to removepublic double getScreenWidth()
public double getScreenHeight()
public void setScreenSize(double pwidth, double pheight)
pwidth
- width (pixels)pheight
- height (pixels)public java.awt.geom.AffineTransform getTransform()
public boolean wantRotate(double displayWidth, double displayHeight)
displayWidth
- width of displaydisplayHeight
- height of displaypublic java.awt.geom.AffineTransform calcTransform(boolean rotate, double displayX, double displayY, double displayWidth, double displayHeight)
rotate
- should the page be rotateddisplayX
- upper right corner XdisplayY
- upper right corner YdisplayWidth
- display widthdisplayHeight
- display heightpublic ucar.unidata.geoloc.ProjectionRect getMapArea(ucar.unidata.geoloc.ProjectionRect rect)
rect
- place results here, or null to create new Objectpublic void setMapArea(ucar.unidata.geoloc.ProjectionRect ma)
ma
- new map areapublic void flipMapArea(ucar.unidata.geoloc.ProjectionRect ma)
ma
- new map areapublic java.awt.geom.Point2D worldToScreen(ucar.unidata.geoloc.ProjectionPointImpl w)
w
- world coordinatepublic java.awt.geom.Point2D worldToScreen(ucar.unidata.geoloc.ProjectionPointImpl w, java.awt.geom.Point2D p)
w
- world coordinatep
- projectionpublic ucar.unidata.geoloc.ProjectionPointImpl screenToWorld(java.awt.geom.Point2D p, ucar.unidata.geoloc.ProjectionPointImpl w)
p
- display pointw
- projectionpublic ucar.unidata.geoloc.ProjectionPointImpl screenToWorld(java.awt.geom.Point2D p)
p
- display pointpublic ucar.unidata.geoloc.ProjectionRect screenToWorld(java.awt.geom.Rectangle2D rect2D)
rect2D
- display regionpublic java.awt.geom.Rectangle2D screenToWorld(ucar.unidata.geoloc.ProjectionRect screenRect)
screenRect
- display regionpublic java.awt.geom.Rectangle2D worldToScreen(ucar.unidata.geoloc.ProjectionRect screenRect)
screenRect
- world regionpublic void pan(double deltax, double deltay)
deltax
- display coordinate x shiftdeltay
- display coordinate y shiftpublic void zoom(double startx, double starty, double width, double height)
startx
- upper left x box coordstarty
- upper left y box coordwidth
- width of boxheight
- size of boxpublic void zoomIn(double x, double y)
zoomIn()
x
- x coordinate of pointy
- y coordinate of pointpublic void zoomOut(double x, double y)
zoomIn()
x
- x coordinate of pointy
- y coordinate of pointpublic void zoomIn()
public void zoomOut()
public void zoom(double scale)
scale
- to zoompublic void moveDown()
public void moveDown(double factor)
factor
- how much to movepublic void moveUp()
public void moveUp(double factor)
factor
- how much to movepublic void moveRight()
public void moveRight(double factor)
factor
- how much to movepublic void moveLeft()
public void moveLeft(double factor)
factor
- how much to movepublic void zoomPrevious()