|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.Line2D
org.geotools.axis.Axis2D
An axis as a graduated line. Axis2D
objets are really Line2D
objects with a Graduation
. Because axis are Line2D
, they can be
located anywhere in a widget with any orientation. Lines are drawn from starting
point
(x1,y1)
to end point
(x2,y2),
using a graduation from minimal value Graduation.getMinimum()
to maximal
value Graduation.getMaximum()
.
Note the line's coordinates (x1,y1) and
(x2,y2) are completly independant of
graduation minimal and maximal values. Line's coordinates should be expressed in
some units convenient for rendering, as pixels or point (1/72 of inch). On the
opposite, graduation can have any arbitrary units, which is given by
Graduation.getUnit()
. The static method createAffineTransform(org.geotools.axis.Axis2D, org.geotools.axis.Axis2D)
can
be used for mapping logical coordinates to pixels coordinates for an arbitrary
pair of Axis2D
objects, which doesn't need to be perpendicular.
AxisInfo
,
AxisOrientation
,
Graduation
,
Serialized FormNested Class Summary | |
class |
Axis2D.TickIterator
Iterator object that iterates along the graduation ticks and provides access to the graduation values. |
Nested classes inherited from class java.awt.geom.Line2D |
java.awt.geom.Line2D.Double, java.awt.geom.Line2D.Float |
Constructor Summary | |
Axis2D()
Construct an axis with a default NumberGraduation . |
|
Axis2D(Graduation graduation)
Construct an axis with the specified graduation. |
Method Summary | |
static java.awt.geom.AffineTransform |
createAffineTransform(Axis2D xAxis,
Axis2D yAxis)
Creates an affine transform mapping logical to pixels coordinates for a pair of axis. |
AxisInfo |
getAxisInfo()
Returns this axis name and orientation. |
java.awt.geom.Rectangle2D |
getBounds2D()
Returns a bounding box for this axis. |
Graduation |
getGraduation()
Returns the axis's graduation. |
double |
getLength()
Returns the axis length. |
java.awt.geom.Point2D |
getP1()
Returns the (x,y) coordinates of the start point. |
java.awt.geom.Point2D |
getP2()
Returns the (x,y) coordinates of the end point. |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform transform)
Returns an iterator object that iterates along the Axis2D boundary
and provides access to the geometry of the shape outline. |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform transform,
double flatness)
Returns an iterator object that iterates along the Axis2D boundary
and provides access to the geometry of the shape outline. |
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key key)
Returns the value of a single preference for the rendering algorithms. |
double |
getX1()
Returns the x coordinate of the start point. |
double |
getX2()
Returns the x coordinate of the end point. |
double |
getY1()
Returns the y coordinate of the start point. |
double |
getY2()
Returns the y coordinate of the end point. |
boolean |
isLabelClockwise()
Returns true if the axis would have to rotate clockwise in order to
overlaps its graduation. |
void |
paint(java.awt.Graphics2D graphics)
Draw this axis in the specified graphics context. |
void |
setLabelClockwise(boolean c)
Sets the label's locations relative to this axis. |
void |
setLine(double x1,
double y1,
double x2,
double y2)
Sets the location of the endpoints of this Axis2D to the specified
coordinates. |
void |
setRenderingHint(java.awt.RenderingHints.Key key,
java.lang.Object value)
Sets the value of a single preference for the rendering algorithms. |
java.lang.String |
toString()
Returns a string representation of this axis. |
Methods inherited from class java.awt.geom.Line2D |
clone, contains, contains, contains, contains, getBounds, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opengis.util.Cloneable |
clone |
Constructor Detail |
public Axis2D()
NumberGraduation
.
public Axis2D(Graduation graduation)
Method Detail |
public Graduation getGraduation()
public AxisInfo getAxisInfo()
public double getX1()
getY1()
,
getX2()
,
setLine(double, double, double, double)
public double getX2()
getY2()
,
getX1()
,
setLine(double, double, double, double)
public double getY1()
getX1()
,
getY2()
,
setLine(double, double, double, double)
public double getY2()
getX2()
,
getY1()
,
setLine(double, double, double, double)
public java.awt.geom.Point2D getP1()
public java.awt.geom.Point2D getP2()
public double getLength()
P2
). This length is usually measured in pixels or points
(1/72 of inch).
public java.awt.geom.Rectangle2D getBounds2D()
P1
) to (P2
), the
axis's ticks and all labels.
getBounds2D
in interface java.awt.Shape
getX1()
,
getY1()
,
getX2()
,
getY2()
public void setLine(double x1, double y1, double x2, double y2) throws java.lang.IllegalArgumentException
Axis2D
to the specified
coordinates. Coordinates should be in pixels (for screen rendering) or points
(for paper rendering). Using points units make it easy to render labels with
a raisonable font size, no matter the screen resolution or the axis graduation.
x1
- Coordinate x of starting point.y1
- Coordinate y of starting pointx2
- Coordinate x of end point.y2
- Coordinate y of end point.
java.lang.IllegalArgumentException
- If a coordinate is NaN
or infinite.getX1()
,
getY1()
,
getX2()
,
getY2()
public boolean isLabelClockwise()
true
if the axis would have to rotate clockwise in order to
overlaps its graduation.
public void setLabelClockwise(boolean c)
true
means
that the axis would have to rotate clockwise in order to overlaps its graduation.
Value false
means that the axis would have to rotate counter-clockwise
in order to overlaps its graduation.
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform transform)
Axis2D
boundary
and provides access to the geometry of the shape outline. The shape includes
the axis line, graduation and labels. If an optional AffineTransform
is specified, the coordinates returned in the iteration are transformed accordingly.
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform transform, double flatness)
Axis2D
boundary
and provides access to the geometry of the shape outline. The shape includes
the axis line, graduation and labels. If an optional AffineTransform
is specified, the coordinates returned in the iteration are transformed accordingly.
getPathIterator
in interface java.awt.Shape
public void paint(java.awt.Graphics2D graphics)
Graphics2D.draw(this)
. However, this method may be slightly
faster and produce better quality output.
graphics
- The graphics context to use for drawing.public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key key)
Graduation
interface.
key
- The key corresponding to the hint to get.
null
if no value is associated to the specified key.Graduation.TICK_LABEL_FONT
,
Graduation.AXIS_TITLE_FONT
public void setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)
Graduation
interface.
key
- The key of the hint to be set.value
- The value indicating preferences for the specified hint category.
A null
value removes any hint for the specified key.Graduation.TICK_LABEL_FONT
,
Graduation.AXIS_TITLE_FONT
public java.lang.String toString()
public static java.awt.geom.AffineTransform createAffineTransform(Axis2D xAxis, Axis2D yAxis)
xAxis
and yAxis
graduations, respectively.xAxis
, which may or may not be horizontal. Changing the y
value move the pixel location in parallel with the yAxis
, which may or
may not be vertical.
xAxis
- The x axis. This axis doesn't have to be horizontal;
it can have any orientation, including vertical.yAxis
- The y axis. This axis doesn't have to be vertical;
it can have any orientation, including horizontal.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |