Class PolygonOutliner
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.PixOutliner
-
- uk.ac.starlink.ttools.plot2.layer.PolygonOutliner
-
- All Implemented Interfaces:
Outliner
public class PolygonOutliner extends PixOutliner
Outliner implementations for plotting shapes defined by listing three or more vertices in data space. There are lots of implementation details hidden in this class, but external users should just need the public static factory methods.- Since:
- 5 Mar 2019
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static ConfigKey<MarkerShape>
MINSHAPE_KEY
Config key for the replacement marker shape.static ConfigKey<java.lang.Integer>
MINSIZE_KEY
Config key for the replacement marker threshold size.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canPaint(DataSpec dataSpec)
Indicates whether this outliner is willing to provide painters for a given DataSpec.ShapePainter
create2DPainter(Surface surf, DataGeom geom, DataSpec dataSpec, java.util.Map<AuxScale,Span> auxSpans, PaperType2D paperType)
Creates a ShapePainter object for plotting onto 2-dimensional surfaces.ShapePainter
create3DPainter(CubeSurface surf, DataGeom geom, DataSpec dataSpec, java.util.Map<AuxScale,Span> auxSpans, PaperType3D paperType)
Creates a ShapePainter object for plotting onto 3-dimensional surfaces.static PolygonOutliner
createArrayOutliner(FloatingArrayCoord arrayCoord, boolean includePos, PolygonShape polyShape)
Returns an outliner for polygons defined by an array-valued coordinate providing interleaved coordinates in user data space.static PolygonOutliner
createFixedOutliner(int np, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for polygons with a fixed number of vertices.static PolygonOutliner
createPlaneAreaOutliner(AreaCoord<PlaneDataGeom> coord, int icArea, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for drawing Area objects to a Plane plot.static PolygonOutliner
createSkyAreaOutliner(AreaCoord<SkyDataGeom> coord, int icArea, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for drawing Area objects to a Sky plot.static PolygonOutliner
createSphereAreaOutliner(AreaCoord<SphereDataGeom> areaCoord, int icArea, FloatingCoord radialCoord, int icRadial, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for drawing Area objects to a Sphere plot.boolean
equals(java.lang.Object o)
java.util.Map<AuxScale,AuxReader>
getAuxRangers(DataGeom geom)
Defines what non-axis ranging information is required by this outliner.javax.swing.Icon
getLegendIcon()
Returns an icon suitable for identifying points painted by this object in a plot legend.int
hashCode()
-
Methods inherited from class uk.ac.starlink.ttools.plot2.layer.PixOutliner
calculateBinPlan, getBinCounts, getPointCount
-
-
-
-
Field Detail
-
MINSIZE_KEY
public static final ConfigKey<java.lang.Integer> MINSIZE_KEY
Config key for the replacement marker threshold size.
-
MINSHAPE_KEY
public static final ConfigKey<MarkerShape> MINSHAPE_KEY
Config key for the replacement marker shape.
-
-
Method Detail
-
getLegendIcon
public javax.swing.Icon getLegendIcon()
Description copied from interface:Outliner
Returns an icon suitable for identifying points painted by this object in a plot legend. The returned icon does not manipulate the colour of the graphics context it operates on.- Returns:
- legend icon for this outliner
-
getAuxRangers
public java.util.Map<AuxScale,AuxReader> getAuxRangers(DataGeom geom)
Description copied from interface:Outliner
Defines what non-axis ranging information is required by this outliner. The return value is a map in which the keys define the ranges that must be supplied to the painting methods, and the values are reader objects that can acquire these ranges from a dataset.- Parameters:
geom
- data geometry- Returns:
- map of required scale keys to scale reader objects
-
canPaint
public boolean canPaint(DataSpec dataSpec)
Description copied from interface:Outliner
Indicates whether this outliner is willing to provide painters for a given DataSpec. The return value may be unconditionally true, but this method provides a hook for outliners to reject plotting based only on characteristics of the DataSpec.- Parameters:
dataSpec
- data specification for plot- Returns:
- true if dataSpec can be used to obtain a non-null painter
-
create2DPainter
public ShapePainter create2DPainter(Surface surf, DataGeom geom, DataSpec dataSpec, java.util.Map<AuxScale,Span> auxSpans, PaperType2D paperType)
Description copied from interface:Outliner
Creates a ShapePainter object for plotting onto 2-dimensional surfaces. This method should only be called ifOutliner.canPaint(uk.ac.starlink.ttools.plot2.data.DataSpec)
returns true for the supplied DataSpec.- Parameters:
surf
- plot surfacegeom
- coordinate geometrydataSpec
- data specificationauxSpans
- map of scale information required for plotpaperType
- 2-d paper type- Returns:
- new 2-d painter
-
create3DPainter
public ShapePainter create3DPainter(CubeSurface surf, DataGeom geom, DataSpec dataSpec, java.util.Map<AuxScale,Span> auxSpans, PaperType3D paperType)
Description copied from interface:Outliner
Creates a ShapePainter object for plotting onto 3-dimensional surfaces. This method should only be called ifOutliner.canPaint(uk.ac.starlink.ttools.plot2.data.DataSpec)
returns true for the supplied DataSpec.- Parameters:
surf
- 3-d plot surfacegeom
- coordinate geometrydataSpec
- data specificationauxSpans
- map of scale information required for plotpaperType
- 3-d paper type- Returns:
- new 3-d painter
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
createFixedOutliner
public static PolygonOutliner createFixedOutliner(int np, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for polygons with a fixed number of vertices.- Parameters:
np
- number of verticespolyShape
- polygon painterminSize
- threshold size for replacement markersminShape
- shape for replacement markers- Returns:
- outliner
-
createPlaneAreaOutliner
public static PolygonOutliner createPlaneAreaOutliner(AreaCoord<PlaneDataGeom> coord, int icArea, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for drawing Area objects to a Plane plot.- Parameters:
coord
- coordinate for reading area objectsicArea
- coordinate index in tuple for area coordinatepolyShape
- polygon painterminSize
- threshold size for replacement markersminShape
- shape for replacement markers- Returns:
- outliner
-
createSkyAreaOutliner
public static PolygonOutliner createSkyAreaOutliner(AreaCoord<SkyDataGeom> coord, int icArea, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for drawing Area objects to a Sky plot.- Parameters:
coord
- coordinate for reading area objectsicArea
- coordinate index in tuple for area coordinatepolyShape
- polygon painterminSize
- threshold size for replacement markersminShape
- shape for replacement markers- Returns:
- outliner
-
createSphereAreaOutliner
public static PolygonOutliner createSphereAreaOutliner(AreaCoord<SphereDataGeom> areaCoord, int icArea, FloatingCoord radialCoord, int icRadial, PolygonShape polyShape, int minSize, MarkerShape minShape)
Returns an outliner for drawing Area objects to a Sphere plot.- Parameters:
areaCoord
- coordinate for reading area objectsicArea
- coordinate index in tuple for area coordinateradialCoord
- coordinate for reading radial distance of areaicRadial
- coordinate index in tuple for radial coordinatepolyShape
- polygon painterminSize
- threshold size for replacement markersminShape
- shape for replacement markers- Returns:
- outliner
-
createArrayOutliner
public static PolygonOutliner createArrayOutliner(FloatingArrayCoord arrayCoord, boolean includePos, PolygonShape polyShape)
Returns an outliner for polygons defined by an array-valued coordinate providing interleaved coordinates in user data space. Each array instance may be of length N*D, where D is the number of coordinates per point in user space. For instance a triangle in plane coordinates would be (x1,y1, x2,y2, x3,y3), and in sky coordinates (lon1,lat1, lon2,lat2, lon3,lat3).- Parameters:
arrayCoord
- array-valued coordinateincludePos
- if true, positional coordinate is included as the first vertex, if false it is ignoredpolyShape
- polygon painter- Returns:
- outliner
-
-