This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 5e5f58366880601feb49d48018112d897a2be5f2 Author: jsorel <[email protected]> AuthorDate: Thu Sep 10 15:30:15 2026 +0200 feat(Geometry): define all describe parameters on geometry interfaces --- .../main/org/apache/sis/geometries/Curve.java | 24 ++- .../main/org/apache/sis/geometries/Empty.java | 239 +++++++++++++++++++++ .../main/org/apache/sis/geometries/Geometry.java | 13 +- .../apache/sis/geometries/GeometryCollection.java | 15 ++ .../main/org/apache/sis/geometries/Point.java | 65 ++++++ .../main/org/apache/sis/geometries/Primitive.java | 12 ++ .../main/org/apache/sis/geometries/Solid.java | 12 ++ .../main/org/apache/sis/geometries/Surface.java | 10 + .../main/org/apache/sis/geometries/curve/Arc.java | 12 ++ .../apache/sis/geometries/curve/BSplineCurve.java | 11 + .../org/apache/sis/geometries/curve/Bezier.java | 13 ++ .../org/apache/sis/geometries/curve/Circle.java | 10 + .../org/apache/sis/geometries/curve/Clothoid.java | 22 ++ .../org/apache/sis/geometries/curve/Conic.java | 12 ++ .../apache/sis/geometries/curve/CubicSpline.java | 10 + .../apache/sis/geometries/curve/EllipticArc.java | 11 + .../apache/sis/geometries/curve/LinearRing.java | 30 +++ .../apache/sis/geometries/curve/MultiCurve.java | 12 ++ .../sis/geometries/curve/MultiLineString.java | 12 ++ .../sis/geometries/curve/PolynomialSpline.java | 24 +++ .../apache/sis/geometries/curve/ProductCurve.java | 37 ++++ .../org/apache/sis/geometries/curve/Spiral.java | 12 ++ .../internal/shared/DefaultPolyhedron.java | 6 - .../apache/sis/geometries/point/MultiPoint.java | 12 ++ .../apache/sis/geometries/solid/BSolidSpline.java | 12 ++ .../sis/geometries/solid/ParametricCurveSolid.java | 13 ++ .../apache/sis/geometries/solid/Polyhedron.java | 12 ++ .../org/apache/sis/geometries/solid/Sphere.java | 12 ++ .../sis/geometries/surface/BSplineSurface.java | 14 ++ .../sis/geometries/surface/BilinearGrid.java | 13 ++ .../sis/geometries/surface/MultiPolygon.java | 12 ++ .../sis/geometries/surface/MultiSurface.java | 12 ++ .../apache/sis/geometries/surface/NurbSurface.java | 23 ++ .../geometries/surface/ParametricCurveSurface.java | 13 ++ .../org/apache/sis/geometries/surface/Polygon.java | 12 ++ .../sis/geometries/surface/PolyhedralSurface.java | 13 ++ .../org/apache/sis/geometries/surface/TIN.java | 13 ++ .../geometries/surface/TriangulatedSurface.java | 12 ++ 38 files changed, 804 insertions(+), 18 deletions(-) diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Curve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Curve.java index 19d84ffc8d..c120566a77 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Curve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Curve.java @@ -80,6 +80,16 @@ public sealed interface Curve extends Orientable DefaultReversedCurve { + /** + * Returns 1: a curve bounds a length. + * + * @see ISO 19107:2019 - 6.4.4.22 + */ + @Override + default int getTopologicDimension() { + return 1; + } + /** * Points lying on this curve, the first one being the start point and the last one the end point. * @@ -159,6 +169,18 @@ public sealed interface Curve extends Orientable return points.getPosition(0).equals(points.getPosition(size - 1), 0); } + /** + * Returns whether this curve closes on itself, + * which for a curve means that its start point is its end point. + * + * @see ISO 19107:2019 - 6.4.4.14 + */ + @UML(identifier="isCycle", specification=ISO_19107) + @Override + default boolean isCycle() { + return isClosed(); + } + /** * Returns whether this curve is both closed and simple, * in which case it is a valid boundary component of a surface. @@ -176,7 +198,7 @@ public sealed interface Curve extends Orientable */ @UML(identifier="isRing", specification=ISO_19107) default boolean isRing() { - throw new UnsupportedOperationException(); + return isCycle() && isSimple(); } /** diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Empty.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Empty.java index eba8423068..8d6631a3a2 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Empty.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Empty.java @@ -16,9 +16,13 @@ */ package org.apache.sis.geometries; +import javax.measure.quantity.Length; import org.apache.sis.geometries.internal.shared.DefaultEmpty; +import org.apache.sis.measure.Quantities; +import org.apache.sis.measure.Units; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; +import org.opengis.geometry.DirectPosition; /** @@ -77,9 +81,244 @@ public sealed interface Empty extends Geometry return TYPE; } + /** + * Returns −1: the empty set has no dimension. + * + * @see ISO 19107:2019 - 6.4.4.22 + */ @Override default int getTopologicDimension() { return -1; } + /** + * Returns {@code true}: the boundary of the empty set is empty. + * + * @see ISO 19107:2019 - 6.4.4.14 + */ + @UML(identifier="isCycle", specification=ISO_19107) + @Override + default boolean isCycle() { + return true; + } + + /** + * Returns {@code true}: the empty set has no position, therefore no anomalous position. + * + * @see ISO 19107:2019 - 6.4.4.15 + */ + @UML(identifier="isSimple", specification=ISO_19107) + @Override + default boolean isSimple() { + return true; + } + + /** + * Returns {@code true}: the empty set is always a valid geometry. + * + * @see ISO 19107:2019 - 6.4.4.16 + */ + @UML(identifier="isValid", specification=ISO_19107) + @Override + default boolean isValid() { + return true; + } + + /** + * Returns {@code this}: the boundary of the empty set is empty. + * + * @see ISO 19107:2019 - 6.4.4.7 + */ + @UML(identifier="boundary", specification=ISO_19107) + @Override + default Geometry boundary() { + return this; + } + + /** + * Returns {@code this}: the empty set is topologically closed. + * + * @see ISO 19107:2019 - 6.4.4.9 + */ + @UML(identifier="closure", specification=ISO_19107) + @Override + default Geometry getClosure() { + return this; + } + + /** + * Returns {@code this}: the convex hull of the empty set is empty. + * + * @see ISO 19107:2019 - 6.4.4.10 + */ + @UML(identifier="convexHull", specification=ISO_19107) + @Override + default Geometry convexHull() { + return this; + } + + /** + * Returns {@code this}: there is no position to grow a buffer around. + * + * @see ISO 19107:2019 - 6.4.4.24 + */ + @Override + default Geometry buffer(double distance) { + return this; + } + + /** + * Returns {@code this}: there is no position to grow a buffer around. + * + * @see ISO 19107:2019 - 6.4.4.24 + */ + @UML(identifier="buffer", specification=ISO_19107) + @Override + default Geometry buffer(Length radius) { + return this; + } + + /** + * Returns {@code null}: the centroid of the empty set is undefined. + * + * @see ISO 19107:2019 - 6.4.4.8 + */ + @UML(identifier="centroid", specification=ISO_19107) + @Override + default Point getCentroid() { + return null; + } + + /** + * Returns {@code null}: the empty set has no interior position. + * + * @see ISO 19107:2019 - 6.4.4.19 + */ + @UML(identifier="representativePoint", specification=ISO_19107) + @Override + default Point getRepresentativePoint() { + return null; + } + + /** + * Returns an infinite distance: no position of this geometry can come close to another geometry. + * + * @see ISO 19107:2019 - 6.4.4.26 + */ + @UML(identifier="distance", specification=ISO_19107) + @Override + default Length distance(Geometry other) { + return Quantities.create(Double.POSITIVE_INFINITY, Units.METRE); + } + + /** + * Returns {@code this}: {@code ∅ ∩ A = ∅}. + * + * @see ISO 19107:2019 - 6.4.8.4 + */ + @UML(identifier="intersection", specification=ISO_19107) + @Override + default Geometry intersection(Geometry other) { + return this; + } + + /** + * Returns the given geometry: {@code ∅ ∪ A = A}. + * + * @see ISO 19107:2019 - 6.4.8.7 + */ + @UML(identifier="union", specification=ISO_19107) + @Override + default Geometry union(Geometry other) { + return other; + } + + /** + * Returns {@code this}: {@code ∅ − A = ∅}. + * + * @see ISO 19107:2019 - 6.4.8.5 + */ + @UML(identifier="difference", specification=ISO_19107) + @Override + default Geometry difference(Geometry other) { + return this; + } + + /** + * Returns the given geometry: {@code (∅ − A) ∪ (A − ∅) = A}. + * + * @see ISO 19107:2019 - 6.4.8.6 + */ + @UML(identifier="symDifference", specification=ISO_19107) + @Override + default Geometry symDifference(Geometry other) { + return other; + } + + /** + * Returns {@code false}: the empty set contains no position at all. + * + * @see ISO 19107:2019 - 6.4.2 + */ + @UML(identifier="contains", specification=ISO_19107) + @Override + default boolean contains(DirectPosition element) { + return false; + } + + /** + * Returns whether the given geometry is empty: the empty set is a superset of itself only. + * + * @see ISO 19107:2019 - 10.8.6.3.2 + */ + @UML(identifier="contains", specification=ISO_19107) + @Override + default boolean contains(Geometry other) { + return other.isEmpty(); + } + + /** + * Returns {@code true}: the empty set is a subset of every geometry. + * + * @see ISO 19107:2019 - 10.8.6.3.7 + */ + @UML(identifier="within", specification=ISO_19107) + @Override + default boolean within(Geometry other) { + return true; + } + + /** + * Returns whether the given geometry is empty: any two empty geometries are equal. + * + * @see ISO 19107:2019 - 6.4.4.27, 10.8.6.3.1 + */ + @UML(identifier="equals", specification=ISO_19107) + @Override + default boolean equal(Geometry other) { + return other.isEmpty(); + } + + /** + * Returns {@code true}: the empty set has no position in common with any geometry. + * + * @see ISO 19107:2019 - 10.8.6.3.3 + */ + @UML(identifier="disjoint", specification=ISO_19107) + @Override + default boolean disjoint(Geometry other) { + return true; + } + + /** + * Returns {@code false}: the empty set has no position in common with any geometry. + * + * @see ISO 19107:2019 - 10.8.6.3.4 + */ + @UML(identifier="intersects", specification=ISO_19107) + @Override + default boolean intersects(Geometry other) { + return false; + } + } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometry.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometry.java index 98ecb67f16..f5f19cf5a6 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometry.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometry.java @@ -222,17 +222,8 @@ public sealed interface Geometry */ @UML(identifier="topologicalDimension", specification=ISO_19107) default int getTopologicDimension() { - if (this instanceof Empty) { - return -1; - } else if (this instanceof Point) { - return 0; - } else if (this instanceof Curve) { - return 1; - } else if (this instanceof Surface) { - return 2; - } else if (this instanceof Solid) { - return 3; - } + //TODO remove this method default when all classes implement it. + //Empty, Point, Curve, Surface, Solid and GeometryCollection already do. throw new UnsupportedOperationException(); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java index 9876ede51d..1aacaed168 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java @@ -114,6 +114,21 @@ public sealed interface GeometryCollection<T extends Geometry> extends Geometry return getNumGeometries() == 0; } + /** + * Returns the largest topological dimension among the elements of this collection, + * or −1 if this collection is empty. + * + * @see ISO 19107:2019 - 6.4.4.22 + */ + @Override + default int getTopologicDimension() { + int dimension = -1; + for (int i = 0, n = getNumGeometries(); i < n; i++) { + dimension = Math.max(dimension, getGeometryN(i).getTopologicDimension()); + } + return dimension; + } + /** * Returns the number of geometries in this GeometryCollection. * It can only change by adding or removing elements. diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Point.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Point.java index 81f077e7b2..4026b590c5 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Point.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Point.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries; +import java.util.List; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.internal.shared.DefaultPoint; @@ -160,6 +161,70 @@ public sealed interface Point extends Primitive return TYPE; } + /** + * Returns 0: a point is a single location. + * + * @see ISO 19107:2019 - 6.4.4.22 + */ + @Override + default int getTopologicDimension() { + return 0; + } + + /** + * Returns an empty list: a point cannot be decomposed. + * + * @see ISO 19107:2019 - 6.4.11.2 + */ + @Override + default List<Primitive> getSegments() { + return List.of(); + } + + /** + * Returns {@code true}: the boundary of a point is empty, therefore a point closes on itself. + * + * @see ISO 19107:2019 - 6.4.4.14 + */ + @UML(identifier="isCycle", specification=ISO_19107) + @Override + default boolean isCycle() { + return true; + } + + /** + * Returns {@code true}: a single location can neither self-intersect nor self-tangent. + * + * @see ISO 19107:2019 - 6.4.4.15 + */ + @UML(identifier="isSimple", specification=ISO_19107) + @Override + default boolean isSimple() { + return true; + } + + /** + * Returns {@code this}: a point is its own centroid. + * + * @see ISO 19107:2019 - 6.4.4.8 + */ + @UML(identifier="centroid", specification=ISO_19107) + @Override + default Point getCentroid() { + return this; + } + + /** + * Returns {@code this}: a point is interior to itself. + * + * @see ISO 19107:2019 - 6.4.4.19 + */ + @UML(identifier="representativePoint", specification=ISO_19107) + @Override + default Point getRepresentativePoint() { + return this; + } + @Override default Envelope getEnvelope() { final Tuple<?> first = getPosition(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Primitive.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Primitive.java index f1a202e857..750cbde8d5 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Primitive.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Primitive.java @@ -53,6 +53,18 @@ public sealed interface Primitive extends Geometry Solid { + /** + * Returns {@link BoundaryType#METRIC}: a primitive is not an aggregate, + * therefore its boundary is unambiguous and is the metric one. + * + * @see ISO 19107:2019 - 6.4.3, 10.8.3 + */ + @UML(identifier="boundaryType", specification=ISO_19107) + @Override + default BoundaryType getBoundaryType() { + return BoundaryType.METRIC; + } + /** * Smaller primitives of the same dimension contained in this primitive, * each of them defining a portion of it. diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Solid.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Solid.java index 8b200d8fbd..16c87596e9 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Solid.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Solid.java @@ -71,6 +71,18 @@ public sealed interface Solid extends Primitive return 3; } + /** + * Returns {@code false}: a solid of finite size in a 3-dimensional coordinate space + * always has a boundary, therefore it never closes on itself. + * + * @see ISO 19107:2019 - 6.4.4.14 + */ + @UML(identifier="isCycle", specification=ISO_19107) + @Override + default boolean isCycle() { + return false; + } + /** * Shells bounding this solid, each of them a closed surface without boundary. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Surface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Surface.java index 110175af39..d725c2ca94 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Surface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Surface.java @@ -74,6 +74,16 @@ public sealed interface Surface extends Orientable DefaultReversedSurface { + /** + * Returns 2: a surface bounds an area. + * + * @see ISO 19107:2019 - 6.4.4.22 + */ + @Override + default int getTopologicDimension() { + return 2; + } + /** * The area of this Surface, as measured in the spatial reference system of this Surface. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Arc.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Arc.java index f5f56ba827..c87fe99bb4 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Arc.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Arc.java @@ -17,6 +17,7 @@ package org.apache.sis.geometries.curve; import java.util.List; +import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.DataPoints; import org.apache.sis.maths.Array; import org.apache.sis.maths.Vector; @@ -37,6 +38,17 @@ public sealed interface Arc extends Conic permits Circle { + /** + * Returns {@link CurveInterpolation#CIRCULAR}. + * + * @see ISO 19107:2019 - 7.9.2 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.CIRCULAR; + } + /** * Number of circular arcs in this chain. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/BSplineCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/BSplineCurve.java index 85e5026a35..00e3eb48b3 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/BSplineCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/BSplineCurve.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.curve; +import org.apache.sis.geometries.CurveInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -48,4 +49,14 @@ public sealed interface BSplineCurve extends SplineCurve NurbCurve { + /** + * Returns {@link CurveInterpolation#BSPLINE}. + * + * @see ISO 19107:2019 - 7.13.8 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.BSPLINE; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Bezier.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Bezier.java index 56d564b062..3b1f487336 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Bezier.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Bezier.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.curve; +import org.apache.sis.geometries.CurveInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -48,4 +49,16 @@ import org.opengis.annotation.UML; @UML(identifier="Bezier", specification=ISO_19107) public non-sealed interface Bezier extends PolynomialSpline, BSplineCurve { + /** + * Returns {@link CurveInterpolation#BEZIER_SPLINE}. + * This value takes precedence over the interpolations declared by the two parent interfaces, + * a Bézier curve being at the same time a polynomial spline and a b-spline. + * + * @see ISO 19107:2019 - 7.13.7 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.BEZIER_SPLINE; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Circle.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Circle.java index 296d73e2b4..2b35034f6d 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Circle.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Circle.java @@ -43,4 +43,14 @@ import org.opengis.annotation.UML; @UML(identifier="Circle", specification=ISO_19107) public non-sealed interface Circle extends Arc { + /** + * Returns {@code true}: a circle is a complete curve closing on itself. + * + * @see ISO 19107:2019 - 7.9.4 + */ + @UML(identifier="isCycle", specification=ISO_19107) + @Override + default boolean isCycle() { + return true; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Clothoid.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Clothoid.java index 4e9a13bdee..12be0b05e7 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Clothoid.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Clothoid.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.curve; +import org.apache.sis.geometries.CurveInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -47,4 +48,25 @@ import org.opengis.annotation.UML; @UML(identifier="Clothoid", specification=ISO_19107) public non-sealed interface Clothoid extends Spiral { + /** + * Returns {@link CurveInterpolation#CLOTHOID}. + * + * @see ISO 19107:2019 - 7.11.3 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.CLOTHOID; + } + + /** + * Returns {@code null}: a clothoid is a planar spiral. + * + * @see ISO 19107:2019 - 7.11.3 + */ + @UML(identifier="torsion", specification=ISO_19107) + @Override + default RealFunction getTorsion() { + return null; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Conic.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Conic.java index d1f3200cdb..e8d7ec1461 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Conic.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Conic.java @@ -17,6 +17,7 @@ package org.apache.sis.geometries.curve; import org.apache.sis.geometries.Curve; +import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.DataPoints; import org.apache.sis.maths.Array; import static org.opengis.annotation.Specification.ISO_19107; @@ -51,6 +52,17 @@ public sealed interface Conic extends Curve EllipticArc { + /** + * Returns {@link CurveInterpolation#CONIC}. + * + * @see ISO 19107:2019 - 7.9.5 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.CONIC; + } + /** * Points lying on this conic, five of them being needed to determine each arc. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CubicSpline.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CubicSpline.java index 3c33255a53..e68a005f5d 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CubicSpline.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CubicSpline.java @@ -42,4 +42,14 @@ import org.opengis.annotation.UML; @UML(identifier="CubicSpline", specification=ISO_19107) public non-sealed interface CubicSpline extends PolynomialSpline { + /** + * Returns 3: a cubic spline is defined by polynomials of degree 3. + * + * @see ISO 19107:2019 - 7.13.6 + */ + @UML(identifier="degree", specification=ISO_19107) + @Override + default int getDegree() { + return 3; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/EllipticArc.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/EllipticArc.java index 45d58f8910..5e5ad6116c 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/EllipticArc.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/EllipticArc.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.curve; +import org.apache.sis.geometries.CurveInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -38,4 +39,14 @@ import org.opengis.annotation.UML; @UML(identifier="EllipticArc", specification=ISO_19107) public non-sealed interface EllipticArc extends Conic { + /** + * Returns {@link CurveInterpolation#ELLIPTICAL}. + * + * @see ISO 19107:2019 - 7.9.6 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.ELLIPTICAL; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LinearRing.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LinearRing.java index 7677dd0446..a49ed90fc0 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LinearRing.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LinearRing.java @@ -38,6 +38,36 @@ public sealed interface LinearRing extends LineString return TYPE; } + /** + * Returns {@code true}: a linear ring is closed by definition. + * + * @see OGC Simple Feature Access 1.2.1 - 6.1.6.2 + */ + @Override + default boolean isClosed() { + return true; + } + + /** + * Returns {@code true}: a linear ring is simple by definition. + * + * @see ISO 19107:2019 - 6.4.4.15 + */ + @Override + default boolean isSimple() { + return true; + } + + /** + * Returns {@code true}: a linear ring is both closed and simple, therefore a ring. + * + * @see ISO 19107:2019 - 6.4.18.8 + */ + @Override + default boolean isRing() { + return true; + } + @Override default String asText() { final StringBuilder sb = new StringBuilder("LINEARRING ("); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiCurve.java index 39883fc653..98edf739d1 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiCurve.java @@ -16,9 +16,11 @@ */ package org.apache.sis.geometries.curve; +import java.util.Set; import javax.measure.quantity.Length; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.GeometryCollection; +import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.internal.shared.DefaultMultiCurve; import org.apache.sis.measure.Quantities; import org.apache.sis.measure.Units; @@ -57,6 +59,16 @@ public sealed interface MultiCurve<T extends Curve> extends GeometryCollection<T return TYPE; } + /** + * Returns {@link GeometryType#CURVE}: all the elements of this collection are curves. + * + * @see ISO 19107:2019 - 6.4.31.2 + */ + @Override + default Set<GeometryType> getElementType() { + return Set.of(GeometryType.CURVE); + } + /** * Returns TRUE if this MultiCurve is closed [StartPoint () = EndPoint () for each Curve in this MultiCurve]. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiLineString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiLineString.java index de80212aa2..ba7990bbfe 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiLineString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/MultiLineString.java @@ -16,7 +16,9 @@ */ package org.apache.sis.geometries.curve; +import java.util.Set; import org.apache.sis.geometries.DataPoints; +import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.DefaultMultiLineString; import org.apache.sis.geometries.mesh.MeshPrimitive; @@ -40,6 +42,16 @@ public sealed interface MultiLineString extends MultiCurve<LineString> return TYPE; } + /** + * Returns {@link GeometryType#LINE}: all the elements of this collection are line strings. + * + * @see ISO 19107:2019 - 6.4.31.2 + */ + @Override + default Set<GeometryType> getElementType() { + return Set.of(GeometryType.LINE); + } + @Override default String asText() { final StringBuilder sb = new StringBuilder("MULTILINESTRING ("); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialSpline.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialSpline.java index b7dfbe0134..95d5cd090a 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialSpline.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialSpline.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.curve; +import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.maths.Vector; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -48,6 +49,29 @@ public sealed interface PolynomialSpline extends SplineCurve Bezier { + /** + * Returns {@link CurveInterpolation#POLYNOMIAL_SPLINE}. + * + * @see ISO 19107:2019 - 7.13.5 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.POLYNOMIAL_SPLINE; + } + + /** + * Returns {@code false}: coordinate offsets being fitted separately, + * an interpolant spline never uses homogeneous coordinates. + * + * @see ISO 19107:2019 - 7.13.5 + */ + @UML(identifier="isRational", specification=ISO_19107) + @Override + default boolean isRational() { + return false; + } + /** * Derivative imposed at the start point of this spline. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ProductCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ProductCurve.java index f8c61c16a7..3ad62d5fe8 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ProductCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ProductCurve.java @@ -17,8 +17,11 @@ package org.apache.sis.geometries.curve; import java.util.List; +import java.util.Set; import org.apache.sis.geometries.Curve; +import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.GeometryCollection; +import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.cs.Projection; import org.apache.sis.measure.Range; import static org.opengis.annotation.Specification.ISO_19107; @@ -51,6 +54,40 @@ import org.opengis.annotation.UML; @UML(identifier="ProductCurve", specification=ISO_19107) public non-sealed interface ProductCurve extends Curve, GeometryCollection<Curve> { + /** + * Returns {@link CurveInterpolation#PRODUCT_CURVE}: the interpolation of a product curve is + * not a single one, it is whatever each projection declares. + * + * @see ISO 19107:2019 - 6.4.22 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.PRODUCT_CURVE; + } + + /** + * Returns 1: a product curve is a curve, not an aggregate of geometries of various dimensions. + * This value resolves the ambiguity between {@link Curve} and {@link GeometryCollection}. + * + * @see ISO 19107:2019 - 6.4.4.22 + */ + @Override + default int getTopologicDimension() { + return 1; + } + + /** + * Returns {@link GeometryType#CURVE}: all the elements of a product curve are curves. + * + * @see ISO 19107:2019 - 6.4.31.2 + */ + @UML(identifier="elementType", specification=ISO_19107) + @Override + default Set<GeometryType> getElementType() { + return Set.of(GeometryType.CURVE); + } + /** * Interval of the construction parameter shared by this curve and its projections, * i.e. the interval between the first and the last {@linkplain #getKnots() knot}. diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Spiral.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Spiral.java index d77ec0fc45..9981805242 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Spiral.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Spiral.java @@ -18,6 +18,7 @@ package org.apache.sis.geometries.curve; import java.util.List; import org.apache.sis.geometries.Curve; +import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.maths.Vector; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -49,6 +50,17 @@ public sealed interface Spiral extends Curve permits Clothoid { + /** + * Returns {@link CurveInterpolation#SPIRAL}. + * + * @see ISO 19107:2019 - 7.11.2 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default CurveInterpolation getInterpolation() { + return CurveInterpolation.SPIRAL; + } + /** * Curvature of this spiral as a function of arc length. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPolyhedron.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPolyhedron.java index 90bb2bd4b8..14cc4bb18d 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPolyhedron.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPolyhedron.java @@ -23,7 +23,6 @@ import javax.measure.quantity.Area; import javax.measure.quantity.Volume; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.Geometry; -import org.apache.sis.geometries.SolidInterpolation; import org.apache.sis.geometries.solid.Polyhedron; import org.apache.sis.geometries.surface.MultiPolygon; import org.opengis.geometry.DirectPosition; @@ -125,11 +124,6 @@ public non-sealed class DefaultPolyhedron extends AbstractGeometry implements Po throw new UnsupportedOperationException("Not supported yet."); } - @Override - public SolidInterpolation getInterpolation() { - throw new UnsupportedOperationException("Not supported yet."); - } - @Override public List<double[]> getKnots() { throw new UnsupportedOperationException("Not supported yet."); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/point/MultiPoint.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/point/MultiPoint.java index 3318bc56a9..764c6095b4 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/point/MultiPoint.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/point/MultiPoint.java @@ -18,7 +18,9 @@ package org.apache.sis.geometries.point; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.DataPoints; +import java.util.Set; import org.apache.sis.geometries.GeometryCollection; +import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.DefaultMultiPoint; @@ -51,6 +53,16 @@ public sealed interface MultiPoint<T extends Point> extends GeometryCollection<T return TYPE; } + /** + * Returns {@link GeometryType#POINT}: all the elements of this collection are points. + * + * @see ISO 19107:2019 - 6.4.31.2 + */ + @Override + default Set<GeometryType> getElementType() { + return Set.of(GeometryType.POINT); + } + /** * View this multipoint as a point sequence */ diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/BSolidSpline.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/BSolidSpline.java index 761562034a..bf3a72c6af 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/BSolidSpline.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/BSolidSpline.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.solid; +import org.apache.sis.geometries.SolidInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -39,4 +40,15 @@ import org.opengis.annotation.UML; @UML(identifier="BSolidSpline", specification=ISO_19107) public non-sealed interface BSolidSpline extends ParametricCurveSolid { + /** + * Returns {@link SolidInterpolation#BSPLINE}: the three families of curves defining the + * interior of this solid are b-splines. + * + * @see ISO 19107:2019 - 9.3.2 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default SolidInterpolation getInterpolation() { + return SolidInterpolation.BSPLINE; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/ParametricCurveSolid.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/ParametricCurveSolid.java index 8c872c44eb..2feff2cc92 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/ParametricCurveSolid.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/ParametricCurveSolid.java @@ -21,6 +21,7 @@ import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Solid; +import org.apache.sis.geometries.SolidInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.opengis.geometry.DirectPosition; @@ -48,6 +49,18 @@ public sealed interface ParametricCurveSolid extends Solid permits BSolidSpline { + /** + * Returns {@link SolidInterpolation#PARAMETRIC_CURVE}: this solid is defined by families of + * curves over a 3-dimensional parameter space. + * + * @see ISO 19107:2019 - 9.3.1 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default SolidInterpolation getInterpolation() { + return SolidInterpolation.PARAMETRIC_CURVE; + } + /** * Type of the curves used to traverse this solid horizontally. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Polyhedron.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Polyhedron.java index d1d5711e69..7f46aec9c4 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Polyhedron.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Polyhedron.java @@ -18,6 +18,7 @@ package org.apache.sis.geometries.solid; import java.util.List; import org.apache.sis.geometries.AttributesType; +import org.apache.sis.geometries.SolidInterpolation; import org.apache.sis.geometries.Solid; import org.apache.sis.geometries.internal.shared.DefaultPolyhedron; import org.apache.sis.geometries.solid.polyhedron.AbstractPolyhedron; @@ -55,6 +56,17 @@ public sealed interface Polyhedron extends Solid return getExteriorShell().getAttributesType(); } + /** + * Returns {@link SolidInterpolation#NONE}: a polyhedron is defined by its boundary shells, + * which leaves its interior unspecified. + * + * @see ISO 19107:2019 - 6.4.30 + */ + @Override + default SolidInterpolation getInterpolation() { + return SolidInterpolation.NONE; + } + /** * Returns the exterior shell of this polyhedron. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Sphere.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Sphere.java index 586f283da7..5cb802e25a 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Sphere.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Sphere.java @@ -24,6 +24,7 @@ import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.Geometries; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.surface.ParametricCurveSurface; import org.apache.sis.maths.Tuple; @@ -136,6 +137,17 @@ public final class Sphere extends AbstractGeometry implements ParametricCurveSur return AttributesType.EMPTY; } + /** + * Returns {@link SurfaceInterpolation#SPHERICAL}: this surface is a section of a sphere. + * + * @see ISO 19107:2019 - 8.5.2 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + public List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.SPHERICAL); + } + /** * @return radius of the sphere. */ diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BSplineSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BSplineSurface.java index 2fbe1abd82..8dbbe73c00 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BSplineSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BSplineSurface.java @@ -19,6 +19,7 @@ package org.apache.sis.geometries.surface; import java.util.List; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.curve.KnotType; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -156,4 +157,17 @@ public sealed interface BSplineSurface extends ParametricCurveSurface default GeometryType getVerticalCurveType() { return GeometryType.SPLINECURVE; } + + /** + * Returns {@link SurfaceInterpolation#POLYNOMIAL_SPLINE} if this surface + * {@linkplain #isPolynomial() is polynomial}, {@link SurfaceInterpolation#NURBS} otherwise. + * + * @see ISO 19107:2019 - 8.7.2 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(isPolynomial() ? SurfaceInterpolation.POLYNOMIAL_SPLINE + : SurfaceInterpolation.NURBS); + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BilinearGrid.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BilinearGrid.java index 883efca6ec..fda24ad98b 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BilinearGrid.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/BilinearGrid.java @@ -16,6 +16,8 @@ */ package org.apache.sis.geometries.surface; +import java.util.List; +import org.apache.sis.geometries.SurfaceInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -49,4 +51,15 @@ import org.opengis.annotation.UML; @UML(identifier="BilinearGrid", specification=ISO_19107) public non-sealed interface BilinearGrid extends ParametricCurveSurface { + /** + * Returns {@link SurfaceInterpolation#LINEAR}: each cell of the grid is interpolated + * bilinearly over the unit square of the parameter space. + * + * @see ISO 19107:2019 - 8.3.4 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.LINEAR); + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiPolygon.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiPolygon.java index a295a895d5..7008210971 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiPolygon.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiPolygon.java @@ -16,6 +16,8 @@ */ package org.apache.sis.geometries.surface; +import java.util.Set; +import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.DefaultMultiPolygon; @@ -46,6 +48,16 @@ public sealed interface MultiPolygon extends MultiSurface<Polygon> return TYPE; } + /** + * Returns {@link GeometryType#POLYGON}: all the elements of this collection are polygons. + * + * @see ISO 19107:2019 - 6.4.31.2 + */ + @Override + default Set<GeometryType> getElementType() { + return Set.of(GeometryType.POLYGON); + } + @Override default String asText() { final StringBuilder sb = new StringBuilder("MULTIPOLYGON ("); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiSurface.java index 4563f9bb21..10dfba4767 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/MultiSurface.java @@ -16,8 +16,10 @@ */ package org.apache.sis.geometries.surface; +import java.util.Set; import javax.measure.quantity.Area; import org.apache.sis.geometries.GeometryCollection; +import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.internal.shared.DefaultMultiSurface; @@ -54,6 +56,16 @@ public sealed interface MultiSurface<T extends Surface> extends GeometryCollecti return TYPE; } + /** + * Returns {@link GeometryType#SURFACE}: all the elements of this collection are surfaces. + * + * @see ISO 19107:2019 - 6.4.31.2 + */ + @Override + default Set<GeometryType> getElementType() { + return Set.of(GeometryType.SURFACE); + } + /** * The area of this MultiSurface, as measured in the spatial reference system of this MultiSurface. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/NurbSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/NurbSurface.java index fad2377b05..af916aca67 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/NurbSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/NurbSurface.java @@ -16,6 +16,8 @@ */ package org.apache.sis.geometries.surface; +import java.util.List; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.internal.shared.DefaultNurbSurface; /** @@ -35,4 +37,25 @@ public sealed interface NurbSurface extends BSplineSurface return TYPE; } + /** + * Returns {@code false}: a NURBS is expressed in homogeneous coordinates, + * therefore it is rational and not polynomial. + * + * @see ISO 19107:2019 - 8.7.2 + */ + @Override + default boolean isPolynomial() { + return false; + } + + /** + * Returns {@link SurfaceInterpolation#NURBS}. + * + * @see ISO 19107:2019 - 6.4.27 + */ + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.NURBS); + } + } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/ParametricCurveSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/ParametricCurveSurface.java index fc4ed3e4ff..405aaddb44 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/ParametricCurveSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/ParametricCurveSurface.java @@ -21,6 +21,7 @@ import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Surface; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.solid.Sphere; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -66,6 +67,18 @@ public sealed interface ParametricCurveSurface extends Surface, ReferenceSystem Sphere { + /** + * Returns {@link SurfaceInterpolation#PARAMETRIC_CURVE}: this surface is defined by families + * of curves over a 2-dimensional parameter space. + * + * @see ISO 19107:2019 - 8.3.1 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.PARAMETRIC_CURVE); + } + /** * Number of rows in the parameter grid, therefore the number of * {@linkplain #getHorizontalCurve(double) horizontal} section curves. diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Polygon.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Polygon.java index 3c5ec90384..af99ba0fb9 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Polygon.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Polygon.java @@ -19,6 +19,7 @@ package org.apache.sis.geometries.surface; import java.util.List; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Surface; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.curve.LinearRing; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.DefaultPolygon; @@ -87,6 +88,17 @@ public sealed interface Polygon extends Surface return getExteriorRing().getAttributesType(); } + /** + * Returns {@link SurfaceInterpolation#PLANAR}: a polygon and its boundary lie in a single plane. + * + * @see ISO 19107:2019 - 8.1.2 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.PLANAR); + } + /** * Rings bounding the holes of this polygon, each of them oriented clockwise * when viewed from the <cite>top</cite> of this polygon. diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/PolyhedralSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/PolyhedralSurface.java index 6c1110c07d..cdb4d7d99e 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/PolyhedralSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/PolyhedralSurface.java @@ -16,8 +16,10 @@ */ package org.apache.sis.geometries.surface; +import java.util.List; import javax.measure.quantity.Area; import org.apache.sis.geometries.Surface; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.internal.shared.DefaultPolyhedralSurface; import org.apache.sis.measure.Quantities; import org.apache.sis.measure.Units; @@ -83,6 +85,17 @@ public sealed interface PolyhedralSurface<T extends Polygon> extends /*GeometryC // @Override // public List<Primitive> getSegments(); + /** + * Returns {@link SurfaceInterpolation#PLANAR}: every patch of this surface is a planar polygon. + * + * @see ISO 19107:2019 - 8.1.4 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.PLANAR); + } + /** * Returns the number of including polygons * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TIN.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TIN.java index 3960f8c540..837b8c47bc 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TIN.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TIN.java @@ -16,7 +16,9 @@ */ package org.apache.sis.geometries.surface; +import java.util.List; import org.apache.sis.geometries.DataPoints; +import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.DefaultTriangulatedSurface; import org.apache.sis.geometries.mesh.MeshPrimitive; @@ -43,6 +45,17 @@ public sealed interface TIN extends TriangulatedSurface<Triangle> return TYPE; } + /** + * Returns {@link SurfaceInterpolation#TIN}: the triangulation of this surface is derived + * from its own data points. + * + * @see ISO 19107:2019 - 6.4.27 + */ + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.TIN); + } + /** * Produce a Well Known Text representation of this TIN. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TriangulatedSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TriangulatedSurface.java index 7105d449e1..e87b606148 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TriangulatedSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/TriangulatedSurface.java @@ -16,6 +16,8 @@ */ package org.apache.sis.geometries.surface; +import java.util.List; +import org.apache.sis.geometries.SurfaceInterpolation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -43,4 +45,14 @@ public sealed interface TriangulatedSurface<T extends Polygon> extends Polyhedra permits TIN { + /** + * Returns {@link SurfaceInterpolation#TRIANGULAR}: the patches of this surface are triangles. + * + * @see ISO 19107:2019 - 8.1.8 + */ + @UML(identifier="interpolation", specification=ISO_19107) + @Override + default List<SurfaceInterpolation> getInterpolation() { + return List.of(SurfaceInterpolation.TRIANGULAR); + } }
