You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2019/06/13 09:37:43 UTC

[sis] 02/02: Partial revert of the fix for NaN in envelope, since it introduced other NaN values. It is not worth to maintain a `modified` flag in this part of the code.

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

commit 8257c0130d180d09a20b27b5a1f08dbbbea89de0
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Jun 13 11:36:28 2019 +0200

    Partial revert of the fix for NaN in envelope, since it introduced other NaN values.
    It is not worth to maintain a `modified` flag in this part of the code.
---
 .../src/main/java/org/apache/sis/coverage/grid/GridExtent.java   | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index 9c763f8..14e8f1f 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -788,7 +788,6 @@ public class GridExtent implements GridEnvelope, Serializable {
                             double lower = envelope.getLower(tgtDim);
                             double upper = envelope.getUpper(tgtDim);
                             final double value = component.getElement(j, component.getNumCol() - 1);
-                            boolean modified = false;
                             /*
                              * Replace only the envelope NaN values by the translation term (non-NaN values are left unchanged).
                              * If the gridToCRS map cell corners, then we update only the lower bound since the transform maps
@@ -803,14 +802,12 @@ public class GridExtent implements GridEnvelope, Serializable {
                                         span = 0;
                                     }
                                 }
-                                if (Double.isNaN(lower)) {lower = value - span; modified = true;}
-                                if (Double.isNaN(upper)) {upper = value + span; modified = true;}
+                                if (Double.isNaN(lower)) lower = value - span;
+                                if (Double.isNaN(upper)) upper = value + span;
                             } else if (Double.isNaN(lower)) {
                                 lower = value;
                             }
-                            if (modified) {
-                                envelope.setRange(tgtDim, lower, upper);
-                            }
+                            envelope.setRange(tgtDim, lower, upper);
                         }
                     }
                     separator.clear();