# 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 final ConfigKey<MarkerShape>`
`MINSHAPE_KEY`
Config key for the replacement marker shape.
`static final ConfigKey<Integer>`
`MINSIZE_KEY`
Config key for the replacement marker threshold size.

## Method Summary

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, Map<AuxScale,Span> auxSpans, PaperType2D paperType)`
Creates a ShapePainter object for plotting onto 2-dimensional surfaces.
`ShapePainter`
`create3DPainter(CubeSurface surf, DataGeom geom, DataSpec dataSpec, 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(Object o)`
`Map<AuxScale, AuxReader>`
`getAuxRangers(DataGeom geom)`
Defines what non-axis ranging information is required by this outliner.
`Icon`
`getLegendIcon()`
Returns an icon suitable for identifying points painted by this object in a plot legend.
`int`
`hashCode()`

### Methods inherited from class PixOutliner

`calculateBinPlan, getBinCounts, getPointCount, getReport`

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### MINSIZE_KEY

public static final ConfigKey<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 Details

### getLegendIcon

public 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 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, 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 if `Outliner.canPaint(DataSpec)` returns true for the supplied DataSpec.

Parameters:
  `surf` - plot surface
  `geom` - coordinate geometry
  `dataSpec` - data specification
  `auxSpans` - map of scale information required for plot
  `paperType` - 2-d paper type
Returns:
  new 2-d painter

### create3DPainter

public ShapePainter create3DPainter(CubeSurface surf, DataGeom geom, DataSpec dataSpec, 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 if `Outliner.canPaint(DataSpec)` returns true for the supplied DataSpec.

Parameters:
  `surf` - 3-d plot surface
  `geom` - coordinate geometry
  `dataSpec` - data specification
  `auxSpans` - map of scale information required for plot
  `paperType` - 3-d paper type
Returns:
  new 3-d painter

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `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 vertices
  `polyShape` - polygon painter
  `minSize` - threshold size for replacement markers
  `minShape` - 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 objects
  `icArea` - coordinate index in tuple for area coordinate
  `polyShape` - polygon painter
  `minSize` - threshold size for replacement markers
  `minShape` - 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 objects
  `icArea` - coordinate index in tuple for area coordinate
  `polyShape` - polygon painter
  `minSize` - threshold size for replacement markers
  `minShape` - 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 objects
  `icArea` - coordinate index in tuple for area coordinate
  `radialCoord` - coordinate for reading radial distance of area
  `icRadial` - coordinate index in tuple for radial coordinate
  `polyShape` - polygon painter
  `minSize` - threshold size for replacement markers
  `minShape` - 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 coordinate
  `includePos` - if true, positional coordinate is included as the first vertex, if false it is ignored
  `polyShape` - polygon painter
Returns:
  outliner