This is an automated email from the ASF dual-hosted git repository.
jsorel pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 4f5de477ca Hide default geometry implementations in a privy package,
add geometry factory class as replacement
4f5de477ca is described below
commit 4f5de477cab2cd13feb25b102c0ebf2ce303bc17
Author: jsorel <[email protected]>
AuthorDate: Tue Jul 1 11:51:03 2025 +0200
Hide default geometry implementations in a privy package, add geometry
factory class as replacement
---
.../main/org/apache/sis/geometries/Geometries.java | 21 +--
.../org/apache/sis/geometries/GeometryFactory.java | 105 +++++++++++++
.../main/org/apache/sis/geometries/LineString.java | 1 +
.../main/org/apache/sis/geometries/LinearRing.java | 1 +
.../org/apache/sis/geometries/MultiLineString.java | 1 +
.../main/org/apache/sis/geometries/MultiPoint.java | 1 +
.../org/apache/sis/geometries/MultiPolygon.java | 2 +
.../main/org/apache/sis/geometries/OBBox.java | 1 +
.../main/org/apache/sis/geometries/Point.java | 1 +
.../main/org/apache/sis/geometries/Polygon.java | 1 +
.../main/org/apache/sis/geometries/Sphere.java | 1 +
.../main/org/apache/sis/geometries/TIN.java | 1 +
.../main/org/apache/sis/geometries/Triangle.java | 1 +
.../sis/geometries/{ => mesh}/MeshPrimitive.java | 21 ++-
.../{ => mesh}/MeshPrimitiveComparator.java | 9 +-
.../{ => mesh}/MeshPrimitiveIndexes.java | 2 +-
.../{ => mesh}/MeshPrimitiveVisitor.java | 12 +-
.../geometries/{ => mesh}/MultiMeshPrimitive.java | 5 +-
.../geometries/operation/GeometryOperations.java | 4 +-
.../operation/spatialanalysis2d/ISOBand.java | 4 +-
.../operation/spatialanalysis2d/ISOLine.java | 4 +-
.../operation/spatialanalysis2d/IsoInclusion.java | 2 +-
.../geometries/{ => privy}/AbstractGeometry.java | 10 +-
.../geometries/{ => privy}/AbstractMultiCurve.java | 5 +-
.../sis/geometries/{ => privy}/ArraySequence.java | 5 +-
.../{ => privy}/DefaultGeometryCollection.java | 4 +-
.../geometries/{ => privy}/DefaultLineString.java | 5 +-
.../geometries/{ => privy}/DefaultLinearRing.java | 5 +-
.../{ => privy}/DefaultMultiLineString.java | 5 +-
.../geometries/{ => privy}/DefaultMultiPoint.java | 6 +-
.../{ => privy}/DefaultMultiPolygon.java | 5 +-
.../{ => privy}/DefaultMultiSurface.java | 4 +-
.../sis/geometries/{ => privy}/DefaultPoint.java | 5 +-
.../{ => privy}/DefaultPointSequence.java | 5 +-
.../sis/geometries/{ => privy}/DefaultPolygon.java | 6 +-
.../geometries/{ => privy}/DefaultTriangle.java | 5 +-
.../processor/spatialanalysis2d/Intersection.java | 15 +-
.../processor/spatialedition/ComputeAttribute.java | 28 ++--
.../geometries/processor/spatialedition/To3D.java | 35 +++--
.../processor/spatialedition/ToPrimitive.java | 50 +++---
.../processor/spatialedition/Transform.java | 57 ++++---
.../simplify/greedyinsert/TINBuilder.java | 10 +-
.../simplify/greedyinsert/WTriangle.java | 6 +-
.../sis/geometries/triangulate/EarClipping.java | 2 +-
.../geometries/triangulate/delaunay/Delaunay.java | 4 +-
.../triangulate/delaunay/OrientedEdge.java | 6 +-
.../triangulate/delaunay/OrientedTriangle.java | 10 +-
.../org/apache/sis/geometries/GeometriesTest.java | 170 ---------------------
.../org/apache/sis/geometries/PreparedTINTest.java | 1 +
.../org/apache/sis/geometries/PrimitiveTest.java | 64 --------
.../org/apache/sis/geometries/TriangleTest.java | 6 +-
.../{ => mesh}/PrimitiveIndexesTest.java | 4 +-
.../PrimitiveTest.java} | 67 ++++----
.../{ => mesh}/PrimitiveVisitorTest.java | 9 +-
.../operation/spatialanalysis2d/IsoBandTest.java | 2 +-
.../geometries/{ => privy}/ArraySequenceTest.java | 4 +-
.../processor/spatialanalysis2d/DistanceTest.java | 14 +-
.../spatialanalysis2d/IntersectionTest.java | 2 +-
.../processor/spatialedition/To3DTest.java | 2 +-
.../processor/spatialedition/ToPrimitiveTest.java | 48 +++---
.../processor/spatialedition/TransformTest.java | 4 +-
.../triangulate/delaunay/DelaunayTest.java | 4 +-
.../triangulate/delaunay/OrientedEdgeTest.java | 4 +-
63 files changed, 425 insertions(+), 479 deletions(-)
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometries.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometries.java
index 59ef464615..afc37270cc 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometries.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Geometries.java
@@ -37,6 +37,9 @@ import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.math.Vector;
import org.apache.sis.geometries.math.Vector3D;
import org.apache.sis.geometries.math.Vectors;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MultiMeshPrimitive;
+import org.apache.sis.geometries.privy.ArraySequence;
import org.apache.sis.geometry.wrapper.jts.JTS;
import org.apache.sis.measure.Units;
import org.apache.sis.referencing.CRS;
@@ -54,7 +57,6 @@ import org.apache.sis.util.Static;
import org.apache.sis.util.Utilities;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.CoordinateSequence;
-import org.locationtech.jts.geom.GeometryFactory;
import org.opengis.geometry.Envelope;
import org.opengis.referencing.IdentifiedObject;
import static org.opengis.referencing.IdentifiedObject.ALIAS_KEY;
@@ -75,7 +77,6 @@ import org.opengis.util.InternationalString;
* @author Johann Sorel (Geomatys)
*/
public final class Geometries extends Static {
- static final GeometryFactory GF = new GeometryFactory();
private static final CoordinateReferenceSystem UNDEFINED_CRS_1D =
createUndefined(1);
private static final CoordinateReferenceSystem UNDEFINED_CRS_2D =
createUndefined(2);
@@ -741,44 +742,44 @@ public final class Geometries extends Static {
if (jts == null) {
return null;
} else if (jts instanceof org.locationtech.jts.geom.Point cdt) {
- return new
DefaultPoint(toPointSequence(cdt.getCoordinateSequence(), crs));
+ return
GeometryFactory.createPoint(toPointSequence(cdt.getCoordinateSequence(), crs));
} else if (jts instanceof org.locationtech.jts.geom.MultiPoint cdt) {
- return new
DefaultMultiPoint(toPointSequence(jts.getFactory().getCoordinateSequenceFactory().create(cdt.getCoordinates()),
crs));
+ return
GeometryFactory.createMultiPoint(toPointSequence(jts.getFactory().getCoordinateSequenceFactory().create(cdt.getCoordinates()),
crs));
} else if (jts instanceof org.locationtech.jts.geom.LinearRing cdt) {
- return new
DefaultLinearRing(toPointSequence(cdt.getCoordinateSequence(), crs));
+ return
GeometryFactory.createLinearRing(toPointSequence(cdt.getCoordinateSequence(),
crs));
} else if (jts instanceof org.locationtech.jts.geom.LineString cdt) {
- return new
DefaultLineString(toPointSequence(cdt.getCoordinateSequence(), crs));
+ return
GeometryFactory.createLineString(toPointSequence(cdt.getCoordinateSequence(),
crs));
} else if (jts instanceof org.locationtech.jts.geom.MultiLineString
cdt) {
final LineString[] strings = new
LineString[cdt.getNumGeometries()];
for (int i = 0; i < strings.length; i++) {
strings[i] = (LineString) fromJTS(cdt.getGeometryN(i), crs);
}
- return new DefaultMultiLineString(strings);
+ return GeometryFactory.createMultiLineString(strings);
} else if (jts instanceof org.locationtech.jts.geom.Polygon cdt) {
final LinearRing exterior = (LinearRing)
fromJTS(cdt.getExteriorRing(), crs);
final List<LinearRing> interiors = new
ArrayList<>(cdt.getNumInteriorRing());
for (int i = 0, n = cdt.getNumInteriorRing(); i < n; i++) {
interiors.add((LinearRing) fromJTS(cdt.getInteriorRingN(i),
crs));
}
- return new DefaultPolygon(exterior, interiors);
+ return GeometryFactory.createPolygon(exterior, interiors);
} else if (jts instanceof org.locationtech.jts.geom.MultiPolygon cdt) {
final Surface[] geoms = new Surface[cdt.getNumGeometries()];
for (int i = 0; i < geoms.length; i++) {
geoms[i] = (Surface) fromJTS(cdt.getGeometryN(i), crs);
}
- return new DefaultMultiSurface(geoms);
+ return GeometryFactory.createMultiSurface(geoms);
} else if (jts instanceof org.locationtech.jts.geom.GeometryCollection
cdt) {
final Geometry[] geoms = new Geometry[cdt.getNumGeometries()];
for (int i = 0; i < geoms.length; i++) {
geoms[i] = fromJTS(cdt.getGeometryN(i), crs);
}
- return new DefaultGeometryCollection(geoms);
+ return GeometryFactory.createGeometryCollection(geoms);
} else {
throw new IllegalArgumentException("Unknown JTS geometry type");
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
new file mode 100644
index 0000000000..34386da45c
--- /dev/null
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.geometries;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.apache.sis.geometries.math.SampleSystem;
+import org.apache.sis.geometries.math.TupleArray;
+import org.apache.sis.geometries.privy.ArraySequence;
+import org.apache.sis.geometries.privy.DefaultGeometryCollection;
+import org.apache.sis.geometries.privy.DefaultLineString;
+import org.apache.sis.geometries.privy.DefaultLinearRing;
+import org.apache.sis.geometries.privy.DefaultMultiLineString;
+import org.apache.sis.geometries.privy.DefaultMultiPoint;
+import org.apache.sis.geometries.privy.DefaultMultiPolygon;
+import org.apache.sis.geometries.privy.DefaultMultiSurface;
+import org.apache.sis.geometries.privy.DefaultPoint;
+import org.apache.sis.geometries.privy.DefaultPolygon;
+import org.apache.sis.geometries.privy.DefaultTriangle;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+/**
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public final class GeometryFactory {
+
+ private GeometryFactory(){}
+
+ public static Point createPoint(CoordinateReferenceSystem crs) {
+ return new DefaultPoint(crs);
+ }
+
+ public static Point createPoint(CoordinateReferenceSystem crs, double ...
position) {
+ return new DefaultPoint(crs, position);
+ }
+
+ public static Point createPoint(SampleSystem ss, double ... position) {
+ return new DefaultPoint(ss, position);
+ }
+
+ public static Point createPoint(PointSequence sequence) {
+ return new DefaultPoint(sequence);
+ }
+
+ public static LineString createLineString(PointSequence sequence) {
+ return new DefaultLineString(sequence);
+ }
+
+ public static LinearRing createLinearRing(PointSequence sequence) {
+ return new DefaultLinearRing(sequence);
+ }
+
+ public static Polygon createPolygon(LinearRing exterior, List<LinearRing>
interiors) {
+ return new DefaultPolygon(exterior, interiors);
+ }
+
+ public static Triangle createTriangle(LinearRing exterior) {
+ return new DefaultTriangle(exterior);
+ }
+
+ public static MultiPoint createMultiPoint(PointSequence sequence) {
+ return new DefaultMultiPoint(sequence);
+ }
+
+ public static MultiLineString createMultiLineString(LineString ...
geometries) {
+ return new DefaultMultiLineString(geometries);
+ }
+
+ public static MultiPolygon createMultiPolygon(Polygon ... geometries) {
+ return new DefaultMultiPolygon(geometries);
+ }
+
+ public static <T extends Surface> MultiSurface<T> createMultiSurface(T ...
geometries) {
+ return new DefaultMultiSurface<>(geometries);
+ }
+
+ public static <T extends Geometry> GeometryCollection<T>
createGeometryCollection(T ... geometries) {
+ return new DefaultGeometryCollection<>(geometries);
+ }
+
+ public static PointSequence createSequence(TupleArray positions) {
+ return
createSequence(Collections.singletonMap(AttributesType.ATT_POSITION,
positions));
+ }
+
+ public static PointSequence createSequence(Map<String, TupleArray>
attributes) {
+ return new ArraySequence(attributes);
+ }
+
+}
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 1461234112..3ae78a34da 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
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
import javax.measure.quantity.Length;
import org.apache.sis.geometry.GeneralEnvelope;
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 219be86658..405424b47e 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
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
/**
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 2f5a2a5a6b..e6e186fe04 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
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
/**
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 2aa18fd588..7a1373d080 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
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolygon.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolygon.java
index a64343a1c4..bc1c77d20d 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolygon.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiPolygon.java
@@ -16,6 +16,8 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
+
/**
* A MultiPolygon is a MultiSurface whose elements are Polygons.
*
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java
index 90376ace7d..3f835f3da0 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/OBBox.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.Vector;
import org.apache.sis.geometries.math.Vectors;
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 a15f3da503..50c732d480 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Point.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Point.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.Vector;
import org.apache.sis.geometry.GeneralEnvelope;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
index d4995b121e..62aba45ba2 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Polygon.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import java.util.List;
import static org.opengis.annotation.Specification.ISO_19107;
import org.opengis.annotation.UML;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Sphere.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Sphere.java
index 00f4c3ed0c..5d09027804 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Sphere.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/Sphere.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.Vector;
import org.apache.sis.geometries.math.Vectors;
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 4e91b66fc8..5e24fcef88 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
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.math.Tuple;
/**
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 18049e6f14..c16bd6caf1 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
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import java.util.Collections;
import java.util.List;
import org.apache.sis.geometries.math.Maths;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitive.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
similarity index 97%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitive.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
index b1a23d89a0..1f53ff0270 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitive.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
import java.util.AbstractMap;
import java.util.ArrayList;
@@ -30,6 +30,17 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.sis.geometries.AttributesType;
+import org.apache.sis.geometries.Geometries;
+import org.apache.sis.geometries.Geometry;
+import org.apache.sis.geometries.GeometryFactory;
+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;
import org.apache.sis.geometries.math.Maths;
import org.apache.sis.geometries.math.SampleSystem;
@@ -1141,7 +1152,7 @@ public interface MeshPrimitive extends Geometry {
@Override
public LineString getGeometryN(int n) {
final int[] indices = (index == null) ? new int[]{n*2, n*2+1} :
index.toArrayInt(n*2, 2);
- return new DefaultLineString(new Sequence(this, indices));
+ return GeometryFactory.createLineString(new Sequence(this,
indices));
}
}
@@ -1207,7 +1218,7 @@ public interface MeshPrimitive extends Geometry {
indices = Arrays.copyOf(indices, 4);
indices[3] = indices[0];
}
- return new DefaultTriangle(new DefaultLinearRing(new
Sequence(this, indices)));
+ return
GeometryFactory.createTriangle(GeometryFactory.createLinearRing(new
Sequence(this, indices)));
}
}
@@ -1235,7 +1246,7 @@ public interface MeshPrimitive extends Geometry {
indices[2] = (int) index.get(2 + n).get(0);
}
indices[3] = indices[0];
- return new DefaultTriangle(new DefaultLinearRing(new
Sequence(this, indices)));
+ return
GeometryFactory.createTriangle(GeometryFactory.createLinearRing(new
Sequence(this, indices)));
}
}
@@ -1273,7 +1284,7 @@ public interface MeshPrimitive extends Geometry {
}
indices[3] = indices[0];
- return new DefaultTriangle(new DefaultLinearRing(new
Sequence(this, indices)));
+ return
GeometryFactory.createTriangle(GeometryFactory.createLinearRing(new
Sequence(this, indices)));
}
}
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveComparator.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java
similarity index 97%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveComparator.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java
index 7959516711..06ab99584d 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveComparator.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveComparator.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
-import org.apache.sis.geometries.MeshPrimitive.Vertex;
+import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.TupleArray;
import java.util.ArrayList;
@@ -24,6 +24,11 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
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.util.Utilities;
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveIndexes.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveIndexes.java
similarity index 99%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveIndexes.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveIndexes.java
index 3165ffabdd..71ba41c86b 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveIndexes.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveIndexes.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
import java.util.ArrayList;
import java.util.Arrays;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveVisitor.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java
similarity index 93%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveVisitor.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java
index 8a8e291411..114c86519c 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MeshPrimitiveVisitor.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitiveVisitor.java
@@ -14,12 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrayCursor;
import org.apache.sis.geometries.math.TupleArrays;
import java.util.HashSet;
+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.util.ArgumentChecks;
@@ -187,11 +193,11 @@ public abstract class MeshPrimitiveVisitor {
}
private Triangle readTriangle(int idx0, int idx1, int idx2) {
- return new DefaultTriangle(new DefaultLinearRing(new
MeshPrimitive.Sequence(primitive, new int[]{idx0, idx1, idx2, idx0})));
+ return
GeometryFactory.createTriangle(GeometryFactory.createLinearRing(new
MeshPrimitive.Sequence(primitive, new int[]{idx0, idx1, idx2, idx0})));
}
private LineString readLine(int idx0, int idx1) {
- return new DefaultLineString(new MeshPrimitive.Sequence(primitive, new
int[]{idx0, idx1}));
+ return GeometryFactory.createLineString(new
MeshPrimitive.Sequence(primitive, new int[]{idx0, idx1}));
}
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiMeshPrimitive.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MultiMeshPrimitive.java
similarity index 96%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiMeshPrimitive.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MultiMeshPrimitive.java
index e0d2987c8a..c97c03644d 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/MultiMeshPrimitive.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MultiMeshPrimitive.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
import java.util.ArrayList;
import java.util.Arrays;
@@ -24,6 +24,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import org.apache.sis.geometries.privy.AbstractGeometry;
+import org.apache.sis.geometries.Geometries;
+import org.apache.sis.geometries.GeometryCollection;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Utilities;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/GeometryOperations.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/GeometryOperations.java
index ee752db816..654fb0c11e 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/GeometryOperations.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/GeometryOperations.java
@@ -21,8 +21,8 @@ import org.apache.sis.geometries.AttributesType;
import org.apache.sis.geometries.Geometry;
import org.apache.sis.geometries.LineString;
import org.apache.sis.geometries.LinearRing;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MeshPrimitiveVisitor;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor;
import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.Triangle;
import org.apache.sis.geometries.operation.spatialanalysis2d.Buffer;
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 4455a7139e..3c18d9f37e 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
@@ -16,8 +16,8 @@
*/
package org.apache.sis.geometries.operation.spatialanalysis2d;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MeshPrimitiveVisitor;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor;
import org.apache.sis.geometries.PointSequence;
import org.apache.sis.geometries.Triangle;
import static
org.apache.sis.geometries.operation.spatialanalysis2d.ISOLine.interpolateToArray;
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 5403df9d4a..dce2039fd2 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
@@ -19,8 +19,8 @@ package org.apache.sis.geometries.operation.spatialanalysis2d;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MeshPrimitiveVisitor;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor;
import org.apache.sis.geometries.PointSequence;
import org.apache.sis.geometries.Triangle;
import org.apache.sis.geometries.math.DataType;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/IsoInclusion.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/IsoInclusion.java
index bb09220aac..61caf667de 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/IsoInclusion.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/operation/spatialanalysis2d/IsoInclusion.java
@@ -16,7 +16,7 @@
*/
package org.apache.sis.geometries.operation.spatialanalysis2d;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
/**
* Enum used in {@linkplain ISOBand isoband computation} to manage the
integration of
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AbstractGeometry.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractGeometry.java
similarity index 86%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AbstractGeometry.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractGeometry.java
index a81f5175cb..87acd71bf6 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AbstractGeometry.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractGeometry.java
@@ -14,13 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrayCursor;
import java.util.HashMap;
import java.util.Map;
+import org.apache.sis.geometries.Geometry;
+import org.apache.sis.geometries.PointSequence;
/**
* Abstract geometry, manages crs only.
@@ -44,7 +46,7 @@ public abstract class AbstractGeometry implements Geometry {
return asText();
}
- protected static void toText(StringBuilder sb, Tuple tuple) {
+ public static void toText(StringBuilder sb, Tuple tuple) {
sb.append(tuple.get(0));
for (int i = 1, n = tuple.getDimension(); i < n; i++) {
sb.append(' ');
@@ -52,7 +54,7 @@ public abstract class AbstractGeometry implements Geometry {
}
}
- protected static void toText(StringBuilder sb, TupleArray array) {
+ public static void toText(StringBuilder sb, TupleArray array) {
final TupleArrayCursor cursor = array.cursor();
boolean first = true;
while (cursor.next()) {
@@ -64,7 +66,7 @@ public abstract class AbstractGeometry implements Geometry {
}
}
- protected static void toText(StringBuilder sb, PointSequence array) {
+ public static void toText(StringBuilder sb, PointSequence array) {
final int size = array.size();
if (size == 0) return;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AbstractMultiCurve.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractMultiCurve.java
similarity index 90%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AbstractMultiCurve.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractMultiCurve.java
index 3f88b15ca7..e6d6bd6c23 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/AbstractMultiCurve.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/AbstractMultiCurve.java
@@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+import org.apache.sis.geometries.Curve;
+import org.apache.sis.geometries.MultiCurve;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/ArraySequence.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/ArraySequence.java
similarity index 97%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/ArraySequence.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/ArraySequence.java
index 7aca1bab13..0f3d630acd 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/ArraySequence.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/ArraySequence.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.math.DataType;
@@ -26,6 +26,9 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.sis.geometries.AttributesType;
+import org.apache.sis.geometries.Point;
+import org.apache.sis.geometries.PointSequence;
import org.apache.sis.util.ArgumentChecks;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultGeometryCollection.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultGeometryCollection.java
similarity index 92%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultGeometryCollection.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultGeometryCollection.java
index 3a387c370e..c6bf60cf9b 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultGeometryCollection.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultGeometryCollection.java
@@ -14,8 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+import org.apache.sis.geometries.Geometry;
+import org.apache.sis.geometries.GeometryCollection;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultLineString.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultLineString.java
similarity index 90%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultLineString.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultLineString.java
index fcd0cc931b..1616b46b89 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultLineString.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultLineString.java
@@ -14,7 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+
+import org.apache.sis.geometries.LineString;
+import org.apache.sis.geometries.PointSequence;
/**
*
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultLinearRing.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultLinearRing.java
similarity index 88%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultLinearRing.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultLinearRing.java
index 089e8ab67a..e8702fe943 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultLinearRing.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultLinearRing.java
@@ -14,7 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+
+import org.apache.sis.geometries.LinearRing;
+import org.apache.sis.geometries.PointSequence;
/**
* TODO : add linear ring constraints.
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiLineString.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
similarity index 88%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiLineString.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
index 09f38f2a5b..2613b56c0e 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiLineString.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiLineString.java
@@ -14,7 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+
+import org.apache.sis.geometries.LineString;
+import org.apache.sis.geometries.MultiLineString;
/**
*
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiPoint.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiPoint.java
similarity index 89%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiPoint.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiPoint.java
index deabe181ad..0d3463a522 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiPoint.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiPoint.java
@@ -14,8 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+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.opengis.geometry.Envelope;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiPolygon.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiPolygon.java
similarity index 88%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiPolygon.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiPolygon.java
index 3d164598ef..fb15bbb936 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiPolygon.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiPolygon.java
@@ -14,7 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+
+import org.apache.sis.geometries.MultiPolygon;
+import org.apache.sis.geometries.Polygon;
/**
*
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiSurface.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiSurface.java
similarity index 93%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiSurface.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiSurface.java
index fe070adba0..c99e596097 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultMultiSurface.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultMultiSurface.java
@@ -14,8 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
+import org.apache.sis.geometries.MultiSurface;
+import org.apache.sis.geometries.Surface;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPoint.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPoint.java
similarity index 95%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPoint.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPoint.java
index 3fc8f4cb80..c7acf911c8 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPoint.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPoint.java
@@ -14,13 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
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.TupleArrays;
import java.util.Objects;
+import org.apache.sis.geometries.AttributesType;
+import org.apache.sis.geometries.Point;
+import org.apache.sis.geometries.PointSequence;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPointSequence.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPointSequence.java
similarity index 93%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPointSequence.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPointSequence.java
index db771aa04b..cb67373c82 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPointSequence.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPointSequence.java
@@ -14,11 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
import org.apache.sis.geometries.math.Tuple;
import java.util.Arrays;
import java.util.List;
+import org.apache.sis.geometries.AttributesType;
+import org.apache.sis.geometries.Point;
+import org.apache.sis.geometries.PointSequence;
import org.apache.sis.util.ArgumentChecks;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPolygon.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPolygon.java
similarity index 92%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPolygon.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPolygon.java
index ff6de3f669..59a8b57476 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultPolygon.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultPolygon.java
@@ -14,10 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
import java.util.Collections;
import java.util.List;
+import org.apache.sis.geometries.Curve;
+import org.apache.sis.geometries.Geometries;
+import org.apache.sis.geometries.LinearRing;
+import org.apache.sis.geometries.Polygon;
import org.apache.sis.util.privy.UnmodifiableArrayList;
import org.apache.sis.util.ArgumentChecks;
import org.opengis.geometry.Envelope;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultTriangle.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultTriangle.java
similarity index 93%
rename from
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultTriangle.java
rename to
incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultTriangle.java
index be7ca71af3..d49e682e47 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/DefaultTriangle.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/privy/DefaultTriangle.java
@@ -14,9 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
import java.util.Objects;
+import org.apache.sis.geometries.LinearRing;
+import org.apache.sis.geometries.PointSequence;
+import org.apache.sis.geometries.Triangle;
/**
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialanalysis2d/Intersection.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialanalysis2d/Intersection.java
index ce4ae73934..b58c1bded2 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialanalysis2d/Intersection.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialanalysis2d/Intersection.java
@@ -17,16 +17,14 @@
package org.apache.sis.geometries.processor.spatialanalysis2d;
import org.apache.sis.geometries.AttributesType;
-import org.apache.sis.geometries.DefaultLineString;
-import org.apache.sis.geometries.DefaultMultiLineString;
-import org.apache.sis.geometries.DefaultPointSequence;
+import org.apache.sis.geometries.privy.DefaultPointSequence;
import org.apache.sis.geometries.Geometries;
import org.apache.sis.geometries.LineString;
import org.apache.sis.geometries.MultiLineString;
-import org.apache.sis.geometries.MultiMeshPrimitive;
+import org.apache.sis.geometries.mesh.MultiMeshPrimitive;
import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.PreparedTIN;
-import org.apache.sis.geometries.MeshPrimitiveVisitor;
+import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor;
import org.apache.sis.geometries.Triangle;
import org.apache.sis.geometries.operation.GeometryOperations;
import org.apache.sis.geometries.operation.OperationException;
@@ -43,8 +41,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
+import org.apache.sis.geometries.GeometryFactory;
import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
/**
*
@@ -227,7 +226,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(new DefaultLineString(new
DefaultPointSequence(point1, point2)));
+ segments.add(GeometryFactory.createLineString(new
DefaultPointSequence(point1, point2)));
}
}
} catch (TransformException ex) {
@@ -235,7 +234,7 @@ public final class Intersection {
}
}
- final MultiLineString mline = new
DefaultMultiLineString(segments.toArray(LineString[]::new));
+ final MultiLineString mline =
GeometryFactory.createMultiLineString(segments.toArray(LineString[]::new));
final MeshPrimitive intersection = (MeshPrimitive)
GeometryOperations.SpatialEdition.toPrimitive(mline);
operation.result = intersection;
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ComputeAttribute.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ComputeAttribute.java
index 8703b827ad..51151ae4d5 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ComputeAttribute.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ComputeAttribute.java
@@ -17,7 +17,7 @@
package org.apache.sis.geometries.processor.spatialedition;
import org.apache.sis.geometries.Geometry;
-import org.apache.sis.geometries.MeshPrimitiveVisitor;
+import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor;
import org.apache.sis.geometries.operation.GeometryOperations;
import org.apache.sis.geometries.operation.OperationException;
import org.apache.sis.geometries.processor.Processor;
@@ -39,7 +39,7 @@ public final class ComputeAttribute {
* Compute attribute on Primitive.
* Also works for ModelPrimitive.
*/
- public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ComputeAttribute,
org.apache.sis.geometries.MeshPrimitive>{
+ public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ComputeAttribute,
org.apache.sis.geometries.mesh.MeshPrimitive>{
@Override
public
Class<org.apache.sis.geometries.operation.spatialedition.ComputeAttribute>
getOperationClass() {
@@ -47,14 +47,14 @@ public final class ComputeAttribute {
}
@Override
- public Class<org.apache.sis.geometries.MeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ComputeAttribute
operation) throws OperationException {
- final org.apache.sis.geometries.MeshPrimitive base =
(org.apache.sis.geometries.MeshPrimitive) operation.geometry;
- final org.apache.sis.geometries.MeshPrimitive copy3d =
base.deepCopy();
+ final org.apache.sis.geometries.mesh.MeshPrimitive base =
(org.apache.sis.geometries.mesh.MeshPrimitive) operation.geometry;
+ final org.apache.sis.geometries.mesh.MeshPrimitive copy3d =
base.deepCopy();
operation.result = copy3d;
TupleArray ta = copy3d.getAttribute(operation.attributeName);
@@ -66,7 +66,7 @@ public final class ComputeAttribute {
if (operation.valueGenerator != null) {
new MeshPrimitiveVisitor(copy3d) {
@Override
- protected void
visit(org.apache.sis.geometries.MeshPrimitive.Vertex vertex) {
+ protected void
visit(org.apache.sis.geometries.mesh.MeshPrimitive.Vertex vertex) {
vertex.setAttribute(operation.attributeName,
operation.valueGenerator.apply(vertex));
}
}.visit();
@@ -79,7 +79,7 @@ public final class ComputeAttribute {
* Compute attribute on MultiPrimitive.
* Also works for ModelPrimitive.
*/
- public static class MultiPrimitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ComputeAttribute,
org.apache.sis.geometries.MultiMeshPrimitive>{
+ public static class MultiPrimitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ComputeAttribute,
org.apache.sis.geometries.mesh.MultiMeshPrimitive>{
@Override
public
Class<org.apache.sis.geometries.operation.spatialedition.ComputeAttribute>
getOperationClass() {
@@ -87,22 +87,22 @@ public final class ComputeAttribute {
}
@Override
- public Class<org.apache.sis.geometries.MultiMeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MultiMeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MultiMeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MultiMeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ComputeAttribute
operation) throws OperationException {
- final org.apache.sis.geometries.MultiMeshPrimitive base =
(org.apache.sis.geometries.MultiMeshPrimitive) operation.geometry;
+ final org.apache.sis.geometries.mesh.MultiMeshPrimitive base =
(org.apache.sis.geometries.mesh.MultiMeshPrimitive) operation.geometry;
- final List<org.apache.sis.geometries.MeshPrimitive> news = new
ArrayList<>();
+ final List<org.apache.sis.geometries.mesh.MeshPrimitive> news =
new ArrayList<>();
for (int i = 0, n = base.getNumGeometries(); i < n; i++) {
Geometry p = base.getGeometryN(i);
p = GeometryOperations.SpatialEdition.computeAttribute(p,
operation.attributeName, operation.attributeSystem, operation.attributeType,
operation.valueGenerator);
- news.add((org.apache.sis.geometries.MeshPrimitive) p);
+ news.add((org.apache.sis.geometries.mesh.MeshPrimitive) p);
}
- final org.apache.sis.geometries.MultiMeshPrimitive copy3d = new
org.apache.sis.geometries.MultiMeshPrimitive(base.getCoordinateReferenceSystem());
+ final org.apache.sis.geometries.mesh.MultiMeshPrimitive copy3d =
new
org.apache.sis.geometries.mesh.MultiMeshPrimitive(base.getCoordinateReferenceSystem());
copy3d.append(news);
operation.result = copy3d;
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/To3D.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/To3D.java
index 9eeae168bc..48ccf14fab 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/To3D.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/To3D.java
@@ -16,21 +16,20 @@
*/
package org.apache.sis.geometries.processor.spatialedition;
-import org.apache.sis.geometries.math.SampleSystem;
-import org.apache.sis.geometries.ArraySequence;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Consumer;
import org.apache.sis.geometries.AttributesType;
-import org.apache.sis.geometries.DefaultLineString;
-import org.apache.sis.geometries.DefaultPoint;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.geometries.PointSequence;
-import org.apache.sis.geometries.operation.OperationException;
-import org.apache.sis.geometries.processor.Processor;
+import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrayCursor;
import org.apache.sis.geometries.math.TupleArrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Consumer;
+import org.apache.sis.geometries.operation.OperationException;
+import org.apache.sis.geometries.privy.ArraySequence;
+import org.apache.sis.geometries.processor.Processor;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -132,8 +131,8 @@ public final class To3D {
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.To3D operation)
throws OperationException {
final org.apache.sis.geometries.Point base =
(org.apache.sis.geometries.Point) operation.geometry;
- final ArraySequence copy3d = to3d(base.asPointSequence(),
operation.crs3d, operation.Zeditor);
- operation.result = new DefaultPoint(copy3d);
+ final PointSequence copy3d = to3d(base.asPointSequence(),
operation.crs3d, operation.Zeditor);
+ operation.result = GeometryFactory.createPoint(copy3d);
}
}
@@ -155,8 +154,8 @@ public final class To3D {
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.To3D operation)
throws OperationException {
final org.apache.sis.geometries.LineString base =
(org.apache.sis.geometries.LineString) operation.geometry;
- final ArraySequence copy3d = to3d(base.getPoints(),
operation.crs3d, operation.Zeditor);
- operation.result = new DefaultLineString(copy3d);
+ final PointSequence copy3d = to3d(base.getPoints(),
operation.crs3d, operation.Zeditor);
+ operation.result = GeometryFactory.createLineString(copy3d);
}
}
@@ -164,7 +163,7 @@ public final class To3D {
* Add Z axis to Primitive.
* Also works for ModelPrimitive.
*/
- public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.To3D,
org.apache.sis.geometries.MeshPrimitive>{
+ public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.To3D,
org.apache.sis.geometries.mesh.MeshPrimitive>{
@Override
public Class<org.apache.sis.geometries.operation.spatialedition.To3D>
getOperationClass() {
@@ -172,14 +171,14 @@ public final class To3D {
}
@Override
- public Class<org.apache.sis.geometries.MeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.To3D operation)
throws OperationException {
- final org.apache.sis.geometries.MeshPrimitive base =
(org.apache.sis.geometries.MeshPrimitive) operation.geometry;
- final org.apache.sis.geometries.MeshPrimitive copy3d =
base.deepCopy();
+ final org.apache.sis.geometries.mesh.MeshPrimitive base =
(org.apache.sis.geometries.mesh.MeshPrimitive) operation.geometry;
+ final org.apache.sis.geometries.mesh.MeshPrimitive copy3d =
base.deepCopy();
operation.result = copy3d;
TupleArray positions = copy3d.getPositions();
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ToPrimitive.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ToPrimitive.java
index 1114b66545..9a91103141 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ToPrimitive.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/ToPrimitive.java
@@ -16,18 +16,18 @@
*/
package org.apache.sis.geometries.processor.spatialedition;
-import org.apache.sis.geometries.ArraySequence;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.sis.geometries.AttributesType;
import org.apache.sis.geometries.Geometry;
import org.apache.sis.geometries.PointSequence;
+import org.apache.sis.geometries.math.TupleArray;
+import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.operation.GeometryOperations;
import org.apache.sis.geometries.operation.OperationException;
+import org.apache.sis.geometries.privy.ArraySequence;
import org.apache.sis.geometries.processor.Processor;
-import org.apache.sis.geometries.math.TupleArray;
-import org.apache.sis.geometries.math.TupleArrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.sis.geometries.triangulate.EarClipping;
/**
@@ -63,7 +63,7 @@ public final class ToPrimitive {
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ToPrimitive
operation) throws OperationException {
- final org.apache.sis.geometries.MeshPrimitive primitive = new
org.apache.sis.geometries.MeshPrimitive.Points();
+ final org.apache.sis.geometries.mesh.MeshPrimitive primitive = new
org.apache.sis.geometries.mesh.MeshPrimitive.Points();
final AttributesType attributesType =
operation.geometry.getAttributesType();
for (String name : attributesType.getAttributeNames()) {
final TupleArray array =
TupleArrays.of(attributesType.getAttributeSystem(name),
attributesType.getAttributeType(name), 1);
@@ -91,7 +91,7 @@ public final class ToPrimitive {
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ToPrimitive
operation) throws OperationException {
- final org.apache.sis.geometries.MeshPrimitive primitive = new
org.apache.sis.geometries.MeshPrimitive.LineStrip();
+ final org.apache.sis.geometries.mesh.MeshPrimitive primitive = new
org.apache.sis.geometries.mesh.MeshPrimitive.LineStrip();
final ArraySequence array =
toArraySequence(((org.apache.sis.geometries.LineString)
operation.geometry).getPoints());
for (String name : array.getAttributeNames()) {
primitive.setAttribute(name, array.getAttribute(name));
@@ -141,7 +141,7 @@ public final class ToPrimitive {
public void
process(org.apache.sis.geometries.operation.spatialedition.ToPrimitive
operation) throws OperationException {
final org.apache.sis.geometries.MultiPoint cdt =
(org.apache.sis.geometries.MultiPoint) operation.geometry;
final ArraySequence array = toArraySequence(cdt.asPointSequence());
- final org.apache.sis.geometries.MeshPrimitive primitive = new
org.apache.sis.geometries.MeshPrimitive.Points();
+ final org.apache.sis.geometries.mesh.MeshPrimitive primitive = new
org.apache.sis.geometries.mesh.MeshPrimitive.Points();
for (String name : array.getAttributeNames()) {
primitive.setAttribute(name, array.getAttribute(name));
}
@@ -175,7 +175,7 @@ public final class ToPrimitive {
}
if (allLines) {
- final org.apache.sis.geometries.MeshPrimitive.Lines primitive
= new org.apache.sis.geometries.MeshPrimitive.Lines();
+ final org.apache.sis.geometries.mesh.MeshPrimitive.Lines
primitive = new org.apache.sis.geometries.mesh.MeshPrimitive.Lines();
final AttributesType attributesType = cdt.getAttributesType();
for (String name : attributesType.getAttributeNames()) {
primitive.setAttribute(name,
TupleArrays.of(attributesType.getAttributeSystem(name),
attributesType.getAttributeType(name), numGeometries*2));
@@ -192,13 +192,13 @@ public final class ToPrimitive {
}
operation.result = primitive;
} else {
- final
org.apache.sis.geometries.MultiMeshPrimitive<org.apache.sis.geometries.MeshPrimitive>
mp =
- new
org.apache.sis.geometries.MultiMeshPrimitive(operation.geometry.getCoordinateReferenceSystem());
+ final
org.apache.sis.geometries.mesh.MultiMeshPrimitive<org.apache.sis.geometries.mesh.MeshPrimitive>
mp =
+ new
org.apache.sis.geometries.mesh.MultiMeshPrimitive(operation.geometry.getCoordinateReferenceSystem());
for (int i = 0; i < numGeometries; i++) {
final Geometry p =
GeometryOperations.SpatialEdition.toPrimitive(cdt.getGeometryN(i));
- if (p instanceof
org.apache.sis.geometries.MultiMeshPrimitive<?> subm) {
+ if (p instanceof
org.apache.sis.geometries.mesh.MultiMeshPrimitive<?> subm) {
mp.append(subm.getComponents());
- } else if (p instanceof
org.apache.sis.geometries.MeshPrimitive cd){
+ } else if (p instanceof
org.apache.sis.geometries.mesh.MeshPrimitive cd){
mp.append(Collections.singletonList(cd));
}
}
@@ -224,13 +224,13 @@ public final class ToPrimitive {
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ToPrimitive
operation) throws OperationException {
- final
org.apache.sis.geometries.MultiMeshPrimitive<org.apache.sis.geometries.MeshPrimitive>
mp = new
org.apache.sis.geometries.MultiMeshPrimitive(operation.geometry.getCoordinateReferenceSystem());
+ final
org.apache.sis.geometries.mesh.MultiMeshPrimitive<org.apache.sis.geometries.mesh.MeshPrimitive>
mp = new
org.apache.sis.geometries.mesh.MultiMeshPrimitive(operation.geometry.getCoordinateReferenceSystem());
final org.apache.sis.geometries.GeometryCollection cdt =
(org.apache.sis.geometries.GeometryCollection) operation.geometry;
for (int i = 0, n = cdt.getNumGeometries(); i < n; i++) {
final Geometry p =
GeometryOperations.SpatialEdition.toPrimitive(cdt.getGeometryN(i));
- if (p instanceof
org.apache.sis.geometries.MultiMeshPrimitive<?> subm) {
+ if (p instanceof
org.apache.sis.geometries.mesh.MultiMeshPrimitive<?> subm) {
mp.append(subm.getComponents());
- } else if (p instanceof
org.apache.sis.geometries.MeshPrimitive cd){
+ } else if (p instanceof
org.apache.sis.geometries.mesh.MeshPrimitive cd){
mp.append(Collections.singletonList(cd));
}
}
@@ -241,7 +241,7 @@ public final class ToPrimitive {
/**
* Does nothing, geometry is already a Primitive.
*/
- public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ToPrimitive,
org.apache.sis.geometries.MeshPrimitive>{
+ public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ToPrimitive,
org.apache.sis.geometries.mesh.MeshPrimitive>{
@Override
public
Class<org.apache.sis.geometries.operation.spatialedition.ToPrimitive>
getOperationClass() {
@@ -249,20 +249,20 @@ public final class ToPrimitive {
}
@Override
- public Class<org.apache.sis.geometries.MeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ToPrimitive
operation) throws OperationException {
- operation.result = (org.apache.sis.geometries.MeshPrimitive)
operation.geometry;
+ operation.result = (org.apache.sis.geometries.mesh.MeshPrimitive)
operation.geometry;
}
}
/**
* Does nothing, geometry is already a MultiPrimitive.
*/
- public static class MultiPrimitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ToPrimitive,
org.apache.sis.geometries.MultiMeshPrimitive>{
+ public static class MultiPrimitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.ToPrimitive,
org.apache.sis.geometries.mesh.MultiMeshPrimitive>{
@Override
public
Class<org.apache.sis.geometries.operation.spatialedition.ToPrimitive>
getOperationClass() {
@@ -270,13 +270,13 @@ public final class ToPrimitive {
}
@Override
- public Class<org.apache.sis.geometries.MultiMeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MultiMeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MultiMeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MultiMeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.ToPrimitive
operation) throws OperationException {
- operation.result = (org.apache.sis.geometries.MultiMeshPrimitive)
operation.geometry;
+ operation.result =
(org.apache.sis.geometries.mesh.MultiMeshPrimitive) operation.geometry;
}
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/Transform.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/Transform.java
index 276f4501a8..3d6461afa4 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/Transform.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/processor/spatialedition/Transform.java
@@ -16,26 +16,23 @@
*/
package org.apache.sis.geometries.processor.spatialedition;
-import org.apache.sis.geometries.math.SampleSystem;
-import org.apache.sis.geometries.ArraySequence;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.apache.sis.geometries.AttributesType;
-import org.apache.sis.geometries.DefaultLinearRing;
-import org.apache.sis.geometries.DefaultTriangle;
+import org.apache.sis.geometries.Curve;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.geometries.PointSequence;
-import org.apache.sis.geometries.operation.GeometryOperations;
-import org.apache.sis.geometries.operation.OperationException;
-import org.apache.sis.geometries.processor.Processor;
+import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.math.Vector;
import org.apache.sis.geometries.math.Vectors;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.sis.geometries.Curve;
-import org.apache.sis.geometries.DefaultPolygon;
-import org.apache.sis.geometries.LinearRing;
+import org.apache.sis.geometries.operation.GeometryOperations;
+import org.apache.sis.geometries.operation.OperationException;
+import org.apache.sis.geometries.privy.ArraySequence;
+import org.apache.sis.geometries.processor.Processor;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
import org.opengis.referencing.operation.TransformException;
@@ -101,7 +98,7 @@ public final class Transform {
cp.setAttribute(name, ps.getAttributeArray(name).copy());
}
}
- operation.result = new DefaultLinearRing(cp);
+ operation.result = GeometryFactory.createLinearRing(cp);
}
}
@@ -128,11 +125,11 @@ public final class Transform {
interiors.set(i, (Curve)
GeometryOperations.SpatialEdition.transform(interiors.get(i), operation.crs,
operation.transform));
}
- operation.result = new
DefaultPolygon((org.apache.sis.geometries.LinearRing) exterior, (List)
interiors);
+ operation.result =
GeometryFactory.createPolygon((org.apache.sis.geometries.LinearRing) exterior,
(List) interiors);
}
}
- public static class MultiPrimitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.Transform,
org.apache.sis.geometries.MultiMeshPrimitive>{
+ public static class MultiPrimitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.Transform,
org.apache.sis.geometries.mesh.MultiMeshPrimitive>{
@Override
public
Class<org.apache.sis.geometries.operation.spatialedition.Transform>
getOperationClass() {
@@ -140,17 +137,17 @@ public final class Transform {
}
@Override
- public Class<org.apache.sis.geometries.MultiMeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MultiMeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MultiMeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MultiMeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.Transform operation)
throws OperationException {
- final org.apache.sis.geometries.MultiMeshPrimitive<?> mp =
(org.apache.sis.geometries.MultiMeshPrimitive) operation.geometry;
- final org.apache.sis.geometries.MultiMeshPrimitive<?> copy = new
org.apache.sis.geometries.MultiMeshPrimitive(operation.crs);
- final List<org.apache.sis.geometries.MeshPrimitive> primitives =
new ArrayList<>();
- for (org.apache.sis.geometries.MeshPrimitive p :
mp.getComponents()) {
- primitives.add((org.apache.sis.geometries.MeshPrimitive)
GeometryOperations.SpatialEdition.transform(p, operation.crs,
operation.transform));
+ final org.apache.sis.geometries.mesh.MultiMeshPrimitive<?> mp =
(org.apache.sis.geometries.mesh.MultiMeshPrimitive) operation.geometry;
+ final org.apache.sis.geometries.mesh.MultiMeshPrimitive<?> copy =
new org.apache.sis.geometries.mesh.MultiMeshPrimitive(operation.crs);
+ final List<org.apache.sis.geometries.mesh.MeshPrimitive>
primitives = new ArrayList<>();
+ for (org.apache.sis.geometries.mesh.MeshPrimitive p :
mp.getComponents()) {
+ primitives.add((org.apache.sis.geometries.mesh.MeshPrimitive)
GeometryOperations.SpatialEdition.transform(p, operation.crs,
operation.transform));
}
copy.append(primitives);
operation.result = copy;
@@ -161,7 +158,7 @@ public final class Transform {
* Transform primitive to a new CoordinateReferenceSystem.
* Note : this method will clone all other attributes untransformed.
*/
- public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.Transform,
org.apache.sis.geometries.MeshPrimitive>{
+ public static class Primitive implements
Processor<org.apache.sis.geometries.operation.spatialedition.Transform,
org.apache.sis.geometries.mesh.MeshPrimitive>{
@Override
public
Class<org.apache.sis.geometries.operation.spatialedition.Transform>
getOperationClass() {
@@ -169,14 +166,14 @@ public final class Transform {
}
@Override
- public Class<org.apache.sis.geometries.MeshPrimitive>
getGeometryClass() {
- return org.apache.sis.geometries.MeshPrimitive.class;
+ public Class<org.apache.sis.geometries.mesh.MeshPrimitive>
getGeometryClass() {
+ return org.apache.sis.geometries.mesh.MeshPrimitive.class;
}
@Override
public void
process(org.apache.sis.geometries.operation.spatialedition.Transform operation)
throws OperationException {
- final org.apache.sis.geometries.MeshPrimitive p =
(org.apache.sis.geometries.MeshPrimitive) operation.geometry;
- final org.apache.sis.geometries.MeshPrimitive copy =
org.apache.sis.geometries.MeshPrimitive.create(p.getType());
+ final org.apache.sis.geometries.mesh.MeshPrimitive p =
(org.apache.sis.geometries.mesh.MeshPrimitive) operation.geometry;
+ final org.apache.sis.geometries.mesh.MeshPrimitive copy =
org.apache.sis.geometries.mesh.MeshPrimitive.create(p.getType());
final Set<String> toSkip = new HashSet<>();
final TupleArray positions =
p.getAttribute(AttributesType.ATT_POSITION);
@@ -269,7 +266,7 @@ public final class Transform {
cp.setAttribute(name, ps.getAttributeArray(name).copy());
}
}
- operation.result = new DefaultTriangle(new DefaultLinearRing(cp));
+ operation.result =
GeometryFactory.createTriangle(GeometryFactory.createLinearRing(cp));
}
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/TINBuilder.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/TINBuilder.java
index 92a5d91ce9..badddff3b0 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/TINBuilder.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/TINBuilder.java
@@ -28,9 +28,7 @@ import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.apache.sis.geometries.ArraySequence;
-import org.apache.sis.geometries.DefaultLinearRing;
-import org.apache.sis.geometries.DefaultTriangle;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.geometries.LinearRing;
import org.apache.sis.geometries.PointSequence;
import org.apache.sis.geometries.Triangle;
@@ -125,9 +123,9 @@ public final class TINBuilder {
for (int i = 0, n = finished.size(); i < n; i++) {
final WTriangle t = finished.get(i);
final TupleArray positions = TupleArrays.of(Arrays.asList(t.p0,
t.p1, t.p2, t.p0), t.p0.getSampleSystem(), t.p0.getDataType());
- final PointSequence points = new ArraySequence(positions);
- final LinearRing exterior = new DefaultLinearRing(points);
- triangles.add(new DefaultTriangle(exterior));
+ final PointSequence points =
GeometryFactory.createSequence(positions);
+ final LinearRing exterior =
GeometryFactory.createLinearRing(points);
+ triangles.add(GeometryFactory.createTriangle(exterior));
}
return triangles;
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/WTriangle.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/WTriangle.java
index 8d6ba6659d..929861afaf 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/WTriangle.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/simplify/greedyinsert/WTriangle.java
@@ -16,9 +16,8 @@
*/
package org.apache.sis.geometries.simplify.greedyinsert;
-import org.apache.sis.geometries.AbstractGeometry;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.AttributesType;
-import org.apache.sis.geometries.DefaultLinearRing;
import org.apache.sis.geometries.LinearRing;
import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.PointSequence;
@@ -28,6 +27,7 @@ import org.apache.sis.geometries.math.Tuple;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiFunction;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.geometries.operation.OperationException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -38,7 +38,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
*/
final class WTriangle extends AbstractGeometry implements Triangle {
- private final LinearRing ring = new DefaultLinearRing(new PointSequence() {
+ private final LinearRing ring = GeometryFactory.createLinearRing(new
PointSequence() {
@Override
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
return p0.getCoordinateReferenceSystem();
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/EarClipping.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/EarClipping.java
index a4c90ae8bd..d64b3403e9 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/EarClipping.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/EarClipping.java
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.sis.geometries.AttributesType;
import org.apache.sis.geometries.Geometry;
import org.apache.sis.geometries.LineString;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometries.Polygon;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.TupleArray;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/Delaunay.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/Delaunay.java
index e4b08daaaa..81e3c67682 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/Delaunay.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/Delaunay.java
@@ -23,8 +23,8 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MeshPrimitive.Vertex;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex;
import org.apache.sis.geometries.index.KdTree;
import org.apache.sis.geometries.math.Maths;
import org.apache.sis.geometries.math.Tuple;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedEdge.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedEdge.java
index cf2eb002a7..f3eb72bd55 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedEdge.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedEdge.java
@@ -16,17 +16,17 @@
*/
package org.apache.sis.geometries.triangulate.delaunay;
-import org.apache.sis.geometries.AbstractGeometry;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.AttributesType;
import org.apache.sis.geometries.LineString;
import org.apache.sis.geometries.PointSequence;
-import org.apache.sis.geometries.MeshPrimitive.Vertex;
+import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex;
import org.apache.sis.geometries.math.Maths;
import org.apache.sis.geometries.math.Tuple;
import java.util.Iterator;
import org.opengis.geometry.Envelope;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
/**
* A oriented edge is a straight line between from a start point to an end
point.
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedTriangle.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedTriangle.java
index a6ebf774ca..b61258c0ca 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedTriangle.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/triangulate/delaunay/OrientedTriangle.java
@@ -16,21 +16,21 @@
*/
package org.apache.sis.geometries.triangulate.delaunay;
-import org.apache.sis.geometries.AbstractGeometry;
+import org.apache.sis.geometries.privy.AbstractGeometry;
import org.apache.sis.geometries.AttributesType;
-import org.apache.sis.geometries.DefaultLinearRing;
import org.apache.sis.geometries.LinearRing;
import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.PointSequence;
-import org.apache.sis.geometries.MeshPrimitive.Vertex;
+import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex;
import org.apache.sis.geometries.Triangle;
import org.apache.sis.geometries.operation.OperationException;
import org.apache.sis.geometries.math.Tuple;
import java.awt.geom.Point2D;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.referencing.privy.ShapeUtilities;
import org.opengis.geometry.Envelope;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
/**
*
@@ -38,7 +38,7 @@ import org.apache.sis.geometries.MeshPrimitive;
*/
final class OrientedTriangle extends AbstractGeometry implements Triangle,
PointSequence {
- private final LinearRing ring = new DefaultLinearRing(this);
+ private final LinearRing ring = GeometryFactory.createLinearRing(this);
private boolean obsolete = false;
public final OrientedEdge ab;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
index 55076e922c..0359b36016 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.sis.geometries;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
import static org.junit.jupiter.api.Assertions.*;
@@ -67,171 +64,4 @@ public class GeometriesTest {
}
- /**
- * Test concatenating triangles.
- */
- @Test
- public void testConcatenateTriangles() {
-
- final MeshPrimitive ts0 = new MeshPrimitive.Triangles();
- ts0.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2}));
- ts0.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0,
- -1,-1,-1, //an unused position, must be added anyway, not the algo
problem at this point
- -1,-1,-1 //an unused position, must be added anyway, not the algo
problem at this point
- }));
-
- final MeshPrimitive ts1 = new MeshPrimitive.Triangles();
- ts1.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2}));
- ts1.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0,
- -1,-1,-1 //an unused position, must be added anyway, not the algo
problem at this point
- }));
-
- final MeshPrimitive ts2 = new MeshPrimitive.Triangles();
- ts2.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2}));
- ts2.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0,
- -1,-1,-1 //an unused position, must be added anyway, not the algo
problem at this point
- }));
-
- final MeshPrimitive ts = Geometries.concatenate(Arrays.asList(ts0,
ts1, ts2));
-
- assertArrayEquals(new int[]{
- 0,1,2, // +2 unused positions
- 5,6,7, // +1 unused position
- 9,10,11
- }, ts.getIndex().toArrayInt());
-
- ts.validate();
- }
-
- /**
- * Test concatenating triangle strips.
- * Strips must be joined by a degenerated triangle.
- */
- @Test
- public void testConcatenateTriangleStrip() {
-
- final MeshPrimitive ts0 = new MeshPrimitive.TriangleStrip();
- ts0.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2,3}));
- ts0.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0,
- 5,6,0
- }));
-
- final MeshPrimitive ts1 = new MeshPrimitive.TriangleStrip();
- ts1.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2,3}));
- ts1.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0,
- 5,6,0
- }));
-
- final MeshPrimitive ts2 = new MeshPrimitive.TriangleStrip();
- ts2.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2,3}));
- ts2.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0,
- 5,6,0
- }));
-
- final MeshPrimitive ts = Geometries.concatenate(Arrays.asList(ts0,
ts1, ts2));
-
- assertArrayEquals(new int[]{
- 0,1,2,3,
- 3,4, //linking degenerated triangle
- 4,5,6,7,
- 7,8, //linking degenerated triangle
- 8,9,10,11
- }, ts.getIndex().toArrayInt());
-
- ts.validate();
- }
-
- /**
- * Test concatenating triangle strips.
- * strips reuse the same vertices in this test
- * Strips must be joined by a degenerated triangle.
- */
- @Test
- public void testConcatenateTriangleStrip2() {
-
- final MeshPrimitive ts0 = new MeshPrimitive.TriangleStrip();
- ts0.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,2,1}));
- ts0.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0
- }));
-
- final MeshPrimitive ts1 = new MeshPrimitive.TriangleStrip();
- ts1.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,0,0}));
- ts1.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0
- }));
-
- final MeshPrimitive ts2 = new MeshPrimitive.TriangleStrip();
- ts2.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,1,1,2}));
- ts2.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- 2,3,0,
- 4,5,0
- }));
-
- final MeshPrimitive ts = Geometries.concatenate(Arrays.asList(ts0,
ts1, ts2));
-
- assertArrayEquals(new int[]{
- 0,1,2,1,
- 1,3, //linking degenerated triangle
- 3,4,3,3,
- 3,5, //linking degenerated triangle
- 5,6,6,7
- }, ts.getIndex().toArrayInt());
-
- ts.validate();
- }
-
- /**
- * Test splitting triangles.
- */
- @Test
- public void testSplitTriangles() {
-
- final MeshPrimitive ts0 = new MeshPrimitive.Triangles();
- ts0.setIndex(TupleArrays.ofUnsigned(1, new int[]{0,2,3, 3,0,2}));
- ts0.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3), new
float[]{
- 0,1,0,
- -1,-1,-1, //an unused position, must be added anyway, not the algo
problem at this point
- 2,3,0,
- 4,5,0,
- -1,-1,-1 //an unused position, must be added anyway, not the algo
problem at this point
- }));
-
- final List<MeshPrimitive> primitives = Geometries.split(ts0, 3);
- assertEquals(2, primitives.size());
- final MeshPrimitive p0 = primitives.get(0);
- final MeshPrimitive p1 = primitives.get(1);
-
- assertEquals(1, p0.getAttributesType().getAttributeNames().size());
- assertEquals(1, p1.getAttributesType().getAttributeNames().size());
- assertEquals(MeshPrimitive.Type.TRIANGLES, p0.getType());
- assertEquals(MeshPrimitive.Type.TRIANGLES, p1.getType());
-
- assertArrayEquals(new int[]{0,1,2}, p0.getIndex().toArrayInt());
- assertArrayEquals(new int[]{0,1,2}, p1.getIndex().toArrayInt());
- assertArrayEquals(new int[]{0,1,0, 2,3,0, 4,5,0},
p0.getPositions().toArrayInt());
- assertArrayEquals(new int[]{4,5,0, 0,1,0, 2,3,0},
p1.getPositions().toArrayInt());
- }
}
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PreparedTINTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PreparedTINTest.java
index 602a0b0486..bef31f33e6 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PreparedTINTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PreparedTINTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.geometries;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.referencing.CRS;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveTest.java
deleted file mode 100644
index 5604ff6328..0000000000
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.geometries;
-
-import org.apache.sis.geometries.math.TupleArrays;
-import static org.junit.jupiter.api.Assertions.*;
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author Johann Sorel (Geomatys)
- */
-public class PrimitiveTest {
-
- /**
- * Test remove duplicate method.
- * In this test vertex 0 and 3 are duplicates.
- */
- @Test
- public void testRemoveDuplicatesByPosition() {
-
- final MeshPrimitive primitive = new MeshPrimitive.TriangleStrip();
- primitive.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3),
- 0,0,0, // <- duplicate
- 0,1,0,
- 1,0,0,
- 0,0,0, // <- duplicate
- 2,0,0));
- primitive.setNormals(TupleArrays.of(3,
- 1,0,0, // <- duplicate
- 2,0,0,
- 3,0,0,
- 4,1,1, // <- duplicate, will not be preserved
- 5,0,0));
- primitive.setIndex(TupleArrays.ofUnsigned(1,
- 0, 1, 2, 3,4));
-
- primitive.removeDuplicatesByPosition();
-
- final int[] positions = primitive.getPositions().toArrayInt();
- final int[] normals = primitive.getNormals().toArrayInt();
- final int[] index = primitive.getIndex().toArrayInt();
-
- assertArrayEquals(new int[]{0,1,2,0,3}, index);
- assertArrayEquals(new int[]{0,0,0, 0,1,0, 1,0,0, 2,0,0}, positions);
- assertArrayEquals(new int[]{1,0,0, 2,0,0, 3,0,0, 5,0,0}, normals);
-
- }
-
-}
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 0d5b226dc3..1265d4790b 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
@@ -35,9 +35,9 @@ public class TriangleTest {
public void constructorTest() {
final TupleArray positions =
TupleArrays.of(CommonCRS.WGS84.normalizedGeographic(), new double[]{0,0, 1,0,
0,1, 0,0});
- final PointSequence points = new ArraySequence(positions);
- final LinearRing exterior = new DefaultLinearRing(points);
- final Triangle triangle = new DefaultTriangle(exterior);
+ final PointSequence points = GeometryFactory.createSequence(positions);
+ final LinearRing exterior = GeometryFactory.createLinearRing(points);
+ final Triangle triangle = GeometryFactory.createTriangle(exterior);
assertNotNull(triangle.getExteriorRing());
assertTrue(triangle.getInteriorRings().isEmpty());
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveIndexesTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveIndexesTest.java
similarity index 98%
rename from
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveIndexesTest.java
rename to
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveIndexesTest.java
index a40876ee5c..d54be53529 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveIndexesTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveIndexesTest.java
@@ -14,8 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitiveIndexes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveTest.java
similarity index 84%
copy from
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
copy to
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveTest.java
index 55076e922c..c224c118e9 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/GeometriesTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveTest.java
@@ -14,56 +14,53 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
import java.util.Arrays;
import java.util.List;
+import org.apache.sis.geometries.Geometries;
import org.apache.sis.geometries.math.TupleArrays;
-import org.apache.sis.referencing.CRS;
-import org.apache.sis.referencing.CommonCRS;
import static org.junit.jupiter.api.Assertions.*;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.referencing.operation.MathTransform;
-import org.opengis.util.FactoryException;
-
/**
*
* @author Johann Sorel (Geomatys)
*/
-public class GeometriesTest {
-
- /**
- * Test creation of undefined CRS.
- */
- @Test
- public void testUndefinedCrs() {
-
- for (int i = 1; i < 10; i++) {
- CoordinateReferenceSystem crs = Geometries.getUndefinedCRS(i);
-
- assertTrue(Geometries.isUndefined(crs));
-
- try {
- CRS.findOperation(crs, CommonCRS.WGS84.geographic(), null);
- fail("Conversion to geographic crs should have fail");
- } catch (FactoryException ex) {
- //ok
- }
- }
- }
+public class PrimitiveTest {
/**
- * Test transform between cartesian crs
+ * Test remove duplicate method.
+ * In this test vertex 0 and 3 are duplicates.
*/
@Test
- @Disabled
- public void testCartesianCrsTransform() throws FactoryException {
-
- MathTransform trs = CRS.findOperation(Geometries.RIGHT_HAND_3D,
Geometries.PSEUDOGEO_3D, null).getMathTransform();
- System.out.println(trs);
+ public void testRemoveDuplicatesByPosition() {
+
+ final MeshPrimitive primitive = new MeshPrimitive.TriangleStrip();
+ primitive.setPositions(TupleArrays.of(Geometries.getUndefinedCRS(3),
+ 0,0,0, // <- duplicate
+ 0,1,0,
+ 1,0,0,
+ 0,0,0, // <- duplicate
+ 2,0,0));
+ primitive.setNormals(TupleArrays.of(3,
+ 1,0,0, // <- duplicate
+ 2,0,0,
+ 3,0,0,
+ 4,1,1, // <- duplicate, will not be preserved
+ 5,0,0));
+ primitive.setIndex(TupleArrays.ofUnsigned(1,
+ 0, 1, 2, 3,4));
+
+ primitive.removeDuplicatesByPosition();
+
+ final int[] positions = primitive.getPositions().toArrayInt();
+ final int[] normals = primitive.getNormals().toArrayInt();
+ final int[] index = primitive.getIndex().toArrayInt();
+
+ assertArrayEquals(new int[]{0,1,2,0,3}, index);
+ assertArrayEquals(new int[]{0,0,0, 0,1,0, 1,0,0, 2,0,0}, positions);
+ assertArrayEquals(new int[]{1,0,0, 2,0,0, 3,0,0, 5,0,0}, normals);
}
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveVisitorTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveVisitorTest.java
similarity index 98%
rename from
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveVisitorTest.java
rename to
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveVisitorTest.java
index 854a492ce5..7b37d87619 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/PrimitiveVisitorTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/mesh/PrimitiveVisitorTest.java
@@ -14,11 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.mesh;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitiveVisitor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.sis.geometries.Geometries;
+import org.apache.sis.geometries.LineString;
+import org.apache.sis.geometries.Point;
+import org.apache.sis.geometries.TIN;
+import org.apache.sis.geometries.Triangle;
import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.math.Vector3D;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/spatialanalysis2d/IsoBandTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/spatialanalysis2d/IsoBandTest.java
index 628266cafc..46ab5d7692 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/spatialanalysis2d/IsoBandTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/operation/spatialanalysis2d/IsoBandTest.java
@@ -22,7 +22,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.sis.geometries.Geometries;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.math.TupleArrays;
import static
org.apache.sis.geometries.operation.spatialanalysis2d.ISOLine.interpolateToCoord2D;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/ArraySequenceTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/privy/ArraySequenceTest.java
similarity index 97%
rename from
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/ArraySequenceTest.java
rename to
incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/privy/ArraySequenceTest.java
index 2723993914..2c52297953 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/ArraySequenceTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/privy/ArraySequenceTest.java
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.geometries;
+package org.apache.sis.geometries.privy;
import java.util.HashMap;
import java.util.Map;
+import org.apache.sis.geometries.AttributesType;
+import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrays;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/DistanceTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/DistanceTest.java
index fe5c38da43..7a842d46e9 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/DistanceTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/DistanceTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.sis.geometries.processor.spatialanalysis2d;
-import org.apache.sis.geometries.DefaultPoint;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.math.SampleSystem;
import org.apache.sis.geometries.operation.GeometryOperations;
@@ -41,8 +41,8 @@ public class DistanceTest {
public void PointPoint() {
{ //different CRS
- final Point point1 = new
DefaultPoint(CommonCRS.WGS84.geographic());
- final Point point2 = new
DefaultPoint(CommonCRS.WGS84.normalizedGeographic());
+ final Point point1 =
GeometryFactory.createPoint(CommonCRS.WGS84.geographic());
+ final Point point2 =
GeometryFactory.createPoint(CommonCRS.WGS84.normalizedGeographic());
try {
new Distance(point1, point2).eval();
fail("evaluation should fail");
@@ -52,14 +52,14 @@ public class DistanceTest {
}
{ //at same position
- final Point point1 = new DefaultPoint(CRS2D, 10.0, 5.0);
- final Point point2 = new DefaultPoint(CRS2D, 10.0, 5.0);
+ final Point point1 = GeometryFactory.createPoint(CRS2D, 10.0, 5.0);
+ final Point point2 = GeometryFactory.createPoint(CRS2D, 10.0, 5.0);
assertEquals(0.0,
GeometryOperations.SpatialAnalysis2D.distance(point1, point2), 0.0);
}
{ //at 1.0 of distance
- final Point point1 = new DefaultPoint(CRS2D, 10, 5);
- final Point point2 = new DefaultPoint(CRS2D, 10, 6);
+ final Point point1 = GeometryFactory.createPoint(CRS2D, 10, 5);
+ final Point point2 = GeometryFactory.createPoint(CRS2D, 10, 6);
assertEquals(1.0,
GeometryOperations.SpatialAnalysis2D.distance(point1, point2), 0.0);
}
}
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/IntersectionTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/IntersectionTest.java
index 30d0a154f4..b952dac928 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/IntersectionTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialanalysis2d/IntersectionTest.java
@@ -18,7 +18,7 @@ package org.apache.sis.geometries.processor.spatialanalysis2d;
import org.apache.sis.geometries.Geometry;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.operation.GeometryOperations;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/To3DTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/To3DTest.java
index b897b7aa03..4458562d60 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/To3DTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/To3DTest.java
@@ -17,7 +17,7 @@
package org.apache.sis.geometries.processor.spatialedition;
import org.apache.sis.geometries.Geometry;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometries.math.Tuple;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.operation.GeometryOperations;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/ToPrimitiveTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/ToPrimitiveTest.java
index 337fff84fa..14042dc6a9 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/ToPrimitiveTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/ToPrimitiveTest.java
@@ -16,20 +16,14 @@
*/
package org.apache.sis.geometries.processor.spatialedition;
-import org.apache.sis.geometries.ArraySequence;
import org.apache.sis.geometries.AttributesType;
-import org.apache.sis.geometries.DefaultLineString;
-import org.apache.sis.geometries.DefaultLinearRing;
-import org.apache.sis.geometries.DefaultMultiLineString;
-import org.apache.sis.geometries.DefaultMultiPoint;
-import org.apache.sis.geometries.DefaultPoint;
-import org.apache.sis.geometries.DefaultPolygon;
import org.apache.sis.geometries.Geometry;
+import org.apache.sis.geometries.GeometryFactory;
import org.apache.sis.geometries.LineString;
import org.apache.sis.geometries.LinearRing;
-import org.apache.sis.geometries.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometries.MultiLineString;
-import org.apache.sis.geometries.MultiMeshPrimitive;
+import org.apache.sis.geometries.mesh.MultiMeshPrimitive;
import org.apache.sis.geometries.MultiPoint;
import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.PointSequence;
@@ -52,7 +46,7 @@ public class ToPrimitiveTest {
@Test
public void testPoint() {
- final Point point = new DefaultPoint(CRS2D, 1, 2);
+ final Point point = GeometryFactory.createPoint(CRS2D, 1, 2);
final Geometry result =
GeometryOperations.SpatialEdition.toPrimitive(point);
assertTrue(result instanceof MeshPrimitive);
final MeshPrimitive primitive = (MeshPrimitive) result;
@@ -62,8 +56,8 @@ public class ToPrimitiveTest {
@Test
public void testLineString() {
final TupleArray positions = TupleArrays.of(CRS2D, new
double[]{0,1,2,3});
- final PointSequence points = new ArraySequence(positions);
- final LineString line = new DefaultLineString(points);
+ final PointSequence points = GeometryFactory.createSequence(positions);
+ final LineString line = GeometryFactory.createLineString(points);
final Geometry result =
GeometryOperations.SpatialEdition.toPrimitive(line);
assertTrue(result instanceof MeshPrimitive);
final MeshPrimitive primitive = (MeshPrimitive) result;
@@ -73,9 +67,9 @@ public class ToPrimitiveTest {
@Test
public void testPolygon() {
final TupleArray positions = TupleArrays.of(CRS2D, new
double[]{0,1,2,3});
- final PointSequence points = new ArraySequence(positions);
- final LinearRing exterior = new DefaultLinearRing(points);
- final Polygon point = new DefaultPolygon(exterior);
+ final PointSequence points = GeometryFactory.createSequence(positions);
+ final LinearRing exterior = GeometryFactory.createLinearRing(points);
+ final Polygon point = GeometryFactory.createPolygon(exterior, null);
final Geometry result =
GeometryOperations.SpatialEdition.toPrimitive(point);
assertTrue(result instanceof MeshPrimitive);
final MeshPrimitive primitive = (MeshPrimitive) result;
@@ -86,14 +80,14 @@ public class ToPrimitiveTest {
public void testMultiLineString() {
{ //one line has 3 points, so we must obtain a MultiPrimitive
final TupleArray positions1 = TupleArrays.of(CRS2D, new
double[]{0,1,2,3});
- final PointSequence points1 = new ArraySequence(positions1);
- final LineString line1 = new DefaultLineString(points1);
+ final PointSequence points1 =
GeometryFactory.createSequence(positions1);
+ final LineString line1 = GeometryFactory.createLineString(points1);
final TupleArray positions2 = TupleArrays.of(CRS2D, new
double[]{3,4,5,6,7,8});
- final PointSequence points2 = new ArraySequence(positions2);
- final LineString line2 = new DefaultLineString(points2);
+ final PointSequence points2 =
GeometryFactory.createSequence(positions2);
+ final LineString line2 = GeometryFactory.createLineString(points2);
- final MultiLineString mlines = new DefaultMultiLineString(line1,
line2);
+ final MultiLineString mlines =
GeometryFactory.createMultiLineString(line1, line2);
final Geometry result =
GeometryOperations.SpatialEdition.toPrimitive(mlines);
assertTrue(result instanceof MultiMeshPrimitive);
@@ -110,14 +104,14 @@ public class ToPrimitiveTest {
}
{ //all linestrings are lines, we must obtain a Primitive.Lines
final TupleArray positions1 = TupleArrays.of(CRS2D, new
double[]{0,1,2,3});
- final PointSequence points1 = new ArraySequence(positions1);
- final LineString line1 = new DefaultLineString(points1);
+ final PointSequence points1 =
GeometryFactory.createSequence(positions1);
+ final LineString line1 = GeometryFactory.createLineString(points1);
final TupleArray positions2 = TupleArrays.of(CRS2D, new
double[]{3,4,5,6});
- final PointSequence points2 = new ArraySequence(positions2);
- final LineString line2 = new DefaultLineString(points2);
+ final PointSequence points2 =
GeometryFactory.createSequence(positions2);
+ final LineString line2 = GeometryFactory.createLineString(points2);
- final MultiLineString mlines = new DefaultMultiLineString(line1,
line2);
+ final MultiLineString mlines =
GeometryFactory.createMultiLineString(line1, line2);
final Geometry result =
GeometryOperations.SpatialEdition.toPrimitive(mlines);
assertTrue(result instanceof MeshPrimitive.Lines);
@@ -133,8 +127,8 @@ public class ToPrimitiveTest {
@Test
public void testMultiPoint() {
final TupleArray positions1 = TupleArrays.of(CRS2D, new
double[]{0,1,2,3});
- final PointSequence points = new ArraySequence(positions1);
- final MultiPoint mpoints = new DefaultMultiPoint(points);
+ final PointSequence points =
GeometryFactory.createSequence(positions1);
+ final MultiPoint mpoints = GeometryFactory.createMultiPoint(points);
final Geometry result =
GeometryOperations.SpatialEdition.toPrimitive(mpoints);
assertTrue(result instanceof MeshPrimitive);
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/TransformTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/TransformTest.java
index facac861f1..cf10ddcce4 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/TransformTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/processor/spatialedition/TransformTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.sis.geometries.processor.spatialedition;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MultiMeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MultiMeshPrimitive;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.geometries.operation.GeometryOperations;
import org.apache.sis.referencing.CRS;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/DelaunayTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/DelaunayTest.java
index a3cf17344a..0f60f16a25 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/DelaunayTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/DelaunayTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.sis.geometries.triangulate.delaunay;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MeshPrimitiveComparator;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitiveComparator;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.referencing.CommonCRS;
diff --git
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/OrientedEdgeTest.java
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/OrientedEdgeTest.java
index 38b586ae0e..6232475972 100644
---
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/OrientedEdgeTest.java
+++
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/triangulate/delaunay/OrientedEdgeTest.java
@@ -17,8 +17,8 @@
package org.apache.sis.geometries.triangulate.delaunay;
import java.util.Iterator;
-import org.apache.sis.geometries.MeshPrimitive;
-import org.apache.sis.geometries.MeshPrimitive.Vertex;
+import org.apache.sis.geometries.mesh.MeshPrimitive;
+import org.apache.sis.geometries.mesh.MeshPrimitive.Vertex;
import org.apache.sis.geometries.math.TupleArray;
import org.apache.sis.geometries.math.TupleArrays;
import org.apache.sis.referencing.CommonCRS;