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 2a9971a9daa304dd1ce4d1e0e6441c4c9befacdb Author: jsorel <[email protected]> AuthorDate: Fri Nov 20 11:12:41 2026 +0100 feat(Geometry): add Representation property on Geometry --- .../main/org/apache/sis/geometries/BBox.java | 8 +++ .../main/org/apache/sis/geometries/Empty.java | 8 +++ .../main/org/apache/sis/geometries/Geometry.java | 14 +++++ .../apache/sis/geometries/GeometryCollection.java | 8 +++ .../main/org/apache/sis/geometries/HyperPlane.java | 8 +++ .../main/org/apache/sis/geometries/OBBox.java | 8 +++ .../main/org/apache/sis/geometries/Plane.java | 8 +++ .../main/org/apache/sis/geometries/Point.java | 8 +++ .../main/org/apache/sis/geometries/Prism.java | 8 +++ .../org/apache/sis/geometries/Representation.java | 62 +++++++++++++++++++++ .../geometries/csg/ConstructiveSolidGeometry.java | 9 +++ .../apache/sis/geometries/curve/ArcByBulge.java | 9 +++ .../sis/geometries/curve/ArcByCenterPoint.java | 9 +++ .../sis/geometries/curve/CircularString.java | 9 +++ .../org/apache/sis/geometries/curve/Clothoid.java | 9 +++ .../apache/sis/geometries/curve/CompoundCurve.java | 13 +++++ .../org/apache/sis/geometries/curve/Conic.java | 9 +++ .../apache/sis/geometries/curve/FunctionCurve.java | 9 +++ .../org/apache/sis/geometries/curve/Geodesic.java | 9 +++ .../main/org/apache/sis/geometries/curve/Line.java | 9 +++ .../apache/sis/geometries/curve/LineString.java | 9 +++ .../apache/sis/geometries/curve/OffsetCurve.java | 9 +++ .../sis/geometries/curve/PolynomialCurve.java | 9 +++ .../main/org/apache/sis/geometries/curve/Ray.java | 9 +++ .../org/apache/sis/geometries/curve/Rhumb.java | 9 +++ .../org/apache/sis/geometries/curve/Spiral.java | 9 +++ .../internal/shared/DefaultReversedCurve.java | 6 ++ .../internal/shared/DefaultReversedSurface.java | 6 ++ .../geometries/internal/shared/DefaultSolid.java | 10 ++++ .../apache/sis/geometries/mesh/MeshPrimitive.java | 65 ++++++++++++++++++++++ .../org/apache/sis/geometries/solid/Frustrum.java | 9 +++ .../sis/geometries/solid/ParametricCurveSolid.java | 9 +++ .../apache/sis/geometries/solid/Polyhedron.java | 9 +++ .../org/apache/sis/geometries/surface/Capsule.java | 9 +++ .../sis/geometries/surface/CurvePolygon.java | 15 +++++ .../apache/sis/geometries/surface/Cylinder.java | 9 +++ .../geometries/surface/ParametricCurveSurface.java | 9 +++ .../org/apache/sis/geometries/surface/Polygon.java | 9 +++ .../sis/geometries/surface/PolyhedralSurface.java | 9 +++ .../geometries/surface/TriangulatedSurface.java | 9 +++ 40 files changed, 471 insertions(+) diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/BBox.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/BBox.java index e967f5bd3b..6931866991 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/BBox.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/BBox.java @@ -162,6 +162,14 @@ public final class BBox extends GeneralEnvelope implements Geometry { return isEmpty() ? -1 : getDimension(); } + /** + * @return a BBOX is ANALYTIC + */ + @Override + public Representation getRepresentation() { + return Representation.ANALYTIC; + } + /** * {@inheritDoc } */ 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 2dc82a4d0a..a7dd38eba4 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 @@ -78,6 +78,14 @@ public sealed interface Empty extends Geometry return GeometryType.EMPTY; } + /** + * @return an Empty geometry is EMPTY + */ + @Override + default Representation getRepresentation() { + return Representation.EMPTY; + } + /** * Returns −1: the empty set has no dimension. * 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 b90ce9e620..756a9d8bd6 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 @@ -268,6 +268,20 @@ public sealed interface Geometry @UML(identifier="topologicalDimension", specification=ISO_19107) int getTopologicDimension(); + /** + * Get the geometric representation. + * for collections it is the element with the most abstract representation. + * + * <p> + * Relation to ISO-19107 :<br> + * ISO-19107 does not have this concept for a simple reason, it does not handle the case of geometries + * holding attributes. + * </ul> + * + * @return geometric representation + */ + Representation getRepresentation(); + /** * Rule used to compute the {@linkplain #getBoundary() boundary} of this geometry * in the ambiguous cases raised by aggregates. 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 49a0eb34f0..68a82e90cf 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 @@ -142,6 +142,14 @@ public sealed interface GeometryCollection<T extends Geometry> extends Geometry, @UML(identifier="elementType", specification=ISO_19107) GeometryType getElementType(); + /** + * @return the most abstract representation of all it's elements + */ + @Override + default Representation getRepresentation() { + return Representation.mostAbstract(StreamSupport.stream(spliterator(), false).map(Geometry::getRepresentation)); + } + /** * Returns whether this collection has no element. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/HyperPlane.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/HyperPlane.java index f982591cd0..d0dfac5ec4 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/HyperPlane.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/HyperPlane.java @@ -84,6 +84,14 @@ public final class HyperPlane extends AbstractGeometry{ return getDimension(); } + /** + * @return an Hyperplane is ANALYTIC + */ + @Override + public Representation getRepresentation() { + return Representation.ANALYTIC; + } + public DataPoints getDataPoints() { return points; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java index 6f992f959e..92b15eb47e 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java @@ -71,6 +71,14 @@ public final class OBBox extends AbstractGeometry { return isEmpty() ? -1 : getDimension(); } + /** + * @return an OBBOX is ANALYTIC + */ + @Override + public Representation getRepresentation() { + return Representation.ANALYTIC; + } + @Override public boolean isEmpty() { return false; diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Plane.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Plane.java index dfa2c590ee..32ef306ae5 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Plane.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Plane.java @@ -96,6 +96,14 @@ public final class Plane extends AbstractGeometry{ return getDimension(); } + /** + * @return an Plane is ANALYTIC + */ + @Override + public Representation getRepresentation() { + return Representation.ANALYTIC; + } + public DataPoints getDataPoints() { return points; } 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 4581376796..93c213bf9a 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 @@ -178,6 +178,14 @@ public sealed interface Point extends Primitive return 0; } + /** + * @return a Point is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } + /** * Returns an empty list: a point cannot be decomposed. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Prism.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Prism.java index 0b0779d589..8d8879c1bf 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Prism.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Prism.java @@ -37,6 +37,14 @@ public sealed interface Prism extends Geometry return GeometryType.PRISM; } + /** + * @return a Prism is ANALYTIC + */ + @Override + default Representation getRepresentation() { + return Representation.ANALYTIC; + } + @Override default DataPointsType getDataPointsType() { return getBase().getDataPointsType(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Representation.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Representation.java new file mode 100644 index 0000000000..020e0e11af --- /dev/null +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Representation.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.geometries; + +import java.util.stream.Stream; + +/** + * A geometry can be represented by several forms. + * A representation can be viewed a geometric abstraction level. + * + * Each representation gain or loss some capabilities. + * It is possible to downgrade a Geometry representation from one type to another using the methods : + * parametrize, discretize and tesselate. + * + * For example : a Sphere. + * A sphere is an analytic geometry with a center and a radius, it is an exact geometric definition but it can not hold attributes on it's surface. + * The sphere can be parametrize in a number of Nurb surfaces without lossing exactness, but also gaining attributes on it's surface. + * It can then be discretize to a polyhedron, lossing in surface precision but having attributes attached to exact vertices. + * And it can be tesselated to triangles for GPU processing. + * + * @author Johann Sorel (Geomatys) + */ +public enum Representation { + EMPTY, + ANALYTIC, + PARAMETRIC, + DISCRETE, + TESSELATED; + + /** + * @return the most abstract representation not empty + */ + public static Representation mostAbstract(Representation r1, Representation r2) { + final int ordinal1 = r1.ordinal(); + if (ordinal1 == 0) return r2; + final int ordinal2 = r2.ordinal(); + if (ordinal2 == 0) return r1; + return ordinal1 < ordinal2 ? r1 : r2; + } + + /** + * @return the most abstract representation + * returns EMPTY is stream is empty or contains only empty elements + */ + public static Representation mostAbstract(Stream<Representation> stream) { + return stream.reduce(Representation::mostAbstract).orElse(EMPTY); + } +} diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/csg/ConstructiveSolidGeometry.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/csg/ConstructiveSolidGeometry.java index 4863aea5de..61aae1620d 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/csg/ConstructiveSolidGeometry.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/csg/ConstructiveSolidGeometry.java @@ -22,6 +22,7 @@ import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.EmptyDataPoints; @@ -55,6 +56,14 @@ public final class ConstructiveSolidGeometry extends AbstractGeometry { throw new UnsupportedOperationException("Not supported yet."); } + /** + * @return a CSG is ANALYTIC + */ + @Override + public Representation getRepresentation() { + return Representation.ANALYTIC; + } + @Override public Envelope getEnvelope() { throw new UnsupportedOperationException("Not supported yet."); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByBulge.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByBulge.java index ad324f0e6b..40cfe186be 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByBulge.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByBulge.java @@ -22,6 +22,7 @@ import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.DefaultArcByBulge; import org.apache.sis.maths.Array; import org.apache.sis.maths.Vector; @@ -52,6 +53,14 @@ public sealed interface ArcByBulge extends Curve return GeometryType.ARCBYBULGE; } + /** + * @return an ArcByBulge curve is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns the two end points of this arc: its start point followed by its end point. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByCenterPoint.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByCenterPoint.java index 4815ccbda0..caa6d5ec22 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByCenterPoint.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/ArcByCenterPoint.java @@ -22,6 +22,7 @@ import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.internal.shared.DefaultArcByCenterPoint; @@ -63,6 +64,14 @@ public sealed interface ArcByCenterPoint extends Curve return GeometryType.ARCBYCENTERPOINT; } + /** + * @return an ArcByCenter curve is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns the centre of the circle this arc is a part of. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CircularString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CircularString.java index e652cf1573..ab6b5917ed 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CircularString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CircularString.java @@ -22,6 +22,7 @@ import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.DefaultCircularString; import org.apache.sis.maths.Array; @@ -47,6 +48,14 @@ public sealed interface CircularString extends Curve return GeometryType.CIRCULARSTRING; } + /** + * @return a CircularString is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns the number of arcs this circular string is made of. */ 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 f8929f9329..90da8d8c6f 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 @@ -20,6 +20,7 @@ import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.DefaultClothoid; @@ -61,6 +62,14 @@ public sealed interface Clothoid extends Spiral return GeometryType.CLOTHOID; } + /** + * @return a Clothoid is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link CurveInterpolation#CLOTHOID}. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CompoundCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CompoundCurve.java index ade5c4dad8..e600024abc 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CompoundCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/CompoundCurve.java @@ -27,6 +27,7 @@ import org.apache.sis.geometries.Geometries; import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Point; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.ConcatenatedDataPoints; import org.apache.sis.geometries.internal.shared.Curves; import org.apache.sis.geometries.internal.shared.DefaultCompoundCurve; @@ -53,6 +54,18 @@ public sealed interface CompoundCurve extends Curve return GeometryType.COMPOUNDCURVE; } + /** + * @return the most abstract representation of all it's elements + */ + @Override + default Representation getRepresentation() { + Representation r = Representation.TESSELATED; + for (int i = 0, n = getNumCurves(); i < n; i++) { + r = Representation.mostAbstract(r, getCurveN(i).getRepresentation()); + } + return r; + } + /** * Returns the number of curves this compound curve is made of. * 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 3b802bdfa9..a1eec024a8 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 @@ -22,6 +22,7 @@ import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.DefaultConic; import org.apache.sis.maths.Array; @@ -65,6 +66,14 @@ public sealed interface Conic extends Curve return GeometryType.CONIC; } + /** + * @return a Conic curve is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link CurveInterpolation#CONIC}. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/FunctionCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/FunctionCurve.java index a3c1789872..9dad9859a2 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/FunctionCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/FunctionCurve.java @@ -19,6 +19,7 @@ package org.apache.sis.geometries.curve; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.apache.sis.geometries.Curve; +import org.apache.sis.geometries.Representation; /** @@ -47,6 +48,14 @@ public sealed interface FunctionCurve<T extends FunctionArc> extends Curve permits PolynomialCurve { + /** + * @return a true Function curve is ANALYTIC + */ + @Override + default Representation getRepresentation() { + return Representation.ANALYTIC; + } + /** * Number of arcs of this curve, therefore the number of real functions needed. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Geodesic.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Geodesic.java index b137579c59..1ae0419749 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Geodesic.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Geodesic.java @@ -22,6 +22,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.internal.shared.DefaultGeodesic; @@ -70,6 +71,14 @@ public sealed interface Geodesic extends Curve return GeometryType.GEODESIC; } + /** + * @return a Geodesic is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link CurveInterpolation#GEODESIC}. * The interpolation between two data points is computed by the associated geometric coordinate diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Line.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Line.java index 8284ce0092..611ff76af9 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Line.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Line.java @@ -29,6 +29,7 @@ import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.Geometries; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.CurveLinearizer; import org.apache.sis.geometries.internal.shared.Curves; import org.apache.sis.geometries.internal.shared.DefaultLine; @@ -77,6 +78,14 @@ public sealed interface Line extends Curve return GeometryType.LINE; } + /** + * @return a Line is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } + /** * Returns {@link CurveInterpolation#LINEAR}. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LineString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LineString.java index fe889f42d8..e2ee711738 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LineString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/LineString.java @@ -29,6 +29,7 @@ import org.apache.sis.geometries.Point; import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.Geometries; import org.apache.sis.geometries.GeometryFactory; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.Centroids; import org.apache.sis.geometries.internal.shared.CurveLinearizer; import org.apache.sis.geometries.internal.shared.Curves; @@ -83,6 +84,14 @@ public sealed interface LineString extends Curve return GeometryType.LINESTRING; } + /** + * @return a LineString is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } + /** * Returns {@link CurveInterpolation#LINEAR}. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/OffsetCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/OffsetCurve.java index a3a9a8a975..d55ae76564 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/OffsetCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/OffsetCurve.java @@ -21,6 +21,7 @@ import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.cs.Bearing; import org.apache.sis.geometries.internal.shared.DefaultOffsetCurve; @@ -60,6 +61,14 @@ public sealed interface OffsetCurve extends Curve return GeometryType.OFFSETCURVE; } + /** + * @return the representation of the offset curve + */ + @Override + default Representation getRepresentation() { + return getBaseCurve().getRepresentation(); + } + /** * Distance at which this curve is generated from the {@linkplain #getBaseCurve() base curve}. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialCurve.java index 0bc4a6412c..a266860c93 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/PolynomialCurve.java @@ -16,6 +16,7 @@ */ package org.apache.sis.geometries.curve; +import org.apache.sis.geometries.Representation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; @@ -56,4 +57,12 @@ public sealed interface PolynomialCurve<PolynomialArc> extends FunctionCurve */ @UML(identifier="degree", specification=ISO_19107) int getDegree(); + + /** + * @return a Polynomial curve is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Ray.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Ray.java index 821a3c0617..d4449b9f4c 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Ray.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Ray.java @@ -25,6 +25,7 @@ import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.Geometries; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Point; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.DefaultRay; import org.apache.sis.maths.Array; import org.apache.sis.maths.NDRange; @@ -57,6 +58,14 @@ public sealed interface Ray extends Curve return GeometryType.RAY; } + /** + * @return a Ray is ANALYTIC + */ + @Override + default Representation getRepresentation() { + return Representation.ANALYTIC; + } + /** * Returns the position the ray starts from. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Rhumb.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Rhumb.java index ee96ae76df..7f4b7827a3 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Rhumb.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Rhumb.java @@ -24,6 +24,7 @@ import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.cs.Bearing; import org.apache.sis.geometries.internal.shared.DefaultRhumb; import org.apache.sis.maths.Array; @@ -70,6 +71,14 @@ public sealed interface Rhumb extends Curve return GeometryType.RHUMB; } + /** + * @return a Rhumb is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link CurveInterpolation#RHUMB}. * 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 a7d5bc2a4b..3140598946 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 @@ -22,6 +22,7 @@ import org.opengis.annotation.UML; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.DefaultSpiral; import org.apache.sis.maths.Vector; @@ -63,6 +64,14 @@ public sealed interface Spiral extends Curve return GeometryType.SPIRAL; } + /** + * @return a Spiral is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link CurveInterpolation#SPIRAL}. * diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedCurve.java index f63f980739..58c7fb9cb2 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedCurve.java @@ -28,6 +28,7 @@ import org.apache.sis.geometries.Orientable; import org.apache.sis.geometries.Point; import org.apache.sis.geometries.Primitive; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.curve.LineString; import org.apache.sis.maths.Array; import org.apache.sis.measure.Quantities; @@ -76,6 +77,11 @@ public non-sealed class DefaultReversedCurve extends AbstractGeometry implements return base.getGeometryType(); } + @Override + public Representation getRepresentation() { + return base.getRepresentation(); + } + /** * Returns the end point of the base curve, which is where this curve starts. */ diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedSurface.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedSurface.java index 6ed92ccf10..a96d102ba4 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedSurface.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultReversedSurface.java @@ -31,6 +31,7 @@ import org.apache.sis.geometries.Primitive; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; /** @@ -83,6 +84,11 @@ public non-sealed class DefaultReversedSurface extends AbstractGeometry implemen return base.getGeometryType(); } + @Override + public Representation getRepresentation() { + return base.getRepresentation(); + } + /** * Returns the area of the base surface. Area is unsigned, so the orientation does not affect it. */ diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultSolid.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultSolid.java index 3d4bb3f66f..7db5d7a982 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultSolid.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultSolid.java @@ -17,6 +17,7 @@ package org.apache.sis.geometries.internal.shared; import java.util.List; +import java.util.stream.StreamSupport; import javax.measure.Quantity; import org.opengis.geometry.Envelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; @@ -29,6 +30,7 @@ import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Solid; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.Geometries; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometry.GeneralEnvelope; @@ -50,6 +52,14 @@ public non-sealed class DefaultSolid extends AbstractGeometry implements Solid { return GeometryType.SOLID; } + /** + * @return the most abstract representation of all it's elements + */ + @Override + public Representation getRepresentation() { + return Representation.mostAbstract(boundaries.stream().map(Geometry::getRepresentation)); + } + @Override public boolean isEmpty() { return boundaries.isEmpty(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java index cbad7e6f46..6d6ddc0a47 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java @@ -45,6 +45,7 @@ import static org.apache.sis.geometries.DataPointsType.ATT_POSITION; import static org.apache.sis.geometries.DataPointsType.ATT_TANGENT; import static org.apache.sis.geometries.DataPointsType.ATT_TEXCOORD; import static org.apache.sis.geometries.DataPointsType.ATT_WEIGHTS; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.curve.LineString; import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.internal.shared.Vertex; @@ -125,6 +126,14 @@ public sealed interface MeshPrimitive extends Geometry return create(type, new ArrayDataPoints(attDef)); } + /** + * @return a Mesh is TESSELATED + */ + @Override + default Representation getRepresentation() { + return Representation.TESSELATED; + } + /** * @return primitive (and positions) CRS. */ @@ -1069,6 +1078,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.POINTS, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + @Override public GeometryType getGeometryType() { return GeometryType.COLLECTION; @@ -1102,6 +1119,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.LINES, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + @Override public GeometryType getElementType() { return GeometryType.LINESTRING; @@ -1129,6 +1154,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.LINE_LOOP, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + /** * Returns the points of this line, in index order, the first point repeated at the end. */ @@ -1147,6 +1180,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.LINE_STRIP, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + /** * Returns the points of this line, in index order. */ @@ -1165,6 +1206,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.TRIANGLES, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + @Override public int getNumPatches() { long nb = (index == null) ? getPositions().getLength() : this.index.getLength(); @@ -1195,6 +1244,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.TRIANGLE_FAN, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + @Override public int getNumPatches() { long nb = (index == null) ? getPositions().getLength() : this.index.getLength(); @@ -1227,6 +1284,14 @@ public sealed interface MeshPrimitive extends Geometry super(Type.TRIANGLE_STRIP, dp); } + /** + * @return a Mesh is TESSELATED + */ + @Override + public Representation getRepresentation() { + return Representation.TESSELATED; + } + @Override public int getNumPatches() { long nb = (index == null) ? getPositions().getLength() : this.index.getLength(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Frustrum.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Frustrum.java index 4cc00bc52b..68f7f58fb6 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Frustrum.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/solid/Frustrum.java @@ -23,6 +23,7 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Plane; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.internal.shared.ConcatenatedDataPoints; @@ -46,6 +47,14 @@ public final class Frustrum extends AbstractGeometry { return GeometryType.FRUSTRUM; } + /** + * @return a Frustrum is ANALYTIC + */ + @Override + public Representation getRepresentation() { + return Representation.ANALYTIC; + } + @Override public boolean isEmpty() { return false; 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 b28569b6a2..b05dd8e7f0 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.opengis.annotation.UML; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Solid; import org.apache.sis.geometries.SolidInterpolation; import org.apache.sis.maths.Array; @@ -49,6 +50,14 @@ public sealed interface ParametricCurveSolid extends Solid permits BSplineSolid { + /** + * @return a ParametricCurveSolid is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link SolidInterpolation#PARAMETRIC_CURVE}: this solid is defined by families of * curves over a 3-dimensional parameter space. 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 62219843b1..fe296420fd 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 @@ -23,6 +23,7 @@ import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.Geometries; import org.apache.sis.geometries.GeometryCollection; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Solid; import org.apache.sis.geometries.SolidInterpolation; import org.apache.sis.geometries.curve.LinearRing; @@ -60,6 +61,14 @@ public sealed interface Polyhedron extends Solid return GeometryType.POLYHEDRON; } + /** + * @return a polyhedron is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } + @Override default DataPointsType getDataPointsType() { return getExteriorShell().getDataPointsType(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Capsule.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Capsule.java index 0bf8fee07a..734f9eb402 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Capsule.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Capsule.java @@ -25,6 +25,7 @@ import org.apache.sis.geometries.DataPointsType; import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.internal.shared.DefaultCapsule; @@ -59,6 +60,14 @@ public sealed interface Capsule extends Surface return GeometryType.CAPSULE; } + /** + * @return a Capsule is ANALYTIC + */ + @Override + default Representation getRepresentation() { + return Representation.ANALYTIC; + } + /** * Returns {@code false}: a capsule always has its two sphere centers. */ diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/CurvePolygon.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/CurvePolygon.java index cc2f26f727..cd3a546c75 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/CurvePolygon.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/CurvePolygon.java @@ -17,6 +17,7 @@ package org.apache.sis.geometries.surface; import java.util.List; +import java.util.stream.Stream; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.opengis.geometry.coordinate.GriddedSurface; @@ -25,7 +26,9 @@ import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.Point; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.Centroids; import org.apache.sis.geometries.internal.shared.ConcatenatedDataPoints; import org.apache.sis.geometries.internal.shared.DefaultCurvePolygon; @@ -75,6 +78,18 @@ public sealed interface CurvePolygon extends Surface return GeometryType.CURVEPOLYGON; } + /** + * @return the most abstract representation of all it's elements + */ + @Override + default Representation getRepresentation() { + final Curve exteriorRing = getExteriorRing(); + if (exteriorRing == null) return Representation.EMPTY; + return Representation.mostAbstract( + Stream.concat(Stream.of(exteriorRing), getInteriorRings().parallelStream()) + .map(Geometry::getRepresentation)); + } + /** * Returns the attributes of the exterior ring, which are the attributes of this surface. */ diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Cylinder.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Cylinder.java index 7fd20854a0..edbf33d7e2 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Cylinder.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/surface/Cylinder.java @@ -28,6 +28,7 @@ import org.apache.sis.geometries.Geometries; import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.curve.Circle; @@ -78,6 +79,14 @@ public sealed interface Cylinder extends Surface return GeometryType.CYLINDER; } + /** + * @return a Cylinder is ANALYTIC + */ + @Override + default Representation getRepresentation() { + return Representation.ANALYTIC; + } + /** * Returns {@link SurfaceInterpolation#CONIC}, since ISO 19107 classifies cylinders and cones * as conic surfaces, followed by {@link SurfaceInterpolation#PLANAR} for the end disks if this 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 444c689a67..011096909f 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 @@ -25,6 +25,7 @@ import org.apache.sis.referencing.NamedIdentifier; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.DataPoints; import org.apache.sis.geometries.GeometryType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.maths.Array; @@ -73,6 +74,14 @@ public sealed interface ParametricCurveSurface extends Surface, ReferenceSystem Sphere { + /** + * @return a ParametricCurveSurface is PARAMETRIC + */ + @Override + default Representation getRepresentation() { + return Representation.PARAMETRIC; + } + /** * Returns {@link SurfaceInterpolation#PARAMETRIC_CURVE}: this surface is defined by families * of curves over a 2-dimensional parameter space. 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 f186c22436..1e0c0a3ca8 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 @@ -24,6 +24,7 @@ import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.DataPointsType; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.curve.LinearRing; import org.apache.sis.geometries.internal.shared.ConcatenatedDataPoints; import org.apache.sis.geometries.internal.shared.DefaultPolygon; @@ -82,6 +83,14 @@ public sealed interface Polygon extends Surface return GeometryType.POLYGON; } + /** + * @return a Polygon is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } + /** * Returns the attributes of the exterior ring, which are the attributes 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 8ea1733780..efbf883ab1 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 @@ -28,6 +28,7 @@ import org.apache.sis.geometries.GeometryType; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.SurfaceInterpolation; import org.apache.sis.geometries.Point; +import org.apache.sis.geometries.Representation; import org.apache.sis.geometries.internal.shared.Centroids; import org.apache.sis.geometries.internal.shared.ConcatenatedDataPoints; import org.apache.sis.geometries.internal.shared.DefaultPolyhedralSurface; @@ -89,6 +90,14 @@ public sealed interface PolyhedralSurface<T extends Polygon> extends /*GeometryC return GeometryType.POLYHEDRALSURFACE; } + /** + * @return a PolyhedralSurface is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } + // @UML(identifier="segment", specification=ISO_19107) // @Override // public List<Primitive> getSegments(); 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 6b7cc3c317..b6574ea6eb 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 @@ -17,6 +17,7 @@ package org.apache.sis.geometries.surface; import java.util.List; +import org.apache.sis.geometries.Representation; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.apache.sis.geometries.SurfaceInterpolation; @@ -55,4 +56,12 @@ public sealed interface TriangulatedSurface<T extends Polygon> extends Polyhedra default List<SurfaceInterpolation> getInterpolation() { return List.of(SurfaceInterpolation.TRIANGULAR); } + + /** + * @return a Tryangulated surface is DISCRETE + */ + @Override + default Representation getRepresentation() { + return Representation.DISCRETE; + } }
