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 cf8c06ee86 feat(Geometry): add shortcut methods on Similarity
cf8c06ee86 is described below
commit cf8c06ee8643ad2eca5a0b574f689c05061ba1bf
Author: jsorel <[email protected]>
AuthorDate: Tue Mar 17 16:40:33 2026 +0100
feat(Geometry): add shortcut methods on Similarity
---
.../org/apache/sis/geometries/math/Similarity.java | 27 ++++++++++++++++++++++
.../apache/sis/geometries/math/Similarity3D.java | 21 +++++++++++++++++
.../apache/sis/geometries/math/SimilarityND.java | 21 +++++++++++++++++
3 files changed, 69 insertions(+)
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity.java
index 91c8a282ad..5fda075790 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity.java
@@ -109,6 +109,33 @@ public interface Similarity<T extends Similarity<T>>
extends ReadOnly.Similarity
*/
T set(ReadOnly.Similarity<?> trs);
+ /**
+ * Update the rotation.
+ * This method will send a change event if values have changed.
+ *
+ * @param rotation new rotation
+ * @return this instance
+ */
+ T setRotation(ReadOnly.Matrix<?> rotation);
+
+ /**
+ * Update the scale.
+ * This method will send a change event if values have changed.
+ *
+ * @param scale new scale
+ * @return this instance
+ */
+ T setScale(ReadOnly.Tuple<?> scale);
+
+ /**
+ * Update the translation.
+ * This method will send a change event if values have changed.
+ *
+ * @param translation new translation
+ * @return this instance
+ */
+ T setTranslation(ReadOnly.Tuple<?> translation);
+
/**
* Set transform from given matrix.
* Matrix must be orthogonal of size dimension+1.
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity3D.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity3D.java
index c6aaf4e124..cabfeb7e38 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity3D.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/Similarity3D.java
@@ -70,6 +70,27 @@ public final class Similarity3D extends
AbstractSimilarity<Similarity3D> {
return this;
}
+ @Override
+ public Similarity3D setRotation(ReadOnly.Matrix<?> rotation) {
+ this.rotation.set(rotation);
+ notifyChanged();
+ return this;
+ }
+
+ @Override
+ public Similarity3D setScale(ReadOnly.Tuple<?> scale) {
+ this.scale.set(scale);
+ notifyChanged();
+ return this;
+ }
+
+ @Override
+ public Similarity3D setTranslation(ReadOnly.Tuple<?> translation) {
+ this.translation.set(translation);
+ notifyChanged();
+ return this;
+ }
+
@Override
public Similarity3D multiply(ReadOnly.Similarity<?> other) {
final Vector<?> resTrans = other.getTranslation().copy()
diff --git
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/SimilarityND.java
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/SimilarityND.java
index d4919e9c9a..5ae629da07 100644
---
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/SimilarityND.java
+++
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/math/SimilarityND.java
@@ -136,6 +136,27 @@ public class SimilarityND extends
AbstractSimilarity<SimilarityND> {
return this;
}
+ @Override
+ public SimilarityND setRotation(ReadOnly.Matrix<?> rotation) {
+ this.rotation.set(rotation);
+ notifyChanged();
+ return this;
+ }
+
+ @Override
+ public SimilarityND setScale(ReadOnly.Tuple<?> scale) {
+ this.scale.set(scale);
+ notifyChanged();
+ return this;
+ }
+
+ @Override
+ public SimilarityND setTranslation(ReadOnly.Tuple<?> translation) {
+ this.translation.set(translation);
+ notifyChanged();
+ return this;
+ }
+
@Override
public SimilarityND multiply(ReadOnly.Similarity<?> other) {
/*