Package uk.ac.starlink.ttools.plot2.geom
Class TickSkyAxisLabeller
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.geom.TickSkyAxisLabeller
-
- All Implemented Interfaces:
SkyAxisLabeller
public abstract class TickSkyAxisLabeller extends java.lang.Object implements SkyAxisLabeller
Partial SkyAxisLabeller implementation that labels axes with positioned numeric labels.- Since:
- 21 Feb 2013
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTickSkyAxisLabeller.SkyTickAggregates a line label, graphics position and text anchor.
-
Constructor Summary
Constructors Constructor Description TickSkyAxisLabeller(java.lang.String name, java.lang.String description)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TickSkyAxisLabeller.SkyTick[]calculateTicks(double[][][] lines, Caption[] labels, java.awt.Rectangle plotBounds)Returns a list of ticks for labelling lines produced by a GridLiner.AxisAnnotationcreateAxisAnnotation(GridLiner gridLiner, Captioner captioner)Returns an axis annotation object for a given grid painter and captioner.static TickSkyAxisLabeller.SkyTickcreateExternalTick(Caption label, double[][] line, java.awt.Rectangle bounds)Constructs a single tick that sits outside the plot bounding box for a given grid line.static TickSkyAxisLabeller.SkyTickcreateInternalTick(Caption label, double[][] line)Constructs a single tick that sits inside the plot bounding box for a given grid line.java.lang.StringgetLabellerDescription()Returns a description for this mode.java.lang.StringgetLabellerName()Returns a name for this axis labelling mode.protected TickSkyAxisLabeller.SkyTick[]removeOverlaps(TickSkyAxisLabeller.SkyTick[] ticks, Captioner captioner)Takes a list of ticks and removes some elements if they are so crowded together the labels overlap.
-
-
-
Method Detail
-
getLabellerName
public java.lang.String getLabellerName()
Description copied from interface:SkyAxisLabellerReturns a name for this axis labelling mode.- Specified by:
getLabellerNamein interfaceSkyAxisLabeller- Returns:
- one-word name
-
getLabellerDescription
public java.lang.String getLabellerDescription()
Description copied from interface:SkyAxisLabellerReturns a description for this mode.- Specified by:
getLabellerDescriptionin interfaceSkyAxisLabeller- Returns:
- description
-
createAxisAnnotation
public AxisAnnotation createAxisAnnotation(GridLiner gridLiner, Captioner captioner)
Description copied from interface:SkyAxisLabellerReturns an axis annotation object for a given grid painter and captioner.- Specified by:
createAxisAnnotationin interfaceSkyAxisLabeller- Parameters:
gridLiner- grid lines for a sky plotcaptioner- text renderer- Returns:
- axis annotation
-
calculateTicks
protected abstract TickSkyAxisLabeller.SkyTick[] calculateTicks(double[][][] lines, Caption[] labels, java.awt.Rectangle plotBounds)
Returns a list of ticks for labelling lines produced by a GridLiner.- Parameters:
lines- gridliner line point arraylabels- gridliner line label arrayplotBounds- extent of plot region in graphics coordinates- See Also:
GridLiner
-
removeOverlaps
protected TickSkyAxisLabeller.SkyTick[] removeOverlaps(TickSkyAxisLabeller.SkyTick[] ticks, Captioner captioner)
Takes a list of ticks and removes some elements if they are so crowded together the labels overlap.- Parameters:
ticks- input tick listcaptioner- text renderer- Returns:
- output tick list, with some items removed if necessary
-
createExternalTick
public static TickSkyAxisLabeller.SkyTick createExternalTick(Caption label, double[][] line, java.awt.Rectangle bounds)
Constructs a single tick that sits outside the plot bounding box for a given grid line.- Parameters:
label- tick textline- grid line coordinates - array of (x,y) arraysbounds- plot region bounds
-
createInternalTick
public static TickSkyAxisLabeller.SkyTick createInternalTick(Caption label, double[][] line)
Constructs a single tick that sits inside the plot bounding box for a given grid line.- Parameters:
label- tick textline- grid line coordinates - array of (x,y) arrays
-
-