[sis] branch geoapi-4.0 updated: Add a constant for the number of bits in `Long.SIZE`. Used in bit shifts.

2021-11-04 Thread desruisseaux
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 38b7778  Add a constant for the number of bits in `Long.SIZE`. Used in 
bit shifts.
38b7778 is described below

commit 38b777853144c9f165be134611ff891d3a7ef385
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 19:18:30 2021 +0100

Add a constant for the number of bits in `Long.SIZE`. Used in bit shifts.
---
 .../java/org/apache/sis/image/MaskedImage.java |  5 ++--
 .../java/org/apache/sis/index/tree/PointTree.java  |  3 ++-
 .../org/apache/sis/internal/util/Numerics.java | 17 ++--
 .../java/org/apache/sis/util/CharSequences.java|  2 +-
 .../apache/sis/util/collection/IntegerList.java|  3 ++-
 .../org/apache/sis/internal/util/NumericsTest.java | 30 +-
 6 files changed, 52 insertions(+), 8 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
index 9b4b3ec..63ec657 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
@@ -39,6 +39,7 @@ import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.coverage.j2d.TilePlaceholder;
 
 import static org.apache.sis.internal.util.Numerics.ceilDiv;
+import static org.apache.sis.internal.util.Numerics.LONG_SHIFT;
 
 
 /**
@@ -275,9 +276,9 @@ final class MaskedImage extends SourceAlignedImage {
  */
 for (int y=yStart; y>> LONG_SHIFT;   // Last 
index in unit of long elements, inclusive.
 final int shift = (index += xoff) & (Long.SIZE-1);  // First 
bit to read in the long, 0 = highest bit.
-index /= Long.SIZE; // Convert 
from bit (pixel) index to long[] index.
+index >>>= LONG_SHIFT;  // Convert 
from bit (pixel) index to long[] index.
 /*
  * We want a value such as `base + index*Long.SIZE + lower` is 
equal to `xStart`
  * when all variables point to the first potentially masked pixel 
of the tile:
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java 
b/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
index c1a672c..81e0d0e 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
@@ -27,6 +27,7 @@ import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 import org.opengis.geometry.Envelope;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.CheckedContainer;
@@ -106,7 +107,7 @@ public class PointTree extends AbstractSet implements 
CheckedContainer,
  * The maximum number of dimensions (inclusive) that this class currently 
supports.
  * Current maximum is {@value}. This restriction come from 2⁶ = {@value 
Long#SIZE}.
  */
-public static final int MAXIMUM_DIMENSIONS = 6;
+public static final int MAXIMUM_DIMENSIONS = Numerics.LONG_SHIFT;
 
 /**
  * The type of elements in this set.
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java 
b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
index 5d18ba9..f986424 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
@@ -39,7 +39,7 @@ import static java.lang.Math.ulp;
  * Miscellaneous utilities methods working on floating point numbers.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.1
+ * @version 1.2
  * @since   0.3
  * @module
  */
@@ -155,6 +155,19 @@ public final class Numerics extends Static {
 public static final int MAX_INTEGER_CONVERTIBLE_TO_FLOAT = 1 << 
(SIGNIFICAND_SIZE_OF_FLOAT + 1);
 
 /**
+ * Right shift to apply for a result equivalent to a division by 
{@Long#SIZE} (ignoring negative numbers).
+ * The value is {@value} so that the following relationship hold: 2⁶ = 
{@value Long#SIZE}.
+ *
+ * Usage
+ * The {@code x / Long.SIZE} operation can be replaced by {@code x >>> 
LONG_SHIFT} if x is positive.
+ * The compiler may not do this optimization itself because those two 
operations are not equivalent for negative
+ * x values (even with {@code >>} instead of {@code >>>}). By 
contrast it is not worth to apply such
+ * replacement on multiplications because the {@code x * Long.SIZE} and 

[sis] 01/01: Merge branch 'geoapi-3.1'

2021-11-04 Thread desruisseaux
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sis.git

commit b94a500b295b52b9fbaf0bb8fdbf43c0ce4e7746
Merge: be181fa 5a19a70
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 17:24:40 2021 +0100

Merge branch 'geoapi-3.1'

 .../main/java/org/apache/sis/gui/DataViewer.java   |  32 +-
 .../main/java/org/apache/sis/gui/RecentFiles.java  |  55 ++-
 .../java/org/apache/sis/gui/SystemMonitor.java | 116 +
 .../apache/sis/gui/coverage/CoverageCanvas.java|  34 +-
 .../java/org/apache/sis/gui/coverage/GridView.java |   4 +-
 .../org/apache/sis/gui/coverage/ImageRequest.java  |  17 +-
 .../org/apache/sis/gui/coverage/RenderingData.java |  13 +-
 .../org/apache/sis/gui/coverage/package-info.java  |   2 +-
 .../org/apache/sis/gui/dataset/FeatureList.java|   4 +-
 .../java/org/apache/sis/gui/dataset/LoadEvent.java |  31 +-
 .../dataset/{LoadEvent.java => ResourceEvent.java} |  41 +-
 .../apache/sis/gui/dataset/ResourceExplorer.java   | 264 ++
 .../org/apache/sis/gui/dataset/ResourceTree.java   | 529 ++---
 .../org/apache/sis/gui/dataset/package-info.java   |   6 +-
 .../java/org/apache/sis/gui/map/MapCanvas.java | 194 +++-
 .../java/org/apache/sis/gui/map/MapCanvasAWT.java  | 100 +++-
 .../java/org/apache/sis/gui/map/package-info.java  |   2 +-
 .../sis/gui/metadata/IdentificationInfo.java   |   2 +-
 .../apache/sis/gui/metadata/MetadataSummary.java   |  30 +-
 .../org/apache/sis/gui/metadata/MetadataTree.java  |   7 +-
 .../org/apache/sis/gui/metadata/package-info.java  |   2 +-
 .../main/java/org/apache/sis/gui/package-info.java |   2 +-
 .../gui/referencing/RecentReferenceSystems.java|   9 +-
 .../apache/sis/internal/gui/BackgroundThreads.java |  18 +-
 .../sis/internal/gui/FixedHeaderColumnSize.java|  89 
 .../org/apache/sis/internal/gui/GUIUtilities.java  |  19 +-
 .../sis/internal/gui/OptionalDataDownloader.java   |  31 +-
 .../org/apache/sis/internal/gui/PropertyView.java  |   4 +-
 .../apache/sis/internal/gui/ResourceLoader.java|  46 +-
 .../org/apache/sis/internal/gui/Resources.java |  22 +-
 .../apache/sis/internal/gui/Resources.properties   |   6 +-
 .../sis/internal/gui/Resources_fr.properties   |   6 +-
 .../java/org/apache/sis/internal/gui/Styles.java   |   2 +-
 .../apache/sis/internal/gui/io/FileAccessItem.java | 420 
 .../apache/sis/internal/gui/io/FileAccessView.java | 136 ++
 .../apache/sis/internal/gui}/io/package-info.java  |   8 +-
 .../org/apache/sis/internal/gui/package-info.java  |   2 +-
 .../java/org/apache/sis/coverage/CategoryList.java |   4 +-
 .../org/apache/sis/coverage/RegionOfInterest.java  | 156 ++
 .../org/apache/sis/coverage/SampleDimension.java   |  86 +++-
 .../coverage/grid/CoordinateOperationFinder.java   |   2 +-
 .../apache/sis/coverage/grid/GridCoverage2D.java   |  67 ++-
 .../sis/coverage/grid/GridCoverageProcessor.java   |  58 ++-
 .../apache/sis/coverage/grid/GridDerivation.java   |   5 +-
 .../apache/sis/filter/DefaultFilterFactory.java|   4 +-
 .../java/org/apache/sis/filter/LogicalFilter.java  |  15 +-
 .../java/org/apache/sis/filter/package-info.java   |   2 +-
 .../java/org/apache/sis/image/ImageProcessor.java  |  88 ++--
 .../java/org/apache/sis/image/MaskedImage.java | 478 +++
 .../java/org/apache/sis/image/PrefetchedImage.java |  87 +---
 .../java/org/apache/sis/image/ResampledImage.java  |  30 +-
 .../org/apache/sis/image/SourceAlignedImage.java   |  21 +-
 .../java/org/apache/sis/image/Visualization.java   | 420 ++--
 .../java/org/apache/sis/image/package-info.java|   9 +-
 .../internal/coverage/j2d/ColorModelFactory.java   |  12 +-
 .../sis/internal/coverage/j2d/Colorizer.java   |   2 +-
 .../sis/internal/coverage/j2d/FillValues.java  | 188 
 .../sis/internal/coverage/j2d/ImageLayout.java |  46 +-
 .../sis/internal/coverage/j2d/TilePlaceholder.java | 395 +++
 .../sis/internal/coverage/j2d/package-info.java|   2 +-
 .../org/apache/sis/coverage/CategoryListTest.java  |   3 +-
 .../org/apache/sis/filter/LogicalFilterTest.java   |   9 +-
 .../apache/sis/metadata/sql/CachedStatement.java   |   4 +-
 .../org/apache/sis/metadata/sql/package-info.java  |   2 +-
 core/sis-referencing/pom.xml   |  11 +
 .../factory/ConcurrentAuthorityFactory.java|   8 +-
 .../referencing/factory/sql/AuthorityCodes.java|  28 +-
 .../factory/sql/CloseableReference.java|  21 +-
 .../referencing/factory/sql/EPSGCodeFinder.java|   2 +
 .../referencing/factory/sql/EPSGDataAccess.java|  30 +-
 .../sis/referencing/factory/sql/package-info.java  |   2 +-
 .../operation/projection/AzimuthalEquidistant.java |   1 +
 .../projection/ModifiedAzimuthalEquidistant.java   |   6 +
 .../java/org/apache/sis/math/MathFunctions.java|   9 +-
 

[sis] branch master updated (be181fa -> b94a500)

2021-11-04 Thread desruisseaux
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sis.git.


from be181fa  Reduce indentation from 4 to 2 spaces for consistency with 
the examples in the documentation. This is for cheking if it solves the problem 
of notifications sent to the wrong mailing list.
 add c9abccd  Fix `IndexOutOfBoundsException` which was thrown when 
`FeatureSet` has no geometry property. The fix is indirect, by making an 
`isEmpty` flag to become `true` when there is no geometry. This is an attempt 
to address the https://github.com/apache/sis/pull/22 pull request without 
discarding the whole feature (features without geometry should be legal).
 add 9fe7fb4  Add a contributor name. His main work was an effort to 
provide derivative formulas in `ModifiedAzimuthalEquidistant`.
 add 6dc2e2d  Workaround for RasterFormatException. 
https://bugs.openjdk.java.net/browse/JDK-8275345
 add eda4d10  Minor documentation fixes and bug fixes related to background 
value.
 add ac3c44d  Fix an integer overflow in call to 
`divisors(Integer.MAX_VALUE)`.
 add b55b18c  Verify that the `bounds` argument is non-empty. This 
verification avoid more confusing exception later.
 add 17bf849  Better identification of case where the image shown in 
`MapCanvas` is in error (i.e. because an exception has been thrown during the 
rendering process).
 add 0daa2b6  Reduce the amount of repaint events when resizing windows.
 add 098b3bc  Popup a dialog box if an error occurred while downloading 
optional resources.
 add 38066bc  Cherry-pick documentation improvement from pull request #24: 
doc(Core): improve SampleDimension apidoc regarding background value management.
 add 8e1df6f  Provide an extension mechanism for allowing users to provide 
their own solution for https://github.com/apache/sis/pull/24
 add da6ade3  Move the provider of empty tiles in a location where it can 
be shared with other operations.
 add 7a62166  Initial version of a "clip" or "mask" operation. Add mask and 
clip operations on grid coverages.
 add 6fb53af  Compute only the tiles that intersect the bounding box of the 
mask. It saves memory and computation when a tile does not intersect the clip.
 add d5601f3  Merge the "clip" and "mask" methods in a single "mask" method 
with boolean argument.
 add debfbf7  Give protected access to `execute(…)` methods in query 
subclasses. This change provides an extension point for more specialized 
queries.
 add 3f35250  Minor tuning: - Remove unnecessary synchronization. - Forward 
loading strategy to wrapped resources. - Typos.
 add 3246cf6  Add an optimization: - A AND NOT(A) = false - A OR  NOT(A) = 
true
 add 93542a4  Apply GDAL "sparse files" convention. It requires relaxing 
`TiledGridCoverage` tile types from `WritableRaster` to `Raster`.
 add eae7522  Remove a background thread that does not seem to be necessary 
anymore.
 add d517cda  Load native metadata in a background thread separated from 
standard metadata. This allows loading those metadata only if the "native 
metadata" tab is selected.
 add 26b4daa  Provide an extension point in `DefaultTreeTable` for 
initializing the tree only when the root node is first requested.
 add 23d2354  Provides a view of GeoTIFF native metadata (TIFF tags and 
GeoKeys).
 add 08e148e  Use separated nodes in native metadata for each TIFF image.
 add 6cd70ce  Fix an `IndexOutOfBoundsException`.
 add 887a01a  Allow to restrict the "best fit range" to floating point 
types. It makes a difference in the interpretation of next value after the 
maximum value.
 add 0e4421b  Fix a problem with `IndexColorModel` creation for 1-bit TIFF 
images.
 add bbde15b  Add a check against closed result sets.
 add ef25f40  Add the possibility to listen to read or write operations.
 add 59e1d2e  Get synchronization lock from a `getSynchronizedLock()` 
method added in `AbstractResource`. It helps to avoid dead locks, by allowing 
subclasses to take a lock on the `DataStore`.
 add 32175f2  Avoid seek operations on very short distances (less than 8 
bytes).
 add cd6d191  Add a "System monitor" view showing which region of files are 
read. We use it for monitoring behavior of GeoTIFF reader.
 add 157bdb0  Add visual indications about seek operations.
 add 5740d3f  More robust parsing of `GDAL_NODATA` tag (may be an empty 
string).
 add a47a93c  Avoid blocking the event thread when asking for a label 
implies a calls to `Resource.getMetadata()`.
 add b957357  Better recording of recently used file (ordered by file 
closed instead of file opened, remove from menu the opened files).
 add aba6ddf  GridCoverageResource API: - Add a `getResolutions()` method. 
- Add `throws DataStoreException` to `get|setLoadingStrategy(…)`.
 add 381fe9d  Replace 

[sis] 01/01: Merge branch 'geoapi-4.0' into geoapi-3.1

2021-11-04 Thread desruisseaux
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-3.1
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 5a19a7005262c7d5123f80deb8e3d90c7201b7ff
Merge: 1e0f827 b6f984f
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 17:09:31 2021 +0100

Merge branch 'geoapi-4.0' into geoapi-3.1

 .../main/java/org/apache/sis/gui/DataViewer.java   |  32 +-
 .../main/java/org/apache/sis/gui/RecentFiles.java  |  55 ++-
 .../java/org/apache/sis/gui/SystemMonitor.java | 116 +
 .../apache/sis/gui/coverage/CoverageCanvas.java|  34 +-
 .../java/org/apache/sis/gui/coverage/GridView.java |   4 +-
 .../org/apache/sis/gui/coverage/ImageRequest.java  |  17 +-
 .../org/apache/sis/gui/coverage/RenderingData.java |  13 +-
 .../org/apache/sis/gui/coverage/package-info.java  |   2 +-
 .../org/apache/sis/gui/dataset/FeatureList.java|   4 +-
 .../java/org/apache/sis/gui/dataset/LoadEvent.java |  31 +-
 .../dataset/{LoadEvent.java => ResourceEvent.java} |  41 +-
 .../apache/sis/gui/dataset/ResourceExplorer.java   | 264 ++
 .../org/apache/sis/gui/dataset/ResourceTree.java   | 529 ++---
 .../org/apache/sis/gui/dataset/package-info.java   |   6 +-
 .../java/org/apache/sis/gui/map/MapCanvas.java | 194 +++-
 .../java/org/apache/sis/gui/map/MapCanvasAWT.java  | 100 +++-
 .../java/org/apache/sis/gui/map/package-info.java  |   2 +-
 .../sis/gui/metadata/IdentificationInfo.java   |   2 +-
 .../apache/sis/gui/metadata/MetadataSummary.java   |  30 +-
 .../org/apache/sis/gui/metadata/MetadataTree.java  |   7 +-
 .../org/apache/sis/gui/metadata/package-info.java  |   2 +-
 .../main/java/org/apache/sis/gui/package-info.java |   2 +-
 .../gui/referencing/RecentReferenceSystems.java|   9 +-
 .../apache/sis/internal/gui/BackgroundThreads.java |  18 +-
 .../sis/internal/gui/FixedHeaderColumnSize.java|  89 
 .../org/apache/sis/internal/gui/GUIUtilities.java  |  19 +-
 .../sis/internal/gui/OptionalDataDownloader.java   |  31 +-
 .../org/apache/sis/internal/gui/PropertyView.java  |   4 +-
 .../apache/sis/internal/gui/ResourceLoader.java|  46 +-
 .../org/apache/sis/internal/gui/Resources.java |  22 +-
 .../apache/sis/internal/gui/Resources.properties   |   6 +-
 .../sis/internal/gui/Resources_fr.properties   |   6 +-
 .../java/org/apache/sis/internal/gui/Styles.java   |   2 +-
 .../apache/sis/internal/gui/io/FileAccessItem.java | 420 
 .../apache/sis/internal/gui/io/FileAccessView.java | 136 ++
 .../apache/sis/internal/gui}/io/package-info.java  |   8 +-
 .../org/apache/sis/internal/gui/package-info.java  |   2 +-
 .../java/org/apache/sis/coverage/CategoryList.java |   4 +-
 .../org/apache/sis/coverage/RegionOfInterest.java  | 156 ++
 .../org/apache/sis/coverage/SampleDimension.java   |  86 +++-
 .../coverage/grid/CoordinateOperationFinder.java   |   2 +-
 .../apache/sis/coverage/grid/GridCoverage2D.java   |  67 ++-
 .../sis/coverage/grid/GridCoverageProcessor.java   |  58 ++-
 .../apache/sis/coverage/grid/GridDerivation.java   |   5 +-
 .../apache/sis/filter/DefaultFilterFactory.java|   6 +-
 .../java/org/apache/sis/filter/LogicalFilter.java  |  15 +-
 .../java/org/apache/sis/filter/package-info.java   |   2 +-
 .../java/org/apache/sis/image/ImageProcessor.java  |  88 ++--
 .../java/org/apache/sis/image/MaskedImage.java | 478 +++
 .../java/org/apache/sis/image/PrefetchedImage.java |  87 +---
 .../java/org/apache/sis/image/ResampledImage.java  |  30 +-
 .../org/apache/sis/image/SourceAlignedImage.java   |  21 +-
 .../java/org/apache/sis/image/Visualization.java   | 420 ++--
 .../java/org/apache/sis/image/package-info.java|   9 +-
 .../internal/coverage/j2d/ColorModelFactory.java   |  12 +-
 .../sis/internal/coverage/j2d/Colorizer.java   |   2 +-
 .../sis/internal/coverage/j2d/FillValues.java  | 188 
 .../sis/internal/coverage/j2d/ImageLayout.java |  46 +-
 .../sis/internal/coverage/j2d/TilePlaceholder.java | 395 +++
 .../sis/internal/coverage/j2d/package-info.java|   2 +-
 .../org/apache/sis/coverage/CategoryListTest.java  |   3 +-
 .../org/apache/sis/filter/LogicalFilterTest.java   |   9 +-
 .../apache/sis/metadata/sql/CachedStatement.java   |   4 +-
 .../org/apache/sis/metadata/sql/package-info.java  |   2 +-
 core/sis-referencing/pom.xml   |  11 +
 .../factory/ConcurrentAuthorityFactory.java|   8 +-
 .../referencing/factory/sql/AuthorityCodes.java|  28 +-
 .../factory/sql/CloseableReference.java|  21 +-
 .../referencing/factory/sql/EPSGCodeFinder.java|   2 +
 .../referencing/factory/sql/EPSGDataAccess.java|  30 +-
 .../sis/referencing/factory/sql/package-info.java  |   2 +-
 .../operation/projection/AzimuthalEquidistant.java |   1 +
 .../projection/ModifiedAzimuthalEquidistant.java   |   6 +
 .../java/org/apache/sis/math/MathFunctions.java|   9 +-

[sis] branch geoapi-3.1 updated (1e0f827 -> 5a19a70)

2021-11-04 Thread desruisseaux
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-3.1
in repository https://gitbox.apache.org/repos/asf/sis.git.


from 1e0f827  Merge branch 'geoapi-4.0' into geoapi-3.1
 add c9abccd  Fix `IndexOutOfBoundsException` which was thrown when 
`FeatureSet` has no geometry property. The fix is indirect, by making an 
`isEmpty` flag to become `true` when there is no geometry. This is an attempt 
to address the https://github.com/apache/sis/pull/22 pull request without 
discarding the whole feature (features without geometry should be legal).
 add 9fe7fb4  Add a contributor name. His main work was an effort to 
provide derivative formulas in `ModifiedAzimuthalEquidistant`.
 add 6dc2e2d  Workaround for RasterFormatException. 
https://bugs.openjdk.java.net/browse/JDK-8275345
 add eda4d10  Minor documentation fixes and bug fixes related to background 
value.
 add ac3c44d  Fix an integer overflow in call to 
`divisors(Integer.MAX_VALUE)`.
 add b55b18c  Verify that the `bounds` argument is non-empty. This 
verification avoid more confusing exception later.
 add 17bf849  Better identification of case where the image shown in 
`MapCanvas` is in error (i.e. because an exception has been thrown during the 
rendering process).
 add 0daa2b6  Reduce the amount of repaint events when resizing windows.
 add 098b3bc  Popup a dialog box if an error occurred while downloading 
optional resources.
 add 38066bc  Cherry-pick documentation improvement from pull request #24: 
doc(Core): improve SampleDimension apidoc regarding background value management.
 add 8e1df6f  Provide an extension mechanism for allowing users to provide 
their own solution for https://github.com/apache/sis/pull/24
 add da6ade3  Move the provider of empty tiles in a location where it can 
be shared with other operations.
 add 7a62166  Initial version of a "clip" or "mask" operation. Add mask and 
clip operations on grid coverages.
 add 6fb53af  Compute only the tiles that intersect the bounding box of the 
mask. It saves memory and computation when a tile does not intersect the clip.
 add d5601f3  Merge the "clip" and "mask" methods in a single "mask" method 
with boolean argument.
 add debfbf7  Give protected access to `execute(…)` methods in query 
subclasses. This change provides an extension point for more specialized 
queries.
 add 3f35250  Minor tuning: - Remove unnecessary synchronization. - Forward 
loading strategy to wrapped resources. - Typos.
 add 3246cf6  Add an optimization: - A AND NOT(A) = false - A OR  NOT(A) = 
true
 add 93542a4  Apply GDAL "sparse files" convention. It requires relaxing 
`TiledGridCoverage` tile types from `WritableRaster` to `Raster`.
 add eae7522  Remove a background thread that does not seem to be necessary 
anymore.
 add d517cda  Load native metadata in a background thread separated from 
standard metadata. This allows loading those metadata only if the "native 
metadata" tab is selected.
 add 26b4daa  Provide an extension point in `DefaultTreeTable` for 
initializing the tree only when the root node is first requested.
 add 23d2354  Provides a view of GeoTIFF native metadata (TIFF tags and 
GeoKeys).
 add 08e148e  Use separated nodes in native metadata for each TIFF image.
 add 6cd70ce  Fix an `IndexOutOfBoundsException`.
 add 887a01a  Allow to restrict the "best fit range" to floating point 
types. It makes a difference in the interpretation of next value after the 
maximum value.
 add 0e4421b  Fix a problem with `IndexColorModel` creation for 1-bit TIFF 
images.
 add bbde15b  Add a check against closed result sets.
 add ef25f40  Add the possibility to listen to read or write operations.
 add 59e1d2e  Get synchronization lock from a `getSynchronizedLock()` 
method added in `AbstractResource`. It helps to avoid dead locks, by allowing 
subclasses to take a lock on the `DataStore`.
 add 32175f2  Avoid seek operations on very short distances (less than 8 
bytes).
 add cd6d191  Add a "System monitor" view showing which region of files are 
read. We use it for monitoring behavior of GeoTIFF reader.
 add 157bdb0  Add visual indications about seek operations.
 add 5740d3f  More robust parsing of `GDAL_NODATA` tag (may be an empty 
string).
 add a47a93c  Avoid blocking the event thread when asking for a label 
implies a calls to `Resource.getMetadata()`.
 add b957357  Better recording of recently used file (ordered by file 
closed instead of file opened, remove from menu the opened files).
 add aba6ddf  GridCoverageResource API: - Add a `getResolutions()` method. 
- Add `throws DataStoreException` to `get|setLoadingStrategy(…)`.
 add 381fe9d  Replace `Visualization.create(…)` method by a builder. It 
simplifies some code and made easier to fix a bug related to mismatched tile 
layout in the `converters == 

[sis] branch geoapi-4.0 updated (657a69f -> b6f984f)

2021-11-04 Thread desruisseaux
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git.


 discard 657a69f  Fix an ArrayIndexOutOfBoundsException when the mask width is 
less than 64 pixels.
 new b6f984f  Fix an ArrayIndexOutOfBoundsException when the mask width is 
less than 64 pixels.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (657a69f)
\
 N -- N -- N   refs/heads/geoapi-4.0 (b6f984f)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[sis] 01/01: Fix an ArrayIndexOutOfBoundsException when the mask width is less than 64 pixels.

2021-11-04 Thread desruisseaux
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 b6f984f1a1c4ed3525c2b63fe2364fef8edf125f
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 16:41:36 2021 +0100

Fix an ArrayIndexOutOfBoundsException when the mask width is less than 64 
pixels.
---
 .../src/main/java/org/apache/sis/image/MaskedImage.java   | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
index 9ac7dab..9b4b3ec 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
@@ -33,6 +33,7 @@ import java.awt.image.IndexColorModel;
 import java.awt.image.MultiPixelPackedSampleModel;
 import java.lang.ref.SoftReference;
 import java.nio.ByteOrder;
+import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.coverage.j2d.FillValues;
 import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.coverage.j2d.TilePlaceholder;
@@ -191,7 +192,7 @@ final class MaskedImage extends SourceAlignedImage {
 /*
  * Create a 1-bit image with an `IndexColorModel` with two colors: 
{0, 0, 0} and {255, 255, 255}.
  * Java2D has specialized code for TYPE_BYTE_BINARY; we reproduce 
something equivalent but with
- * the array size rounded to an integer multiple of {@code long} 
size.
+ * the array size rounded to an integer multiple of `long` size.
  */
 final byte[] gray = {0, -1};
 final IndexColorModel cm = new IndexColorModel(1, gray.length, 
gray, gray, gray);
@@ -215,7 +216,7 @@ final class MaskedImage extends SourceAlignedImage {
 b.put(b.position(), ~b.get());  // Inverse all 
bits.
 }
 }
-mask.order(ByteOrder.BIG_ENDIAN).asReadOnlyBuffer();
+mask = mask.order(ByteOrder.BIG_ENDIAN).asReadOnlyBuffer();
 final MultiPixelPackedSampleModel sm = 
(MultiPixelPackedSampleModel) raster.getSampleModel();
 assert sm.getNumDataElements() == 1 && sm.getPixelBitStride() == 1 
&& sm.getDataBitOffset() == 0;
 maskScanlineStride = sm.getScanlineStride() * Byte.SIZE;
@@ -295,10 +296,10 @@ final class MaskedImage extends SourceAlignedImage {
  * We need to clear those bits for allowing the loop to skip them.
  */
 long element = mask.get(index);
-if (shift != 0) {
-long m = (1L << (Long.SIZE - shift)) - 1;
+{   // For keeping variable local.
+long m = Numerics.bitmask(Long.SIZE - shift) - 1;   // 
All bits set if shift = 0.
 if (index == emax && remaining != 0) {
-m &= (1L << (Long.SIZE - remaining)) - 1;
+m &= -(1L << (Long.SIZE - remaining));  // 
~(x-1) simplified as -x
 }
 present &= (element | ~m);
 element &= m;


[sis] branch geoapi-4.0 updated: Fix an ArrayIndexOutOfBoundsException when the mask width is less than 64 pixels.

2021-11-04 Thread desruisseaux
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 657a69f  Fix an ArrayIndexOutOfBoundsException when the mask width is 
less than 64 pixels.
657a69f is described below

commit 657a69f47e700b226e11b318ee3efa54ae4125b8
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 16:41:36 2021 +0100

Fix an ArrayIndexOutOfBoundsException when the mask width is less than 64 
pixels.
---
 .../src/main/java/org/apache/sis/image/MaskedImage.java   | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
index 9ac7dab..1a98b2f 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/MaskedImage.java
@@ -33,6 +33,7 @@ import java.awt.image.IndexColorModel;
 import java.awt.image.MultiPixelPackedSampleModel;
 import java.lang.ref.SoftReference;
 import java.nio.ByteOrder;
+import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.coverage.j2d.FillValues;
 import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.coverage.j2d.TilePlaceholder;
@@ -191,7 +192,7 @@ final class MaskedImage extends SourceAlignedImage {
 /*
  * Create a 1-bit image with an `IndexColorModel` with two colors: 
{0, 0, 0} and {255, 255, 255}.
  * Java2D has specialized code for TYPE_BYTE_BINARY; we reproduce 
something equivalent but with
- * the array size rounded to an integer multiple of {@code long} 
size.
+ * the array size rounded to an integer multiple of `long` size.
  */
 final byte[] gray = {0, -1};
 final IndexColorModel cm = new IndexColorModel(1, gray.length, 
gray, gray, gray);
@@ -215,7 +216,7 @@ final class MaskedImage extends SourceAlignedImage {
 b.put(b.position(), ~b.get());  // Inverse all 
bits.
 }
 }
-mask.order(ByteOrder.BIG_ENDIAN).asReadOnlyBuffer();
+mask = mask.order(ByteOrder.BIG_ENDIAN).asReadOnlyBuffer();
 final MultiPixelPackedSampleModel sm = 
(MultiPixelPackedSampleModel) raster.getSampleModel();
 assert sm.getNumDataElements() == 1 && sm.getPixelBitStride() == 1 
&& sm.getDataBitOffset() == 0;
 maskScanlineStride = sm.getScanlineStride() * Byte.SIZE;
@@ -295,10 +296,10 @@ final class MaskedImage extends SourceAlignedImage {
  * We need to clear those bits for allowing the loop to skip them.
  */
 long element = mask.get(index);
-if (shift != 0) {
-long m = (1L << (Long.SIZE - shift)) - 1;
+{   // For keeping variable locale.
+long m = Numerics.bitmask(Long.SIZE - shift) - 1;   // 
All bits set if shift = 0.
 if (index == emax && remaining != 0) {
-m &= (1L << (Long.SIZE - remaining)) - 1;
+m &= -(1L << (Long.SIZE - remaining));  // 
~(x-1) simplified as -x
 }
 present &= (element | ~m);
 element &= m;


[sis] 01/02: Do not interrupt threads that are blocked on I/O operations. This is necessary for avoiding to close InterruptibleChannel.

2021-11-04 Thread desruisseaux
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 e2f00c48d881d8d9a23d5411d61bbd339996e034
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 10:15:40 2021 +0100

Do not interrupt threads that are blocked on I/O operations.
This is necessary for avoiding to close InterruptibleChannel.
---
 .../src/main/java/org/apache/sis/gui/coverage/GridView.java |  4 ++--
 .../main/java/org/apache/sis/gui/dataset/FeatureList.java   |  4 ++--
 .../org/apache/sis/gui/metadata/IdentificationInfo.java |  2 +-
 .../java/org/apache/sis/gui/metadata/MetadataSummary.java   |  2 +-
 .../java/org/apache/sis/internal/gui/BackgroundThreads.java | 13 +
 .../main/java/org/apache/sis/internal/gui/PropertyView.java |  4 ++--
 6 files changed, 21 insertions(+), 8 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridView.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridView.java
index bf6dd8c..057c7e7 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridView.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/GridView.java
@@ -316,7 +316,7 @@ public class GridView extends Control {
 final ImageLoader previous = loader;
 loader = null;
 if (previous != null) {
-previous.cancel();
+previous.cancel(BackgroundThreads.NO_INTERRUPT_DURING_IO);
 }
 loader = new ImageLoader(source, true);
 BackgroundThreads.execute(loader);
@@ -444,7 +444,7 @@ public class GridView extends Control {
  */
 private void onImageSpecified(final RenderedImage image) {
 if (loader != null) {
-loader.cancel();
+loader.cancel(BackgroundThreads.NO_INTERRUPT_DURING_IO);
 loader = null;
 }
 tiles.clear();  // Let garbage collector dispose the rasters.
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureList.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureList.java
index ab8b9cc..5c1ef2c 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureList.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureList.java
@@ -149,7 +149,7 @@ final class FeatureList extends ObservableListBase 
{
 final FeatureLoader previous = nextPageLoader;
 if (previous != null) {
 nextPageLoader = null;
-previous.cancel();
+previous.cancel(BackgroundThreads.NO_INTERRUPT_DURING_IO);
 }
 if (features != null) {
 nextPageLoader = new FeatureLoader(table, features);
@@ -333,7 +333,7 @@ final class FeatureList extends ObservableListBase 
{
 final FeatureLoader loader = nextPageLoader;
 nextPageLoader = null;
 if (loader != null) {
-loader.cancel();
+loader.cancel(BackgroundThreads.NO_INTERRUPT_DURING_IO);
 BackgroundThreads.execute(loader::waitAndClose);
 }
 }
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java
index 1c83184..8da5616 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java
@@ -238,7 +238,7 @@ final class IdentificationInfo extends 
Section {
 @Override
 void setInformation(final Metadata metadata) {
 if (aggregateWalker != null) {
-aggregateWalker.cancel();
+aggregateWalker.cancel(BackgroundThreads.NO_INTERRUPT_DURING_IO);
 aggregateWalker = null;
 }
 final Collection info;
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
index dee04f1..b17445e 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
@@ -200,7 +200,7 @@ public class MetadataSummary extends Widget {
 public void setMetadata(final Resource resource) {
 assert Platform.isFxApplicationThread();
 if (getter != null) {
-getter.cancel();
+getter.cancel(BackgroundThreads.NO_INTERRUPT_DURING_IO);
 getter = null;
 }
 if (resource == null) {
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/BackgroundThreads.java
 

[sis] branch geoapi-4.0 updated (fed0a14 -> 3f52106)

2021-11-04 Thread desruisseaux
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git.


from fed0a14  Fix `NullPointerException`, partially caused by changes in 
`MapCanvas` state when a rendering is in progress. We workaround this problem 
with a new `MapCanvas.runAfterRendering(Runnable)` method.
 new e2f00c4  Do not interrupt threads that are blocked on I/O operations. 
This is necessary for avoiding to close InterruptibleChannel.
 new 3f52106  Document better who is in charge of closing JDBC connections. 
Check if the connection is closed in methods that do not use the connection 
immediately.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/sis/gui/coverage/GridView.java |  4 +--
 .../org/apache/sis/gui/dataset/FeatureList.java|  4 +--
 .../sis/gui/metadata/IdentificationInfo.java   |  2 +-
 .../apache/sis/gui/metadata/MetadataSummary.java   |  2 +-
 .../apache/sis/internal/gui/BackgroundThreads.java | 13 ++
 .../org/apache/sis/internal/gui/PropertyView.java  |  4 +--
 .../factory/ConcurrentAuthorityFactory.java|  8 +++---
 .../referencing/factory/sql/AuthorityCodes.java| 28 
 .../factory/sql/CloseableReference.java| 21 ++-
 .../referencing/factory/sql/EPSGCodeFinder.java|  2 ++
 .../referencing/factory/sql/EPSGDataAccess.java| 30 --
 .../sis/referencing/factory/sql/package-info.java  |  2 +-
 .../java/org/apache/sis/util/resources/Errors.java |  5 
 .../apache/sis/util/resources/Errors.properties|  1 +
 .../apache/sis/util/resources/Errors_fr.properties |  1 +
 15 files changed, 88 insertions(+), 39 deletions(-)


[sis] 02/02: Document better who is in charge of closing JDBC connections. Check if the connection is closed in methods that do not use the connection immediately.

2021-11-04 Thread desruisseaux
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 3f521061600df52d0ac8648e66759e7824b8f6c4
Author: Martin Desruisseaux 
AuthorDate: Thu Nov 4 10:17:59 2021 +0100

Document better who is in charge of closing JDBC connections.
Check if the connection is closed in methods that do not use the connection 
immediately.
---
 .../factory/ConcurrentAuthorityFactory.java|  8 +++---
 .../referencing/factory/sql/AuthorityCodes.java| 28 
 .../factory/sql/CloseableReference.java| 21 ++-
 .../referencing/factory/sql/EPSGCodeFinder.java|  2 ++
 .../referencing/factory/sql/EPSGDataAccess.java| 30 --
 .../sis/referencing/factory/sql/package-info.java  |  2 +-
 .../java/org/apache/sis/util/resources/Errors.java |  5 
 .../apache/sis/util/resources/Errors.properties|  1 +
 .../apache/sis/util/resources/Errors_fr.properties |  1 +
 9 files changed, 67 insertions(+), 31 deletions(-)

diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
index a817f9f..358fc38 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
@@ -1779,7 +1779,7 @@ public abstract class ConcurrentAuthorityFactorySynchronization note
- * our public API claims that {@link IdentifiedObjectFinder}s are not 
thread-safe.
+ * Our public API claims that {@link IdentifiedObjectFinder}s are not 
thread-safe.
  * Nevertheless we synchronize this particular implementation for safety, 
because the consequence of misuse
  * are more dangerous than other implementations. Furthermore this is also 
a way to assert that no code path
  * go to the {@link #create(AuthorityFactoryProxy, String)} method from a 
non-overridden public method.
@@ -2090,7 +2090,7 @@ public abstract class ConcurrentAuthorityFactory List clear(final 
Deque> availableDAOs) {
+private static  List 
clear(final Deque> availableDAOs) {
 assert Thread.holdsLock(availableDAOs);
 final List factories = new ArrayList<>(availableDAOs.size());
 DataAccessRef dao;
@@ -2107,9 +2107,9 @@ public abstract class ConcurrentAuthorityFactory void close(final List 
factories) throws Exception {
+private static  void close(final 
List factories) throws Exception {
 Exception exception = null;
-for (int i=factories.size(); --i>=0;) {
+for (int i = factories.size(); --i >= 0;) {
 final DAO factory = factories.get(i);
 if (factory instanceof AutoCloseable) try {
 ((AutoCloseable) factory).close();
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
index 2afa8d9..90f55f9 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
@@ -34,20 +34,26 @@ import org.apache.sis.util.collection.IntegerList;
  * A map of EPSG authority codes as keys and object names as values.
  * This map requires a living connection to the EPSG database.
  *
- * Serialization of this class stores a copy of all authority codes.
- * The serialization does not preserve any connection to the database.
+ * Serialization
+ * Serialization of this class stores a copy of all authority codes.
+ * The serialization does not preserve any connection to the database.
  *
- * This method does not implement {@link AutoCloseable} because the same 
instance may be shared by many users,
+ * Garbage collection
+ * This method does not implement {@link AutoCloseable} because the same 
instance may be shared by many users,
  * since {@link EPSGDataAccess#getAuthorityCodes(Class)} caches {@code 
AuthorityCodes} instances. Furthermore we can
  * not rely on the users closing {@code AuthorityCodes} themselves because 
this is not part of the usual contract
  * for Java collection classes (we could document that recommendation in 
method Javadoc, but not every developers
  * read Javadoc). Relying on the garbage collector for disposing this resource 
is far from ideal, but alternatives
  * are not very convincing either (load the same codes many time, have the 
risk that users do not dispose resources,
- * have the risk to return to user an already closed {@code AuthorityCodes} 
instance).
+ * have the risk to return to user an already closed {@code AuthorityCodes} 
instance).
  *
  * @author