Class FlatShape
java.lang.Object
org.apache.sis.internal.feature.AbstractGeometry
org.apache.sis.internal.feature.j2d.FlatShape
- All Implemented Interfaces:
Shape
- Direct Known Subclasses:
MultiPolylines
,Polyline
A shape made of straight lines. This shape does not contain any Bézier curve.
Consequently, the flatness factor of path iterator can be ignored.
- Since:
- 1.1
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final IntervalRectangle
Cached values of shape bounds. -
Constructor Summary
ConstructorsConstructorDescriptionFlatShape
(double[] coordinates, int size) Creates a shape with bounds initialized to minimum and maximum coordinates of given array.FlatShape
(IntervalRectangle bounds) Creates a shape with the given bounds. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Tests if the specified point is inside the boundary of the shape.fastClip
(Rectangle2D areaOfInterest) Returns a potentially smaller shape containing all polylines that intersect the given area of interest.final Rectangle
Returns an integer rectangle that completely encloses the shape.final Rectangle2D
Returns a rectangle that completely encloses the shape.final PathIterator
getPathIterator
(AffineTransform at, double flatness) Returns an iterator for the shape outline geometry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.Shape
contains, contains, contains, getPathIterator, intersects, intersects
-
Field Details
-
bounds
Cached values of shape bounds.- See Also:
-
-
Constructor Details
-
FlatShape
FlatShape(IntervalRectangle bounds) Creates a shape with the given bounds. The given argument is stored by reference; it is not cloned.- Parameters:
bounds
- the shape bounds (not cloned).
-
FlatShape
FlatShape(double[] coordinates, int size) Creates a shape with bounds initialized to minimum and maximum coordinates of given array. Thecoordinates
array shall not be empty.- Parameters:
coordinates
- the coordinate values as (x,y) tuples.size
- number of valid value incoordinates
array.
-
-
Method Details
-
getBounds
Returns an integer rectangle that completely encloses the shape. There is no guarantee that the rectangle is the smallest bounding box that encloses the shape. -
getBounds2D
Returns a rectangle that completely encloses the shape. There is no guarantee that the rectangle is the smallest bounding box that encloses the shape.- Specified by:
getBounds2D
in interfaceShape
-
contains
Tests if the specified point is inside the boundary of the shape. This method delegates toShape.contains(double, double)
. -
getPathIterator
Returns an iterator for the shape outline geometry. The flatness factor is ignored on the assumption that this shape does not contain any Bézier curve, as stipulated inFlatShape
class contract.- Specified by:
getPathIterator
in interfaceShape
- Parameters:
at
- an optional transform to apply on coordinate values.flatness
- ignored.- Returns:
- an iterator for the shape outline geometry.
-
fastClip
Returns a potentially smaller shape containing all polylines that intersect the given area of interest. This method performs only a quick check based on bounds intersections. It does not test individual points. The returned shape may still have many points outside the given bounds.- Parameters:
areaOfInterest
- the area of interest. Edges are considered exclusive.- Returns:
- a potentially smaller shape, or
null
if this shape is fully outside the AOI.
-