Package slash.navigation.common
Record Class Polygon
java.lang.Object
java.lang.Record
slash.navigation.common.Polygon
public record Polygon(List<List<NavigationPosition>> rings, List<Boolean> holes, BoundingBox boundingBox)
extends Record
An area defined by one or more rings of
NavigationPositions, e.g. a clip polygon of an extract.
Rings flagged as hole cut out of the area. Containment uses the even-odd rule, which
handles holes without looking at the flag. Deliberately no java.awt.geom: this module
must stay free of GUI dependencies.- Author:
- Christian Pesch
-
Constructor Summary
ConstructorsConstructorDescriptionPolygon(List<List<NavigationPosition>> rings, List<Boolean> holes, BoundingBox boundingBox) Creates an instance of aPolygonrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theboundingBoxrecord component.booleancontains(NavigationPosition position) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.holes()Returns the value of theholesrecord component.booleanintersects(BoundingBox tile) A corner test alone misses a narrow polygon crossing the tile, a vertex test alone misses a tile fully inside the polygon, so all three cases are checked.static Polygonrings()Returns the value of theringsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
of
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
rings
Returns the value of theringsrecord component.- Returns:
- the value of the
ringsrecord component
-
holes
Returns the value of theholesrecord component.- Returns:
- the value of the
holesrecord component
-
boundingBox
Returns the value of theboundingBoxrecord component.- Returns:
- the value of the
boundingBoxrecord component
-