This is an automated email from the ASF dual-hosted git repository.
desruisseaux 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 d92bcd3 Fix a NullPointerException when transforming coordinates with SpecializableTransform.transform(…)
methods working on arrays and the last coordinates are inside a sub-grid.
d92bcd3 is described below
commit d92bcd3d94d6ebcd54d7703a41785b5bdef7023a
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Aug 6 19:21:51 2020 +0200
Fix a NullPointerException when transforming coordinates with SpecializableTransform.transform(…)
methods working on arrays and the last coordinates are inside a sub-grid.
---
.../operation/transform/SpecializableTransform.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
index 4bf1f82..47b58bf 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
@@ -648,24 +648,24 @@ class SpecializableTransform extends AbstractMathTransform implements
Serializab
while (numPts > 0) {
SubArea domain = forward.locate(dst);
if (domain == null) {
- dst.offset += dstInc;
+ dst.offset += dstInc; // Skip point for which
there is no specialized transform.
numPts--;
continue;
}
do {
- RTreeNode next = domain; // Contains the specialized
transform to use.
- int num = (dst.offset - dstOff) / dstInc; // Number of points that
are not retransformeD.
- srcOff += num * srcInc; // Skip the source coordinates
that are not retransformed.
+ RTreeNode next = domain; // The specialized transform
to use in next iteration.
+ int num = (dst.offset - dstOff) / dstInc; // Number of points skipped
before this loop.
+ srcOff += num * srcInc; // Make source offset
synchronized with target offset.
dstOff = dst.offset; // Destination index
of the first coordinate to retransform.
do {
dst.offset += dstInc; // Destination index
after the last coordinate to transform.
if (--numPts <= 0) {
- domain = null;
+ next = null; // For telling the second
`while` condition to stop.
break;
}
next = RTreeNode.locate(domain, dst);
- } while (next == domain);
- num = (dst.offset - dstOff) / dstInc; // Number of points to
retransform.
+ } while (next == domain); // Continue until we
find a change of specialized transform.
+ num = (dst.offset - dstOff) / dstInc; // Number of points to
transform.
transform.apply(domain.inverse, srcOff, dstOff, num);
domain = (SubArea) next;
srcOff += srcInc * num;
|