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 c2010b7bc9a44801489a6db412af97dd0141f6f6
Author: jsorel <[email protected]>
AuthorDate: Mon Sep 7 09:08:23 2026 +0200

    feat(Geometry): add geodesic curve implementation
---
 .../org/apache/sis/geometries/GeometryFactory.java |   6 ++
 .../org/apache/sis/geometries/curve/Geodesic.java  | 103 +++++++++++++++++++++
 .../shared/DefaultGeodesic.java}                   |  34 +++++--
 3 files changed, 133 insertions(+), 10 deletions(-)

diff --git 
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryFactory.java
 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryFactory.java
index 3cec7571ea..84471d90dd 100644
--- 
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryFactory.java
+++ 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryFactory.java
@@ -27,6 +27,7 @@ import org.apache.sis.geometries.curve.ArcByBulge;
 import org.apache.sis.geometries.curve.ArcByCenterPoint;
 import org.apache.sis.geometries.conics.Circle;
 import org.apache.sis.geometries.conics.CircularString;
+import org.apache.sis.geometries.curve.Geodesic;
 import org.apache.sis.geometries.math.SampleSystem;
 import org.apache.sis.geometries.math.NDArrays;
 import org.apache.sis.geometries.math.Array;
@@ -38,6 +39,7 @@ import 
org.apache.sis.geometries.internal.shared.DefaultCircularString;
 import org.apache.sis.geometries.internal.shared.DefaultCompoundCurve;
 import org.apache.sis.geometries.internal.shared.DefaultCurvePolygon;
 import org.apache.sis.geometries.internal.shared.DefaultEmpty;
+import org.apache.sis.geometries.internal.shared.DefaultGeodesic;
 import org.apache.sis.geometries.internal.shared.DefaultGeometryCollection;
 import org.apache.sis.geometries.internal.shared.DefaultLineString;
 import org.apache.sis.geometries.internal.shared.DefaultLinearRing;
@@ -107,6 +109,10 @@ public final class GeometryFactory extends 
org.apache.sis.geometry.wrapper.Geome
         return new DefaultLineString(sequence);
     }
 
+    public static Geodesic createGeodesic(DataPoints sequence) {
+        return new DefaultGeodesic(sequence);
+    }
+
     public static LinearRing createLinearRing(DataPoints sequence) {
         return new DefaultLinearRing(sequence);
     }
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
new file mode 100644
index 0000000000..4924208eba
--- /dev/null
+++ 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/curve/Geodesic.java
@@ -0,0 +1,103 @@
+/*
+ * 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.curve;
+
+import org.apache.sis.geometries.AttributesType;
+import static org.opengis.annotation.Specification.ISO_19107;
+import org.opengis.annotation.UML;
+import org.apache.sis.geometries.Curve;
+import org.apache.sis.geometries.CurveInterpolation;
+import org.apache.sis.geometries.DataPoints;
+import org.apache.sis.geometries.Point;
+import org.apache.sis.geometries.internal.shared.AbstractGeometry;
+import org.apache.sis.geometries.math.Array;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+
+/**
+ * A curve between two point which is interpolated on the ellipsid.
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+@UML(identifier="Geodesic", specification=ISO_19107) // section 7.3.2
+public interface Geodesic extends Curve {
+
+    public static final String TYPE = "GEODESIC";
+
+    @Override
+    public default String getGeometryType() {
+        return TYPE;
+    }
+
+    @UML(identifier="interpolation", specification=ISO_19107) // section 
7.3.2.2
+    @Override
+    public default CurveInterpolation getInterpolation() {
+        return CurveInterpolation.GEODESIC;
+    }
+
+    /**
+     * The number of Points in this Geodesic.
+     *
+     * @see OGC Simple Feature Access 1.2.1 - 6.1.7.2
+     * @return number of Points in this Geodesic.
+     */
+    default int getNumPoints() {
+        return getDataPoints().size();
+    }
+
+    /**
+     * Returns the specified Point N in this Geodesic.
+     *
+     * @see OGC Simple Feature Access 1.2.1 - 6.1.7.2
+     * @return the specified Point N in this Geodesic.
+     */
+    default Point getPointN(int n) {
+        return getDataPoints().getPoint(n);
+    }
+
+    /**
+     * @return null, a Geodesic has no control points
+     */
+    @Override
+    public default Array getControlPoints() {
+        return null;
+    }
+
+    @Override
+    default CoordinateReferenceSystem getCoordinateReferenceSystem() {
+        return getDataPoints().getCoordinateReferenceSystem();
+    }
+
+    @Override
+    default void setCoordinateReferenceSystem(CoordinateReferenceSystem cs) 
throws IllegalArgumentException {
+        getDataPoints().setCoordinateReferenceSystem(cs);
+    }
+
+    @Override
+    public default AttributesType getAttributesType() {
+        return getDataPoints().getAttributesType();
+    }
+
+    @Override
+    default String asText() {
+        final StringBuilder sb = new StringBuilder("GEODESIC (");
+        final DataPoints points = getDataPoints();
+        AbstractGeometry.toText(sb, points);
+        sb.append(')');
+        return sb.toString();
+    }
+}
diff --git 
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/geodesics/Geodesic.java
 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeodesic.java
similarity index 57%
rename from 
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/geodesics/Geodesic.java
rename to 
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeodesic.java
index 1368fbb115..5ac9b1a3cc 100644
--- 
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/geodesics/Geodesic.java
+++ 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeodesic.java
@@ -14,24 +14,38 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.geometries.geodesics;
+package org.apache.sis.geometries.internal.shared;
 
-import static org.opengis.annotation.Specification.ISO_19107;
-import org.opengis.annotation.UML;
-import org.apache.sis.geometries.Curve;
-import org.apache.sis.geometries.CurveInterpolation;
+import org.apache.sis.geometries.DataPoints;
+import org.apache.sis.geometries.curve.Geodesic;
+import org.opengis.geometry.Envelope;
 
 
 /**
  *
  * @author Johann Sorel (Geomatys)
  */
-@UML(identifier="Geodesic", specification=ISO_19107) // section 7.3.2
-public interface Geodesic extends Curve {
+public class DefaultGeodesic extends AbstractGeometry implements Geodesic {
+
+    private final DataPoints points;
+
+    public DefaultGeodesic(DataPoints points) {
+        this.points = points;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return points.isEmpty();
+    }
 
-    @UML(identifier="interpolation", specification=ISO_19107) // section 
7.3.2.2
     @Override
-    public default CurveInterpolation getInterpolation() {
-        return CurveInterpolation.GEODESIC;
+    public DataPoints getDataPoints() {
+        return points;
     }
+
+    @Override
+    public Envelope getEnvelope() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
 }

Reply via email to