|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.latdraw.beans.View
public class View
This holds information about the current window (viewport) in lattice coordinates and the transformation to screen coordinates.
3D Lattice Coordinates: 3-space with the least element of the lattice (or ordered set) at the origin. (Ordered set without 0 can be drawn by adding a 0 and not displaying it.) The z coordinate of every element will be nonnegative.
Screen Transform: the lattice coordinates will be projected to a plane containing the z axis. (This is not done here but in Diagram.) The origin will be mapped to a screen point centered horizontally and 5% above the bottom edge.
This could handle zooming if we want it.
old:
This holds the current window (viewport) in lattice coordinates being
displayed. Suppose you want to display the nose. If the length of the
board is 180, you might want to show from x = 160 to x = 190 and
vertically you want the board centered. To do this you would
construct a View by
new View(View.HORIZONTAL, new double[] {160, 190}, 0.0)
So a View has a direction either HORIZONTAL or VERTICAL, a range,
and a value of the center in the other direction. There is also a
boolean to indicate whether the vertical coordinate goes up or down.
There is also a verticalShiftFrac which will shift the the image
vertically in screen by the screen (window) height times this.
In the HORIZONTAL case,
with a range [x_0, x_1] of x values and a single
y value, the view the user will see will be a rectangle with
upper left [x_0, y - d] and lower right [x_1, y + d] where d is as big as
can be shown on the screen given that the aspect ratio must be preserved.
This class is bacically immutable except for the transforms.
| Constructor Summary | |
|---|---|
View()
|
|
| Method Summary | |
|---|---|
java.awt.geom.AffineTransform |
getLatToScreen()
|
java.awt.geom.AffineTransform |
getLatToScreen(double wd,
double ht)
|
java.awt.geom.AffineTransform |
getScreenToLat()
|
java.awt.geom.AffineTransform |
getScreenToLat(double wd,
double ht)
|
void |
setTransform(double w,
double h)
Set the latToScreen transfrom for the view port to be shown. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public View()
| Method Detail |
|---|
public void setTransform(double w,
double h)
public java.awt.geom.AffineTransform getLatToScreen()
public java.awt.geom.AffineTransform getLatToScreen(double wd,
double ht)
public java.awt.geom.AffineTransform getScreenToLat()
public java.awt.geom.AffineTransform getScreenToLat(double wd,
double ht)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||