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 8290d6355ac0d133f20e8e669a7f29ee1f1cb752 Author: jsorel <[email protected]> AuthorDate: Mon Sep 7 09:01:02 2026 +0200 refactor(Geometry): rename PointSequence to DataPoints to follow ISO:19107 naming --- .../sis/geometries/AttributeInterpolation.java | 50 ++++++++++++++++++++++ ...ineString.java => AttributeTransformation.java} | 41 ++++++++---------- .../org/apache/sis/geometries/AttributesType.java | 18 ++++++++ .../main/org/apache/sis/geometries/Curve.java | 8 ++-- .../{PointSequence.java => DataPoints.java} | 15 ++++++- .../org/apache/sis/geometries/GeometryFactory.java | 30 ++++++------- .../org/apache/sis/geometries/GeometryVisitor.java | 2 +- .../main/org/apache/sis/geometries/LineString.java | 4 +- .../main/org/apache/sis/geometries/LinearRing.java | 2 +- .../org/apache/sis/geometries/MultiLineString.java | 2 +- .../main/org/apache/sis/geometries/MultiPoint.java | 4 +- .../main/org/apache/sis/geometries/Point.java | 4 +- .../org/apache/sis/geometries/PreparedTIN.java | 2 +- .../main/org/apache/sis/geometries/TIN.java | 2 +- .../main/org/apache/sis/geometries/Triangle.java | 12 +++--- .../main/org/apache/sis/geometries/Wrapper.java | 16 +++---- .../apache/sis/geometries/adapter/JTSAdapter.java | 34 +++++++-------- .../geometries/adapter/PathIteratorAdapter.java | 22 +++++----- .../sis/geometries/adapter/ShapeAdapter.java | 6 +-- .../sis/geometries/adapter/ShapeConverter.java | 14 +++--- .../main/org/apache/sis/geometries/conics/Arc.java | 4 +- .../sis/geometries/conics/CircularString.java | 6 +-- .../org/apache/sis/geometries/conics/Conic.java | 4 +- .../apache/sis/geometries/curve/ArcByBulge.java | 4 +- .../sis/geometries/curve/ArcByCenterPoint.java | 4 +- .../internal/shared/AbstractGeometry.java | 4 +- .../{ArraySequence.java => ArrayDataPoints.java} | 13 +++--- .../internal/shared/DefaultArcByBulge.java | 8 ++-- .../internal/shared/DefaultCircularString.java | 8 ++-- .../internal/shared/DefaultCompoundCurve.java | 4 +- ...ltPointSequence.java => DefaultDataPoints.java} | 10 ++--- .../internal/shared/DefaultLineString.java | 8 ++-- .../internal/shared/DefaultLinearRing.java | 4 +- .../internal/shared/DefaultMultiPoint.java | 8 ++-- .../geometries/internal/shared/DefaultPoint.java | 16 +++---- .../internal/shared/DefaultReversedCurve.java | 4 +- .../internal/shared/DefaultTriangle.java | 4 +- .../apache/sis/geometries/mesh/MeshPrimitive.java | 12 +++--- .../geometries/mesh/MeshPrimitiveComparator.java | 6 +-- .../sis/geometries/mesh/MeshPrimitiveVisitor.java | 6 +-- .../sis/geometries/operation/Intersection.java | 4 +- .../org/apache/sis/geometries/operation/To3D.java | 16 +++---- .../sis/geometries/operation/ToPrimitive.java | 14 +++--- .../apache/sis/geometries/operation/Transform.java | 12 +++--- .../simplify/greedyinsert/TINBuilder.java | 4 +- .../simplify/greedyinsert/TinDistance.java | 4 +- .../operation/simplify/greedyinsert/WTriangle.java | 6 +-- .../operation/spatialanalysis2d/ISOBand.java | 4 +- .../operation/spatialanalysis2d/ISOLine.java | 4 +- .../triangulate/delaunay/OrientedEdge.java | 10 ++--- .../triangulate/delaunay/OrientedTriangle.java | 8 ++-- .../main/org/apache/sis/gml/AbstractGMLWriter.java | 4 +- .../main/org/apache/sis/gml/GML2Writer.java | 6 +-- .../main/org/apache/sis/gml/GML3Writer.java | 4 +- .../org/apache/sis/gml/PositionListBuilder.java | 6 +-- .../org/apache/sis/geometries/TriangleTest.java | 2 +- .../sis/geometries/adapter/ShapeAdapterTest.java | 16 +++---- .../sis/geometries/adapter/ShapeConverterTest.java | 4 +- .../internal/shared/ArraySequenceTest.java | 10 ++--- .../sis/geometries/operation/ToPrimitiveTest.java | 16 +++---- .../test/org/apache/sis/gml/GML2ReaderTest.java | 4 +- .../test/org/apache/sis/gml/GML2WriterTest.java | 4 +- .../test/org/apache/sis/gml/GML3ReaderTest.java | 4 +- .../test/org/apache/sis/gml/GML3WriterTest.java | 4 +- .../test/org/apache/sis/gml/GeometryAssert.java | 6 +-- .../apache/sis/gml/JAXBGeometryAdapterTest.java | 4 +- .../storage/dggs/DiscreteGlobalGridSystems.java | 6 +-- .../sis/referencing/dggs/AbstractDggrsTest.java | 4 +- 68 files changed, 346 insertions(+), 269 deletions(-) diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributeInterpolation.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributeInterpolation.java new file mode 100644 index 0000000000..756a80b27b --- /dev/null +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributeInterpolation.java @@ -0,0 +1,50 @@ +/* + * 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; + +/** + * Defines how geometry attribute should be interpolation on the curves, surfaces or in volumes. + * This information will be used by geometry transforming operations. + * + * TODO : experimentale but needed + * + * @author Johann Sorel (Geomatys) + */ +public enum AttributeInterpolation { + + /** + * Used for any attribute which is in the geometry coordinate reference system. + * Attribute must be in a compatible CRS. + */ + TRANSLATE, + /** + * Computed value should be the value of the nearest geometric point + */ + NEAREST, + /** + * Computed value should be linearly interpolated between geometric points. + * It must follow the curve (distance along the curve) or surface. + */ + LINEAR, + /** + * An attribute value applies to the whole segment until the next point. + * For a curve of two points [A..B] this means the value should be used on the [A..B[ interval, excluding B. + * For a surface or volume, the first attribute value applies to the whole surface or volume. + */ + LEADING + +} diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributeTransformation.java similarity index 60% copy from incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java copy to incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributeTransformation.java index 4edcf32b76..1847f4f332 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AttributeTransformation.java @@ -14,32 +14,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.geometries.internal.shared; - -import org.apache.sis.geometries.LineString; -import org.apache.sis.geometries.PointSequence; - +package org.apache.sis.geometries; /** + * Defines how geometry attribute should be transformed on the curves, surfaces or in volumes. + * This information will be used by geometry transforming operations. + * + * TODO : experimentale but needed * * @author Johann Sorel (Geomatys) */ -public class DefaultLineString extends AbstractGeometry implements LineString { - - private final PointSequence points; - - public DefaultLineString(PointSequence points) { - this.points = points; - } - - @Override - public boolean isEmpty() { - return points.isEmpty(); - } - - @Override - public PointSequence getDataPoints() { - return points; - } +public enum AttributeTransformation { + + /** + * Value remains unchanged. + */ + NONE, + /** + * Any coordinate transformation applies to the attribute values. + */ + TRANSFORM, + /** + * The value should be rotated using the rotation matrix of the transform at the given point. + */ + ROTATE } 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 b9aeefc8c3..7cfc34e7e5 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 @@ -70,6 +70,24 @@ public interface AttributesType { */ DataType getAttributeType(String name); + /** + * Get how values should be interpolation in geometric operations. + * + * TODO : experimentale but needed + */ + default AttributeInterpolation getAttributeInterpolation(String name) { + return AttributeInterpolation.NEAREST; + } + + /** + * Get how values should be transformed in geometric operations. + * + * TODO : experimentale but needed + */ + default AttributeTransformation getAttributeTransformation(String name) { + return AttributeTransformation.NONE; + } + /** * Returns attribute names. * 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 0574932512..fe135f738b 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 @@ -42,14 +42,14 @@ public interface Curve extends Orientable { * * <p> * Difference with ISO-19107 : The type has been changed from - * a list of direct positions to a PointSequence. + * a list of direct positions to DataPoints. * This change allows to accomodate addition attributes like in GLTF or GPU models. * </p> * * @return curve data points. */ @UML(identifier="dataPoint", specification=ISO_19107) // section 6.4.18.3 - PointSequence getDataPoints(); + DataPoints getDataPoints(); /** * The length of this Curve in its associated spatial reference. @@ -70,7 +70,7 @@ public interface Curve extends Orientable { */ @UML(identifier="startPoint", specification=ISO_19107) // section 6.4.18.6 default Point getStartPoint() { - final PointSequence points = getDataPoints(); + final DataPoints points = getDataPoints(); if (points.isEmpty()) return null; return points.getPoint(0); } @@ -83,7 +83,7 @@ public interface Curve extends Orientable { */ @UML(identifier="endPoint", specification=ISO_19107) // section 6.4.18.7 default Point getEndPoint() { - final PointSequence points = getDataPoints(); + final DataPoints points = getDataPoints(); if (points.isEmpty()) return null; return points.getPoint(points.size()-1); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PointSequence.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DataPoints.java similarity index 89% rename from incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PointSequence.java rename to incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DataPoints.java index b217d3bbda..f746b022d4 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PointSequence.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DataPoints.java @@ -26,10 +26,23 @@ import org.apache.sis.geometries.math.Array; /** + * Enriched version of ISO-19107 DataPoints with multiple attributes capabilities. + * + * <p> + * ISO-19107 defines DataPoints on Curves as a List of DirectPosition. + * We extent this list with additional property support. + * By doing this we can store the old 'M' value as a properly separated information + * but also all 'normal','color','tangent','wight'.... informations which exist + * in other specifications. + * </p> + * + * <p> + * The ISO-19107 DirectPosition becomes the POSITION attribute. + * </p> * * @author Johann Sorel (Geomatys) */ -public interface PointSequence { +public interface DataPoints { /** * Get geometry coordinate system. 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 a973bc6b06..3cec7571ea 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 @@ -31,7 +31,7 @@ import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.Array; import org.apache.sis.geometries.math.Vector; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.internal.shared.DefaultArcByBulge; import org.apache.sis.geometries.internal.shared.DefaultArcByCenterPoint; import org.apache.sis.geometries.internal.shared.DefaultCircularString; @@ -99,15 +99,15 @@ public final class GeometryFactory extends org.apache.sis.geometry.wrapper.Geome return new DefaultPoint(ss, position); } - public static Point createPoint(PointSequence sequence) { + public static Point createPoint(DataPoints sequence) { return new DefaultPoint(sequence); } - public static LineString createLineString(PointSequence sequence) { + public static LineString createLineString(DataPoints sequence) { return new DefaultLineString(sequence); } - public static LinearRing createLinearRing(PointSequence sequence) { + public static LinearRing createLinearRing(DataPoints sequence) { return new DefaultLinearRing(sequence); } @@ -119,7 +119,7 @@ public final class GeometryFactory extends org.apache.sis.geometry.wrapper.Geome return new DefaultTriangle(exterior); } - public static MultiPoint createMultiPoint(PointSequence sequence) { + public static MultiPoint createMultiPoint(DataPoints sequence) { return new DefaultMultiPoint(sequence); } @@ -192,7 +192,7 @@ public final class GeometryFactory extends org.apache.sis.geometry.wrapper.Geome return new DefaultCompoundCurve(crs, curves); } - public static CircularString createCircularString(PointSequence sequence) { + public static CircularString createCircularString(DataPoints sequence) { return new DefaultCircularString(sequence); } @@ -220,7 +220,7 @@ public final class GeometryFactory extends org.apache.sis.geometry.wrapper.Geome * @param bulge distance from the midpoint of the chord to the arc, along {@code normal}. * @param normal direction the arc bulges towards, perpendicular to the chord. */ - public static ArcByBulge createArcByBulge(PointSequence points, double bulge, Vector<?> normal) { + public static ArcByBulge createArcByBulge(DataPoints points, double bulge, Vector<?> normal) { return new DefaultArcByBulge(points, bulge, normal); } @@ -272,12 +272,12 @@ public final class GeometryFactory extends org.apache.sis.geometry.wrapper.Geome return new DefaultReversedSurface(base); } - public static PointSequence createSequence(Array positions) { + public static DataPoints createSequence(Array positions) { return createSequence(Collections.singletonMap(AttributesType.ATT_POSITION, positions)); } - public static PointSequence createSequence(Map<String, Array> attributes) { - return new ArraySequence(attributes); + public static DataPoints createSequence(Map<String, Array> attributes) { + return new ArrayDataPoints(attributes); } // //////////////////////////////////////////////////////////////////////// @@ -362,21 +362,21 @@ public final class GeometryFactory extends org.apache.sis.geometry.wrapper.Geome @Override public Point createPoint(boolean isFloat, Dimensions dimensions, DoubleBuffer coordinates) { - final ArraySequence points; + final ArrayDataPoints points; if (!dimensions.hasZ) { final SampleSystem ss = SampleSystem.ofSize(2); if (isFloat) { - points = new ArraySequence(NDArrays.of(ss, (float) coordinates.get(0), (float) coordinates.get(1))); + points = new ArrayDataPoints(NDArrays.of(ss, (float) coordinates.get(0), (float) coordinates.get(1))); } else { - points = new ArraySequence(NDArrays.of(ss, coordinates.get(0), coordinates.get(1))); + points = new ArrayDataPoints(NDArrays.of(ss, coordinates.get(0), coordinates.get(1))); } } else { final SampleSystem ss = SampleSystem.ofSize(3); if (isFloat) { - points = new ArraySequence(NDArrays.of(ss, (float) coordinates.get(0), (float) coordinates.get(1), (float) coordinates.get(2))); + points = new ArrayDataPoints(NDArrays.of(ss, (float) coordinates.get(0), (float) coordinates.get(1), (float) coordinates.get(2))); } else { - points = new ArraySequence(NDArrays.of(ss, coordinates.get(0), coordinates.get(1), coordinates.get(2))); + points = new ArrayDataPoints(NDArrays.of(ss, coordinates.get(0), coordinates.get(1), coordinates.get(2))); } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryVisitor.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryVisitor.java index 4e2bccf616..fb59c93d19 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryVisitor.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryVisitor.java @@ -120,7 +120,7 @@ public class GeometryVisitor { } } - public void visit(PointSequence sequence) { + public void visit(DataPoints sequence) { for (int i = 0, n = sequence.size(); i < n; i++) { visit(sequence.getPoint(i)); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LineString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LineString.java index ef1abdadd5..4553a59472 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LineString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LineString.java @@ -108,7 +108,7 @@ public interface LineString extends Curve { @Override default Envelope getEnvelope() { - PointSequence points = getDataPoints(); + DataPoints points = getDataPoints(); if (points.isEmpty()) { return null; } @@ -118,7 +118,7 @@ public interface LineString extends Curve { @Override default String asText() { final StringBuilder sb = new StringBuilder("LINESTRING ("); - final PointSequence points = getDataPoints(); + 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/LinearRing.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LinearRing.java index 3e281f2087..6653e45315 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LinearRing.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/LinearRing.java @@ -37,7 +37,7 @@ public interface LinearRing extends LineString { @Override default String asText() { final StringBuilder sb = new StringBuilder("LINEARRING ("); - final PointSequence points = getDataPoints(); + final DataPoints points = getDataPoints(); for (int i = 0, n = points.size() ; i < n; i++) { final Tuple pt = points.getPosition(i); if (i > 0) sb.append(','); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiLineString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiLineString.java index 474f9878bb..addf68ed1c 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiLineString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiLineString.java @@ -41,7 +41,7 @@ public interface MultiLineString extends MultiCurve<LineString> { if (k > 0) sb.append(','); sb.append('('); final LineString line = getGeometryN(k); - final PointSequence points = line.getDataPoints(); + final DataPoints points = line.getDataPoints(); for (int i = 0, n = points.size() ; i < n; i++) { final Tuple pos = points.getPosition(i); if (i > 0) sb.append(','); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPoint.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPoint.java index 9e226fb898..13bf30c526 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPoint.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPoint.java @@ -43,8 +43,8 @@ public interface MultiPoint<T extends Point> extends GeometryCollection<T>{ /** * View this multipoint as a point sequence */ - default PointSequence asDataPoints() { - return new PointSequence() { + default DataPoints asDataPoints() { + return new DataPoints() { @Override public CoordinateReferenceSystem getCoordinateReferenceSystem() { return MultiPoint.this.getCoordinateReferenceSystem(); 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 d177155b2e..5e1c3d53d6 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 @@ -56,8 +56,8 @@ public interface Point extends Primitive { /** * View this point as a single point sequence */ - default PointSequence asPointSequence() { - return new PointSequence() { + default DataPoints asDataPoint() { + return new DataPoints() { @Override public CoordinateReferenceSystem getCoordinateReferenceSystem() { return Point.this.getCoordinateReferenceSystem(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PreparedTIN.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PreparedTIN.java index d1b1c7f33b..856943ae5b 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PreparedTIN.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/PreparedTIN.java @@ -341,7 +341,7 @@ public interface PreparedTIN extends TIN { final Iterator<Triangle> iterator = triangles.iterator(); while (iterator.hasNext()) { final Triangle triangle = iterator.next(); - final PointSequence points = triangle.getExteriorRing().getDataPoints(); + final DataPoints points = triangle.getExteriorRing().getDataPoints(); final Tuple a = points.getPosition(0); final Tuple b = points.getPosition(1); final Tuple c = points.getPosition(2); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/TIN.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/TIN.java index c70e581062..2ea5c5b47c 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/TIN.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/TIN.java @@ -51,7 +51,7 @@ public interface TIN extends TriangulatedSurface<Triangle> { sb.append(','); } sb.append("(("); - final PointSequence points = triangle.getExteriorRing().getDataPoints(); + final DataPoints points = triangle.getExteriorRing().getDataPoints(); corner = points.getPosition(0); AbstractGeometry.toText(sb, corner); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Triangle.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Triangle.java index 4134b0891d..6bbaddb517 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Triangle.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Triangle.java @@ -72,7 +72,7 @@ public interface Triangle extends Polygon { @Override default Envelope getEnvelope() { - final PointSequence exterior = getExteriorRing().getDataPoints(); + final DataPoints exterior = getExteriorRing().getDataPoints(); final Tuple<?> first = exterior.getPosition(0); final BBox env = new BBox(first, first); env.add(exterior.getPosition(1)); @@ -83,7 +83,7 @@ public interface Triangle extends Polygon { @Override default double getArea() { - final PointSequence points = getExteriorRing().getDataPoints(); + final DataPoints points = getExteriorRing().getDataPoints(); final Tuple<?> a = points.getPosition(0); final Tuple<?> b = points.getPosition(1); final Tuple<?> c = points.getPosition(2); @@ -101,7 +101,7 @@ public interface Triangle extends Polygon { * @return point distance to triangle */ default double distance(Tuple pt) { - final PointSequence exterior = getExteriorRing().getDataPoints(); + final DataPoints exterior = getExteriorRing().getDataPoints(); final Tuple<?> p0 = exterior.getPosition(0); final Tuple<?> p1 = exterior.getPosition(1); final Tuple<?> p2 = exterior.getPosition(2); @@ -214,7 +214,7 @@ public interface Triangle extends Polygon { @Override default String asText() { - final PointSequence exterior = getExteriorRing().getDataPoints(); + final DataPoints exterior = getExteriorRing().getDataPoints(); final StringBuilder sb = new StringBuilder("TRIANGLE (("); AbstractGeometry.toText(sb, exterior.getPosition(0)); sb.append(','); @@ -265,7 +265,7 @@ public interface Triangle extends Polygon { @Override public Tuple getPosition() { - final PointSequence points = triangle.getExteriorRing().getDataPoints(); + final DataPoints points = triangle.getExteriorRing().getDataPoints(); switch (cornerIdx) { case -1 : return interpolate( @@ -286,7 +286,7 @@ public interface Triangle extends Polygon { */ @Override public Tuple getAttribute(String name) { - final PointSequence points = triangle.getExteriorRing().getDataPoints(); + final DataPoints points = triangle.getExteriorRing().getDataPoints(); switch (cornerIdx) { case -1 : return interpolate( diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Wrapper.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Wrapper.java index 3b73d4f1d4..3c866e2e87 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Wrapper.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Wrapper.java @@ -32,7 +32,7 @@ import org.opengis.filter.SpatialOperatorName; import org.opengis.filter.DistanceOperatorName; import org.apache.sis.filter.sqlmm.SQLMM; import org.apache.sis.geometries.math.Tuple; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometry.GeneralEnvelope; import org.apache.sis.geometry.wrapper.Geometries; import org.apache.sis.geometry.wrapper.GeometryType; @@ -308,7 +308,7 @@ public final class Wrapper extends GeometryWrapper { /** * View SIS Geometry as a JTS Geometry. * Only the matching JTS geometry types are supported. - * The created geometry references the original geometry PointSequences, so modifications + * The created geometry references the original geometry DataPoints, so modifications * are forwarded to the original but all metadata change, like the CRS, will not be preserved if changed * after the JTS view has been made. * @@ -322,7 +322,7 @@ public final class Wrapper extends GeometryWrapper { /** * View SIS Geometry as a JTS Geometry. * Only the matching JTS geometry types are supported. - * The created geometry references the original geometry PointSequences, so modifications + * The created geometry references the original geometry DataPoints, so modifications * are forwarded to the original but all metadata change, like the CRS, will not be preserved if changed * after the JTS view has been made. * @@ -335,7 +335,7 @@ public final class Wrapper extends GeometryWrapper { final org.locationtech.jts.geom.Geometry jts; if (geometry instanceof Point cdt){ - jts = gf.createPoint(new JTSSequence(cdt.asPointSequence())); + jts = gf.createPoint(new JTSSequence(cdt.asDataPoint())); } else if (geometry instanceof LinearRing cdt) { jts = gf.createLinearRing(new JTSSequence(cdt.getDataPoints())); } else if (geometry instanceof LineString cdt) { @@ -375,13 +375,13 @@ public final class Wrapper extends GeometryWrapper { return jts; } /** - * Decorate a PointSequence as a JTS CoordinateSequence + * Decorate a DataPoint as a JTS CoordinateSequence */ private static class JTSSequence implements CoordinateSequence { - private final PointSequence ps; + private final DataPoints ps; - public JTSSequence(PointSequence ps) { + public JTSSequence(DataPoints ps) { this.ps = ps; } @@ -455,7 +455,7 @@ public final class Wrapper extends GeometryWrapper { @Override public CoordinateSequence copy() { - final PointSequence cp = new ArraySequence(ps.getAttributeArray(AttributesType.ATT_POSITION)); + final DataPoints cp = new ArrayDataPoints(ps.getAttributeArray(AttributesType.ATT_POSITION)); return new JTSSequence(cp); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/JTSAdapter.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/JTSAdapter.java index eaf95556e9..2ba71918ab 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/JTSAdapter.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/JTSAdapter.java @@ -30,7 +30,7 @@ import org.apache.sis.geometries.math.Vector; import org.apache.sis.geometries.math.Vectors; import org.apache.sis.geometries.math.Cursor; import org.apache.sis.geometries.math.Array; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.locationtech.jts.geom.CoordinateXY; @@ -62,16 +62,16 @@ public final class JTSAdapter { if (jts == null) { return null; } else if (jts instanceof org.locationtech.jts.geom.Point cdt) { - return GeometryFactory.createPoint(toPointSequence(cdt.getCoordinateSequence(), crs, copy)); + return GeometryFactory.createPoint(toDataPoints(cdt.getCoordinateSequence(), crs, copy)); } else if (jts instanceof org.locationtech.jts.geom.MultiPoint cdt) { - return GeometryFactory.createMultiPoint(toPointSequence(jts.getFactory().getCoordinateSequenceFactory().create(cdt.getCoordinates()), crs, copy)); + return GeometryFactory.createMultiPoint(toDataPoints(jts.getFactory().getCoordinateSequenceFactory().create(cdt.getCoordinates()), crs, copy)); } else if (jts instanceof org.locationtech.jts.geom.LinearRing cdt) { - return GeometryFactory.createLinearRing(toPointSequence(cdt.getCoordinateSequence(), crs, copy)); + return GeometryFactory.createLinearRing(toDataPoints(cdt.getCoordinateSequence(), crs, copy)); } else if (jts instanceof org.locationtech.jts.geom.LineString cdt) { - return GeometryFactory.createLineString(toPointSequence(cdt.getCoordinateSequence(), crs, copy)); + return GeometryFactory.createLineString(toDataPoints(cdt.getCoordinateSequence(), crs, copy)); } else if (jts instanceof org.locationtech.jts.geom.MultiLineString cdt) { final LineString[] strings = new LineString[cdt.getNumGeometries()]; @@ -119,7 +119,7 @@ public final class JTSAdapter { if (geom == null) { return null; } else if (geom instanceof Point cdt) { - final CoordinateSequence cs = toCoordinateSequence(cdt.asPointSequence(), copy, gf); + final CoordinateSequence cs = toCoordinateSequence(cdt.asDataPoint(), copy, gf); jts = new org.locationtech.jts.geom.Point(cs, gf); } else if (geom instanceof MultiPoint cdt) { final CoordinateSequence cs = toCoordinateSequence(cdt.asDataPoints(), copy, gf); @@ -165,10 +165,10 @@ public final class JTSAdapter { } /** - * Convert JTS coordinate sequence to SIS PointSequence. + * Convert JTS coordinate sequence to SIS DataPoints. * @param copy if true create a copy of the coordinate sequence, otherwise create a view */ - private static PointSequence toPointSequence(CoordinateSequence cs, CoordinateReferenceSystem crs, boolean copy) { + private static DataPoints toDataPoints(CoordinateSequence cs, CoordinateReferenceSystem crs, boolean copy) { final int size = cs.size(); final int dimension = crs.getCoordinateSystem().getDimension(); @@ -186,13 +186,13 @@ public final class JTSAdapter { } i++; } - return new ArraySequence(positions); + return new ArrayDataPoints(positions); } else { - return new JTSSequence(cs, crs); + return new JTSDataPoints(cs, crs); } } - private static CoordinateSequence toCoordinateSequence(PointSequence ps, boolean copy, org.locationtech.jts.geom.GeometryFactory gf) { + private static CoordinateSequence toCoordinateSequence(DataPoints ps, boolean copy, org.locationtech.jts.geom.GeometryFactory gf) { final CoordinateReferenceSystem crs = ps.getCoordinateReferenceSystem(); final int dimension = ps.getDimension(); if (copy) { @@ -211,14 +211,14 @@ public final class JTSAdapter { } } - private static class JTSSequence implements PointSequence { + private static class JTSDataPoints implements DataPoints { private final CoordinateSequence jts; private final CoordinateReferenceSystem crs; private final int dim; private final AttributesType type; - private JTSSequence(CoordinateSequence jts, CoordinateReferenceSystem crs) { + private JTSDataPoints(CoordinateSequence jts, CoordinateReferenceSystem crs) { this.jts = jts; this.crs = crs; this.dim = jts.getDimension(); @@ -293,10 +293,10 @@ public final class JTSAdapter { */ private static class JTSPoint implements Point { - private final JTSSequence parent; + private final JTSDataPoints parent; private final int index; - public JTSPoint(JTSSequence geometry, int index) { + public JTSPoint(JTSDataPoints geometry, int index) { this.parent = geometry; this.index = index; } @@ -346,9 +346,9 @@ public final class JTSAdapter { private static class SISSequence implements CoordinateSequence { - private final PointSequence points; + private final DataPoints points; - public SISSequence(PointSequence points) { + public SISSequence(DataPoints points) { this.points = points; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/PathIteratorAdapter.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/PathIteratorAdapter.java index 93fb55d4c7..b0bdad4b9f 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/PathIteratorAdapter.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/PathIteratorAdapter.java @@ -25,11 +25,11 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryCollection; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.util.Classes; import org.apache.sis.util.resources.Errors; +import org.apache.sis.geometries.DataPoints; /** @@ -49,13 +49,13 @@ final class PathIteratorAdapter implements PathIterator { /** * Provider of point sequences. */ - private final Iterator<PointSequence> sequences; + private final Iterator<DataPoints> sequences; /** * The sequence of point tuples to return, * or {@code null} if the iteration is finished. */ - private PointSequence coordinates; + private DataPoints coordinates; /** * Number of points to return in the sequence. @@ -175,12 +175,12 @@ final class PathIteratorAdapter implements PathIterator { * @param geometry the geometry for which to get coordinate sequences. * @return coordinate sequences over the given geometry. */ - private static Iterator<PointSequence> iterator(final Geometry geometry) { - final Collection<PointSequence> sequences; + private static Iterator<DataPoints> iterator(final Geometry geometry) { + final Collection<DataPoints> sequences; if (geometry instanceof LineString) { sequences = List.of(((LineString) geometry).getDataPoints()); } else if (geometry instanceof Point) { - sequences = List.of(((Point) geometry).asPointSequence()); + sequences = List.of(((Point) geometry).asDataPoint()); } else if (geometry instanceof Polygon) { return new RingIterator((Polygon) geometry); } else if (geometry instanceof GeometryCollection) { @@ -196,7 +196,7 @@ final class PathIteratorAdapter implements PathIterator { * The first coordinate sequence is the exterior ring and * all other sequences are interior rings. */ - private static final class RingIterator implements Iterator<PointSequence> { + private static final class RingIterator implements Iterator<DataPoints> { /** The polygon for which to return rings. */ private final Polygon polygon; @@ -215,7 +215,7 @@ final class PathIteratorAdapter implements PathIterator { } /** Returns the coordinate sequence of the next ring. */ - @Override public PointSequence next() { + @Override public DataPoints next() { final LineString current; if (interior < 0) { current = polygon.getExteriorRing(); @@ -230,7 +230,7 @@ final class PathIteratorAdapter implements PathIterator { /** * An iterator over the coordinate sequences of a geometry collection. */ - private static final class GeomIterator implements Iterator<PointSequence> { + private static final class GeomIterator implements Iterator<DataPoints> { /** The collection for which to return geometries. */ private final GeometryCollection collection; @@ -238,7 +238,7 @@ final class PathIteratorAdapter implements PathIterator { private int index; /** Coordinate sequences of the current geometry. */ - private Iterator<PointSequence> current; + private Iterator<DataPoints> current; /** Created a new iterator for the given collection. */ GeomIterator(final GeometryCollection collection) { @@ -262,7 +262,7 @@ final class PathIteratorAdapter implements PathIterator { } /** Returns the coordinate sequence of the next geometry. */ - @Override public PointSequence next() { + @Override public DataPoints next() { return current.next(); } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeAdapter.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeAdapter.java index c34fb3a600..f712e2871b 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeAdapter.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeAdapter.java @@ -27,8 +27,7 @@ import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.math.Array; import org.apache.sis.geometries.math.DataType; import org.apache.sis.geometries.math.NDArrays; @@ -37,6 +36,7 @@ import org.apache.sis.geometry.wrapper.j2d.EmptyShape; import org.apache.sis.referencing.internal.shared.AbstractShape; import org.apache.sis.referencing.internal.shared.IntervalRectangle; import org.opengis.geometry.Envelope; +import org.apache.sis.geometries.DataPoints; /** @@ -154,7 +154,7 @@ public final class ShapeAdapter extends AbstractShape { xmax, ymin, xmin, ymin }); - final PointSequence ps = new ArraySequence(positions); + final DataPoints ps = new ArrayDataPoints(positions); final LinearRing ring = GeometryFactory.createLinearRing(ps); return GeometryFactory.createPolygon(ring, null); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeConverter.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeConverter.java index 7546d296a1..a1eaf7622d 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeConverter.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/ShapeConverter.java @@ -27,13 +27,13 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Surface; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.math.Array; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.referencing.internal.shared.AbstractShape; +import org.apache.sis.geometries.DataPoints; /** @@ -154,13 +154,13 @@ public abstract class ShapeConverter { } /** Returns a copy of current coordinate values as a SIS coordinate sequence. */ - @Override PointSequence toSequence(final boolean close) { + @Override DataPoints toSequence(final boolean close) { if (close && !Arrays.equals(buffer, 0, 2, buffer, length - 2, length)) { addPoint(buffer); } final Array array = NDArrays.of(SampleSystem.cartesian(2), Arrays.copyOf(buffer, length)); - return new ArraySequence(array); + return new ArrayDataPoints(array); } } @@ -202,12 +202,12 @@ public abstract class ShapeConverter { } /** Returns a copy of current coordinate values as a SIS coordinate sequence. */ - @Override PointSequence toSequence(final boolean close) { + @Override DataPoints toSequence(final boolean close) { if (close && !Arrays.equals(buffer, 0, 2, buffer, length - 2, length)) { addPoint(buffer); } final Array array = NDArrays.of(SampleSystem.cartesian(2), Arrays.copyOf(buffer, length)); - return new ArraySequence(array); + return new ArrayDataPoints(array); } } @@ -231,7 +231,7 @@ public abstract class ShapeConverter { * @param close whether to ensure that the first point is repeated as the last point. * @return a SIS coordinate sequence containing a copy of current coordinate values. */ - abstract PointSequence toSequence(boolean close); + abstract DataPoints toSequence(boolean close); /** * Iterates over all coordinates given by the {@link #iterator} and stores them in a SIS geometry. diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Arc.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Arc.java index 95b18f3891..5a66f80ca3 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Arc.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Arc.java @@ -17,11 +17,11 @@ package org.apache.sis.geometries.conics; import java.util.List; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Array; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.apache.sis.geometries.math.Vector; +import org.apache.sis.geometries.DataPoints; /** @@ -40,7 +40,7 @@ public interface Arc extends Conic { @UML(identifier="dataPoints", specification=ISO_19107) // section 7.9.2.4 @Override - PointSequence getDataPoints(); + DataPoints getDataPoints(); @UML(identifier="radius", specification=ISO_19107) // section 7.9.2.5 List<Vector> getRadius(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java index d3d1530ed1..9d288ae7d2 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/CircularString.java @@ -21,8 +21,8 @@ import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Array; +import org.apache.sis.geometries.DataPoints; /** @@ -67,7 +67,7 @@ public interface CircularString extends Curve { * @return the control points, never null. Its size is odd and at least 3, or 0 if empty. */ @Override - PointSequence getDataPoints(); + DataPoints getDataPoints(); /** * @return null, a CircularString has no control points @@ -109,7 +109,7 @@ public interface CircularString extends Curve { @Override default boolean isClosed() { - final PointSequence points = getDataPoints(); + final DataPoints points = getDataPoints(); final int size = points.size(); if (size == 0) { return false; diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Conic.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Conic.java index f7275e7923..0fd7603870 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Conic.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/conics/Conic.java @@ -19,8 +19,8 @@ package org.apache.sis.geometries.conics; import static org.opengis.annotation.Specification.ISO_19107; import org.opengis.annotation.UML; import org.apache.sis.geometries.Curve; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Array; +import org.apache.sis.geometries.DataPoints; /** @@ -32,7 +32,7 @@ public interface Conic extends Curve { @UML(identifier="dataPoints", specification=ISO_19107) // section 7.9.5.2 @Override - PointSequence getDataPoints(); + DataPoints getDataPoints(); @UML(identifier="controlPoints", specification=ISO_19107) // section 7.9.5.2 @Override 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 80d08a36a2..2c8f980769 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 @@ -21,9 +21,9 @@ import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Array; import org.apache.sis.geometries.math.Vector; +import org.apache.sis.geometries.DataPoints; /** @@ -55,7 +55,7 @@ public interface ArcByBulge extends Curve { * @return the start and end points, never null and always of size 2. */ @Override - PointSequence getDataPoints(); + DataPoints getDataPoints(); /** * Returns the distance from the midpoint of the chord joining the two end points to the arc, 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 ed9bcfaa9a..1f37ad75af 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,8 +22,8 @@ import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Array; +import org.apache.sis.geometries.DataPoints; /** @@ -104,7 +104,7 @@ public interface ArcByCenterPoint extends Curve { } @Override - public default PointSequence getDataPoints() { + public default DataPoints getDataPoints() { throw new UnsupportedOperationException("Not supported yet"); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/AbstractGeometry.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/AbstractGeometry.java index d765953328..8ce0480fd7 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/AbstractGeometry.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/AbstractGeometry.java @@ -19,12 +19,12 @@ package org.apache.sis.geometries.internal.shared; import java.util.HashMap; import java.util.Map; import org.apache.sis.geometries.Geometry; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.Cursor; import org.apache.sis.geometries.math.Array; import org.apache.sis.geometry.GeneralEnvelope; import org.opengis.geometry.Envelope; +import org.apache.sis.geometries.DataPoints; /** @@ -69,7 +69,7 @@ public abstract class AbstractGeometry implements Geometry { } } - public static void toText(StringBuilder sb, PointSequence array) { + public static void toText(StringBuilder sb, DataPoints array) { final int size = array.size(); if (size == 0) return; diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArraySequence.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java similarity index 94% rename from incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArraySequence.java rename to incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java index a7ab7bd092..77cabddb79 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArraySequence.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java @@ -21,12 +21,10 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.opengis.geometry.Envelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.BBox; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.geometries.math.DataType; import org.apache.sis.geometries.math.Tuple; @@ -34,22 +32,23 @@ import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.Cursor; import org.apache.sis.geometries.math.Array; import org.apache.sis.util.ArgumentChecks; +import org.apache.sis.geometries.DataPoints; /** * * @author Johann Sorel (Geomatys) */ -public final class ArraySequence implements PointSequence, AttributesType { +public final class ArrayDataPoints implements DataPoints, AttributesType { private Array positions; private final Map<String,Array> attributes = new HashMap<>(1); - public ArraySequence(Array positions) { + public ArrayDataPoints(Array positions) { this(Collections.singletonMap(AttributesType.ATT_POSITION, positions)); } - public ArraySequence(Map<String, Array> attributes) { + public ArrayDataPoints(Map<String, Array> attributes) { this.attributes.putAll(attributes); this.positions = attributes.get(AttributesType.ATT_POSITION); ArgumentChecks.ensureNonNull("positions", this.positions); @@ -167,10 +166,10 @@ public final class ArraySequence implements PointSequence, AttributesType { */ public static class Indexed implements Point { - private final ArraySequence parent; + private final ArrayDataPoints parent; private final int index; - public Indexed(ArraySequence geometry, int index) { + public Indexed(ArrayDataPoints geometry, int index) { this.parent = geometry; this.index = index; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultArcByBulge.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultArcByBulge.java index 54f09dc058..4a26fb49eb 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultArcByBulge.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultArcByBulge.java @@ -17,9 +17,9 @@ package org.apache.sis.geometries.internal.shared; import org.opengis.geometry.Envelope; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.curve.ArcByBulge; import org.apache.sis.geometries.math.Vector; +import org.apache.sis.geometries.DataPoints; /** @@ -28,7 +28,7 @@ import org.apache.sis.geometries.math.Vector; */ public class DefaultArcByBulge extends AbstractGeometry implements ArcByBulge { - private final PointSequence points; + private final DataPoints points; private final double bulge; private final Vector<?> normal; @@ -41,7 +41,7 @@ public class DefaultArcByBulge extends AbstractGeometry implements ArcByBulge { * @throws IllegalArgumentException if the number of points is not 2, if the bulge is not a * real number, or if no normal is given. */ - public DefaultArcByBulge(final PointSequence points, final double bulge, final Vector<?> normal) { + public DefaultArcByBulge(final DataPoints points, final double bulge, final Vector<?> normal) { if (points == null || points.size() != 2) { throw new IllegalArgumentException("An arc by bulge is defined by exactly 2 points" + " (its start and its end), but got " + ((points != null) ? points.size() : 0) + '.'); @@ -59,7 +59,7 @@ public class DefaultArcByBulge extends AbstractGeometry implements ArcByBulge { } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { return points; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCircularString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCircularString.java index 04fd89e57f..070e3587a5 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCircularString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCircularString.java @@ -16,9 +16,9 @@ */ package org.apache.sis.geometries.internal.shared; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.conics.CircularString; import org.opengis.geometry.Envelope; +import org.apache.sis.geometries.DataPoints; /** * A curve made of circular arcs, each defined by three of the control points. @@ -27,7 +27,7 @@ import org.opengis.geometry.Envelope; */ public class DefaultCircularString extends AbstractGeometry implements CircularString { - private final PointSequence points; + private final DataPoints points; /** * Creates a circular string from the given control points. @@ -36,7 +36,7 @@ public class DefaultCircularString extends AbstractGeometry implements CircularS * point. Its size must be odd and at least 3, or 0 for an empty circular string. * @throws IllegalArgumentException if the number of points cannot describe a whole number of arcs. */ - public DefaultCircularString(PointSequence points) { + public DefaultCircularString(DataPoints points) { final int size = points.size(); if (size != 0 && (size < 3 || (size % 2) == 0)) { throw new IllegalArgumentException("A circular string needs an odd number of at least 3 points " @@ -46,7 +46,7 @@ public class DefaultCircularString extends AbstractGeometry implements CircularS } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { return points; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCompoundCurve.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCompoundCurve.java index 02fd790bc0..1a743fe4ec 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCompoundCurve.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultCompoundCurve.java @@ -21,8 +21,8 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.CompoundCurve; import org.apache.sis.geometries.Curve; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Array; +import org.apache.sis.geometries.DataPoints; /** @@ -112,7 +112,7 @@ public class DefaultCompoundCurve extends AbstractGeometry implements CompoundCu } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { throw new UnsupportedOperationException("Not supported yet."); } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPointSequence.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultDataPoints.java similarity index 90% rename from incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPointSequence.java rename to incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultDataPoints.java index 9c8ba267f4..1fe84eb74d 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPointSequence.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultDataPoints.java @@ -21,28 +21,28 @@ import java.util.List; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.util.ArgumentChecks; +import org.apache.sis.geometries.DataPoints; /** - * Point sequence backed by a list of Point. + * Datas points backed by a list of Point. * @author Johann Sorel (Geomatys) */ -public final class DefaultPointSequence implements PointSequence { +public final class DefaultDataPoints implements DataPoints { private final List<Point> points; /** * @param points list will be used directly. */ - public DefaultPointSequence(List<Point> points) { + public DefaultDataPoints(List<Point> points) { ArgumentChecks.ensureNonEmpty("points", points); this.points = points; } - public DefaultPointSequence(Point... points) { + public DefaultDataPoints(Point... points) { this(Arrays.asList(points)); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java index 4edcf32b76..4ba9337abc 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLineString.java @@ -17,7 +17,7 @@ package org.apache.sis.geometries.internal.shared; import org.apache.sis.geometries.LineString; -import org.apache.sis.geometries.PointSequence; +import org.apache.sis.geometries.DataPoints; /** @@ -26,9 +26,9 @@ import org.apache.sis.geometries.PointSequence; */ public class DefaultLineString extends AbstractGeometry implements LineString { - private final PointSequence points; + private final DataPoints points; - public DefaultLineString(PointSequence points) { + public DefaultLineString(DataPoints points) { this.points = points; } @@ -38,7 +38,7 @@ public class DefaultLineString extends AbstractGeometry implements LineString { } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { return points; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLinearRing.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLinearRing.java index e93b9badff..139592ade9 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLinearRing.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultLinearRing.java @@ -17,7 +17,7 @@ package org.apache.sis.geometries.internal.shared; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; +import org.apache.sis.geometries.DataPoints; /** @@ -27,7 +27,7 @@ import org.apache.sis.geometries.PointSequence; */ public class DefaultLinearRing extends DefaultLineString implements LinearRing{ - public DefaultLinearRing(PointSequence points) { + public DefaultLinearRing(DataPoints points) { super(points); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultMultiPoint.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultMultiPoint.java index ec3ab6f861..3615896438 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultMultiPoint.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultMultiPoint.java @@ -21,7 +21,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; +import org.apache.sis.geometries.DataPoints; /** @@ -30,9 +30,9 @@ import org.apache.sis.geometries.PointSequence; */ public class DefaultMultiPoint extends AbstractGeometry implements MultiPoint<Point> { - private final PointSequence points; + private final DataPoints points; - public DefaultMultiPoint(PointSequence points) { + public DefaultMultiPoint(DataPoints points) { this.points = points; } @@ -67,7 +67,7 @@ public class DefaultMultiPoint extends AbstractGeometry implements MultiPoint<Po } @Override - public PointSequence asDataPoints() { + public DataPoints asDataPoints() { return points; } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPoint.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPoint.java index c4b56b87fd..6e1d19b8ae 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPoint.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultPoint.java @@ -20,11 +20,11 @@ import java.util.Objects; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.geometries.math.DataType; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.NDArrays; +import org.apache.sis.geometries.DataPoints; /** @@ -34,29 +34,29 @@ import org.apache.sis.geometries.math.NDArrays; */ public class DefaultPoint extends AbstractGeometry implements Point { - private final PointSequence points; + private final DataPoints points; /** * @param crs geometry coordinate system, not null. */ public DefaultPoint(CoordinateReferenceSystem crs) { - points = new ArraySequence(NDArrays.of(SampleSystem.of(crs), DataType.DOUBLE, 1)); + points = new ArrayDataPoints(NDArrays.of(SampleSystem.of(crs), DataType.DOUBLE, 1)); } public DefaultPoint(Tuple position) { - points = new ArraySequence(NDArrays.of(position.getSampleSystem(), position.getDataType(), 1)); + points = new ArrayDataPoints(NDArrays.of(position.getSampleSystem(), position.getDataType(), 1)); points.setPosition(0, position); } public DefaultPoint(CoordinateReferenceSystem crs, double... position) { - points = new ArraySequence(NDArrays.of(crs, position)); + points = new ArrayDataPoints(NDArrays.of(crs, position)); } public DefaultPoint(SampleSystem ss, double... position) { - points = new ArraySequence(NDArrays.of(ss, position)); + points = new ArrayDataPoints(NDArrays.of(ss, position)); } - public DefaultPoint(PointSequence ps) { + public DefaultPoint(DataPoints ps) { if (ps.size() != 1) { throw new IllegalArgumentException("Point sequence must contain one point"); } @@ -64,7 +64,7 @@ public class DefaultPoint extends AbstractGeometry implements Point { } @Override - public PointSequence asPointSequence() { + public DataPoints asDataPoint() { return points; } 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 8691a0bcb2..bbce828cff 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 @@ -24,9 +24,9 @@ import org.apache.sis.geometries.Curve; import org.apache.sis.geometries.CurveInterpolation; import org.apache.sis.geometries.Orientable; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Primitive; import org.apache.sis.geometries.math.Array; +import org.apache.sis.geometries.DataPoints; /** @@ -138,7 +138,7 @@ public class DefaultReversedCurve extends AbstractGeometry implements Curve { } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { return base.getDataPoints(); } } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultTriangle.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultTriangle.java index ecd8900166..c2d1a55e59 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultTriangle.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultTriangle.java @@ -18,8 +18,8 @@ package org.apache.sis.geometries.internal.shared; import java.util.Objects; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; +import org.apache.sis.geometries.DataPoints; /** @@ -34,7 +34,7 @@ public class DefaultTriangle extends DefaultPolygon implements Triangle { */ public DefaultTriangle(LinearRing exterior) { super(exterior); - final PointSequence points = exterior.getDataPoints(); + final DataPoints points = exterior.getDataPoints(); final int size = points.size(); switch (size) { case 0: //empty triangle 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 328bd23280..5f66b7c1f0 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 @@ -41,7 +41,6 @@ import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.MultiLineString; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.TIN; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.math.DataType; @@ -58,6 +57,7 @@ import org.apache.sis.geometries.math.Array; import org.apache.sis.geometry.GeneralEnvelope; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.collection.Containers; +import org.apache.sis.geometries.DataPoints; /** @@ -794,7 +794,7 @@ public interface MeshPrimitive extends Geometry { @Override protected void visit(Triangle candidate) { - final PointSequence points = candidate.getExteriorRing().getDataPoints(); + final DataPoints points = candidate.getExteriorRing().getDataPoints(); long idx0 = ((MeshPrimitive.Vertex)points.getPoint(0)).getIndex(); long idx1 = ((MeshPrimitive.Vertex)points.getPoint(1)).getIndex(); long idx2 = ((MeshPrimitive.Vertex)points.getPoint(2)).getIndex(); @@ -828,7 +828,7 @@ public interface MeshPrimitive extends Geometry { @Override protected void visit(LineString candidate) { - final PointSequence points = candidate.getDataPoints(); + final DataPoints points = candidate.getDataPoints(); long idx0 = ((MeshPrimitive.Vertex)points.getPoint(0)).getIndex(); long idx1 = ((MeshPrimitive.Vertex)points.getPoint(1)).getIndex(); positions.get(idx0, pos0); @@ -1051,7 +1051,7 @@ public interface MeshPrimitive extends Geometry { } } - public static final class Sequence implements PointSequence { + public static final class Sequence implements DataPoints { private final Abs primitive; public final int[] index; @@ -1159,7 +1159,7 @@ public interface MeshPrimitive extends Geometry { } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { //select all points, duplicate first point as last int[] indices; if (index == null) { @@ -1181,7 +1181,7 @@ public interface MeshPrimitive extends Geometry { } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { final int[] indices; if (index == null) { indices = new int[Math.toIntExact(getPositions().getLength())]; diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java index 622f28f802..56713299af 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java @@ -24,12 +24,12 @@ import java.util.Objects; import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.Array; import org.apache.sis.referencing.CRS; +import org.apache.sis.geometries.DataPoints; /** @@ -254,12 +254,12 @@ public final class MeshPrimitiveComparator { private static boolean isDegenerated(Object candidate) { if (candidate instanceof LineString) { final LineString cdt = (LineString) candidate; - final PointSequence points = cdt.getDataPoints(); + final DataPoints points = cdt.getDataPoints(); return points.getPosition(0).equals(points.getPosition(1)); } else if (candidate instanceof Triangle) { final Triangle cdt = (Triangle) candidate; - final PointSequence points = cdt.getExteriorRing().getDataPoints(); + final DataPoints points = cdt.getExteriorRing().getDataPoints(); final Tuple c0 = points.getPosition(0); final Tuple c1 = points.getPosition(1); final Tuple c2 = points.getPosition(2); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java index 80361048ce..6cd423c814 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java @@ -21,12 +21,12 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.Cursor; import org.apache.sis.geometries.math.Array; import org.apache.sis.util.ArgumentChecks; +import org.apache.sis.geometries.DataPoints; /** @@ -204,7 +204,7 @@ public abstract class MeshPrimitiveVisitor { * Override this method to process a triangle. */ protected void visit(Triangle candidate) { - final PointSequence points = candidate.getExteriorRing().getDataPoints(); + final DataPoints points = candidate.getExteriorRing().getDataPoints(); visit((MeshPrimitive.Vertex) points.getPoint(0)); visit((MeshPrimitive.Vertex) points.getPoint(1)); visit((MeshPrimitive.Vertex) points.getPoint(2)); @@ -214,7 +214,7 @@ public abstract class MeshPrimitiveVisitor { * Override this method to process a line. */ protected void visit(LineString candidate) { - final PointSequence points = candidate.getDataPoints(); + final DataPoints points = candidate.getDataPoints(); visit((MeshPrimitive.Vertex) points.getPoint(0)); visit((MeshPrimitive.Vertex) points.getPoint(1)); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Intersection.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Intersection.java index c20a2661c1..8573ae6f55 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Intersection.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Intersection.java @@ -31,7 +31,7 @@ import org.apache.sis.geometries.Point; import org.apache.sis.geometries.PreparedTIN; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.GeometryFactory; -import org.apache.sis.geometries.internal.shared.DefaultPointSequence; +import org.apache.sis.geometries.internal.shared.DefaultDataPoints; import org.apache.sis.geometries.mesh.MultiMeshPrimitive; import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor; import org.apache.sis.geometries.mesh.MeshPrimitive; @@ -182,7 +182,7 @@ public final class Intersection { final double[] bary2 = Triangle.getBarycentricValue2D(x1, y1, x2, y2, x3, y3, p2.get(0), p2.get(1), 0.0, false); final Point point1 = triangle.interpolate(bary1); final Point point2 = triangle.interpolate(bary2); - segments.add(GeometryFactory.createLineString(new DefaultPointSequence(point1, point2))); + segments.add(GeometryFactory.createLineString(new DefaultDataPoints(point1, point2))); } } } catch (TransformException ex) { diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/To3D.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/To3D.java index 2aef6747d7..b974153ad9 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/To3D.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/To3D.java @@ -25,16 +25,16 @@ import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.Cursor; import org.apache.sis.geometries.math.Array; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.referencing.CRS; import org.apache.sis.referencing.CommonCRS; +import org.apache.sis.geometries.DataPoints; /** @@ -52,17 +52,17 @@ public final class To3D { } } - private static ArraySequence copy(PointSequence ps) { + private static ArrayDataPoints copy(DataPoints ps) { final Map<String,Array> attributes = new HashMap<>(); for (String name : ps.getAttributesType().getAttributeNames()) { attributes.put(name, ps.getAttributeArray(name).copy()); } - return new ArraySequence(attributes); + return new ArrayDataPoints(attributes); } - private static ArraySequence to3d(PointSequence base, CoordinateReferenceSystem crs3d, Consumer<Tuple> Zeditor) { + private static ArrayDataPoints to3d(DataPoints base, CoordinateReferenceSystem crs3d, Consumer<Tuple> Zeditor) { - final ArraySequence ps = copy(base); + final ArrayDataPoints ps = copy(base); if (Zeditor == null) { Zeditor = (Tuple t) -> t.set(2, 0.0); @@ -119,7 +119,7 @@ public final class To3D { * Add Z axis to Point. */ public static Point to3D(Point base, CoordinateReferenceSystem crs3d, Consumer<Tuple> zeditor) { - final PointSequence copy3d = to3d(base.asPointSequence(), crs3d, zeditor); + final DataPoints copy3d = to3d(base.asDataPoint(), crs3d, zeditor); return GeometryFactory.createPoint(copy3d); } @@ -127,7 +127,7 @@ public final class To3D { * Add Z axis to LineString. */ public static LineString to3D(LineString base, CoordinateReferenceSystem crs3d, Consumer<Tuple> zeditor) { - final PointSequence copy3d = to3d(base.getDataPoints(), crs3d, zeditor); + final DataPoints copy3d = to3d(base.getDataPoints(), crs3d, zeditor); return GeometryFactory.createLineString(copy3d); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/ToPrimitive.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/ToPrimitive.java index 113bc64288..f42dd656af 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/ToPrimitive.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/ToPrimitive.java @@ -26,14 +26,14 @@ import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.MultiLineString; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.Array; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.mesh.MultiMeshPrimitive; import org.apache.sis.geometries.operation.triangulate.EarClipping; +import org.apache.sis.geometries.DataPoints; /** @@ -44,12 +44,12 @@ public final class ToPrimitive { private ToPrimitive(){} - private static ArraySequence toArraySequence(PointSequence points) { + private static ArrayDataPoints toArraySequence(DataPoints points) { final Map<String,Array> attributes = new HashMap<>(); for (String name : points.getAttributesType().getAttributeNames()) { attributes.put(name, points.getAttributeArray(name)); } - return new ArraySequence(attributes); + return new ArrayDataPoints(attributes); } /** @@ -71,7 +71,7 @@ public final class ToPrimitive { */ public static MeshPrimitive.LineStrip toPrimitive(LineString geometry) throws OperationException { final MeshPrimitive.LineStrip primitive = new MeshPrimitive.LineStrip(); - final ArraySequence array = toArraySequence(geometry.getDataPoints()); + final ArrayDataPoints array = toArraySequence(geometry.getDataPoints()); for (String name : array.getAttributeNames()) { primitive.setAttribute(name, array.getAttribute(name)); } @@ -90,7 +90,7 @@ public final class ToPrimitive { * Transform MultiPoint to Primitive. */ public static MeshPrimitive.Points toPrimitive(MultiPoint geometry) throws OperationException { - final ArraySequence array = toArraySequence(geometry.asDataPoints()); + final ArrayDataPoints array = toArraySequence(geometry.asDataPoints()); final MeshPrimitive.Points primitive = new MeshPrimitive.Points(); for (String name : array.getAttributeNames()) { primitive.setAttribute(name, array.getAttribute(name)); @@ -118,7 +118,7 @@ public final class ToPrimitive { for (int i = 0, k = 0; i < numGeometries; i++, k += 2) { final org.apache.sis.geometries.LineString line = geometry.getGeometryN(i); - final PointSequence points = line.getDataPoints(); + final DataPoints points = line.getDataPoints(); for (String name : attributesType.getAttributeNames()) { Array att = primitive.getAttribute(name); att.set(k, points.getAttribute(0, name)); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Transform.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Transform.java index b0bf221c01..1a6d9834ac 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Transform.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/Transform.java @@ -24,7 +24,6 @@ import org.opengis.referencing.operation.TransformException; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.math.SampleSystem; @@ -32,12 +31,13 @@ import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.Vector; import org.apache.sis.geometries.math.Vectors; import org.apache.sis.geometries.math.Array; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.mesh.MultiMeshPrimitive; import org.apache.sis.referencing.operation.matrix.MatrixSIS; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.MathTransform; +import org.apache.sis.geometries.DataPoints; /** @@ -79,10 +79,10 @@ public final class Transform { public static LinearRing transform(LinearRing r, CoordinateReferenceSystem crs, MathTransform transform) throws OperationException { - PointSequence ps = r.getDataPoints(); + DataPoints ps = r.getDataPoints(); final Array reference = ps.getAttributeArray(AttributesType.ATT_POSITION); final Array positions = transform(reference, crs, transform); - final ArraySequence cp = new ArraySequence(positions); + final ArrayDataPoints cp = new ArrayDataPoints(positions); for (String name : ps.getAttributesType().getAttributeNames()) { if (!AttributesType.ATT_POSITION.equals(name)) { cp.setAttribute(name, ps.getAttributeArray(name).copy()); @@ -186,11 +186,11 @@ public final class Transform { } public static Triangle transform(Triangle p, CoordinateReferenceSystem crs, MathTransform transform) throws OperationException { - final PointSequence ps = p.getExteriorRing().getDataPoints(); + final DataPoints ps = p.getExteriorRing().getDataPoints(); final Array reference = ps.getAttributeArray(AttributesType.ATT_POSITION); final Array positions = transform(reference, crs, transform); - final ArraySequence cp = new ArraySequence(positions); + final ArrayDataPoints cp = new ArrayDataPoints(positions); for (String name : ps.getAttributesType().getAttributeNames()) { if (!AttributesType.ATT_POSITION.equals(name)) { cp.setAttribute(name, ps.getAttributeArray(name).copy()); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TINBuilder.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TINBuilder.java index b7f4ee3db3..1d01b6fe55 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TINBuilder.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TINBuilder.java @@ -31,7 +31,6 @@ import java.util.logging.Logger; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.math.Maths; import org.apache.sis.geometries.math.Tuple; @@ -40,6 +39,7 @@ import org.apache.sis.geometries.math.Array; import org.apache.sis.geometries.operation.OperationException; import org.apache.sis.referencing.CRS; import org.apache.sis.util.ArgumentChecks; +import org.apache.sis.geometries.DataPoints; /** @@ -124,7 +124,7 @@ public final class TINBuilder { for (int i = 0, n = finished.size(); i < n; i++) { final WTriangle t = finished.get(i); final Array positions = NDArrays.of(Arrays.asList(t.p0, t.p1, t.p2, t.p0), t.p0.getSampleSystem(), t.p0.getDataType()); - final PointSequence points = GeometryFactory.createSequence(positions); + final DataPoints points = GeometryFactory.createSequence(positions); final LinearRing exterior = GeometryFactory.createLinearRing(points); triangles.add(GeometryFactory.createTriangle(exterior)); } diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TinDistance.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TinDistance.java index 44ca406453..9593102321 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TinDistance.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/TinDistance.java @@ -17,11 +17,11 @@ package org.apache.sis.geometries.operation.simplify.greedyinsert; import java.util.function.BiFunction; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.math.Maths; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.Vector; +import org.apache.sis.geometries.DataPoints; /** @@ -32,7 +32,7 @@ final class TinDistance implements BiFunction<Tuple,Triangle,Double> { @Override public Double apply(Tuple pt, Triangle triangle) { - final PointSequence points = triangle.getExteriorRing().getDataPoints(); + final DataPoints points = triangle.getExteriorRing().getDataPoints(); final Tuple p0 = points.getPosition(0); final Tuple p1 = points.getPosition(1); final Tuple p2 = points.getPosition(2); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/WTriangle.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/WTriangle.java index f67b94eb31..65acf3f355 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/WTriangle.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/simplify/greedyinsert/WTriangle.java @@ -23,13 +23,13 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.math.Maths; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.operation.OperationException; +import org.apache.sis.geometries.DataPoints; /** @@ -39,7 +39,7 @@ import org.apache.sis.geometries.operation.OperationException; */ final class WTriangle extends AbstractGeometry implements Triangle { - private final LinearRing ring = GeometryFactory.createLinearRing(new PointSequence() { + private final LinearRing ring = GeometryFactory.createLinearRing(new DataPoints() { @Override public CoordinateReferenceSystem getCoordinateReferenceSystem() { return p0.getCoordinateReferenceSystem(); @@ -62,7 +62,7 @@ final class WTriangle extends AbstractGeometry implements Triangle { @Override public Point getPoint(final int index) { - final PointSequence ps = this; + final DataPoints ps = this; switch (index) { case 0 : case 1 : diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOBand.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOBand.java index 64e6bc0059..8a97cf1701 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOBand.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOBand.java @@ -28,7 +28,6 @@ import org.locationtech.jts.geom.TopologyException; import org.locationtech.jts.geom.impl.PackedCoordinateSequence; import org.locationtech.jts.geom.impl.PackedCoordinateSequenceFactory; import org.opengis.util.FactoryException; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor; @@ -36,6 +35,7 @@ import static org.apache.sis.geometries.operation.spatialanalysis2d.ISOLine.inte import org.apache.sis.geometries.math.Tuple; import org.apache.sis.measure.NumberRange; import org.apache.sis.util.ArgumentChecks; +import org.apache.sis.geometries.DataPoints; /** @@ -79,7 +79,7 @@ public final class ISOBand { final MeshPrimitiveVisitor visitor = new MeshPrimitiveVisitor(triangles) { @Override protected void visit(Triangle candidate) { - final PointSequence points = candidate.getExteriorRing().getDataPoints(); + final DataPoints points = candidate.getExteriorRing().getDataPoints(); Tuple t0 = points.getPosition(0); Tuple t1 = points.getPosition(1); Tuple t2 = points.getPosition(2); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOLine.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOLine.java index f6858aa876..ddc33a15b2 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOLine.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/ISOLine.java @@ -22,7 +22,6 @@ import java.util.List; import org.locationtech.jts.geom.Coordinate; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.util.FactoryException; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor; @@ -34,6 +33,7 @@ import org.apache.sis.geometries.math.Vectors; import org.apache.sis.geometries.math.Array; import org.apache.sis.referencing.CRS; import org.apache.sis.referencing.CommonCRS; +import org.apache.sis.geometries.DataPoints; /** @@ -55,7 +55,7 @@ public final class ISOLine { final MeshPrimitiveVisitor visitor = new MeshPrimitiveVisitor(triangles) { @Override protected void visit(Triangle candidate) { - final PointSequence points = candidate.getExteriorRing().getDataPoints(); + final DataPoints points = candidate.getExteriorRing().getDataPoints(); final double[] p0 = points.getPosition(0).toArrayDouble(); final double[] p1 = points.getPosition(1).toArrayDouble(); final double[] p2 = points.getPosition(2).toArrayDouble(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedEdge.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedEdge.java index 4c01968fe8..5aaeef6de1 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedEdge.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedEdge.java @@ -21,12 +21,12 @@ import org.opengis.geometry.Envelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.LineString; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.internal.shared.AbstractGeometry; import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.math.Maths; import org.apache.sis.geometries.math.Tuple; +import org.apache.sis.geometries.DataPoints; /** @@ -35,7 +35,7 @@ import org.apache.sis.geometries.math.Tuple; * * @author Johann Sorel (Geomatys) */ -final class OrientedEdge extends AbstractGeometry implements LineString, PointSequence { +final class OrientedEdge extends AbstractGeometry implements LineString, DataPoints { /** * Structure is shared by the two opposite directional edges. @@ -181,7 +181,7 @@ final class OrientedEdge extends AbstractGeometry implements LineString, PointSe } @Override - public PointSequence getDataPoints() { + public DataPoints getDataPoints() { return this; } @@ -197,7 +197,7 @@ final class OrientedEdge extends AbstractGeometry implements LineString, PointSe } //////////////////////////////////////////////////////////////////////////// - // PointSequence /////////////////////////////////////////////////////////// + // DataPoint /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// @Override @@ -222,7 +222,7 @@ final class OrientedEdge extends AbstractGeometry implements LineString, PointSe */ @Override public Envelope getEnvelope() { - return PointSequence.super.getEnvelope(); + return DataPoints.super.getEnvelope(); } @Override diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedTriangle.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedTriangle.java index 244d4c1de6..90bbc8cdaf 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedTriangle.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/triangulate/delaunay/OrientedTriangle.java @@ -22,7 +22,6 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.geometries.AttributesType; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Triangle; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.internal.shared.AbstractGeometry; @@ -31,13 +30,14 @@ import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.operation.OperationException; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.referencing.internal.shared.ShapeUtilities; +import org.apache.sis.geometries.DataPoints; /** * * @author Johann Sorel (Geomatys) */ -final class OrientedTriangle extends AbstractGeometry implements Triangle, PointSequence { +final class OrientedTriangle extends AbstractGeometry implements Triangle, DataPoints { private final LinearRing ring = GeometryFactory.createLinearRing(this); @@ -225,7 +225,7 @@ final class OrientedTriangle extends AbstractGeometry implements Triangle, Point } //////////////////////////////////////////////////////////////////////////// - // PointSequence /////////////////////////////////////////////////////////// + // DataPoint /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// @Override @@ -250,7 +250,7 @@ final class OrientedTriangle extends AbstractGeometry implements Triangle, Point */ @Override public Envelope getEnvelope() { - return PointSequence.super.getEnvelope(); + return DataPoints.super.getEnvelope(); } @Override diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/AbstractGMLWriter.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/AbstractGMLWriter.java index c7fd8c1d2b..81e2180154 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/AbstractGMLWriter.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/AbstractGMLWriter.java @@ -29,7 +29,6 @@ import org.apache.sis.geometries.MultiCurve; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.MultiSurface; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.Surface; import org.apache.sis.geometries.math.Tuple; @@ -38,6 +37,7 @@ import org.apache.sis.storage.DataStoreReferencingException; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -257,7 +257,7 @@ abstract class AbstractGMLWriter implements GMLGeometryWriter { /** * Appends every tuple of the given sequence to the given buffer, all separated by spaces. */ - protected static void appendSequence(final StringBuilder sb, final PointSequence points) { + protected static void appendSequence(final StringBuilder sb, final DataPoints points) { for (int i = 0, n = points.size(); i < n; i++) { if (i != 0) sb.append(' '); appendTuple(sb, points.getPosition(i)); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML2Writer.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML2Writer.java index 9077a54855..66bc194a62 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML2Writer.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML2Writer.java @@ -29,10 +29,10 @@ import org.apache.sis.geometries.MultiCurve; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.MultiSurface; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.storage.DataStoreContentException; import org.apache.sis.storage.DataStoreReferencingException; +import org.apache.sis.geometries.DataPoints; /** @@ -88,7 +88,7 @@ public final class GML2Writer extends AbstractGMLWriter { @Override protected void writePoint(final Point g, final String srsName, final boolean declareNamespace) throws XMLStreamException { writeStart(GML2Tags.POINT, srsName, declareNamespace); - writeCoordinates(g.asPointSequence()); + writeCoordinates(g.asDataPoint()); writer.writeEndElement(); } @@ -251,7 +251,7 @@ public final class GML2Writer extends AbstractGMLWriter { * Writes a {@code <gml:coordinates>} element containing the given coordinate tuples, using the * GML 2.0 default separators (a comma between the ordinates of a tuple, a space between tuples). */ - private void writeCoordinates(final PointSequence points) throws XMLStreamException { + private void writeCoordinates(final DataPoints points) throws XMLStreamException { final StringBuilder sb = new StringBuilder(); for (int i=0, n=points.size(); i<n; i++) { if (i != 0) sb.append(GML2Tags.DEFAULT_TS); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML3Writer.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML3Writer.java index 25b8bddc58..1988d81d12 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML3Writer.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/GML3Writer.java @@ -38,7 +38,6 @@ import org.apache.sis.geometries.MultiPolyhedron; import org.apache.sis.geometries.MultiSurface; import org.apache.sis.geometries.Orientable; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.PolyhedralSurface; import org.apache.sis.geometries.Polyhedron; @@ -50,6 +49,7 @@ import org.apache.sis.geometries.conics.CircularString; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.storage.DataStoreContentException; import org.apache.sis.storage.DataStoreReferencingException; +import org.apache.sis.geometries.DataPoints; /** @@ -267,7 +267,7 @@ public final class GML3Writer extends AbstractGMLWriter { * Writes a {@code <gml:posList>} element containing the given coordinate tuples, with an * explicit {@code srsDimension} attribute taken from the width of the sequence itself. */ - private void writePosList(final PointSequence points) throws XMLStreamException { + private void writePosList(final DataPoints points) throws XMLStreamException { writer.writeStartElement(GML3Tags.POS_LIST); writer.writeAttribute(GML3Tags.SRS_DIMENSION, String.valueOf(points.getDimension())); final StringBuilder sb = new StringBuilder(); diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/PositionListBuilder.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/PositionListBuilder.java index c874b47320..89f5207269 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/PositionListBuilder.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/gml/PositionListBuilder.java @@ -18,7 +18,6 @@ package org.apache.sis.gml; import java.util.Arrays; import org.apache.sis.geometries.GeometryFactory; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.DataType; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; @@ -27,11 +26,12 @@ import org.apache.sis.storage.DataStoreReferencingException; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** * Accumulator of coordinate tuples read from a GML document, and factory of the - * {@link PointSequence} that the Apache SIS geometry model is built upon. + * {@link DataPoints} that the Apache SIS geometry model is built upon. * * <p>Coordinates are accumulated as a single flat {@code double[]} of {@code size() × dimension()} * ordinates, which is the layout that {@link NDArrays#of(SampleSystem, double...)} expects. The @@ -170,7 +170,7 @@ final class PositionListBuilder { * @throws DataStoreContentException if the accumulated tuple width contradicts {@code inScope}. * @throws DataStoreReferencingException if the CRS needed to reconcile the two cannot be created. */ - final PointSequence build(final CoordinateReferenceSystem inScope) + final DataPoints build(final CoordinateReferenceSystem inScope) throws DataStoreContentException, DataStoreReferencingException { /* diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/TriangleTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/TriangleTest.java index 4ad61def8d..d74753ac37 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/TriangleTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/TriangleTest.java @@ -38,7 +38,7 @@ public class TriangleTest { public void constructorTest() { final Array positions = NDArrays.of(CommonCRS.WGS84.normalizedGeographic(), new double[]{0,0, 1,0, 0,1, 0,0}); - final PointSequence points = GeometryFactory.createSequence(positions); + final DataPoints points = GeometryFactory.createSequence(positions); final LinearRing exterior = GeometryFactory.createLinearRing(points); final Triangle triangle = GeometryFactory.createTriangle(exterior); diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeAdapterTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeAdapterTest.java index d99cb1193b..c3cfc605d0 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeAdapterTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeAdapterTest.java @@ -23,7 +23,7 @@ import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.Polygon; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.geometry.wrapper.j2d.DecimatedShape; @@ -108,7 +108,7 @@ public final class ShapeAdapterTest { */ @Test public void testLineString() { - initialize(GeometryFactory.createLineString(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + initialize(GeometryFactory.createLineString(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 3,1, 7,6, 5,2 @@ -124,11 +124,11 @@ public final class ShapeAdapterTest { */ @Test public void testMultiLineString() { - final LineString line1 = GeometryFactory.createLineString(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + final LineString line1 = GeometryFactory.createLineString(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 10, 12, 5, 2 }))); - final LineString line2 = GeometryFactory.createLineString(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + final LineString line2 = GeometryFactory.createLineString(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 3, 1, 7, 6, 5, 2 @@ -147,7 +147,7 @@ public final class ShapeAdapterTest { */ @Test public void testPolygon() { - final LinearRing ring = GeometryFactory.createLinearRing(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + final LinearRing ring = GeometryFactory.createLinearRing(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 3, 1, 7, 6, 5, 2, @@ -166,13 +166,13 @@ public final class ShapeAdapterTest { */ @Test public void testMultiPolygon() { - final LinearRing ring1 = GeometryFactory.createLinearRing(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + final LinearRing ring1 = GeometryFactory.createLinearRing(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 3, 1, 7, 6, 5, 2, 3, 1 }))); - final LinearRing ring2 = GeometryFactory.createLinearRing(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + final LinearRing ring2 = GeometryFactory.createLinearRing(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 12, 3, 1, 9, 4, 6, @@ -201,7 +201,7 @@ public final class ShapeAdapterTest { */ @Test public void testAsDecimatedShapeLineString() { - final LineString line = GeometryFactory.createLineString(new ArraySequence(NDArrays.of(CARTESIAN_2D, new double[]{ + final LineString line = GeometryFactory.createLineString(new ArrayDataPoints(NDArrays.of(CARTESIAN_2D, new double[]{ 0, 0, 1, 0, 2, 0 diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeConverterTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeConverterTest.java index c2fba9a30d..a2b9ae92ad 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeConverterTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/ShapeConverterTest.java @@ -36,7 +36,6 @@ import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.MultiPolygon; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.Vector2D; @@ -45,6 +44,7 @@ import org.apache.sis.geometries.math.Vector2D; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; import org.opengis.geometry.Envelope; +import org.apache.sis.geometries.DataPoints; /** @@ -97,7 +97,7 @@ public final class ShapeConverterTest { } else if (geom instanceof Point pt) { lst.add(new Vector2D.Double(pt.getPosition().toArrayDouble())); } else if (geom instanceof LineString ls) { - PointSequence ps = ls.getDataPoints(); + DataPoints ps = ls.getDataPoints(); for (int i = 0, n = ps.size(); i < n; i++) { lst.add(new Vector2D.Double(ps.getPosition(i).toArrayDouble())); } diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/internal/shared/ArraySequenceTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/internal/shared/ArraySequenceTest.java index 5aa6f6cd57..516dac2c99 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/internal/shared/ArraySequenceTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/internal/shared/ArraySequenceTest.java @@ -46,7 +46,7 @@ public class ArraySequenceTest { public void constructorNoCrsTest() { final Array positions = NDArrays.of(2, new double[]{0,0, 1,0, 0,1, 0,0}); assertThrows(NullPointerException.class, ()->{ - ArraySequence array = new ArraySequence(positions); + ArrayDataPoints array = new ArrayDataPoints(positions); }); } @@ -56,7 +56,7 @@ public class ArraySequenceTest { @Test public void constructorCrsTest() { final Array positions = NDArrays.of(CommonCRS.WGS84.normalizedGeographic(), new double[]{0,0, 1,0, 0,1, 0,0}); - ArraySequence array = new ArraySequence(positions); + ArrayDataPoints array = new ArrayDataPoints(positions); } /** @@ -68,7 +68,7 @@ public class ArraySequenceTest { final Map<String,Array> attributes = new HashMap<>(); attributes.put(AttributesType.ATT_NORMAL, normals); assertThrows(NullPointerException.class, ()->{ - ArraySequence array = new ArraySequence(attributes); + ArrayDataPoints array = new ArrayDataPoints(attributes); }); } @@ -82,7 +82,7 @@ public class ArraySequenceTest { final Map<String,Array> attributes = new HashMap<>(); attributes.put(AttributesType.ATT_POSITION, positions); attributes.put(AttributesType.ATT_NORMAL, normals); - ArraySequence array = new ArraySequence(attributes); + ArrayDataPoints array = new ArrayDataPoints(attributes); } /** @@ -97,7 +97,7 @@ public class ArraySequenceTest { final Map<String,Array> attributes = new HashMap<>(); attributes.put(AttributesType.ATT_POSITION, positions); attributes.put(AttributesType.ATT_NORMAL, normals); - final ArraySequence array = new ArraySequence(attributes); + final ArrayDataPoints array = new ArrayDataPoints(attributes); assertEquals(CommonCRS.WGS84.normalizedGeographic(), array.getCoordinateReferenceSystem()); assertEquals(2, array.getDimension()); diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/ToPrimitiveTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/ToPrimitiveTest.java index 9c16611ee8..3a502a1dd0 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/ToPrimitiveTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/ToPrimitiveTest.java @@ -25,7 +25,6 @@ import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.MultiLineString; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.mesh.MeshPrimitive; import org.apache.sis.geometries.mesh.MultiMeshPrimitive; @@ -36,6 +35,7 @@ import org.apache.sis.referencing.CommonCRS; // Test dependencies import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import org.apache.sis.geometries.DataPoints; /** @@ -58,7 +58,7 @@ public class ToPrimitiveTest { @Test public void testLineString() { final Array positions = NDArrays.of(CRS2D, new double[]{0,1,2,3}); - final PointSequence points = GeometryFactory.createSequence(positions); + final DataPoints points = GeometryFactory.createSequence(positions); final LineString line = GeometryFactory.createLineString(points); final Geometry result = new GeometryProcessor().toPrimitive(line); assertTrue(result instanceof MeshPrimitive); @@ -69,7 +69,7 @@ public class ToPrimitiveTest { @Test public void testPolygon() { final Array positions = NDArrays.of(CRS2D, new double[]{0,1,2,3}); - final PointSequence points = GeometryFactory.createSequence(positions); + final DataPoints points = GeometryFactory.createSequence(positions); final LinearRing exterior = GeometryFactory.createLinearRing(points); final Polygon point = GeometryFactory.createPolygon(exterior, null); final Geometry result = new GeometryProcessor().toPrimitive(point); @@ -82,11 +82,11 @@ public class ToPrimitiveTest { public void testMultiLineString() { { //one line has 3 points, so we must obtain a MultiPrimitive final Array positions1 = NDArrays.of(CRS2D, new double[]{0,1,2,3}); - final PointSequence points1 = GeometryFactory.createSequence(positions1); + final DataPoints points1 = GeometryFactory.createSequence(positions1); final LineString line1 = GeometryFactory.createLineString(points1); final Array positions2 = NDArrays.of(CRS2D, new double[]{3,4,5,6,7,8}); - final PointSequence points2 = GeometryFactory.createSequence(positions2); + final DataPoints points2 = GeometryFactory.createSequence(positions2); final LineString line2 = GeometryFactory.createLineString(points2); final MultiLineString mlines = GeometryFactory.createMultiLineString(line1, line2); @@ -106,11 +106,11 @@ public class ToPrimitiveTest { } { //all linestrings are lines, we must obtain a Primitive.Lines final Array positions1 = NDArrays.of(CRS2D, new double[]{0,1,2,3}); - final PointSequence points1 = GeometryFactory.createSequence(positions1); + final DataPoints points1 = GeometryFactory.createSequence(positions1); final LineString line1 = GeometryFactory.createLineString(points1); final Array positions2 = NDArrays.of(CRS2D, new double[]{3,4,5,6}); - final PointSequence points2 = GeometryFactory.createSequence(positions2); + final DataPoints points2 = GeometryFactory.createSequence(positions2); final LineString line2 = GeometryFactory.createLineString(points2); final MultiLineString mlines = GeometryFactory.createMultiLineString(line1, line2); @@ -129,7 +129,7 @@ public class ToPrimitiveTest { @Test public void testMultiPoint() { final Array positions1 = NDArrays.of(CRS2D, new double[]{0,1,2,3}); - final PointSequence points = GeometryFactory.createSequence(positions1); + final DataPoints points = GeometryFactory.createSequence(positions1); final MultiPoint mpoints = GeometryFactory.createMultiPoint(points); final Geometry result = new GeometryProcessor().toPrimitive(mpoints); diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2ReaderTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2ReaderTest.java index 85a5f5dcd1..1df8583a69 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2ReaderTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2ReaderTest.java @@ -31,7 +31,6 @@ import org.apache.sis.geometries.MultiLineString; import org.apache.sis.geometries.MultiPoint; import org.apache.sis.geometries.MultiPolygon; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; @@ -48,6 +47,7 @@ import static org.apache.sis.gml.GeometryAssert.assertUndefinedCRS; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -93,7 +93,7 @@ public final class GML2ReaderTest { /** * Creates a point sequence in the {@link #wgs84} CRS from a flat list of ordinates. */ - private PointSequence sequence(final double... ordinates) { + private DataPoints sequence(final double... ordinates) { return GeometryFactory.createSequence(NDArrays.of(SampleSystem.of(wgs84), ordinates)); } diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2WriterTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2WriterTest.java index 6a1b434145..42e4dd119c 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2WriterTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML2WriterTest.java @@ -26,7 +26,6 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; import org.apache.sis.referencing.CRS; @@ -37,6 +36,7 @@ import static org.junit.jupiter.api.Assertions.*; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -71,7 +71,7 @@ public final class GML2WriterTest extends TestCase { /** * Creates a point sequence in the {@link #wgs84} CRS from a flat list of ordinates. */ - private PointSequence sequence(final double... ordinates) { + private DataPoints sequence(final double... ordinates) { return GeometryFactory.createSequence(NDArrays.of(SampleSystem.of(wgs84), ordinates)); } diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3ReaderTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3ReaderTest.java index fc16763ec9..1424477af7 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3ReaderTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3ReaderTest.java @@ -37,7 +37,6 @@ import org.apache.sis.geometries.MultiPolygon; import org.apache.sis.geometries.MultiPolyhedron; import org.apache.sis.geometries.Orientable; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.PolyhedralSurface; import org.apache.sis.geometries.Polyhedron; @@ -62,6 +61,7 @@ import static org.apache.sis.gml.GeometryAssert.assertUndefinedCRS; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -107,7 +107,7 @@ public final class GML3ReaderTest { /** * Creates a point sequence in the {@link #wgs84} CRS from a flat list of ordinates. */ - private PointSequence sequence(final double... ordinates) { + private DataPoints sequence(final double... ordinates) { return GeometryFactory.createSequence(NDArrays.of(SampleSystem.of(wgs84), ordinates)); } diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3WriterTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3WriterTest.java index d1851e7954..500ef0f136 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3WriterTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GML3WriterTest.java @@ -28,7 +28,6 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.curve.ArcByCenterPoint; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; @@ -42,6 +41,7 @@ import static org.junit.jupiter.api.Assertions.*; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -76,7 +76,7 @@ public final class GML3WriterTest extends TestCase { /** * Creates a point sequence in the {@link #wgs84} CRS from a flat list of ordinates. */ - private PointSequence sequence(final double... ordinates) { + private DataPoints sequence(final double... ordinates) { return GeometryFactory.createSequence(NDArrays.of(SampleSystem.of(wgs84), ordinates)); } diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GeometryAssert.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GeometryAssert.java index 6dab0e0591..add8bc35e6 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GeometryAssert.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/GeometryAssert.java @@ -23,7 +23,6 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryCollection; import org.apache.sis.geometries.LineString; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.referencing.CRS; @@ -32,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.*; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -84,7 +84,7 @@ final class GeometryAssert { if (expected instanceof Point e) { final Point a = (Point) actual; - assertSequenceEquals(e.asPointSequence(), a.asPointSequence(), tolerance); + assertSequenceEquals(e.asDataPoint(), a.asDataPoint(), tolerance); } else if (expected instanceof LineString e) { // Also covers LinearRing. final LineString a = (LineString) actual; assertSequenceEquals(e.getDataPoints(), a.getDataPoints(), tolerance); @@ -111,7 +111,7 @@ final class GeometryAssert { * tolerance. Delegates to {@code Array.equals(Array, double)}, which also compares the tuple * width and the sample system, and therefore the coordinate reference system. */ - private static void assertSequenceEquals(final PointSequence expected, final PointSequence actual, + private static void assertSequenceEquals(final DataPoints expected, final DataPoints actual, final double tolerance) { assertEquals(expected.size(), actual.size(), "number of points"); diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/JAXBGeometryAdapterTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/JAXBGeometryAdapterTest.java index 5cb9d917cc..3ce55b610e 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/JAXBGeometryAdapterTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/gml/JAXBGeometryAdapterTest.java @@ -24,7 +24,6 @@ import org.apache.sis.geometries.Geometry; import org.apache.sis.geometries.GeometryFactory; import org.apache.sis.geometries.LinearRing; import org.apache.sis.geometries.Point; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometries.math.SampleSystem; @@ -47,6 +46,7 @@ import static org.apache.sis.gml.GeometryAssert.assertGeometryEquals; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.geometries.DataPoints; /** @@ -128,7 +128,7 @@ public final class JAXBGeometryAdapterTest { /** * Creates a point sequence in the {@link #wgs84} CRS from a flat list of ordinates. */ - private PointSequence sequence(final double... ordinates) { + private DataPoints sequence(final double... ordinates) { return GeometryFactory.createSequence(NDArrays.of(SampleSystem.of(wgs84), ordinates)); } diff --git a/incubator/src/org.apache.sis.referencing.dggs/main/org/apache/sis/storage/dggs/DiscreteGlobalGridSystems.java b/incubator/src/org.apache.sis.referencing.dggs/main/org/apache/sis/storage/dggs/DiscreteGlobalGridSystems.java index e20e151149..ed5750363a 100644 --- a/incubator/src/org.apache.sis.referencing.dggs/main/org/apache/sis/storage/dggs/DiscreteGlobalGridSystems.java +++ b/incubator/src/org.apache.sis.referencing.dggs/main/org/apache/sis/storage/dggs/DiscreteGlobalGridSystems.java @@ -38,8 +38,7 @@ import org.opengis.referencing.datum.Ellipsoid; import org.opengis.referencing.operation.TransformException; import org.opengis.util.FactoryException; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; -import org.apache.sis.geometries.internal.shared.ArraySequence; +import org.apache.sis.geometries.internal.shared.ArrayDataPoints; import org.apache.sis.geometries.math.Array; import org.apache.sis.geometries.math.NDArrays; import org.apache.sis.geometry.Envelopes; @@ -66,6 +65,7 @@ import org.apache.sis.storage.rs.CodedResource; import org.apache.sis.storage.rs.internal.shared.CodedCoverageAsFeatureSet; import org.apache.sis.storage.rs.internal.shared.s2.Factory; import org.apache.sis.storage.rs.internal.shared.s2.S2; +import org.apache.sis.geometries.DataPoints; /** @@ -258,7 +258,7 @@ public final class DiscreteGlobalGridSystems { if (s2 == null) return null; final double[] coords = S2.toArray(s2.loop(0)); final Array positions = NDArrays.of(CommonCRS.WGS84.normalizedGeographic(), coords); - final PointSequence sequence = new ArraySequence(positions); + final DataPoints sequence = new ArrayDataPoints(positions); final LinearRing exterior = org.apache.sis.geometries.GeometryFactory.createLinearRing(sequence); return org.apache.sis.geometries.GeometryFactory.createPolygon(exterior, null); } diff --git a/incubator/src/org.apache.sis.referencing.dggs/test/org/apache/sis/referencing/dggs/AbstractDggrsTest.java b/incubator/src/org.apache.sis.referencing.dggs/test/org/apache/sis/referencing/dggs/AbstractDggrsTest.java index 4ad1283843..2d981134bc 100644 --- a/incubator/src/org.apache.sis.referencing.dggs/test/org/apache/sis/referencing/dggs/AbstractDggrsTest.java +++ b/incubator/src/org.apache.sis.referencing.dggs/test/org/apache/sis/referencing/dggs/AbstractDggrsTest.java @@ -33,7 +33,6 @@ import org.apache.sis.coverage.grid.GridExtent; import org.apache.sis.coverage.grid.GridGeometry; import org.apache.sis.coverage.grid.GridOrientation; import org.apache.sis.geometries.LinearRing; -import org.apache.sis.geometries.PointSequence; import org.apache.sis.geometries.Polygon; import org.apache.sis.geometries.math.Tuple; import org.apache.sis.geometries.math.Vector2D; @@ -51,6 +50,7 @@ import org.apache.sis.storage.rs.CodeIterator; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.apache.sis.geometries.DataPoints; /** @@ -187,7 +187,7 @@ public abstract class AbstractDggrsTest { final Polygon geometry = (Polygon) DiscreteGlobalGridSystems.toSISPolygon(z.getGeographicExtent()); final DirectPosition center = z.getPosition(); final LinearRing exterior = (LinearRing) geometry.getExteriorRing(); - final PointSequence ps = exterior.getDataPoints(); + final DataPoints ps = exterior.getDataPoints(); for (int i = 0; i < ps.size(); i++) { final Tuple corner = ps.getPosition(i);
