sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/04: Tune tracing information for debugging purposes.
Date Wed, 13 Jan 2021 18:12:20 GMT
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 9279763cbce7f5cc832f734e2e623acb5116f1d3
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Jan 13 12:43:10 2021 +0100

    Tune tracing information for debugging purposes.
---
 .../apache/sis/gui/coverage/CoverageCanvas.java    | 26 +++++++++++-----------
 .../apache/sis/gui/coverage/IsolineRenderer.java   |  7 ++++++
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
index 66dd5c0..b7d47fe 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -102,7 +102,7 @@ public class CoverageCanvas extends MapCanvasAWT {
      * @see #trace(String, Object...)
      */
     @Debug
-    private static final boolean TRACE = false;
+    static final boolean TRACE = false;
 
     /**
      * The data shown in this canvas. Note that setting this property to a non-null value
may not
@@ -336,7 +336,7 @@ public class CoverageCanvas extends MapCanvasAWT {
      */
     final void setCategoryColors(final Function<Category, java.awt.Color[]> colors)
{
         if (TRACE) {
-            trace(".setCategoryColors(…)");
+            trace("setCategoryColors(Function): causes repaint.");
         }
         data.processor.setCategoryColors(colors);
         resampledImage = null;
@@ -457,7 +457,7 @@ public class CoverageCanvas extends MapCanvasAWT {
      */
     private void setRawImage(final RenderedImage image, final GridGeometry domain, final
List<SampleDimension> ranges) {
         if (TRACE) {
-            trace(".setRawImage(%s)", image);
+            trace("setRawImage(…): the new source of data is:%n\t%s", image);
         }
         if (isolines != null) {
             isolines.clear();
@@ -480,7 +480,7 @@ public class CoverageCanvas extends MapCanvasAWT {
      */
     private void onInterpolationSpecified(final Interpolation newValue) {
         if (TRACE) {
-            trace(".onInterpolationSpecified(%s)", newValue);
+            trace("onInterpolationSpecified(%s)", newValue);
         }
         data.processor.setInterpolation(newValue);
         resampledImage = null;
@@ -646,7 +646,7 @@ public class CoverageCanvas extends MapCanvasAWT {
                                            Math.abs(resampledToDisplay.getTranslateY()))
                                   < Integer.MAX_VALUE - OVERFLOW_SAFETY_MARGIN;
                         if (TRACE && !isValid) {
-                            trace(": New resample for avoiding overflow caused by translation.");
+                            trace("render(): new resample for avoiding overflow caused by
translation.");
                         }
                     }
                 }
@@ -654,13 +654,13 @@ public class CoverageCanvas extends MapCanvasAWT {
                     if (recoloredImage == null) {
                         recoloredImage = data.recolor();
                         if (TRACE) {
-                            trace(": Recolor by application of %s.", data.selectedDerivative.name());
+                            trace("render(): recolor by application of %s.", data.selectedDerivative);
                         }
                     }
                     resampledImage = data.resampleAndConvert(recoloredImage, objectiveCRS,
objectiveToDisplay, objectivePOI);
                     resampledToDisplay = data.getTransform(objectiveToDisplay);
                     if (TRACE) {
-                        trace(" resampling result: %s.", resampledImage);
+                        trace("render(): resampling result:%n\t%s", resampledImage);
                     }
                 }
                 prefetchedImage = data.prefetch(resampledImage, resampledToDisplay, displayBounds);
@@ -719,13 +719,13 @@ public class CoverageCanvas extends MapCanvasAWT {
      */
     private void cacheRenderingData(final Worker worker) {
         if (TRACE && data.changed(worker.data)) {
-            trace(".cacheRenderingData(…):%n%s", worker.data);
+            trace("cacheRenderingData(…): new visual coverage:%n%s", worker.data);
         }
         data = worker.data;
         derivedImages.put(data.selectedDerivative, worker.recoloredImage);
         resampledImage = worker.resampledImage;
         if (TRACE) {
-            trace(": New objective bounds:%n%s", this);
+            trace("cacheRenderingData(…): objective bounds after rendering at %tT:%n%s",
System.currentTimeMillis(), this);
         }
         /*
          * Notify the "Image properties" tab that the image changed. The `propertyExplorer`
field is non-null
@@ -734,7 +734,7 @@ public class CoverageCanvas extends MapCanvasAWT {
         if (propertyExplorer != null) {
             propertyExplorer.setImage(resampledImage, worker.getVisibleImageBounds());
             if (TRACE) {
-                trace(": Update image property view with visible area %s.",
+                trace("cacheRenderingData(…): Update image property view with visible area
%s.",
                       propertyExplorer.getVisibleImageBounds(resampledImage));
             }
         }
@@ -783,7 +783,7 @@ public class CoverageCanvas extends MapCanvasAWT {
      */
     final void setStyling(final Stretching selection) {
         if (TRACE) {
-            trace(".setStyling(%s)", selection);
+            trace("setStyling(%s)", selection);
         }
         if (data.selectedDerivative != selection) {
             data.selectedDerivative = selection;
@@ -805,7 +805,7 @@ public class CoverageCanvas extends MapCanvasAWT {
     @Override
     protected void clear() {
         if (TRACE) {
-            trace("CoverageCanvas.clear()");
+            trace("clear()");
         }
         setRawImage(null, null, null);
         super.clear();
@@ -822,7 +822,7 @@ public class CoverageCanvas extends MapCanvasAWT {
     @SuppressWarnings("UseOfSystemOutOrSystemErr")
     private static void trace(final String format, final Object... arguments) {
         if (TRACE) {
-            System.out.print("CoverageCanvas");
+            System.out.print("CoverageCanvas.");
             System.out.printf(format, arguments);
             System.out.println();
         }
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/IsolineRenderer.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/IsolineRenderer.java
index 2646c6f..943c391 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/IsolineRenderer.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/IsolineRenderer.java
@@ -294,6 +294,7 @@ final class IsolineRenderer {
      * @return the {@code snapshots} array, potentially with less elements.
      * @throws TransformException if an interpolated point can not be transformed using the
given transform.
      */
+    @SuppressWarnings("UseOfSystemOutOrSystemErr")      // Used only for debugging.
     static Snapshot[] complete(final Snapshot[] snapshots, final RenderedImage data, final
MathTransform gridToCRS)
             throws TransformException
     {
@@ -322,6 +323,12 @@ final class IsolineRenderer {
          * all bands in one single call to `Isolines.generate(…)`. Results are written
in empty slots of `shapes`.
          */
         if (levels != null) {
+            if (CoverageCanvas.TRACE) {
+                System.out.println("IsolineRenderer.complete(…):");
+                for (int i=0; i<levels.length; i++) {
+                    System.out.printf("\tFor band %d: %s%n", i, Arrays.toString(levels[i]));
+                }
+            }
             final Isolines[] isolines = Isolines.generate(data, levels, gridToCRS);
             for (int i=0; i<numViews; i++) {
                 snapshots[i].complete(isolines[i]);


Mime
View raw message