public class PolygonConstraint extends PolyLineConstraintAdapter implements IConstraint
For polygons defining an area, the interior of the area is defined as being bounded by a counter-clockwise polygon. Thus a clockwise polygon would define a "hole" in the area. It is worth noting that this convention is just the opposite of that taken by ESRI's Shapefile format, though it is consistent with conventions used in general computational geometry.
Organizing the list of vertices that defines the polygon Some implementations of polygon geometries include an extra "closure" vertex so that the last vertex in the list of vertices that defines the polygon is also the first. Although that approach has some advantages, this class does not use it. Each vertex in the polygon geometry is assumed to be unique. Thus, if the polygon represents a triangle, the getVertices and Vertex iterator methods will return exactly three vertices.
applicationData, constraintIndex, constraintLinkingEdge, isComplete, length, list, maintainingTin
Constructor and Description |
---|
PolygonConstraint()
Standard constructor
|
PolygonConstraint(List<Vertex> vList)
Constructs a constraint with the specified vertices.
|
PolygonConstraint(Vertex v0,
Vertex v1,
Vertex v2,
Vertex v3)
A convenience constructor intended for the frequently occurring case
in which an application wishes to define a constraint as a rectangle
or four-vertex polygon
|
Modifier and Type | Method and Description |
---|---|
void |
complete()
Called to indicate that the feature is complete and that
no further vertices will be added to it.
|
boolean |
definesConstrainedRegion()
Indicates whether the constraint applies a constrained region behavior
when added to a TIN.
|
double |
getArea()
Get the computed square area for the constraint polygon.
|
PolygonConstraint |
getConstraintWithNewGeometry(List<Vertex> geometry)
Gets a new constraint that has the attributes of this constraint
and the specified geometry.
|
double |
getNominalPointSpacing()
Get the average distance between points for the feature.
|
Path2D |
getPath2D(AffineTransform transform)
Gets a Java Path2D based on the geometry of the constraint mapped through
an optional affine transform.
|
List<Vertex> |
getVertices()
Gets the vertices for this feature.
|
boolean |
isPolygon()
Indicates whether the instance represents a polygon.
|
boolean |
isValid()
Indicates that sufficient information has been stored in
the polyline to establish a valid geometry.
|
PolygonConstraint |
refactor(Iterable<Vertex> geometry)
Creates a new polyline feature with the specified geometry
and transfers any data elements defined by the implementing class
from the current object to the newly created one.
|
String |
toString() |
add, getApplicationData, getBounds, getConstraintIndex, getConstraintLinkingEdge, getLength, getManagingTin, isPointInsideConstraint, iterator, setApplicationData, setConstraintIndex, setConstraintLinkingEdge
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getApplicationData, getConstraintIndex, getConstraintLinkingEdge, getManagingTin, isPointInsideConstraint, setApplicationData, setConstraintIndex, setConstraintLinkingEdge
forEach, iterator, spliterator
public PolygonConstraint()
public PolygonConstraint(Vertex v0, Vertex v1, Vertex v2, Vertex v3)
v0
- the initial vertex of the polygonv1
- the second vertex of the polygonv2
- the third vertex of the polygonv3
- the final vertex of the polygonpublic List<Vertex> getVertices()
IPolyline
getVertices
in interface IPolyline
getVertices
in class PolyLineConstraintAdapter
public final void complete()
IPolyline
Multiple calls to complete are benign and will be ignored. If vertices are added after complete is called, the behavior is undefined.
public boolean isPolygon()
IPolyline
public boolean definesConstrainedRegion()
definesConstrainedRegion
in interface IConstraint
public double getArea()
public double getNominalPointSpacing()
IPolyline
getNominalPointSpacing
in interface IPolyline
public PolygonConstraint getConstraintWithNewGeometry(List<Vertex> geometry)
IConstraint
getConstraintWithNewGeometry
in interface IConstraint
geometry
- a valid set of vertices.public PolygonConstraint refactor(Iterable<Vertex> geometry)
IPolyline
This method is intended to be used in cases where application code performs some kind of transformation on the geometry of the existing object and produces a new object. In doing so, the application code treats the existing object on a read-only basis, but is free to transfer any implementation-specific data from the old object to the new. Examples of possible transformations include an implementation of a point-reduction technique such as Visvalingam's algorithm or point-addition techniques such as curve smoothing.
public boolean isValid()
IPolyline
public Path2D getPath2D(AffineTransform transform)
getPath2D
in interface IConstraint
transform
- a valid transform, or the null to use the identity
transform.Copyright © 2021. All rights reserved.