public class CoordinateGrid extends SceneComponent
A scene component whose geometry is a coordinate grid that fills a rectangle in user space (usually the viewport of a viewer).
The spacing of
the grid lines is either 1, 2 or 5 times a power of ten choosen in such a
way that neither the number of horizontal grid lines nor the number of
vertical grid lines exceeds a limit set by the property
maximumLineCount
.
Every ten'th grid line is overdrawn with a different type of line, which
form the "coarse grid". The paint and the stroke of these lines can be
controlled by editing the SceneComponent
returned by
getCoarseGrid
.
Constructor and Description |
---|
CoordinateGrid()
Creates an aspect ratio preserving grid filling the region where both
coordinates lie between -1 and 1.
|
CoordinateGrid(Rectangle2D.Double r,
boolean keepAspectRatio)
Creates a grid filling the rectangle
r , preserving the
aspect ratio if keepAspectRatio is true. |
Modifier and Type | Method and Description |
---|---|
SceneComponent |
getCoarseGrid()
Returns the scene component responsible for the coarse grid (every
ten'th grid line).
|
Paint |
getCoarseGridPaint() |
Stroke |
getCoarseGridStroke() |
String |
getHorizontalUnit() |
int |
getMaximumLineCount()
Returns the maximal number of horizontal lines both (as well as the
maximal number of vertical lines).
|
Rectangle2D.Double |
getRectangle()
Returns the rectangle that is filled by the grid.
|
String |
getVerticalUnit() |
boolean |
isKeepingAspectRatio()
Whether the horizontal spacing of grid lines equals the vertical
spacing (in user space).
|
void |
setCoarseGridPaint(Paint s) |
void |
setCoarseGridStroke(Stroke s) |
void |
setHorizontalUnit(String s) |
void |
setKeepingAspectRatio(boolean b)
Sets the boolean that determines whether the horizontal spacing of grid
lines equals the vertical spacing (in user space).
|
void |
setMaximumLineCount(int n)
Sets the maximal number of horizontal lines both (as well as the
maximal number of vertical lines).
|
void |
setRectangle(Rectangle2D.Double r)
Sets the rectangle that is filled by the grid.
|
void |
setVerticalUnit(String s) |
addAppearanceChangeListener, addChild, addChild, addDragListener, addMouseOverListener, appearanceChange, copyAttributesFrom, drag, dragEnd, dragStart, fireAppearanceChange, getAnnotated, getAnnotationMargin, getAnnotationPaint, getAnnotations, getChild, getChildCount, getFilled, getFont, getHighlightAnnotationPaint, getHighlighted, getHighlightOutlinePaint, getHighlightPaint, getHighlightPointPaint, getIcons, getName, getOutlined, getOutlinePaint, getPaint, getPointFilled, getPointOutlined, getPointPaint, getPoints, getPointShape, getPointStroke, getShape, getStroke, getTransform, isAnnotationDragEnabled, isAreaDragEnabled, isIconDragEnabled, isMouseOverEnabled, isOutlineDragEnabled, isPointDragEnabled, isVisible, mouseEnter, mouseLeave, removeAllChildren, removeAppearanceChangeListener, removeChild, removeDragListener, removeMouseOverListener, setAnnotated, setAnnotationDragEnabled, setAnnotationMargin, setAnnotationPaint, setAreaDragEnabled, setFilled, setFont, setHighlightAnnotationPaint, setHighlighted, setHighlightOutlinePaint, setHighlightPaint, setHighlightPointPaint, setIconDragEnabled, setMouseOverEnabled, setName, setOutlined, setOutlineDragEnabled, setOutlinePaint, setPaint, setPointDragEnabled, setPointFilled, setPointOutlined, setPointPaint, setPointShape, setPointStroke, setShape, setStroke, setTransform, setVisible
public CoordinateGrid()
public CoordinateGrid(Rectangle2D.Double r, boolean keepAspectRatio)
r
, preserving the
aspect ratio if keepAspectRatio
is true.public SceneComponent getCoarseGrid()
public Paint getCoarseGridPaint()
public Stroke getCoarseGridStroke()
public String getHorizontalUnit()
public int getMaximumLineCount()
public Rectangle2D.Double getRectangle()
public String getVerticalUnit()
public boolean isKeepingAspectRatio()
public void setCoarseGridPaint(Paint s)
public void setCoarseGridStroke(Stroke s)
public void setHorizontalUnit(String s)
public void setKeepingAspectRatio(boolean b)
public void setMaximumLineCount(int n)
public void setRectangle(Rectangle2D.Double r)
public void setVerticalUnit(String s)