This is an automated email from the ASF dual-hosted git repository.
jsorel pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new e75a1a0b49 Add geometry classes and reference from OGC Features and
Geometries JSON draft
e75a1a0b49 is described below
commit e75a1a0b49785926ef4028a99909d597fdf3a6a6
Author: jsorel <[email protected]>
AuthorDate: Mon Jul 7 11:19:55 2025 +0200
Add geometry classes and reference from OGC Features and Geometries JSON
draft
---
.../org/apache/sis/geometries/AttributesType.java | 6 ++-
...aultMultiLineString.java => CompoundCurve.java} | 19 +++----
.../main/org/apache/sis/geometries/MultiCurve.java | 1 +
...ltMultiLineString.java => MultiPolyhedron.java} | 18 ++++---
.../org/apache/sis/geometries/MultiSurface.java | 1 +
.../main/org/apache/sis/geometries/Polygon.java | 1 +
.../main/org/apache/sis/geometries/Polyhedron.java | 63 ++++++++++++++++++++++
.../main/org/apache/sis/geometries/Prism.java | 57 ++++++++++++++++++++
.../CircularString.java} | 18 ++++---
.../org/apache/sis/geometries/package-info.java | 2 +
...tractMultiCurve.java => DefaultMultiCurve.java} | 5 +-
.../geometries/privy/DefaultMultiLineString.java | 2 +-
12 files changed, 164 insertions(+), 29 deletions(-)
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributesType.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributesType.java
index 57199a51a6..eb6de35ab8 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributesType.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributesType.java
@@ -28,7 +28,11 @@ import java.util.Map;
* 3D Engine decompose draw calls by primitive types.
* Each indexed primitives are forwarded with a set of Attributes.
*
- * @author Johann Sorel (Geomatys)
+ * In common GIS, a single ordinate has been defined as 'M'.
+ * It is a very limited capability compared to 3D engine geometry properties.
+ *
+ * @author Johann Sorel (Geomatys
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#bb_measures
*/
public interface AttributesType {
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/CompoundCurve.java
similarity index 69%
copy from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
copy to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/CompoundCurve.java
index 2613b56c0e..408fa0650f 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/CompoundCurve.java
@@ -14,19 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries.privy;
-
-import org.apache.sis.geometries.LineString;
-import org.apache.sis.geometries.MultiLineString;
+package org.apache.sis.geometries;
/**
*
- * @author Johann Sorel (Geomatys)
+ * @todo
+ * @author Johann Sorel (Geomatys
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#compound_curve
*/
-public class DefaultMultiLineString extends AbstractMultiCurve<LineString>
implements MultiLineString {
+public interface CompoundCurve extends Curve {
- public DefaultMultiLineString(LineString... geometries) {
- super(geometries);
- }
+ public static final String TYPE = "COMPOUNDCURVE";
+ @Override
+ public default String getGeometryType() {
+ return TYPE;
+ }
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiCurve.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiCurve.java
index 88485ab526..a8ddf5255a 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiCurve.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiCurve.java
@@ -35,6 +35,7 @@ package org.apache.sis.geometries;
* A MultiCurve is defined as topologically closed.
*
* @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#multi_curve
*/
public interface MultiCurve<T extends Curve> extends GeometryCollection<T>{
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolyhedron.java
similarity index 59%
copy from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
copy to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolyhedron.java
index 2613b56c0e..94f8c68028 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolyhedron.java
@@ -14,19 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries.privy;
-
-import org.apache.sis.geometries.LineString;
-import org.apache.sis.geometries.MultiLineString;
+package org.apache.sis.geometries;
/**
+ * A multi-polyhedron is a collection of polyhedron objects. These are
arbitrary aggregations.
+ * There is no assumption regarding the topological relationships between the
polyhedron objects,
+ * but in most cases the polyhedron objects will not intersect each other.
*
* @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#multi_polyhedron
*/
-public class DefaultMultiLineString extends AbstractMultiCurve<LineString>
implements MultiLineString {
+public interface MultiPolyhedron extends GeometryCollection<Polyhedron> {
+
+ public static final String TYPE = "MULTIPOLYHEDRON";
- public DefaultMultiLineString(LineString... geometries) {
- super(geometries);
+ @Override
+ public default String getGeometryType() {
+ return TYPE;
}
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiSurface.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiSurface.java
index baf239ec4d..b49af1deef 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiSurface.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiSurface.java
@@ -31,6 +31,7 @@ package org.apache.sis.geometries;
* having overlapping interiors in their 2D projections.
*
* @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#multi_surface
*/
public interface MultiSurface<T extends Surface> extends GeometryCollection<T>{
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
index 62aba45ba2..1fe4653634 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
@@ -41,6 +41,7 @@ import org.opengis.geometry.coordinate.GriddedSurface;
* f) The exterior of a Polygon with 1 or more holes is not connected. Each
hole defines a connected component of the exterior.
*
* @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#curve_polygon
*/
@UML(identifier="Polygon", specification=ISO_19107) // section 8.1.2
public interface Polygon extends Surface {
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polyhedron.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polyhedron.java
new file mode 100644
index 0000000000..44139b1556
--- /dev/null
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polyhedron.java
@@ -0,0 +1,63 @@
+/*
+ * 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.List;
+
+/**
+ * A solid is defined by its bounding surfaces. Each bounding surface is a
closed, simple surface, also called a shell.
+ *
+ * Each solid has a unique exterior shell and any number of shells that are
inside the exterior shell
+ * and that describe voids. The interior shells do not intersect each other
and cannot contain another interior shell.
+ *
+ * A polyhedron is a solid where each shell is a multi-polygon. 'Closed' means
that the multi-polygon
+ * shell is watertight, it splits space into two distinct regions: inside and
outside of the shell. 'Simple' means
+ * that the polygons that make up the shell do not intersect, they only touch
each other along their common boundaries.
+ *
+ *
+ * @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#polyhedron
+ */
+public interface Polyhedron extends Geometry {
+
+ public static final String TYPE = "POLYHEDRON";
+
+ @Override
+ public default String getGeometryType() {
+ return TYPE;
+ }
+
+ @Override
+ public default AttributesType getAttributesType() {
+ return getExteriorShell().getAttributesType();
+ }
+
+ /**
+ * Returns the exterior shell of this polyhedron.
+ *
+ * @return exterior shell of this polyhedron.
+ */
+ MultiPolygon getExteriorShell();
+
+ /**
+ * Returns a list of void shell inside the polyhedron.
+ *
+ * @return all void shell inside the polyhedron
+ */
+ List<MultiPolygon> getInteriorShells();
+
+}
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
new file mode 100644
index 0000000000..0944445987
--- /dev/null
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Prism.java
@@ -0,0 +1,57 @@
+/*
+ * 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 org.apache.sis.measure.NumberRange;
+import org.opengis.referencing.crs.SingleCRS;
+
+/**
+ * A prism is defined by a base shape (e.g. Polygon or Circle) that is then
extruded from some optional lower limit to an upper limit.
+ *
+ * @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#prism
+ */
+public interface Prism extends Geometry {
+
+ public static final String TYPE = "PRISM";
+
+ @Override
+ public default String getGeometryType() {
+ return TYPE;
+ }
+
+ @Override
+ public default AttributesType getAttributesType() {
+ return getBase().getAttributesType();
+ }
+
+ /**
+ * @return base shape of the prism.
+ */
+ Geometry getBase();
+
+ /**
+ * @return lower and upper limits of the extrusion
+ */
+ NumberRange<?> getExtrusionRange();
+
+ /**
+ * @return the extrusion crs
+ */
+ SingleCRS getExtrusionCrs();
+
+}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java
similarity index 71%
copy from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
copy to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java
index 2613b56c0e..ece8270291 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java
@@ -14,19 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries.privy;
+package org.apache.sis.geometries.conics;
-import org.apache.sis.geometries.LineString;
-import org.apache.sis.geometries.MultiLineString;
+import org.apache.sis.geometries.Curve;
/**
- *
+ * @todo
* @author Johann Sorel (Geomatys)
+ * @see https://docs.ogc.org/DRAFTS/21-045r1.html#circular_string
*/
-public class DefaultMultiLineString extends AbstractMultiCurve<LineString>
implements MultiLineString {
+public interface CircularString extends Curve {
- public DefaultMultiLineString(LineString... geometries) {
- super(geometries);
- }
+ public static final String TYPE = "CIRCULARSTRING";
+ @Override
+ public default String getGeometryType() {
+ return TYPE;
+ }
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/package-info.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/package-info.java
index f488c390b1..c1030b444e 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/package-info.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/package-info.java
@@ -21,7 +21,9 @@
* <ul>
* <li>ISO 19107 version 2019</li>
* <li>OGC Simple Feature Access https://www.ogc.org/standards/sfa</li>
+ * <li>OGC Features and Geometries JSON - Part 1: Core
https://docs.ogc.org/DRAFTS/21-045r1.html</li>
* <li>Khronos GLTF-2
https://github.com/KhronosGroup/glTF/tree/main/specification/2.0</li>
+ * <li>Khronos ANARI https://github.com/KhronosGroup/ANARI-SDK</li>
* </ul>
*
* This API being a merge of different geometry standard some elements differ
from the original specifications.
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractMultiCurve.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiCurve.java
similarity index 88%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractMultiCurve.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiCurve.java
index e6d6bd6c23..04cd18eb63 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractMultiCurve.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiCurve.java
@@ -18,18 +18,17 @@ package org.apache.sis.geometries.privy;
import org.apache.sis.geometries.Curve;
import org.apache.sis.geometries.MultiCurve;
-import org.apache.sis.geometries.privy.AbstractGeometry;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
*
* @author Johann Sorel (Geomatys)
*/
-public abstract class AbstractMultiCurve<T extends Curve> extends
AbstractGeometry implements MultiCurve<T> {
+public class DefaultMultiCurve<T extends Curve> extends AbstractGeometry
implements MultiCurve<T> {
private final T[] curves;
- public AbstractMultiCurve(T[] geometries) {
+ public DefaultMultiCurve(T[] geometries) {
this.curves = geometries;
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
index 2613b56c0e..52cf33fdd6 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
@@ -23,7 +23,7 @@ import org.apache.sis.geometries.MultiLineString;
*
* @author Johann Sorel (Geomatys)
*/
-public class DefaultMultiLineString extends AbstractMultiCurve<LineString>
implements MultiLineString {
+public class DefaultMultiLineString extends DefaultMultiCurve<LineString>
implements MultiLineString {
public DefaultMultiLineString(LineString... geometries) {
super(geometries);