|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdods.clients.importwizard.TMAP.map.MapGrid
public class MapGrid
A grid for use with the MapCanvas.
A MapGrid contains all the information for the conversion of pixels to user values and vice versa. Associating a grid with a map also allows MapTools to work in snap-to-grid mode. version 2.3, 23 Jun 1997
Field Summary | |
---|---|
double |
delta_X
The grid spacing (in "user" coordinates) in the x dimension. |
double |
delta_Y
The grid spacing (in "user" coordinates) in the y dimension. |
double[] |
domain_X
The data domain along X [in user coordinates]. |
double[] |
domain_Y
The data domain along Y [in user coordinates]. |
Rectangle |
imageRect
The rectangle (in pixels) of the base image. |
boolean |
modulo_X
Flag determining whether the X axis is modulo or not (eg. longitude). |
double |
x_factor
Full "user" domain of x in the base image. |
double |
x_start
"user" value of the leftmost pixel in the base image. |
int |
x_type
The X axis type. |
double |
y_factor
Full "user" domain of y in the base image. |
double |
y_start
"user" value of the topmost pixel in the base image. |
int |
y_type
The Y axis type. |
Fields inherited from interface dods.clients.importwizard.TMAP.map.MapConstants |
---|
DEPTH_AXIS, HEIGHT_AXIS, HI, LATITUDE_AXIS, LO, LONGITUDE_AXIS, MID, PT, SNAP_MID, SNAP_ON, TIME_AXIS |
Constructor Summary | |
---|---|
MapGrid()
Constructs a new MapGrid. |
|
MapGrid(double x_lo,
double x_hi,
double y_lo,
double y_hi)
Constructs and initializes a MapGrid with the specified parameters. |
Method Summary | |
---|---|
double |
getDelta_X()
Gets delta_X which is used in grid snapping. |
double |
getDelta_Y()
Gets delta_Y which is used in grid snapping. |
double |
pixelToUser_X(int pixel_x)
Converts a pixel value into a "user" value. |
double |
pixelToUser_Y(int pixel_y)
Converts a pixel value into a "user" value. |
int |
rangeToPixels_X(double range_x)
Converts a "user" range along X to a width in pixels. |
int |
rangeToPixels_Y(double range_y)
Converts a "user" range along Y to a width in pixels. |
void |
setCanvasWidth(int width)
Sets canvasWidth. |
void |
setDelta_X(double delta)
Sets delta_X which is used in grid snapping. |
void |
setDelta_Y(double delta)
Sets delta_Y which is used in grid snapping. |
void |
setDomain_X(double lo,
double hi)
Sets the domain of X of the grid (in "user" coordinates). |
void |
setDomain_Y(double lo,
double hi)
Sets the domain of Y of the grid (in "user" coordinates). |
int |
snap_X(int pixel_x,
int style)
Returns the X pixel value nearest the closest X grid point. |
int |
snap_X(int pixel_x,
int style,
int shift)
Returns the X pixel value nearest the closest X grid point. |
int |
snap_Y(int pixel_y,
int style)
Returns the Y pixel value nearest the closest Y grid point. |
int |
snap_Y(int pixel_y,
int style,
int shift)
Returns the Y pixel value nearest the closest Y grid point. |
double |
snapUser_X(double user_x,
int style)
Returns the X "user" value nearest the closest X grid point. |
double |
snapUser_X(double user_x,
int style,
int shift)
Returns the X "user" value nearest the closest X grid point. |
double |
snapUser_Y(double user_y,
int style)
Returns the Y "user" value nearest the closest Y grid point. |
double |
snapUser_Y(double user_y,
int style,
int shift)
|
int |
userToPixel_X(double user_x)
Converts a "user" value into a pixel value. |
int |
userToPixel_Y(double user_y)
Converts a "user" value into a pixel value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public double[] domain_X
public double[] domain_Y
public double x_start
public double y_start
public double x_factor
public double y_factor
public double delta_X
public double delta_Y
public int x_type
MapConstants
public int y_type
MapConstants
public boolean modulo_X
public Rectangle imageRect
Do not alter this property inside of MapGrid.java!
Constructor Detail |
---|
public MapGrid()
public MapGrid(double x_lo, double x_hi, double y_lo, double y_hi)
x_lo
- the "user" value of the low end of the data domain along x.x_hi
- the "user" value of the high end of the data domain along x.y_lo
- the "user" value of the low end of the data domain along y.y_hi
- the "user" value of the high end of the data domain along y.
The data domain is that region represented by the underlying base image.Method Detail |
---|
public void setCanvasWidth(int width)
width
- the width associated with the MapCanvas.public void setDomain_X(double lo, double hi)
lo
- the "user" value of the low end of the data domain along X.hi
- the "user" value of the high end of the data domain along X.
A default delta_X will be calculated. This is overridden by
the tool whenever MapTool.setDelta_X() is used to assign a
specific delta_X to a tool.public void setDomain_Y(double lo, double hi)
lo
- the "user" value of the low end of the data domain along Y.hi
- the "user" value of the high end of the data domain along Y.
A default delta_Y will be calculated. This is overridden by
the tool whenever MapTool.setDelta_Y() is used to assign a
specific delta_Y to a tool.public void setDelta_X(double delta)
delta
- the "user" spacing of grid cells along the X axis.public double getDelta_X()
public void setDelta_Y(double delta)
delta
- the "user" spacing of grid cells along the Y axis.public double getDelta_Y()
public double pixelToUser_X(int pixel_x)
pixel_x
- the X value in pixels.
public int userToPixel_X(double user_x)
user_x
- the X value in "user" units.
public int rangeToPixels_X(double range_x)
range_x
- a "user" range.
public int snap_X(int pixel_x, int style)
pixel_x
- the current X position in pixels.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]
public int snap_X(int pixel_x, int style, int shift)
pixel_x
- the current mouse X position.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]shift
- number of grid cells to shift the result
public double snapUser_X(double user_x, int style)
user_x
- the "user" X position.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]
public double snapUser_X(double user_x, int style, int shift)
user_x
- the "user" X position.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]shift
- number of grid cells to shift the result
public double pixelToUser_Y(int pixel_y)
pixel_y
- the pixel's y value.
public int userToPixel_Y(double user_y)
user_y
- the "user" y value.
public int rangeToPixels_Y(double range_y)
range_y
- a "user" range.
public int snap_Y(int pixel_y, int style)
pixel_y
- the current Y position in pixels.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]
public int snap_Y(int pixel_y, int style, int shift)
pixel_y
- the current mouse Y position.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]shift
- number of grid cells to shift the result
public double snapUser_Y(double user_y, int style)
user_y
- the "user" Y position.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]
public double snapUser_Y(double user_y, int style, int shift)
user_y
- the "user" Y position.style
- which nearby gridpoint to snap to [SNAP_ON, SNAP_MID]shift
- number of grid cells to shift the result
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |