java.lang.Object
org.jfree.chart3d.graphics2d.Anchor2D
- All Implemented Interfaces:
Serializable
Represents an anchor point for a chart title and/or legend. The anchor
point is defined relative to a reference rectangle, the dimensions of which
are not known in advance (typically the reference rectangle is the bounding
rectangle of a chart that is being drawn). Some predefined anchor points
are provided in the
Instances of this class are immutable.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
TitleAnchor
and LegendAnchor
classes.
Instances of this class are immutable.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Anchor2D
An anchor point at the bottom center with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the bottom left with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the bottom right with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the center of the target rectangle.static final Anchor2D
An anchor point at the center left with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the center right with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the top center with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the top left with zero offset from the target rectangle bounds.static final Anchor2D
An anchor point at the top right with zero offset from the target rectangle bounds. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tests this instance for equality with an arbitrary object.getAnchorPoint
(Rectangle2D rect) Returns the anchor point for the given rectangle.Returns the offsets.getRefPt()
Returns the reference point.resolveAnchorWithPercentOffset
(double startX, double startY, double endX, double endY) Resolves the anchor to a specific point relative to a rectangle defined by the points (startX, startY) and (endX, endY).
-
Field Details
-
TOP_LEFT
An anchor point at the top left with zero offset from the target rectangle bounds.- Since:
- 1.1
-
TOP_CENTER
An anchor point at the top center with zero offset from the target rectangle bounds.- Since:
- 1.1
-
TOP_RIGHT
An anchor point at the top right with zero offset from the target rectangle bounds.- Since:
- 1.1
-
CENTER_LEFT
An anchor point at the center left with zero offset from the target rectangle bounds.- Since:
- 1.1
-
CENTER
An anchor point at the center of the target rectangle.- Since:
- 1.1
-
CENTER_RIGHT
An anchor point at the center right with zero offset from the target rectangle bounds.- Since:
- 1.1
-
BOTTOM_LEFT
An anchor point at the bottom left with zero offset from the target rectangle bounds.- Since:
- 1.1
-
BOTTOM_CENTER
An anchor point at the bottom center with zero offset from the target rectangle bounds.- Since:
- 1.1
-
BOTTOM_RIGHT
An anchor point at the bottom right with zero offset from the target rectangle bounds.- Since:
- 1.1
-
-
Constructor Details
-
Anchor2D
public Anchor2D()Creates a default instance. -
Anchor2D
Creates a newAnchor2D
instance with the specified reference point and offsets of(4.0, 4.0)
.- Parameters:
refPt
- the reference point (null
not permitted).
-
Anchor2D
Creates a new anchor.- Parameters:
refPt
- the reference point (null
not permitted).offset
- the offset (null
not permitted).
-
-
Method Details
-
getRefPt
Returns the reference point.- Returns:
- The reference point (never
null
).
-
getOffset
Returns the offsets.- Returns:
- The offsets (never
null
).
-
getAnchorPoint
Returns the anchor point for the given rectangle.- Parameters:
rect
- the reference rectangle (null
not permitted).- Returns:
- The anchor point.
-
resolveAnchorWithPercentOffset
public Point2D resolveAnchorWithPercentOffset(double startX, double startY, double endX, double endY) Resolves the anchor to a specific point relative to a rectangle defined by the points (startX, startY) and (endX, endY).- Parameters:
startX
- the x-coordinate for the bottom left corner of the target rect.startY
- the y-coordinate for the bottom left corner of the target rect.endX
- the x-coordinate for the top right corner of the target rect.endY
- the y-coordinate for the top right corner of the target rect.- Returns:
- The resolved point.
- Since:
- 1.2
-
equals
Tests this instance for equality with an arbitrary object.
-