This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new c6490c349b feat(Geometry): GeometryCollection implement Iterator,
enforce not null elements in the collection, check array sizes in
ArrayDataPoints
c6490c349b is described below
commit c6490c349bca28f3f1af6acedde2efa68b038f65
Author: jsorel <[email protected]>
AuthorDate: Tue Nov 3 10:41:39 2026 +0100
feat(Geometry): GeometryCollection implement Iterator, enforce not null
elements in the collection, check array sizes in ArrayDataPoints
---
.../main/org/apache/sis/geometries/Geometries.java | 7 +-
.../apache/sis/geometries/GeometryCollection.java | 89 +++++++++++++++-
.../internal/shared/ArrayDataPoints.java | 11 +-
.../internal/shared/DefaultGeometryCollection.java | 11 +-
.../shared/GeometryCollectionSpliterator.java | 115 +++++++++++++++++++++
.../apache/sis/geometries/mesh/MeshPrimitive.java | 16 +++
.../main/org/apache/sis/maths/Vector1D.java | 36 +++++++
.../main/org/apache/sis/maths/Vector2D.java | 45 ++++++++
.../main/org/apache/sis/maths/Vector3D.java | 54 ++++++++++
.../main/org/apache/sis/maths/Vector4D.java | 63 +++++++++++
10 files changed, 434 insertions(+), 13 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 2f612d91ad..f4c610a684 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
@@ -648,13 +648,14 @@ public final class Geometries {
index[i] = newIndex;
}
- //rebuild attributes arrays
+ //rebuild attributes arrays, all attributes change length, they must
be replaced together
+ final Map<String,Array> rebuilt = new HashMap<>();
for (String name : rebuild.keySet()) {
final Array oldTa = primitive.getAttribute(name);
final List<Vector<?>> newTa = rebuild.get(name);
- final Array ta = NDArrays.of(newTa, oldTa.getSampleSystem(),
oldTa.getDataType());
- primitive.setAttribute(name, ta);
+ rebuilt.put(name, NDArrays.of(newTa, oldTa.getSampleSystem(),
oldTa.getDataType()));
}
+ primitive.setAttributes(rebuilt);
//new index
primitive.setIndex(NDArrays.ofUnsigned(primitive.getIndex().getSampleSystem(),
index));
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java
index 4e779dbbc6..e2a888a6d4 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/GeometryCollection.java
@@ -16,6 +16,13 @@
*/
package org.apache.sis.geometries;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import javax.measure.Quantity;
import static org.opengis.annotation.Specification.ISO_19107;
import org.opengis.annotation.UML;
@@ -27,12 +34,12 @@ import
org.apache.sis.geometries.internal.shared.ConcatenatedDataPoints;
import org.apache.sis.geometries.internal.shared.DefaultGeometryCollection;
import org.apache.sis.geometries.internal.shared.DefaultMultiPoint;
import org.apache.sis.geometries.internal.shared.EmptyDataPoints;
+import org.apache.sis.geometries.internal.shared.GeometryCollectionSpliterator;
import org.apache.sis.geometries.mesh.MeshPrimitive;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.measure.Quantities;
import org.apache.sis.measure.Units;
-
/**
* A typed collection of geometric objects which behaves as the set union of
its elements.
*
@@ -42,6 +49,7 @@ import org.apache.sis.measure.Units;
* system of the collection.</li>
* <li>Every element is an instance of one of the {@linkplain
#getElementType() allowed types},
* or of a subtype of one of them.</li>
+ * <li>No element is null. An empty element shall be represented by an empty
geometry.</li>
* <li>The topological dimension of the collection is the largest
topological dimension among
* its elements.</li>
* <li>No other constraint is placed on the elements, but subtypes may
restrict membership based
@@ -78,7 +86,7 @@ import org.apache.sis.measure.Units;
* @see ISO 19107:2019 - 6.4.31
*/
@UML(identifier="Collection", specification=ISO_19107)
-public sealed interface GeometryCollection<T extends Geometry> extends Geometry
+public sealed interface GeometryCollection<T extends Geometry> extends
Geometry, Iterable<T>
permits ProductCurve,
DefaultMultiPoint,
DefaultGeometryCollection,
@@ -246,7 +254,7 @@ public sealed interface GeometryCollection<T extends
Geometry> extends Geometry
* </ul>
*
* @param n geometry index.
- * @return the Nth geometr in this GeometryCollection.
+ * @return the Nth geometry in this GeometryCollection, never null.
*
* @see OGC Simple Feature Access 1.2.1 - 6.1.3.2
* @see ISO 19107:2019 - 6.4.32, 6.4.32.2, 6.4.32.3
@@ -378,4 +386,79 @@ public sealed interface GeometryCollection<T extends
Geometry> extends Geometry
return getRepresentativePoint();
}
+ /**
+ * Returns an iterator over the elements of this collection, in the order
of their indices.
+ *
+ * The number of elements is read when the iterator is created and the
iterator does not support removal.
+ * It throws {@link NullPointerException} if an element is null.
+ *
+ * @return an iterator over the elements of this collection.
+ */
+ @Override
+ default Iterator<T> iterator() {
+ return new Iterator<T>() {
+ /** Index of the next element to return. */
+ private int index;
+
+ /** Number of elements in the collection. */
+ private final int count = getNumGeometries();
+
+ @Override
+ public boolean hasNext() {
+ return index < count;
+ }
+
+ @Override
+ public T next() {
+ if (index >= count) {
+ throw new NoSuchElementException();
+ }
+ return getGeometryN(index);
+ }
+
+ @Override
+ public void forEachRemaining(final Consumer<? super T> action) {
+ Objects.requireNonNull(action);
+ while (index < count) {
+ action.accept(getGeometryN(index));
+ }
+ }
+ };
+ }
+
+ /**
+ * Returns a spliterator over the elements of this collection, in the
order of their indices.
+ * The spliterator reads the elements with {@link #getGeometryN(int)} and
splits in halves of exact size.
+ * It reports {@link Spliterator#NONNULL} and throws {@link
NullPointerException} if an element is null.
+ *
+ * @return a spliterator over the elements of this collection.
+ */
+ @Override
+ default Spliterator<T> spliterator() {
+ return new GeometryCollectionSpliterator<>(this);
+ }
+
+ /**
+ * Returns a sequential stream over the elements of this collection, in
the order of their indices.
+ *
+ * @return a sequential stream over the elements of this collection.
+ *
+ * @see java.util.Collection#stream()
+ */
+ default Stream<T> stream() {
+ return StreamSupport.stream(spliterator(), false);
+ }
+
+ /**
+ * Returns a possibly parallel stream over the elements of this collection.
+ * It is allowable for this method to return a sequential stream.
+ *
+ * @return a possibly parallel stream over the elements of this collection.
+ *
+ * @see java.util.Collection#parallelStream()
+ */
+ default Stream<T> parallelStream() {
+ return StreamSupport.stream(spliterator(), true);
+ }
+
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java
index e77336cd61..82dba79428 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/ArrayDataPoints.java
@@ -25,10 +25,8 @@ import java.util.Map;
import java.util.Objects;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.geometries.DataPoints;
-import org.apache.sis.geometries.Point;
import org.apache.sis.geometries.DataPointsType;
import org.apache.sis.maths.Array;
-import org.apache.sis.maths.Cursor;
import org.apache.sis.maths.DataType;
import org.apache.sis.maths.NDArrays;
import org.apache.sis.maths.NDRange;
@@ -195,12 +193,14 @@ public final class ArrayDataPoints implements DataPoints,
DataPointsType {
@Override
public SampleSystem getAttributeSystem(String name) {
- return attributes.get(name).getSampleSystem();
+ final Array array = attributes.get(name);
+ return (array != null) ? array.getSampleSystem() : null;
}
@Override
public DataType getAttributeType(String name) {
- return attributes.get(name).getDataType();
+ final Array array = attributes.get(name);
+ return (array != null) ? array.getDataType() : null;
}
@Override
@@ -210,7 +210,8 @@ public final class ArrayDataPoints implements DataPoints,
DataPointsType {
@Override
public Array getAttributeArray(String name) {
- return attributes.get(name).copy();
+ final Array array = attributes.get(name);
+ return (array != null) ? array.copy() : null;
}
@Override
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeometryCollection.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeometryCollection.java
index e1a17f09c3..fb7f899876 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeometryCollection.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/DefaultGeometryCollection.java
@@ -56,7 +56,12 @@ public non-sealed class DefaultGeometryCollection<T extends
Geometry> extends Ab
*/
public DefaultGeometryCollection(GeometryType elementType,
CoordinateReferenceSystem fallbackCRS, T[] geometries) {
this.elementType = elementType;
- if (geometries != null) this.geometries.addAll(List.of(geometries));
+ if (geometries != null) {
+ for (int i = 0; i < geometries.length; i++) {
+ ArgumentChecks.ensureNonNullElement("geometries", i,
geometries[i]);
+ }
+ this.geometries.addAll(List.of(geometries));
+ }
this.fallbackCRS = (fallbackCRS != null) ? fallbackCRS :
Geometries.getUndefinedCRS(2);
}
@@ -114,10 +119,12 @@ public non-sealed class DefaultGeometryCollection<T
extends Geometry> extends Ab
/**
* Add primitives.
*
- * @param other Primitives to merge in.
+ * @param other Primitives to merge in, without null element.
*/
public void append(Collection<? extends Geometry> other) {
+ int i = 0;
for (Geometry p : other) {
+ ArgumentChecks.ensureNonNullElement("other", i++, p);
if (!CRS.equivalent(fallbackCRS,
p.getCoordinateReferenceSystem())) {
throw new IllegalArgumentException("Primitives must have the
same CRS as the MultiPrimitive.");
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/GeometryCollectionSpliterator.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/GeometryCollectionSpliterator.java
new file mode 100644
index 0000000000..958f2f7b0a
--- /dev/null
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/internal/shared/GeometryCollectionSpliterator.java
@@ -0,0 +1,115 @@
+/*
+ * 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.internal.shared;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import org.apache.sis.geometries.Geometry;
+import org.apache.sis.geometries.GeometryCollection;
+
+
+/**
+ * A spliterator over the elements of a {@link GeometryCollection}, reading
them by index with
+ * {@link GeometryCollection#getGeometryN(int)}. Since every element can be
reached directly,
+ * this spliterator splits in two halves of exact size.
+ *
+ * <p>The number of elements is read when this spliterator is created. Adding
or removing elements
+ * in the collection after that point results in unspecified behavior.</p>
+ *
+ * <p>Elements of a collection are never null. This spliterator verifies that
constraint on each
+ * element it returns, so that a non-conforming implementation fails at the
element at fault.</p>
+ *
+ * @param <T> type of the elements of the collection.
+ *
+ * @author Johann Sorel (Geomatys)
+ */
+public final class GeometryCollectionSpliterator<T extends Geometry>
implements Spliterator<T> {
+
+ private final GeometryCollection<T> collection;
+
+ /**
+ * Index of the next element to return.
+ */
+ private int index;
+
+ /**
+ * Index after the last element to return.
+ */
+ private final int fence;
+
+ /**
+ * Creates a spliterator over all elements of the given collection.
+ *
+ * @param collection the collection to traverse, not null.
+ */
+ public GeometryCollectionSpliterator(final GeometryCollection<T>
collection) {
+ this(collection, 0, collection.getNumGeometries());
+ }
+
+ private GeometryCollectionSpliterator(final GeometryCollection<T>
collection, final int index, final int fence) {
+ this.collection = collection;
+ this.index = index;
+ this.fence = fence;
+ }
+
+ /**
+ * Returns the element at the given index, verifying that it is not null.
+ */
+ private T element(final int i) {
+ return collection.getGeometryN(i);
+ }
+
+ @Override
+ public boolean tryAdvance(final Consumer<? super T> action) {
+ Objects.requireNonNull(action);
+ if (index < fence) {
+ action.accept(element(index++));
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void forEachRemaining(final Consumer<? super T> action) {
+ Objects.requireNonNull(action);
+ while (index < fence) {
+ action.accept(element(index++));
+ }
+ }
+
+ @Override
+ public Spliterator<T> trySplit() {
+ final int start = index;
+ final int middle = (start + fence) >>> 1;
+ if (middle <= start) {
+ return null;
+ }
+ index = middle;
+ return new GeometryCollectionSpliterator<>(collection, start, middle);
+ }
+
+ @Override
+ public long estimateSize() {
+ return fence - index;
+ }
+
+ @Override
+ public int characteristics() {
+ return ORDERED | SIZED | SUBSIZED | NONNULL;
+ }
+}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
index 968772c86c..8523cc7c08 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/mesh/MeshPrimitive.java
@@ -172,6 +172,16 @@ public sealed interface MeshPrimitive extends Geometry
*/
void setAttribute(String name, Array array);
+ /**
+ * Replaces all attributes at once. Attributes not in the given map are
removed.
+ * Used when all attributes are rebuilt with a new length, which {@link
#setAttribute(String, Array)}
+ * cannot do one attribute at a time.
+ *
+ * @param attributes the new attributes, which must contain the positions.
+ * @throws IllegalArgumentException if positions are missing or the arrays
have different lengths.
+ */
+ void setAttributes(Map<String,Array> attributes);
+
/**
* Get geometry index.
* The index combined with the index range define the different primitives.
@@ -472,6 +482,12 @@ public sealed interface MeshPrimitive extends Geometry
}
}
+ @Override
+ public void setAttributes(Map<String,Array> attributes) {
+ dataPoints.setAttributes(attributes);
+ positions = dataPoints.getAttribute(ATT_POSITION);
+ }
+
/**
* Get geometry index.
* The index combined with the index range define the different
primitives.
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector1D.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector1D.java
index a31b490a3b..6418c1d2a9 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector1D.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector1D.java
@@ -124,6 +124,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final byte x;
+ public Byte() {
+ this.x = 0;
+ }
+
public Byte(byte x) {
this.x = x;
}
@@ -264,6 +268,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final byte x;
+ public UByte() {
+ this.x = 0;
+ }
+
public UByte(byte x) {
this.x = x;
}
@@ -404,6 +412,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final short x;
+ public Short() {
+ this.x = 0;
+ }
+
public Short(short x) {
this.x = x;
}
@@ -544,6 +556,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final short x;
+ public UShort() {
+ this.x = 0;
+ }
+
public UShort(short x) {
this.x = x;
}
@@ -684,6 +700,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final int x;
+ public Int() {
+ this.x = 0;
+ }
+
public Int(int x) {
this.x = x;
}
@@ -824,6 +844,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final int x;
+ public UInt() {
+ this.x = 0;
+ }
+
public UInt(int x) {
this.x = x;
}
@@ -964,6 +988,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final long x;
+ public Long() {
+ this.x = 0;
+ }
+
public Long(long x) {
this.x = x;
}
@@ -1104,6 +1132,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final float x;
+ public Float() {
+ this.x = 0;
+ }
+
public Float(float x) {
this.x = x;
}
@@ -1271,6 +1303,10 @@ public abstract sealed class Vector1D<T extends
Vector1D<T>> extends AbstractVec
public final double x;
+ public Double() {
+ this.x = 0;
+ }
+
public Double(double x) {
this.x = x;
}
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector2D.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector2D.java
index f84c55d122..fadaec3c37 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector2D.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector2D.java
@@ -156,6 +156,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final byte x;
public final byte y;
+ public Byte() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public Byte(byte x, byte y) {
this.x = x;
this.y = y;
@@ -326,6 +331,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final byte x;
public final byte y;
+ public UByte() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public UByte(byte x, byte y) {
this.x = x;
this.y = y;
@@ -496,6 +506,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final short x;
public final short y;
+ public Short() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public Short(short x, short y) {
this.x = x;
this.y = y;
@@ -666,6 +681,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final short x;
public final short y;
+ public UShort() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public UShort(short x, short y) {
this.x = x;
this.y = y;
@@ -836,6 +856,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final int x;
public final int y;
+ public Int() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public Int(int x, int y) {
this.x = x;
this.y = y;
@@ -1006,6 +1031,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final int x;
public final int y;
+ public UInt() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public UInt(int x, int y) {
this.x = x;
this.y = y;
@@ -1176,6 +1206,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final long x;
public final long y;
+ public Long() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public Long(long x, long y) {
this.x = x;
this.y = y;
@@ -1346,6 +1381,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final float x;
public final float y;
+ public Float() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public Float(float x, float y) {
this.x = x;
this.y = y;
@@ -1553,6 +1593,11 @@ public abstract sealed class Vector2D<T extends
Vector2D<T>> extends AbstractVec
public final double x;
public final double y;
+ public Double() {
+ this.x = 0;
+ this.y = 0;
+ }
+
public Double(double x, double y) {
this.x = x;
this.y = y;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector3D.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector3D.java
index 80b382be64..e878c15baa 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector3D.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector3D.java
@@ -256,6 +256,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final byte y;
public final byte z;
+ public Byte() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public Byte(byte x, byte y, byte z) {
this.x = x;
this.y = y;
@@ -444,6 +450,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final byte y;
public final byte z;
+ public UByte() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public UByte(byte x, byte y, byte z) {
this.x = x;
this.y = y;
@@ -632,6 +644,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final short y;
public final short z;
+ public Short() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public Short(short x, short y, short z) {
this.x = x;
this.y = y;
@@ -820,6 +838,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final short y;
public final short z;
+ public UShort() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public UShort(short x, short y, short z) {
this.x = x;
this.y = y;
@@ -1020,6 +1044,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final int y;
public final int z;
+ public Int() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public Int(int x, int y, int z) {
this.x = x;
this.y = y;
@@ -1208,6 +1238,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final int y;
public final int z;
+ public UInt() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public UInt(int x, int y, int z) {
this.x = x;
this.y = y;
@@ -1404,6 +1440,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final long y;
public final long z;
+ public Long() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public Long(long x, long y, long z) {
this.x = x;
this.y = y;
@@ -1592,6 +1634,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final float y;
public final float z;
+ public Float() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public Float(float x, float y, float z) {
this.x = x;
this.y = y;
@@ -1819,6 +1867,12 @@ public abstract sealed class Vector3D<T extends
Vector3D<T>> extends AbstractVec
public final double y;
public final double z;
+ public Double() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
public Double(double x, double y, double z) {
this.x = x;
this.y = y;
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector4D.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector4D.java
index 0f56cbcb36..432334b528 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector4D.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector4D.java
@@ -135,6 +135,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final byte z;
public final byte w;
+ public Byte() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public Byte(byte x, byte y, byte z, byte w) {
this.x = x;
this.y = y;
@@ -336,6 +343,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final byte z;
public final byte w;
+ public UByte() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public UByte(byte x, byte y, byte z, byte w) {
this.x = x;
this.y = y;
@@ -537,6 +551,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final short z;
public final short w;
+ public Short() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public Short(short x, short y, short z, short w) {
this.x = x;
this.y = y;
@@ -738,6 +759,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final short z;
public final short w;
+ public UShort() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public UShort(short x, short y, short z, short w) {
this.x = x;
this.y = y;
@@ -954,6 +982,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final int z;
public final int w;
+ public Int() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public Int(int x, int y, int z, int w) {
this.x = x;
this.y = y;
@@ -1155,6 +1190,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final int z;
public final int w;
+ public UInt() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public UInt(int x, int y, int z, int w) {
this.x = x;
this.y = y;
@@ -1366,6 +1408,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final long z;
public final long w;
+ public Long() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public Long(long x, long y, long z, long w) {
this.x = x;
this.y = y;
@@ -1567,6 +1616,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final float z;
public final float w;
+ public Float() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public Float(float x, float y, float z, float w) {
this.x = x;
this.y = y;
@@ -1809,6 +1865,13 @@ public abstract sealed class Vector4D<T extends
Vector4D<T>> extends AbstractVec
public final double z;
public final double w;
+ public Double() {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.w = 0;
+ }
+
public Double(double x, double y, double z, double w) {
this.x = x;
this.y = y;