|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.PlotTool
Encapsulates the transform between world and image coordinates for use in plotting data graphs. Provides functions to plot or mark an array of Point2D data or an array of such Point2D arrays. Automatically handles the painting of axes, grid lines, and tick marks on the axes.
The "world" coordinate space refers to the coordinate space inhabited by the data arrays or functions that are to be plotted.
The "image" coordinate space refers to the coordinate space of the graphics context on which the plots are painted.
As of 2.5.0, adjusted the algorithms to intelligently skip over data points that are not finite.
| Field Summary | |
static Color |
DEFAULT_AXES_COLOR
Default color for each of the axes. |
static int |
DEFAULT_AXES_SIZE
Default width for each of the axes. |
static boolean |
DEFAULT_EQUALIZE
Default value for the preservesShape property. |
static Color |
DEFAULT_GRID_COLOR
Default color for each of the grid lines. |
static int |
DEFAULT_INSET
Default image inset. |
static Color |
DEFAULT_PLOT_COLOR
Default color for plots. |
static BasicStroke |
DEFAULT_STROKE
Helper for strokes of thickness 1. |
static Color |
DEFAULT_TICK_COLOR
Default color for each of the tick marks. |
static int |
DEFAULT_TICK_SIZE
Default length for a tick mark. |
static int |
DEFAULT_WINDOW_SIZE
Default window size. |
protected Rectangle2D.Double |
imageBounds
Bounding rectangle of the image coordinate space. |
protected XInterval |
imageXRange
The x-interval in image coordinates. |
protected XInterval |
imageYRange
The y-interval in image coordinates. |
protected int |
inset
Number of pixels in image coordinate units to inset the transform of the world coordinates. |
protected AffineTransform |
inverseMapping
The inverse of the world to image transform. |
protected Transform1D |
inverseXMapping
The inverse of the x-component of the world to image transform. |
protected Transform1D |
inverseYMapping
The inverse of the y-component of the world to image transform. |
protected Line2D.Double |
L
Helper for line computation. |
protected AffineTransform |
mapping
The world to image transform. |
static int |
MINIMUM_GRID_PIXELS
Minimum pixel distance for automatic grid line painting. |
static int |
MINIMUM_TICK_PIXELS
Minimum pixel distance for automatic tick mark painting. |
protected Point2D.Double |
P
Helper for point computation. |
protected boolean |
preservesShape
Whether or not to preserve geometric shape. |
protected Point2D.Double |
Q
Helper for point computation. |
protected Point2D.Double |
scale
The absolute value of the x and y scale factors. |
protected Rectangle2D.Double |
worldBounds
Bounding rectangle of the world coordinate space. |
protected XInterval |
worldXRange
The x-interval in world coordinates. |
protected XInterval |
worldYRange
The y-interval in world coordinates. |
protected Transform1D |
xMapping
The x-component of the world to image transform. |
protected Transform1D |
yMapping
The y-component of the world to image transform. |
| Constructor Summary | |
PlotTool()
Constructs a plot tool with the default parameters. |
|
PlotTool(Rectangle2D w,
Rectangle2D i)
Constructs a plot tool for use with the given world and image coordinate spaces. |
|
PlotTool(Rectangle2D w,
Rectangle2D i,
boolean eq)
Constructs a plot tool for use with the given world and image coordinate spaces, with the given policy regarding the preservation of geometric shape. |
|
PlotTool(Rectangle2D w,
Rectangle2D i,
boolean eq,
int in)
Constructs a plot tool for use with the given world and image coordinate spaces, with the given policy regarding the preservation of geometric shape, and the given image inset. |
|
| Method Summary | |
PlotTool |
autoAxes(Graphics2D g)
Plots black axes of thickness 3 in given graphics context. |
PlotTool |
autoGridLines(Graphics2D g)
Plots grid lines appropriate for the world to image transform in the given graphics context, using the default thickness and the default color for grid lines. |
Point2D |
autoSpacing(int minPixel)
Returns a Point2D object encapsulating
an appropriate spacing for grid lines and tick marks
in world coordinates. |
PlotTool |
autoTickMarks(Graphics2D g)
Plots tick marks appropriate for the world to image transform in the given graphics context, using the default thickness and the default color for tick marks. |
static double |
findSpacing(double minimumDelta)
Returns the smallest double that has one of the three forms 10k, 2*10k, or 5*10k, and is greater than or equal to the absolute value of the given minimum. |
Rectangle2D |
getImageBounds()
Returns a clone of the image coordinate bounds. |
int |
getInset()
Return the image inset. |
AffineTransform |
getInverseTransform()
Returns a clone of the inverse of the world bounds to image bounds two-dimensional transform. |
Transform1D |
getInverseXTransform()
Returns a clone of the inverse of the x component of the world to image transform. |
Transform1D |
getInverseYTransform()
Returns a clone of the inverse of the y component of the world to image transform. |
AffineTransform |
getTransform()
Returns a clone of the world bounds to image bounds two-dimensional transform. |
Rectangle2D |
getWorldBounds()
Returns a clone of the world coordinate bounds. |
Transform1D |
getXTransform()
Returns a clone of the x component of the world to image transform. |
Transform1D |
getYTransform()
Return a clone of the y component of the world to image transform. |
Point2D |
inverseScale(Point2D source)
Returns the point produced by transforming the given point using the inverse of the world to image transform. |
Point2D |
inverseScale(Point2D source,
Point2D target)
Scales the given source Point2D
using the inverse of the world to image transform
and sets the target Point2D
to the transformed value. |
double |
inverseXScale(double x)
Returns the result of scaling the given value using the x component of the inverse of the world to image transform. |
double |
inverseYScale(double y)
Returns the result of scaling the given value using the y component of the inverse of the world to image transform. |
static Rectangle2D |
makeBoundsRectangle2D(Point2D[] data)
Return the smallest rectangle containing the data in the given Point2D array
and return null if no data is supplied. |
static Rectangle2D |
makeBoundsRectangle2D(Point2D[][] data)
Return the smallest rectangle containing the data in the given array of Point2D arrays
and return null if no data is supplied. |
void |
markData(Graphics2D g,
Point2D[][] data,
Paint[] color,
PlotMark plotmark)
Transforms the points of the given array of arrays using the world to image transform and marks the resulting points in the given graphics context using the given color or Paint array
to paint the marks for the corresponding sub array
of the data. |
void |
markData(Graphics2D g,
Point2D[][] data,
Paint[] color,
PlotMark[] plotmarks)
Transforms the points of the given array of arrays using the world to image transform and marks the resulting points in the given graphics context using the given color or Paint array
and the given plot mark array
to paint the marks for the corresponding sub array
of the data. |
void |
markData(Graphics2D g,
Point2D[][] data,
Paint color,
PlotMark plotmark)
Transforms the points of the given array of arrays using the world to image transform and marks the resulting points in the given graphics context using the given color or Paint
to paint the marks. |
void |
markData(Graphics2D g,
Point2D[] data,
Paint color,
PlotMark plotmark)
Transforms the points of the given array using the world to image transform and marks the resulting points in the given graphics context using the given color or Paint
to paint the marks. |
PlotTool |
plotAxes(Graphics2D g,
Paint color,
int thick)
Plots axes in the given graphics context using the given color or Paint
and the given line thickness. |
void |
plotData(Graphics2D g,
Point2D[][] data,
Paint color)
Transforms the points of the given array of point arrays using the world to image transform and draws a line plot of each transformed 1-dimensional point array in the given graphics context using the given color or Paint
to draw the lines. |
void |
plotData(Graphics2D g,
Point2D[][] data,
Paint[] color)
Transforms the points of the given array of point arrays using the world to image transform and draws a line plot of each transformed 1-dimensional point array in the given graphics context using the given color or Paint array
to draw the lines. |
void |
plotData(Graphics2D g,
Point2D[][] data,
Paint[] color,
Stroke s)
Transforms the points of the given array of point arrays using the world to image transform and draws a line plot of each transformed 1-dimensional point array in the given graphics context using the given color or Paint array
and the given Stroke
to draw the lines. |
void |
plotData(Graphics2D g,
Point2D[][] data,
Paint color,
Stroke s)
Transforms the points of the given array of point arrays using the world to image transform and draws a line plot of each transformed 1-dimensional point array in the given graphics context using the given color or Paint
and the given Stroke to draw the lines. |
void |
plotData(Graphics2D g,
Point2D[] data,
Paint color)
Transforms the points of the given array using the world to image transform and draws a line plot of the transformed points in the given graphics context using the given color or Paint
to draw the lines. |
void |
plotData(Graphics2D g,
Point2D[] data,
Paint color,
Stroke s)
Transforms the points of the given array using the world to image transform and draws a line plot of the transformed points in the given graphics context using the given color or Paint
and the given Stroke
to draw the lines. |
PlotTool |
plotGridLines(Graphics2D g,
Paint color,
double xDelta,
double yDelta)
Plots vertical and horizontal grid lines of thickness 1 using the given color or Paint
and the given grid spacing values. |
PlotTool |
plotGridLines(Graphics2D g,
Paint color,
Point2D delta)
Plots vertical and horizontal grid lines of thickness 1 using the given color or Paint
and the given grid spacing values
encapsulated as a Point2D object. |
void |
plotHGridLine(Graphics2D g,
double yPosition)
Plots a horizontal grid line corresponding to the given y position in world coordinates, in the given graphics context. |
PlotTool |
plotHGridLines(Graphics2D g,
Paint color,
double delta)
Plots a sequence of horizontal grid lines of thickness 1 using the given color or Paint
and the given y grid spacing value. |
void |
plotHTickMark(Graphics2D g,
double yPosition,
int ticksize)
Plots a horizontal tick line corresponding to the given y position in world coordinates, in the given graphics context using the given tick size. |
PlotTool |
plotHTickMarks(Graphics2D g,
Paint color,
double delta,
int ticksize)
Plots a sequence of horizontal tick marks of thickness 1 using the given color or Paint,
y grid spacing value, and tick mark length. |
PlotTool |
plotTickMarks(Graphics2D g,
Paint color,
double xDelta,
double yDelta,
int ticksize)
Plots vertical and horizontal tick marks of thickness 1 using the given color or Paint,
the grid spacing values and tick mark length. |
PlotTool |
plotTickMarks(Graphics2D g,
Paint color,
Point2D delta,
int ticksize)
Plots vertical and horizontal tick marks of thickness 1 using the given color or Paint,
grid spacing values encapsulated
as a Point2D object, and tick mark length. |
void |
plotVGridLine(Graphics2D g,
double xPosition)
Plots a vertical grid line corresponding to the given x position in world coordinates, in the given graphics context. |
PlotTool |
plotVGridLines(Graphics2D g,
Paint color,
double delta)
Plots a sequence of vertical grid lines of thickness 1 using the given color or Paint
and the given x grid spacing value. |
void |
plotVTickMark(Graphics2D g,
double xPosition,
int ticksize)
Plots a vertical tick line corresponding to the given x position in world coordinates, in the given graphics context using the given tick size. |
PlotTool |
plotVTickMarks(Graphics2D g,
Paint color,
double delta,
int ticksize)
Plots a sequence of vertical tick marks of thickness 1 using the given color or Paint,
x grid spacing value, and tick mark length. |
boolean |
preservesShape()
Returns whether or not this tool preserves geometric shape. |
private void |
readObject(ObjectInputStream in)
Extends the default deserialization process to restore helper data members upon instantiation. |
Point2D |
scale(Point2D source)
Returns the point produced by transforming the given point using the world to image transform. |
Point2D |
scale(Point2D source,
Point2D target)
Scales the given source Point2D
using the world to image transform
and sets the target Point2D
to the transformed value. |
PlotTool |
setImageBounds(Rectangle2D i)
Sets the image coordinate bounds to the given bounds. |
PlotTool |
setInset(int in)
Sets the image inset to the given value in image pixel units. |
PlotTool |
setPlotTool(PlotTool other)
Sets the world coordinate space, the image coordinate space, the shape preservation policy and the image inset for this plot tool to the respective values for the given plot tool. |
PlotTool |
setPlotTool(Rectangle2D w,
Rectangle2D i,
boolean eq,
int in)
Sets the world coordinate space, the image coordinate space, the shape preservation policy and the image inset for this plot tool to the given values. |
PlotTool |
setPreservesShape(boolean eq)
Sets the geometric shape preservation policy to the given value. |
protected PlotTool |
setTransforms()
Creates an affine transform suitable for transforming points in the world coordinate space to points in the image coordinate space, either by best fit or by preserving the shape of the geometry. |
PlotTool |
setWorldBounds(Point2D[] data)
Set the world coordinate bounds to the smallest rectangle that contains the Point2D array data. |
PlotTool |
setWorldBounds(Point2D[][] data)
Set the world coordinate bounds to the smallest rectangle that contains the Point2D array of array data. |
PlotTool |
setWorldBounds(Rectangle2D w)
Sets the world coordinate bounds to the given bounds. |
void |
storeImageBounds(Rectangle2D i)
Stores the given image coordinate bounds. |
protected void |
storeInset(int in)
Stores the given inset value. |
protected void |
storePreservesShape(boolean ps)
Stores the given shape preservation policy. |
protected void |
storeWorldBounds(Rectangle2D w)
Stores the given world coordinate bounds. |
int |
xMaxIndex(double delta)
Returns the maximum index for vertical grid or tick lines given the spacing along the x axis in world coordinates. |
int |
xMinIndex(double delta)
Returns the minimum index for vertical grid or tick lines given the spacing along the x axis in world coordinates. |
double |
xScale(double x)
Returns the result of scaling the given value using the x component of the world to image transform. |
int |
yMaxIndex(double delta)
Returns the maximum index for horizontal grid or tick lines given the spacing along the y axis in world coordinates. |
int |
yMinIndex(double delta)
Returns the minimum index for horizontal grid or tick lines given the spacing along the y axis in world coordinates. |
double |
yScale(double y)
Returns the result of scaling the given value using the y component of the world to image transform. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_WINDOW_SIZE
null parameters are passed.
public static final boolean DEFAULT_EQUALIZE
public static final int DEFAULT_INSET
public static final int DEFAULT_AXES_SIZE
public static final int MINIMUM_GRID_PIXELS
public static final int MINIMUM_TICK_PIXELS
public static final int DEFAULT_TICK_SIZE
public static final Color DEFAULT_PLOT_COLOR
public static final Color DEFAULT_AXES_COLOR
public static final Color DEFAULT_GRID_COLOR
public static final Color DEFAULT_TICK_COLOR
public static final BasicStroke DEFAULT_STROKE
protected Rectangle2D.Double worldBounds
protected Rectangle2D.Double imageBounds
protected boolean preservesShape
protected int inset
protected AffineTransform mapping
protected Transform1D xMapping
protected Transform1D yMapping
protected AffineTransform inverseMapping
protected Transform1D inverseXMapping
protected Transform1D inverseYMapping
protected XInterval worldXRange
protected XInterval worldYRange
protected XInterval imageXRange
protected XInterval imageYRange
protected Point2D.Double scale
protected transient Point2D.Double P
protected transient Point2D.Double Q
protected transient Line2D.Double L
| Constructor Detail |
public PlotTool()
public PlotTool(Rectangle2D w,
Rectangle2D i)
w - the desired world coordinate boundsi - the desired image coordinate bounds
public PlotTool(Rectangle2D w,
Rectangle2D i,
boolean eq)
w - the desired world coordinate boundsi - the desired image coordinate boundseq - whether or not the transform preserves geometric shape
public PlotTool(Rectangle2D w,
Rectangle2D i,
boolean eq,
int in)
w - the desired world coordinate boundsi - the desired image coordinate boundseq - whether or not the transform preserves geometric shapein - the desired inset in image pixel units| Method Detail |
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
in - the deserialization input stream
IOException
ClassNotFoundExceptionpublic PlotTool setPlotTool(PlotTool other)
other - the object to be copied
public PlotTool setPlotTool(Rectangle2D w,
Rectangle2D i,
boolean eq,
int in)
w - the desired world coordinate boundsi - the desired image coordinate boundseq - whether or not the transform preserves geometric shapein - the desired inset in image pixel units
public PlotTool setWorldBounds(Rectangle2D w)
w - the new world coordinate bounds
public Rectangle2D getWorldBounds()
public PlotTool setWorldBounds(Point2D[] data)
Point2D array data.
data - the array data to enclose in the bounds
public PlotTool setWorldBounds(Point2D[][] data)
Point2D array of array data.
data - the array of array data to enclose in the bounds
public static Rectangle2D makeBoundsRectangle2D(Point2D[] data)
Return the smallest rectangle containing the data
in the given Point2D array
and return null if no data is supplied.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
data - the Point2D arraypublic static Rectangle2D makeBoundsRectangle2D(Point2D[][] data)
Return the smallest rectangle containing the data
in the given array of Point2D arrays
and return null if no data is supplied.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
data - the Point2D arraypublic PlotTool setImageBounds(Rectangle2D i)
i - the new image coordinate bounds
public Rectangle2D getImageBounds()
public PlotTool setPreservesShape(boolean eq)
eq - whether or not this tool preserves geometric shape
public boolean preservesShape()
public PlotTool setInset(int in)
in - the new image inset in image pixel units
public int getInset()
public AffineTransform getTransform()
public Transform1D getXTransform()
public Transform1D getYTransform()
public AffineTransform getInverseTransform()
public Transform1D getInverseXTransform()
public Transform1D getInverseYTransform()
public Point2D scale(Point2D source,
Point2D target)
Scales the given source Point2D
using the world to image transform
and sets the target Point2D
to the transformed value.
This method signature follows the conventions
for similar methods in the AffineTransform class.
source - the point to transformtarget - the point to store transformed point
or null if a new point should be created
nullpublic Point2D scale(Point2D source)
source - the point to transformpublic double xScale(double x)
public double yScale(double y)
public Point2D inverseScale(Point2D source,
Point2D target)
Scales the given source Point2D
using the inverse of the world to image transform
and sets the target Point2D
to the transformed value.
This method signature follows the conventions
for similar methods in the AffineTransform class.
source - the point to transformtarget - the point to store transformed point
or null if a new point should be created
nullpublic Point2D inverseScale(Point2D source)
source - the point to transformpublic double inverseXScale(double x)
public double inverseYScale(double y)
public void plotData(Graphics2D g,
Point2D[] data,
Paint color)
Transforms the points of the given array
using the world to image transform and
draws a line plot of the transformed points
in the given graphics context
using the given color or Paint
to draw the lines.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and plotcolor - the color or paint
public void plotData(Graphics2D g,
Point2D[] data,
Paint color,
Stroke s)
Transforms the points of the given array
using the world to image transform and
draws a line plot of the transformed points
in the given graphics context
using the given color or Paint
and the given Stroke
to draw the lines.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and plotcolor - the color or paints - the stroke for plotting the lines
public void plotData(Graphics2D g,
Point2D[][] data,
Paint color)
Transforms the points
of the given array of point arrays
using the world to image transform
and draws a line plot of each transformed
1-dimensional point array
in the given graphics context
using the given color or Paint
to draw the lines.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and plotcolor - the color or paint
public void plotData(Graphics2D g,
Point2D[][] data,
Paint color,
Stroke s)
Transforms the points
of the given array of point arrays
using the world to image transform
and draws a line plot of each transformed
1-dimensional point array
in the given graphics context
using the given color or Paint
and the given Stroke to draw the lines.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and plotcolor - the color or paints - the stroke for plotting the lines
public void plotData(Graphics2D g,
Point2D[][] data,
Paint[] color)
Transforms the points
of the given array of point arrays
using the world to image transform
and draws a line plot of each transformed
1-dimensional point array
in the given graphics context
using the given color or Paint array
to draw the lines.
The method cycles through the colors for successive line plots and will repeat colors if needed.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and plotcolor - the color or paint array
public void plotData(Graphics2D g,
Point2D[][] data,
Paint[] color,
Stroke s)
Transforms the points
of the given array of point arrays
using the world to image transform
and draws a line plot of each transformed
1-dimensional point array
in the given graphics context
using the given color or Paint array
and the given Stroke
to draw the lines.
The method cycles through the colors for successive line plots and will repeat colors if needed.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and plotcolor - the color or paint arrays - the stroke for plotting the lines
public void markData(Graphics2D g,
Point2D[] data,
Paint color,
PlotMark plotmark)
Transforms the points of the given array
using the world to image transform
and marks the resulting points
in the given graphics context
using the given color or Paint
to paint the marks.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and markcolor - the color or paintplotmark - the mark to use
public void markData(Graphics2D g,
Point2D[][] data,
Paint color,
PlotMark plotmark)
Transforms the points of the given array of arrays
using the world to image transform
and marks the resulting points
in the given graphics context
using the given color or Paint
to paint the marks.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and markcolor - the color or paintplotmark - the mark to use
public void markData(Graphics2D g,
Point2D[][] data,
Paint[] color,
PlotMark plotmark)
Transforms the points of the given array of arrays
using the world to image transform
and marks the resulting points
in the given graphics context
using the given color or Paint array
to paint the marks for the corresponding sub array
of the data.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and markcolor - the color or paint arrayplotmark - the mark to use
public void markData(Graphics2D g,
Point2D[][] data,
Paint[] color,
PlotMark[] plotmarks)
Transforms the points of the given array of arrays
using the world to image transform
and marks the resulting points
in the given graphics context
using the given color or Paint array
and the given plot mark array
to paint the marks for the corresponding sub array
of the data.
As of 2.5.0, skips data points that are not finite
as well as data points that are null.
g - the graphics contextdata - the data to transform and markcolor - the color or paint arrayplotmarks - the array of marks to use
public void plotVGridLine(Graphics2D g,
double xPosition)
g - the graphics contextxPosition - the x position in world coordinates
public void plotHGridLine(Graphics2D g,
double yPosition)
g - the graphics contextyPosition - the y position in world coordinates
public void plotVTickMark(Graphics2D g,
double xPosition,
int ticksize)
g - the graphics contextxPosition - the x position in world coordinatesticksize - the length of the tick mark
public void plotHTickMark(Graphics2D g,
double yPosition,
int ticksize)
g - the graphics contextyPosition - the y position in world coordinatesticksize - the length of the tick markpublic int xMinIndex(double delta)
delta - the spacing along the x axis
in world coordinatespublic int yMinIndex(double delta)
delta - the spacing along the y axis
in world coordinatespublic int xMaxIndex(double delta)
delta - the spacing along the x axis
in world coordinatespublic int yMaxIndex(double delta)
delta - the spacing along the y axis
in world coordinates
public PlotTool plotVGridLines(Graphics2D g,
Paint color,
double delta)
Paint
and the given x grid spacing value.
g - the graphics contextcolor - the grid line colordelta - the x grid spacing
public PlotTool plotHGridLines(Graphics2D g,
Paint color,
double delta)
Paint
and the given y grid spacing value.
g - the graphics contextcolor - the grid line colordelta - the y grid spacing
public PlotTool plotGridLines(Graphics2D g,
Paint color,
double xDelta,
double yDelta)
Paint
and the given grid spacing values.
g - the graphics contextcolor - the grid line colorxDelta - the x-spacingyDelta - the y-spacing
public PlotTool plotGridLines(Graphics2D g,
Paint color,
Point2D delta)
Paint
and the given grid spacing values
encapsulated as a Point2D object.
g - the graphics contextcolor - the grid line colordelta - a Point2D encapsulating
the grid spacing in the x and y directions
public PlotTool plotVTickMarks(Graphics2D g,
Paint color,
double delta,
int ticksize)
Paint,
x grid spacing value, and tick mark length.
g - the graphics contextcolor - the tick mark colordelta - the x tick mark spacingticksize - the length for each tick mark
public PlotTool plotHTickMarks(Graphics2D g,
Paint color,
double delta,
int ticksize)
Paint,
y grid spacing value, and tick mark length.
g - the graphics contextcolor - the tick mark colordelta - the y tick mark spacingticksize - the length for each tick mark
public PlotTool plotTickMarks(Graphics2D g,
Paint color,
double xDelta,
double yDelta,
int ticksize)
Paint,
the grid spacing values and tick mark length.
g - the graphics contextcolor - the tick mark colorxDelta - the x-spacingyDelta - the y-spacingticksize - the length for each tick mark
public PlotTool plotTickMarks(Graphics2D g,
Paint color,
Point2D delta,
int ticksize)
Paint,
grid spacing values encapsulated
as a Point2D object, and tick mark length.
g - the graphics contextcolor - the tick mark colordelta - a Point2D encapsulating
the tick mark spacing
in the x and y directionsticksize - the length for each tick mark
public static double findSpacing(double minimumDelta)
Returns the smallest double that has one of the three forms 10k, 2*10k, or 5*10k, and is greater than or equal to the absolute value of the given minimum.
Returns 0.0 if the given minimum is equal to 0.0 or is not finite.
minimumDelta - the minimum value that could be returnedpublic Point2D autoSpacing(int minPixel)
Point2D object encapsulating
an appropriate spacing for grid lines and tick marks
in world coordinates.
The x and y values of the returned
Point2D object will each have one of the
three numeric forms: 10k,
2*10k, or 5*10k.
If this plot tool is set to preserve geometric shape
then the x and y values of the returned
point will be equal.
minPixel - the minimum spacing in image pixel units
Point2D object encapsulating
the appropriate spacing
for grid lines and tick marks
in world coordinatespublic PlotTool autoGridLines(Graphics2D g)
g - the graphics context on which to plot
public PlotTool autoTickMarks(Graphics2D g)
g - the graphics context on which to plot
public PlotTool plotAxes(Graphics2D g,
Paint color,
int thick)
Paint
and the given line thickness.
g - the graphics context on which to plotcolor - the desired axes colorthick - the desired axes line thickness
public PlotTool autoAxes(Graphics2D g)
g - the graphics context on which to plot
protected void storeWorldBounds(Rectangle2D w)
w - the new world coordinate boundspublic void storeImageBounds(Rectangle2D i)
i - the new image coordinate boundsprotected void storePreservesShape(boolean ps)
ps - whether or not the transform
preserves geometric shapeprotected void storeInset(int in)
in - the new image inset in image pixel unitsprotected PlotTool setTransforms()
Creates an affine transform suitable for transforming points in the world coordinate space to points in the image coordinate space, either by best fit or by preserving the shape of the geometry.
The affine transform will support the mathematician's convention for world coodinates:
This means that in practice:
The image of the world will be centered, that is, the center of the bounds rectangle for the world coordinate space will map to the center of the bounds rectangle for the image coordinate space.
If this plot tool is not set to preserve geometric shape, then the transform will map the bounds rectangle for the world coordinate space directly to the bounds rectangle for the image coordinate space.
The inset parameter is used to adjust the transform so that the world coordinate bounds maps to a subrectangle of the image coordinate bounds inset on all sides by the given number of pixels.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||