Package uk.ac.starlink.ttools.plot2.geom
Class NavDecorations
java.lang.Object
uk.ac.starlink.ttools.plot2.geom.NavDecorations
Utility class supplying visual feedback decorations for
two-dimensional plot navigation.
- Since:
- 18 Feb 2014
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionstatic Decoration
Utility function to center a symmetric icon at a point.static Decoration
Utility function to center one of the 1-dimensional zoom icons about a given point on its axis.static BandDecoration
createBandDecoration
(Point p1, Point p2, boolean xuse, boolean yuse, Rectangle bounds) Returns a decoration appropriate for a 2d frame zoom.static Decoration
Returns a simple marker at a point.static Decoration
createDragDecoration
(Point p, double xfact, double yfact, boolean xuse, boolean yuse, Rectangle bounds) Returns a decoration appropriate for a 2d drag zoom.static Decoration
createWheelDecoration
(Point p, double xfact, double yfact, boolean xuse, boolean yuse, Rectangle bounds) Returns a decoration appropriate for a 2d wheel zoom.static void
Draws a line with an arrow head at one end.static Graphics2D
Sets graphics context ready for navigation decorations.
-
Method Details
-
createCenterDecoration
Returns a simple marker at a point.- Parameters:
p
- position- Returns:
- position marker centered at
p
-
createWheelDecoration
public static Decoration createWheelDecoration(Point p, double xfact, double yfact, boolean xuse, boolean yuse, Rectangle bounds) Returns a decoration appropriate for a 2d wheel zoom.- Parameters:
p
- reference pointxfact
- X direction zoom factoryfact
- Y direction zoom factorxuse
- true if X zoom is in effectyuse
- true if Y zoom is in effectbounds
- plot region bounds- Returns:
- marker centered at p
-
createDragDecoration
public static Decoration createDragDecoration(Point p, double xfact, double yfact, boolean xuse, boolean yuse, Rectangle bounds) Returns a decoration appropriate for a 2d drag zoom.- Parameters:
p
- reference pointxfact
- X direction zoom factoryfact
- Y direction zoom factorxuse
- true if X zoom is in effectyuse
- true if Y zoom is in effectbounds
- plot region bounds- Returns:
- marker centered at p
-
createBandDecoration
public static BandDecoration createBandDecoration(Point p1, Point p2, boolean xuse, boolean yuse, Rectangle bounds) Returns a decoration appropriate for a 2d frame zoom. The returned object has a target rectangle associated with it, which makes sense for this kind of decoration.- Parameters:
p1
- drag start pointp2
- drag (current) end pointxuse
- true if X zoom is in effectyuse
- true if Y zoom is in effectbounds
- plot region bounds- Returns:
- frame decoration with target rectangle
-
center
Utility function to center a symmetric icon at a point. The icon must correctly report its dimensions for this to work.- Parameters:
icon
- iconp
- central point- Returns:
- centered decoration
-
center1d
Utility function to center one of the 1-dimensional zoom icons about a given point on its axis. The icon must correctly report its dimensions for this to work.- Parameters:
icon
- iconisY
- false for X axis annotation, true for Y axis annotationp
- reference pointbounds
- plot bounds- Returns:
- centered decoration
-
drawArrow
Draws a line with an arrow head at one end.- Parameters:
g
- graphics contextx0
- start X coordinatey0
- start Y coordinatex1
- end (arrow) X coordinatey1
- end (arrow) Y coordinate
-
prepareGraphics
Sets graphics context ready for navigation decorations. The colour is modified as appropriate. The result is a new graphics context, which does not need to be reset (and should be disposed) when the caller is finished with it.- Parameters:
g
- supplied graphics context- Returns:
- new, adjusted graphics context based on
g
-