sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [sis] branch geoapi-4.0 updated: Coverage2D : add sample dimension and rendered image bands size match verification
Date Wed, 04 Dec 2019 09:50:27 GMT
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 e79f07f  Coverage2D : add sample dimension and rendered image bands size match verification
e79f07f is described below

commit e79f07f6217bfaec822d8e7451848c4f7853e5de
Author: jsorel <johann.sorel@geomatys.com>
AuthorDate: Wed Dec 4 10:50:09 2019 +0100

    Coverage2D : add sample dimension and rendered image bands size match verification
---
 .../java/org/apache/sis/internal/coverage/GridCoverage2D.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/GridCoverage2D.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/GridCoverage2D.java
index 66c7c59..57e9a6f 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/GridCoverage2D.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/GridCoverage2D.java
@@ -78,10 +78,13 @@ public final class GridCoverage2D extends GridCoverage {
 
         //check image is coherent with grid geometry
         if (image.getWidth() != extent.getSize(imageAxes[0])) {
-            throw new IllegalArgumentException("Image width " + image.getWidth() + "does
not match grid extent width "+ extent.getSize(imageAxes[0]));
+            throw new IllegalArgumentException("Image width " + image.getWidth() + " does
not match grid extent width "+ extent.getSize(imageAxes[0]));
         }
-        if (image.getHeight()!= extent.getSize(imageAxes[1])) {
-            throw new IllegalArgumentException("Image height " + image.getHeight()+ "does
not match grid extent height "+ extent.getSize(imageAxes[1]));
+        if (image.getHeight() != extent.getSize(imageAxes[1])) {
+            throw new IllegalArgumentException("Image height " + image.getHeight()+ " does
not match grid extent height "+ extent.getSize(imageAxes[1]));
+        }
+        if (image.getSampleModel().getNumBands() != bands.size()) {
+            throw new IllegalArgumentException("Image sample model number of bands " + image.getSampleModel().getNumBands()+
" does not match number of sample dimensions "+ bands.size());
         }
     }
 


Mime
View raw message