Package noaa.coastwatch.render.feature
Class PolygonFeature
java.lang.Object
noaa.coastwatch.render.feature.AbstractFeature
noaa.coastwatch.render.feature.LineFeature
noaa.coastwatch.render.feature.PolygonFeature
- All Implemented Interfaces:
Iterable<EarthLocation>
,Feature
The
PolygonFeature
class is a LineFeature
with
extra properties and rendering algorithms specific to polygons.
Polygons are rendered as filled where as lines are rendered as a
series of segments only. Polygons have an inherent winding
direction which may be used to determine what is inside the polygon
and what is outside. The winding direction is not used by the
rendering algorithm, but rather is a convenience for the user so
that polygons of different winding directions may be grouped
together but treated differently depending on their direction.- Since:
- 3.1.4
- Author:
- Peter Hollemans
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The clockwise winding direction.static final int
The counter-clockwise winding direction.Fields inherited from class noaa.coastwatch.render.feature.LineFeature
fastMode, lastDiscontinuous, lastPath, lastTrans
Fields inherited from class noaa.coastwatch.render.feature.AbstractFeature
points
-
Constructor Summary
ConstructorDescriptionPolygonFeature
(int direction) Creates a new empty polygon feature with no attributes.PolygonFeature
(int direction, Object[] attributeArray) Creates a new empty polygon feature with attributes. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the winding direction.void
render
(Graphics2D g, EarthImageTransform trans) Renders this feature to a graphics context.void
renderOutline
(Graphics2D g, EarthImageTransform trans) Renders the outline of this polygon feature to a graphics context.transform
(EarthImageTransform imageTrans) Transforms this line feature to a path.Methods inherited from class noaa.coastwatch.render.feature.LineFeature
filter, getFastMode, getPath, isDiscontinuous, setFastMode
Methods inherited from class noaa.coastwatch.render.feature.AbstractFeature
add, addAll, equals, get, getAttribute, getAttributeCount, hashCode, iterator, remove, setAttributes, size
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
CLOCKWISE
public static final int CLOCKWISEThe clockwise winding direction.- See Also:
-
COUNTER_CLOCKWISE
public static final int COUNTER_CLOCKWISEThe counter-clockwise winding direction.- See Also:
-
-
Constructor Details
-
PolygonFeature
public PolygonFeature(int direction) Creates a new empty polygon feature with no attributes.- Parameters:
direction
- the winding direction, either clockwise or counter-clockwise.
-
PolygonFeature
Creates a new empty polygon feature with attributes.- Parameters:
direction
- the winding direction, either clockwise or counter-clockwise.attributeArray
- the array of feature attributes.
-
-
Method Details
-
getDirection
public int getDirection()Gets the winding direction. -
renderOutline
Renders the outline of this polygon feature to a graphics context. This method allows the user to render the polygon as if it was line data with no filling applied. It simply calls the overriddenLineFeature.render(java.awt.Graphics2D, noaa.coastwatch.render.EarthImageTransform)
method.- Parameters:
g
- the graphics context for drawing.trans
- the earth image transform for converting Earth locations to image points.
-
transform
Description copied from class:LineFeature
Transforms this line feature to a path. TheEarthImageTransform
is used to eliminate any line segments which do not transform to valid image points.- Overrides:
transform
in classLineFeature
- Parameters:
imageTrans
- the transform for converting earth locations to image points.- Returns:
- the path that follows this feature's points in the transformed space.
-
render
Description copied from class:LineFeature
Renders this feature to a graphics context.- Overrides:
render
in classLineFeature
- Parameters:
g
- the graphics context for drawing.trans
- the earth image transform for converting Earth locations to image points.
-