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 2021/09/22 16:26:05 UTC
[sis] branch geoapi-4.0 updated (19acaac -> a493472)
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 19acaac Fix unmarshalling of <gmi:MI_PolarizationOrientationCode>.
new 7485605 Move `RasterLoadingStrategy` to public API.
new 75db362 Move `WraparoundAdjustment` outside of `sis-referencing` module. It is specific to grid coverage support.
new 93868d7 Rename `FolderStoreProvider` as `StoreProvider` for consistency with other internal store provider. The `Folder` prefix is redundant with package names and these providers are no expected to be used directly.
new 63a6974 Use better method names for some `SQLBuilder` methods.
new 975a191 Rename `insert(…)` as `insertDimension` and `reduce(…)` as `reduceDimension`.
new c3bb6f3 Remove link to UCAR Javadoc. The link seems to not work anymore.
new a493472 Remove <scope>provided</scope> in declarations of Jakarta API dependency. Environments providing JAXB by default are rare now.
The 7 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:
application/sis-console/pom.xml | 4 --
application/sis-javafx/pom.xml | 5 ---
application/sis-openoffice/pom.xml | 5 ---
.../apache/sis/coverage/grid/GridDerivation.java | 1 -
.../org/apache/sis/coverage/grid/GridExtent.java | 34 ++++++++++++----
.../org/apache/sis/coverage/grid/GridGeometry.java | 2 +-
.../apache/sis/coverage/grid/SliceGeometry.java | 2 +-
.../sis/coverage/grid}/WraparoundAdjustment.java | 47 +++-------------------
.../sis/coverage/grid/GridDerivationTest.java | 2 +-
.../apache/sis/coverage/grid/GridExtentTest.java | 16 ++++----
.../coverage/grid}/WraparoundAdjustmentTest.java | 19 ++-------
.../apache/sis/test/suite/FeatureTestSuite.java | 1 +
.../sis/internal/metadata/sql/SQLBuilder.java | 10 ++---
.../sis/metadata/sql/IdentifierGenerator.java | 2 +-
.../apache/sis/metadata/sql/MetadataSource.java | 2 +-
.../apache/sis/metadata/sql/MetadataWriter.java | 2 +-
.../internal/referencing/WraparoundApplicator.java | 37 ++++++++++++++++-
.../referencing/WraparoundApplicatorTest.java} | 22 +++++-----
.../sis/test/suite/ReferencingTestSuite.java | 2 +-
pom.xml | 7 ----
.../sis/internal/netcdf/ucar/package-info.java | 5 +--
.../sis/internal/sql/feature/FeatureIterator.java | 2 +-
.../sis/internal/storage/AbstractGridResource.java | 30 +-------------
.../sis/internal/storage/TiledGridResource.java | 1 +
.../apache/sis/internal/storage/folder/Store.java | 4 +-
...FolderStoreProvider.java => StoreProvider.java} | 8 ++--
.../sis/internal/storage/folder/WritableStore.java | 4 +-
.../apache/sis/storage/GridCoverageResource.java | 32 +++++++++++++++
.../storage/RasterLoadingStrategy.java | 6 +--
.../org.apache.sis.storage.DataStoreProvider | 2 +-
.../sis/internal/storage/folder/StoreTest.java | 4 +-
.../sis/test/storage/CoverageReadConsistency.java | 2 +-
32 files changed, 153 insertions(+), 169 deletions(-)
rename core/{sis-referencing/src/main/java/org/apache/sis/internal/referencing => sis-feature/src/main/java/org/apache/sis/coverage/grid}/WraparoundAdjustment.java (92%)
rename core/{sis-referencing/src/test/java/org/apache/sis/internal/referencing => sis-feature/src/test/java/org/apache/sis/coverage/grid}/WraparoundAdjustmentTest.java (93%)
copy core/sis-referencing/src/test/java/org/apache/sis/{referencing/operation/DefaultFormulaTest.java => internal/referencing/WraparoundApplicatorTest.java} (62%)
rename storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/{FolderStoreProvider.java => StoreProvider.java} (98%)
rename storage/sis-storage/src/main/java/org/apache/sis/{internal => }/storage/RasterLoadingStrategy.java (95%)
[sis] 02/07: Move `WraparoundAdjustment` outside of
`sis-referencing` module. It is specific to grid coverage support.
Posted by de...@apache.org.
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 75db362d129b25074c9e88990970d69ecd5cc945
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 14:54:24 2021 +0200
Move `WraparoundAdjustment` outside of `sis-referencing` module.
It is specific to grid coverage support.
---
.../apache/sis/coverage/grid/GridDerivation.java | 1 -
.../sis/coverage/grid}/WraparoundAdjustment.java | 47 +++-------------------
.../sis/coverage/grid/GridDerivationTest.java | 2 +-
.../coverage/grid}/WraparoundAdjustmentTest.java | 19 ++-------
.../apache/sis/test/suite/FeatureTestSuite.java | 1 +
.../internal/referencing/WraparoundApplicator.java | 37 ++++++++++++++++-
.../referencing/WraparoundApplicatorTest.java | 44 ++++++++++++++++++++
.../sis/test/suite/ReferencingTestSuite.java | 2 +-
8 files changed, 92 insertions(+), 61 deletions(-)
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
index e6cd64a..feed88f 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
@@ -35,7 +35,6 @@ import org.apache.sis.referencing.operation.transform.LinearTransform;
import org.apache.sis.referencing.operation.transform.TransformSeparator;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.CRS;
-import org.apache.sis.internal.referencing.WraparoundAdjustment;
import org.apache.sis.internal.referencing.DirectPositionView;
import org.apache.sis.geometry.GeneralDirectPosition;
import org.apache.sis.geometry.GeneralEnvelope;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/WraparoundAdjustment.java
similarity index 92%
rename from core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java
rename to core/sis-feature/src/main/java/org/apache/sis/coverage/grid/WraparoundAdjustment.java
index 6ebf80d..32017c2 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/WraparoundAdjustment.java
@@ -14,27 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.referencing;
+package org.apache.sis.coverage.grid;
-import javax.measure.Unit;
import org.opengis.geometry.DirectPosition;
import org.opengis.geometry.Envelope;
-import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem;
-import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.opengis.referencing.cs.EllipsoidalCS;
-import org.opengis.referencing.cs.RangeMeaning;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import org.apache.sis.referencing.operation.transform.MathTransforms;
-import org.apache.sis.measure.Longitude;
-import org.apache.sis.measure.Units;
import org.apache.sis.math.MathFunctions;
import org.apache.sis.geometry.Envelopes;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.geometry.GeneralDirectPosition;
+import org.apache.sis.internal.referencing.WraparoundApplicator;
/**
@@ -43,11 +37,11 @@ import org.apache.sis.geometry.GeneralDirectPosition;
* to move an envelope or a position inside a given domain of validity.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
* @since 1.0
* @module
*/
-public final class WraparoundAdjustment {
+final class WraparoundAdjustment {
/**
* The region inside which a given Area Of Interest (AOI) or Point Of Interest (POI) should be located.
* This envelope may be initially in a projected CRS and converted later to geographic CRS in order to
@@ -116,35 +110,6 @@ public final class WraparoundAdjustment {
}
/**
- * Returns the range (maximum - minimum) of axis in specified dimension if it has wraparound meaning,
- * or {@link Double#NaN} otherwise. This method implements a fallback for longitude axis if it does
- * not declare the minimum and maximum values as expected.
- *
- * @param cs the coordinate system for which to get wraparound range.
- * @param dimension dimension of the axis to test.
- * @return the wraparound range, or {@link Double#NaN} if none.
- */
- static double range(final CoordinateSystem cs, final int dimension) {
- final CoordinateSystemAxis axis = cs.getAxis(dimension);
- if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) {
- double period = axis.getMaximumValue() - axis.getMinimumValue();
- if (period > 0 && period != Double.POSITIVE_INFINITY) {
- return period;
- }
- final AxisDirection dir = AxisDirections.absolute(axis.getDirection());
- if (AxisDirection.EAST.equals(dir) && cs instanceof EllipsoidalCS) {
- period = Longitude.MAX_VALUE - Longitude.MIN_VALUE;
- final Unit<?> unit = axis.getUnit();
- if (unit != null) {
- period = Units.DEGREE.getConverterTo(Units.ensureAngular(unit)).convert(period);
- }
- return period;
- }
- }
- return Double.NaN;
- }
-
- /**
* Sets {@link #crs} to the given value if it is non-null, or to the {@link #domainOfValidity} CRS otherwise.
* If no non-null CRS is available, returns {@code false} for instructing caller to terminate immediately.
*
@@ -257,7 +222,7 @@ public final class WraparoundAdjustment {
*/
final CoordinateSystem cs = crs.getCoordinateSystem();
for (int i=cs.getDimension(); --i >= 0;) {
- final double period = range(cs, i);
+ final double period = WraparoundApplicator.range(cs, i);
if (period > 0) {
/*
* Found an axis (typically the longitude axis) with wraparound range meaning.
@@ -421,7 +386,7 @@ public final class WraparoundAdjustment {
}
final CoordinateSystem cs = crs.getCoordinateSystem();
for (int i=cs.getDimension(); --i >= 0;) {
- final double period = range(cs, i);
+ final double period = WraparoundApplicator.range(cs, i);
if (period > 0) {
transformDomainToAOI();
final double x = shifted.getOrdinate(i);
diff --git a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridDerivationTest.java b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridDerivationTest.java
index 40d3248..baa2c34 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridDerivationTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridDerivationTest.java
@@ -59,7 +59,7 @@ import static org.apache.sis.coverage.grid.GridGeometryTest.assertExtentEquals;
* @since 1.0
* @module
*/
-@DependsOn(GridGeometryTest.class)
+@DependsOn({GridGeometryTest.class, WraparoundAdjustmentTest.class})
public final strictfp class GridDerivationTest extends TestCase {
/**
* Tests {@link GridDerivation#subgrid(Envelope, double...)} using only the
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WraparoundAdjustmentTest.java b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/WraparoundAdjustmentTest.java
similarity index 93%
rename from core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WraparoundAdjustmentTest.java
rename to core/sis-feature/src/test/java/org/apache/sis/coverage/grid/WraparoundAdjustmentTest.java
index 813ccdb..c168222 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WraparoundAdjustmentTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/WraparoundAdjustmentTest.java
@@ -14,19 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.referencing;
+package org.apache.sis.coverage.grid;
import org.opengis.geometry.Envelope;
-import org.opengis.referencing.cs.*;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import org.apache.sis.referencing.crs.DefaultProjectedCRS;
import org.apache.sis.referencing.crs.HardCodedCRS;
-import org.apache.sis.referencing.cs.HardCodedCS;
import org.apache.sis.referencing.operation.HardCodedConversions;
import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.test.DependsOnMethod;
+import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -37,22 +35,12 @@ import static org.apache.sis.test.ReferencingAssert.*;
* Tests {@link WraparoundAdjustment}.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
* @since 1.0
* @module
*/
public final strictfp class WraparoundAdjustmentTest extends TestCase {
/**
- * Tests {@link WraparoundAdjustment#range(CoordinateSystem, int)}.
- */
- @Test
- public void testRange() {
- assertTrue (Double.isNaN(WraparoundAdjustment.range(HardCodedCS.GEODETIC_φλ, 0)));
- assertEquals(360, WraparoundAdjustment.range(HardCodedCS.GEODETIC_φλ, 1), STRICT);
- assertEquals(400, WraparoundAdjustment.range(HardCodedCS.ELLIPSOIDAL_gon, 0), STRICT);
- }
-
- /**
* Convenience method for the tests.
*/
private static Envelope adjustWraparoundAxes(Envelope areaOfInterest, Envelope domainOfValidity, MathTransform validToAOI)
@@ -113,7 +101,6 @@ public final strictfp class WraparoundAdjustmentTest extends TestCase {
* @throws TransformException should never happen since this test does not transform coordinates.
*/
@Test
- @DependsOnMethod("testRange")
public void testWithShiftedAOI() throws TransformException {
final GeneralEnvelope domainOfValidity = new GeneralEnvelope(HardCodedCRS.WGS84);
domainOfValidity.setRange(0, 80, 100);
diff --git a/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java b/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
index dfe80ee..32834e5 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
@@ -105,6 +105,7 @@ import org.junit.runners.Suite;
org.apache.sis.coverage.SampleDimensionTest.class,
org.apache.sis.coverage.SampleRangeFormatTest.class,
org.apache.sis.coverage.grid.PixelTranslationTest.class,
+ org.apache.sis.coverage.grid.WraparoundAdjustmentTest.class,
org.apache.sis.coverage.grid.GridOrientationTest.class,
org.apache.sis.coverage.grid.GridExtentTest.class,
org.apache.sis.coverage.grid.GridGeometryTest.class,
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundApplicator.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundApplicator.java
index 0d43218..e7ce027 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundApplicator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundApplicator.java
@@ -16,7 +16,11 @@
*/
package org.apache.sis.internal.referencing;
+import javax.measure.Unit;
import org.opengis.geometry.DirectPosition;
+import org.opengis.referencing.cs.RangeMeaning;
+import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.operation.CoordinateOperation;
@@ -25,6 +29,8 @@ import org.opengis.referencing.operation.TransformException;
import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.transform.WraparoundTransform;
import org.apache.sis.util.collection.BackingStoreException;
+import org.apache.sis.measure.Longitude;
+import org.apache.sis.measure.Units;
/**
@@ -123,7 +129,7 @@ public final class WraparoundApplicator {
* @throws TransformException if a coordinate can not be computed.
*/
private MathTransform concatenate(final MathTransform tr, final int wraparoundDimension) throws TransformException {
- final double period = WraparoundAdjustment.range(targetCS, wraparoundDimension);
+ final double period = range(targetCS, wraparoundDimension);
if (!(period > 0 && period != Double.POSITIVE_INFINITY)) {
return tr;
}
@@ -153,4 +159,33 @@ public final class WraparoundApplicator {
period, (sourceMedian == null) ? Double.NaN : sourceMedian.getOrdinate(wraparoundDimension), m);
return MathTransforms.concatenate(tr, wraparound);
}
+
+ /**
+ * Returns the range (maximum - minimum) of axis in specified dimension if it has wraparound meaning,
+ * or {@link Double#NaN} otherwise. This method implements a fallback for longitude axis if it does
+ * not declare the minimum and maximum values as expected.
+ *
+ * @param cs the coordinate system for which to get wraparound range.
+ * @param dimension dimension of the axis to test.
+ * @return the wraparound range, or {@link Double#NaN} if none.
+ */
+ public static double range(final CoordinateSystem cs, final int dimension) {
+ final CoordinateSystemAxis axis = cs.getAxis(dimension);
+ if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) {
+ double period = axis.getMaximumValue() - axis.getMinimumValue();
+ if (period > 0 && period != Double.POSITIVE_INFINITY) {
+ return period;
+ }
+ final AxisDirection dir = AxisDirections.absolute(axis.getDirection());
+ if (AxisDirection.EAST.equals(dir) && cs instanceof EllipsoidalCS) {
+ period = Longitude.MAX_VALUE - Longitude.MIN_VALUE;
+ final Unit<?> unit = axis.getUnit();
+ if (unit != null) {
+ period = Units.DEGREE.getConverterTo(Units.ensureAngular(unit)).convert(period);
+ }
+ return period;
+ }
+ }
+ return Double.NaN;
+ }
}
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WraparoundApplicatorTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WraparoundApplicatorTest.java
new file mode 100644
index 0000000..ad5e4d1
--- /dev/null
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WraparoundApplicatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing;
+
+import org.apache.sis.referencing.cs.HardCodedCS;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.apache.sis.test.ReferencingAssert.*;
+
+
+/**
+ * Tests {@link WraparoundApplicator}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.1
+ * @since 1.1
+ * @module
+ */
+public final strictfp class WraparoundApplicatorTest extends TestCase {
+ /**
+ * Tests {@link WraparoundApplicator#range(CoordinateSystem, int)}.
+ */
+ @Test
+ public void testRange() {
+ assertTrue (Double.isNaN(WraparoundApplicator.range(HardCodedCS.GEODETIC_φλ, 0)));
+ assertEquals(360, WraparoundApplicator.range(HardCodedCS.GEODETIC_φλ, 1), STRICT);
+ assertEquals(400, WraparoundApplicator.range(HardCodedCS.ELLIPSOIDAL_gon, 0), STRICT);
+ }
+}
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
index d3165e7..c10e4bc 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
@@ -37,7 +37,7 @@ import org.junit.BeforeClass;
org.apache.sis.internal.referencing.VerticalDatumTypesTest.class,
org.apache.sis.internal.referencing.PositionalAccuracyConstantTest.class,
org.apache.sis.internal.referencing.ReferencingUtilitiesTest.class,
- org.apache.sis.internal.referencing.WraparoundAdjustmentTest.class,
+ org.apache.sis.internal.referencing.WraparoundApplicatorTest.class,
org.apache.sis.internal.referencing.ExtentSelectorTest.class,
org.apache.sis.internal.referencing.WKTKeywordsTest.class,
org.apache.sis.internal.referencing.WKTUtilitiesTest.class,
[sis] 06/07: Remove link to UCAR Javadoc. The link seems to not
work anymore.
Posted by de...@apache.org.
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 c3bb6f3130e6c2b5b21a6c8e8f00129513bee64e
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 17:05:35 2021 +0200
Remove link to UCAR Javadoc. The link seems to not work anymore.
---
pom.xml | 1 -
.../main/java/org/apache/sis/internal/netcdf/ucar/package-info.java | 5 +----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index d5f89bb..a23908b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -878,7 +878,6 @@
<link>https://docs.oracle.com/javase/8/docs/api</link>
<link>http://unitsofmeasurement.github.io/unit-api/site/apidocs</link>
<link>http://www.geoapi.org/snapshot/javadoc</link>
- <link>https://docs.unidata.ucar.edu/netcdf-java/current/javadoc</link>
</links>
<additionalOptions>
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java
index 3138597..105353e 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/package-info.java
@@ -21,10 +21,7 @@
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @version 1.1
- *
- * @see <a href="https://docs.unidata.ucar.edu/netcdf-java/current/javadoc/index.html">UCAR javadoc</a>
- *
- * @since 0.3
+ * @since 0.3
* @module
*/
package org.apache.sis.internal.netcdf.ucar;
[sis] 07/07: Remove provided in declarations of
Jakarta API dependency. Environments providing JAXB by default are rare
now.
Posted by de...@apache.org.
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 a493472a10ae595f06aa9d38a4b2a5b39d08ddf6
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 18:24:15 2021 +0200
Remove <scope>provided</scope> in declarations of Jakarta API dependency.
Environments providing JAXB by default are rare now.
---
application/sis-console/pom.xml | 4 ----
application/sis-javafx/pom.xml | 5 -----
application/sis-openoffice/pom.xml | 5 -----
pom.xml | 6 ------
4 files changed, 20 deletions(-)
diff --git a/application/sis-console/pom.xml b/application/sis-console/pom.xml
index 7b12425..bdf2bda 100644
--- a/application/sis-console/pom.xml
+++ b/application/sis-console/pom.xml
@@ -139,10 +139,6 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- </dependency>
<!-- Test dependencies -->
<dependency>
diff --git a/application/sis-javafx/pom.xml b/application/sis-javafx/pom.xml
index fa2e2a9..995a99f 100644
--- a/application/sis-javafx/pom.xml
+++ b/application/sis-javafx/pom.xml
@@ -151,11 +151,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<scope>runtime</scope>
diff --git a/application/sis-openoffice/pom.xml b/application/sis-openoffice/pom.xml
index 4e2f8a2..b2138f2 100644
--- a/application/sis-openoffice/pom.xml
+++ b/application/sis-openoffice/pom.xml
@@ -100,11 +100,6 @@
<artifactId>sis-utility</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <scope>compile</scope>
- </dependency>
<!-- Following dependencies are included in LibreOffice runtime environment. -->
<dependency>
diff --git a/pom.xml b/pom.xml
index a23908b..715f72d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -469,7 +469,6 @@
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jaxb.version}</version>
- <scope>provided</scope> <!-- Because available in JDK8. -->
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
@@ -534,11 +533,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency> <!-- To be removed after https://issues.apache.org/jira/browse/SIS-469 is done. -->
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
[sis] 03/07: Rename `FolderStoreProvider` as `StoreProvider` for
consistency with other internal store provider. The `Folder` prefix is
redundant with package names and these providers are no expected to be used
directly.
Posted by de...@apache.org.
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 93868d77c9613c67ed22a1c75925043c9b4a7739
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 15:09:30 2021 +0200
Rename `FolderStoreProvider` as `StoreProvider` for consistency with other internal store provider.
The `Folder` prefix is redundant with package names and these providers are no expected to be used directly.
---
.../main/java/org/apache/sis/internal/storage/folder/Store.java | 4 ++--
.../folder/{FolderStoreProvider.java => StoreProvider.java} | 8 ++++----
.../org/apache/sis/internal/storage/folder/WritableStore.java | 4 ++--
.../META-INF/services/org.apache.sis.storage.DataStoreProvider | 2 +-
.../java/org/apache/sis/internal/storage/folder/StoreTest.java | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
index 524c206..d03cbf3 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
@@ -90,7 +90,7 @@ class Store extends DataStore implements StoreResource, Aggregate, DirectoryStre
private final Store originator;
/**
- * The {@link FolderStoreProvider#LOCATION} parameter value.
+ * The {@link StoreProvider#LOCATION} parameter value.
*/
protected final Path location;
@@ -213,7 +213,7 @@ class Store extends DataStore implements StoreResource, Aggregate, DirectoryStre
@Override
public Optional<ParameterValueGroup> getOpenParameters() {
final String format = StoreUtilities.getFormatName(componentProvider);
- final ParameterValueGroup pg = (provider != null ? provider.getOpenParameters() : FolderStoreProvider.PARAMETERS).createValue();
+ final ParameterValueGroup pg = (provider != null ? provider.getOpenParameters() : StoreProvider.PARAMETERS).createValue();
pg.parameter(DataStoreProvider.LOCATION).setValue(location);
if (locale != null) pg.parameter("locale" ).setValue(locale );
if (timezone != null) pg.parameter("timezone").setValue(timezone);
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/StoreProvider.java
similarity index 98%
rename from storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
rename to storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/StoreProvider.java
index f85f93e..9561f58 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/StoreProvider.java
@@ -62,11 +62,11 @@ import org.apache.sis.setup.OptionKey;
* @since 0.8
* @module
*/
-@StoreMetadata(formatName = FolderStoreProvider.NAME,
+@StoreMetadata(formatName = StoreProvider.NAME,
capabilities = {Capability.READ, Capability.WRITE},
resourceTypes = {Aggregate.class, FeatureSet.class, GridCoverageResource.class},
yieldPriority = true)
-public final class FolderStoreProvider extends DataStoreProvider {
+public final class StoreProvider extends DataStoreProvider {
/**
* A short name or abbreviation for the data format.
*/
@@ -119,7 +119,7 @@ public final class FolderStoreProvider extends DataStoreProvider {
/**
* Creates a new provider.
*/
- public FolderStoreProvider() {
+ public StoreProvider() {
}
/**
@@ -159,7 +159,7 @@ public final class FolderStoreProvider extends DataStoreProvider {
return ProbeResult.SUPPORTED;
}
} catch (FileSystemNotFoundException e) {
- Logging.recoverableException(getLogger(), FolderStoreProvider.class, "probeContent", e);
+ Logging.recoverableException(getLogger(), StoreProvider.class, "probeContent", e);
// Nothing we can do, may happen often.
}
return ProbeResult.UNSUPPORTED_STORAGE;
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java
index 8a53cc2..add465c 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/WritableStore.java
@@ -62,7 +62,7 @@ final class WritableStore extends Store implements WritableAggregate {
/**
* Creates a new folder store from the given file, path or URI.
* Contrarily to the {@link Store} parent class, the {@code format} is mandatory for writable stores.
- * This is not verified by this constructor; it should be verified by {@link FolderStoreProvider} instead.
+ * This is not verified by this constructor; it should be verified by {@link StoreProvider} instead.
*/
WritableStore(DataStoreProvider provider, StorageConnector connector, Path path, DataStoreProvider format)
throws DataStoreException, IOException
@@ -79,7 +79,7 @@ final class WritableStore extends Store implements WritableAggregate {
ArgumentChecks.ensureNonNull("resource", resource);
if (!(resource instanceof FeatureSet)) {
throw new DataStoreException(message(Resources.Keys.CanNotStoreResourceType_2, new Object[] {
- FolderStoreProvider.NAME, StoreUtilities.getInterface(resource.getClass())
+ StoreProvider.NAME, StoreUtilities.getInterface(resource.getClass())
}));
}
/*
diff --git a/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider b/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider
index 5c1a70f..821d25b 100644
--- a/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider
+++ b/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider
@@ -1,4 +1,4 @@
org.apache.sis.internal.storage.xml.StoreProvider
org.apache.sis.internal.storage.wkt.StoreProvider
org.apache.sis.internal.storage.csv.StoreProvider
-org.apache.sis.internal.storage.folder.FolderStoreProvider
+org.apache.sis.internal.storage.folder.StoreProvider
diff --git a/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java b/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
index 1f04666..54b98c6 100644
--- a/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
+++ b/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
@@ -89,9 +89,9 @@ public final strictfp class StoreTest extends TestCase {
*/
@Test
public void testSearchProviderParameter() throws URISyntaxException, DataStoreException, IOException {
- final FolderStoreProvider provider = new FolderStoreProvider();
+ final StoreProvider provider = new StoreProvider();
final Set<String> identifiers = new HashSet<>(Arrays.asList("Sample 1", "Sample 2", "Sample 3", "data4"));
- final ParameterValueGroup params = FolderStoreProvider.PARAMETERS.createValue();
+ final ParameterValueGroup params = StoreProvider.PARAMETERS.createValue();
params.parameter("location").setValue(testDirectory());
params.parameter("format").setValue("XML");
try (Store store = (Store) provider.open(params)) {
[sis] 04/07: Use better method names for some `SQLBuilder` methods.
Posted by de...@apache.org.
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 63a69747639deed1f2750469f2412fc0635a74b9
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 16:31:09 2021 +0200
Use better method names for some `SQLBuilder` methods.
---
.../java/org/apache/sis/internal/metadata/sql/SQLBuilder.java | 10 +++++-----
.../java/org/apache/sis/metadata/sql/IdentifierGenerator.java | 2 +-
.../main/java/org/apache/sis/metadata/sql/MetadataSource.java | 2 +-
.../main/java/org/apache/sis/metadata/sql/MetadataWriter.java | 2 +-
.../org/apache/sis/internal/sql/feature/FeatureIterator.java | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLBuilder.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLBuilder.java
index 25f8b16..e08fdb9 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLBuilder.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLBuilder.java
@@ -183,13 +183,13 @@ public class SQLBuilder extends Syntax {
}
/**
- * Appends a value in a {@code SELECT} statement.
- * The {@code "="} string will be inserted before the value.
+ * Appends a {@code "= <value>"} string in a {@code SELECT} statement.
+ * The value is written between quotes, except if it is a number or a boolean.
*
* @param value the value to append, or {@code null}.
* @return this builder, for method call chaining.
*/
- public final SQLBuilder appendCondition(final Object value) {
+ public final SQLBuilder appendEqualsValue(final Object value) {
if (value == null) {
buffer.append(" IS NULL");
return this;
@@ -243,7 +243,7 @@ public class SQLBuilder extends Syntax {
* @param value the value to append.
* @return this builder, for method call chaining.
*/
- public final SQLBuilder appendEscaped(final String value) {
+ public final SQLBuilder appendWildcardEscaped(final String value) {
final StringTokenizer tokens = new StringTokenizer(value, "_%", true);
while (tokens.hasMoreTokens()) {
buffer.append(tokens.nextToken());
@@ -283,7 +283,7 @@ public class SQLBuilder extends Syntax {
*
* @return this builder, for method call chaining.
*/
- public final SQLBuilder insertDistinct() {
+ public final SQLBuilder insertDistinctAfterSelect() {
assert CharSequences.startsWith(buffer, SELECT, false) : buffer;
buffer.insert(SELECT.length(), "DISTINCT ");
return this;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/IdentifierGenerator.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/IdentifierGenerator.java
index 4bc1677..aae4366 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/IdentifierGenerator.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/IdentifierGenerator.java
@@ -115,7 +115,7 @@ final class IdentifierGenerator implements AutoCloseable {
* @throws SQLException if an error occurred while searching for an identifier.
*/
final String identifier(String proposal) throws SQLException {
- statement.setString(1, buffer.clear().appendEscaped(proposal).append('%').toString());
+ statement.setString(1, buffer.clear().appendWildcardEscaped(proposal).append('%').toString());
try (ResultSet rs = statement.executeQuery()) {
if (rs.next()) {
String current = rs.getString(1);
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
index 3326476..34b6530 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
@@ -752,7 +752,7 @@ public class MetadataSource implements AutoCloseable {
} else {
helper.append(" AND ");
}
- helper.appendIdentifier(column).appendCondition(toStorableValue(value));
+ helper.appendIdentifier(column).appendEqualsValue(toStorableValue(value));
}
/*
* The SQL statement is ready, with metadata dependency (if any) resolved. We can now execute it.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java
index a7c8794..f7be613 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java
@@ -663,7 +663,7 @@ public class MetadataWriter extends MetadataSource {
final String identifier = Types.getCodeName(code);
final String query = helper().clear().append(SQLBuilder.SELECT).appendIdentifier(CODE_COLUMN)
.append(" FROM ").appendIdentifier(schema(), table).append(" WHERE ")
- .appendIdentifier(CODE_COLUMN).appendCondition(identifier).toString();
+ .appendIdentifier(CODE_COLUMN).appendEqualsValue(identifier).toString();
final boolean exists;
try (ResultSet rs = stmt.executeQuery(query)) {
exists = rs.next();
diff --git a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/FeatureIterator.java b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/FeatureIterator.java
index af78ad2..fba5727 100644
--- a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/FeatureIterator.java
+++ b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/FeatureIterator.java
@@ -114,7 +114,7 @@ final class FeatureIterator implements Spliterator<Feature>, AutoCloseable {
if (distinct || filter != null || sort != null || offset > 0 || count > 0) {
final SQLBuilder builder = new SQLBuilder(table.database).append(sql);
if (distinct) {
- builder.insertDistinct();
+ builder.insertDistinctAfterSelect();
}
if (filter != null) {
builder.append(" WHERE ").append(filter);
[sis] 01/07: Move `RasterLoadingStrategy` to public API.
Posted by de...@apache.org.
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 7485605ecd9697c4e80d4c0ecdb5741cc3053746
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 13:56:57 2021 +0200
Move `RasterLoadingStrategy` to public API.
---
.../sis/internal/storage/AbstractGridResource.java | 28 -------------------
.../sis/internal/storage/TiledGridResource.java | 1 +
.../apache/sis/storage/GridCoverageResource.java | 32 ++++++++++++++++++++++
.../storage/RasterLoadingStrategy.java | 6 +---
.../sis/test/storage/CoverageReadConsistency.java | 2 +-
5 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
index 4bbf543..0e60107 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
@@ -484,34 +484,6 @@ public abstract class AbstractGridResource extends AbstractResource implements G
}
/**
- * Returns an indication about when the "physical" loading of raster data will happen.
- * This is the strategy actually applied by this resource implementation, not necessarily
- * the strategy given in the last call to {@link #setLoadingStrategy(RasterLoadingStrategy)
- * setLoadingStrategy(…)}.
- *
- * <p>The default strategy is to load raster data at {@link #read read(…)} method invocation time.</p>
- *
- * @return current raster data loading strategy for this resource.
- */
- public RasterLoadingStrategy getLoadingStrategy() {
- return RasterLoadingStrategy.AT_READ_TIME;
- }
-
- /**
- * Sets the preferred strategy about when to do the "physical" loading of raster data.
- * Implementations are free to ignore this parameter or to replace the given strategy
- * by the closest alternative that this resource can support.
- *
- * @param strategy the desired strategy for loading raster data.
- * @return {@code true} if the given strategy has been accepted, or {@code false}
- * if this implementation replaced the given strategy by an alternative.
- */
- public boolean setLoadingStrategy(final RasterLoadingStrategy strategy) {
- ArgumentChecks.ensureNonNull("strategy", strategy);
- return strategy == getLoadingStrategy();
- }
-
- /**
* Logs the execution of a {@link #read(GridGeometry, int...)} operation.
* The log level will be {@link Level#FINE} if the operation was quick enough,
* or {@link PerformanceLevel#SLOW} or higher level otherwise.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridResource.java
index 0a2bad4..bb67d36 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridResource.java
@@ -36,6 +36,7 @@ import org.apache.sis.coverage.grid.GridGeometry;
import org.apache.sis.coverage.grid.GridRoundingMode;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.RasterLoadingStrategy;
import org.apache.sis.storage.event.StoreListeners;
import org.apache.sis.util.collection.WeakValueHashMap;
import org.apache.sis.util.ArraysExt;
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java
index e30cf6b..ce2fe89 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java
@@ -160,4 +160,36 @@ public interface GridCoverageResource extends DataSet {
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
GridCoverage read(GridGeometry domain, int... range) throws DataStoreException;
+
+ /**
+ * Returns an indication about when the "physical" loading of raster data will happen.
+ * This is the strategy actually applied by this resource implementation, not necessarily
+ * the strategy given in the last call to {@link #setLoadingStrategy(RasterLoadingStrategy)
+ * setLoadingStrategy(…)}.
+ *
+ * <p>The default strategy is to load raster data at {@link #read read(…)} method invocation time.</p>
+ *
+ * @return current raster data loading strategy for this resource.
+ *
+ * @since 1.1
+ */
+ default RasterLoadingStrategy getLoadingStrategy() {
+ return RasterLoadingStrategy.AT_READ_TIME;
+ }
+
+ /**
+ * Sets the preferred strategy about when to do the "physical" loading of raster data.
+ * Implementations are free to ignore this parameter or to replace the given strategy
+ * by the closest alternative that this resource can support.
+ *
+ * @param strategy the desired strategy for loading raster data.
+ * @return {@code true} if the given strategy has been accepted, or {@code false}
+ * if this implementation replaced the given strategy by an alternative.
+ *
+ * @since 1.1
+ */
+ default boolean setLoadingStrategy(final RasterLoadingStrategy strategy) {
+ ArgumentChecks.ensureNonNull("strategy", strategy);
+ return strategy == getLoadingStrategy();
+ }
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RasterLoadingStrategy.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/RasterLoadingStrategy.java
similarity index 95%
rename from storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RasterLoadingStrategy.java
rename to storage/sis-storage/src/main/java/org/apache/sis/storage/RasterLoadingStrategy.java
index 7d674c2..3c1a16e 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RasterLoadingStrategy.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/RasterLoadingStrategy.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.storage;
+package org.apache.sis.storage;
import java.lang.ref.SoftReference;
import java.awt.image.RenderedImage;
@@ -23,8 +23,6 @@ import org.opengis.coverage.CannotEvaluateException;
import org.apache.sis.coverage.grid.GridExtent;
import org.apache.sis.coverage.grid.GridGeometry;
import org.apache.sis.coverage.grid.GridCoverage;
-import org.apache.sis.storage.GridCoverageResource;
-import org.apache.sis.storage.DataStoreException;
/**
@@ -40,8 +38,6 @@ import org.apache.sis.storage.DataStoreException;
* The lazy strategy is more efficient when only a few tiles will be used and those tiles are not known in advance.
* The lazy strategy is also the only applicable one if the image is too large for holding in memory.</p>
*
- * @todo This enumeration is internal for now, but may move to public API in a future version.
- *
* @author Martin Desruisseaux (Geomatys)
* @version 1.1
* @since 1.1
diff --git a/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java b/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java
index 6c2fe68..a15d7a1 100644
--- a/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java
+++ b/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java
@@ -29,8 +29,8 @@ import org.apache.sis.coverage.grid.GridGeometry;
import org.apache.sis.coverage.grid.GridExtent;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.GridCoverageResource;
+import org.apache.sis.storage.RasterLoadingStrategy;
import org.apache.sis.internal.storage.AbstractGridResource;
-import org.apache.sis.internal.storage.RasterLoadingStrategy;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.image.PixelIterator;
[sis] 05/07: Rename `insert(…)` as `insertDimension` and `reduce(…)` as `reduceDimension`.
Posted by de...@apache.org.
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 975a19153ba0e9d30096cec9b995f46d7125b62b
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 22 17:04:16 2021 +0200
Rename `insert(…)` as `insertDimension` and `reduce(…)` as `reduceDimension`.
---
.../org/apache/sis/coverage/grid/GridExtent.java | 34 +++++++++++++++++-----
.../org/apache/sis/coverage/grid/GridGeometry.java | 2 +-
.../apache/sis/coverage/grid/SliceGeometry.java | 2 +-
.../apache/sis/coverage/grid/GridExtentTest.java | 16 +++++-----
.../sis/internal/storage/AbstractGridResource.java | 2 +-
5 files changed, 38 insertions(+), 18 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 2e967b1..7368d8e 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
@@ -314,7 +314,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
*
* @see #getLow()
* @see #getHigh()
- * @see #insert(int, DimensionNameType, long, long, boolean)
+ * @see #insertDimension(int, DimensionNameType, long, long, boolean)
*/
public GridExtent(final DimensionNameType[] axisTypes, final long[] low, final long[] high, final boolean isHighIncluded) {
ArgumentChecks.ensureNonNull("high", high);
@@ -625,7 +625,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
*
* @return the number of dimensions.
*
- * @see #reduce(int...)
+ * @see #reduceDimension(int[])
*/
@Override
public final int getDimension() {
@@ -1049,6 +1049,14 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
}
/**
+ * @deprecated Renamed {@link #insertDimension(int, DimensionNameType, long, long, boolean)}.
+ */
+ @Deprecated
+ public GridExtent insert(final int offset, final DimensionNameType axisType, final long low, long high, final boolean isHighIncluded) {
+ return insertDimension(offset, axisType, low, high, isHighIncluded);
+ }
+
+ /**
* Returns a new grid envelope with the specified dimension inserted at the given index in this grid envelope.
* To append a new dimension after all existing dimensions, set {@code offset} to {@link #getDimension()}.
*
@@ -1061,8 +1069,10 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
* This argument does not apply to {@code low} value, which is always inclusive.
* @return a new grid envelope with the specified dimension added.
* @throws IllegalArgumentException if the low coordinate value is greater than the high coordinate value.
+ *
+ * @since 1.1
*/
- public GridExtent insert(final int offset, final DimensionNameType axisType, final long low, long high, final boolean isHighIncluded) {
+ public GridExtent insertDimension(final int offset, final DimensionNameType axisType, final long low, long high, final boolean isHighIncluded) {
final int dimension = getDimension();
ArgumentChecks.ensureBetween("offset", 0, dimension, offset);
if (!isHighIncluded) {
@@ -1231,13 +1241,21 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
}
/**
+ * @deprecated Renamed {@link #reduceDimension(int...)}.
+ */
+ @Deprecated
+ public GridExtent reduce(int... dimensions) {
+ return reduceDimension(dimensions);
+ }
+
+ /**
* Returns a grid extent that encompass only some dimensions of this grid extent.
* This method copies the specified dimensions of this grid extent into a new grid extent.
* The given dimensions must be in strictly ascending order without duplicated values.
* The number of dimensions of the sub grid envelope will be {@code dimensions.length}.
*
* <p>This method performs a <cite>dimensionality reduction</cite> and can be used as the
- * converse of {@link #insert(int, DimensionNameType, long, long, boolean)}.
+ * converse of {@link #insertDimension(int, DimensionNameType, long, long, boolean)}.
* This method can not be used for changing dimension order.</p>
*
* @param dimensions the dimensions to select, in strictly increasing order.
@@ -1246,8 +1264,10 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
*
* @see #getSubspaceDimensions(int)
* @see GridGeometry#reduce(int...)
+ *
+ * @since 1.1
*/
- public GridExtent reduce(int... dimensions) {
+ public GridExtent reduceDimension(int... dimensions) {
dimensions = verifyDimensions(dimensions, getDimension());
return (dimensions != null) ? reorder(dimensions) : this;
}
@@ -1289,7 +1309,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
* grid borders.</div>
*
* This method does not reduce the number of dimensions of the grid extent.
- * For dimensionality reduction, see {@link #reduce(int...)}.
+ * For dimensionality reduction, see {@link #reduceDimension(int[])}.
*
* <h4>Number of arguments</h4>
* The {@code periods} array length should be equal to the {@linkplain #getDimension() number of dimensions}.
@@ -1352,7 +1372,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
* in the given point will be rounded to nearest integer.
*
* <p>This method does not reduce the number of dimensions of the grid extent.
- * For dimensionality reduction, see {@link #reduce(int...)}.</p>
+ * For dimensionality reduction, see {@link #reduceDimension(int[])}.</p>
*
* @param slicePoint where to take a slice. NaN values are handled as if their dimensions were absent.
* @param modifiedDimensions mapping from {@code slicePoint} dimensions to this {@code GridExtent} dimensions,
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
index 2f1e160..d9e6d8c 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
@@ -1353,7 +1353,7 @@ public class GridGeometry implements LenientComparable, Serializable {
* @throws IndexOutOfBoundsException if an index is out of bounds.
*
* @see GridExtent#getSubspaceDimensions(int)
- * @see GridExtent#reduce(int...)
+ * @see GridExtent#reduceDimension(int[])
* @see org.apache.sis.referencing.CRS#reduce(CoordinateReferenceSystem, int...)
*/
public GridGeometry reduce(int... dimensions) {
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
index 264dabe..0279bac 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
@@ -176,7 +176,7 @@ final class SliceGeometry implements Function<RenderedImage, GridGeometry> {
extent = sliceExtent;
}
if (extent != null) {
- extent = extent.reduce(gridDimensions);
+ extent = extent.reduceDimension(gridDimensions);
}
GeneralEnvelope subArea = null;
if (useSubExtent && cornerToCRS != null) try {
diff --git a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
index 46858d1..91123d1 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
@@ -133,7 +133,7 @@ public final strictfp class GridExtentTest extends TestCase {
}
/**
- * Tests {@link GridExtent#insert(int, DimensionNameType, long, long, boolean)}
+ * Tests {@link GridExtent#insertDimension(int, DimensionNameType, long, long, boolean)}
* with {@code offset} set to {@link GridExtent#getDimension()}.
*/
@Test
@@ -142,10 +142,10 @@ public final strictfp class GridExtentTest extends TestCase {
}
/**
- * Tests {@link GridExtent#insert(int, DimensionNameType, long, long, boolean)}.
+ * Tests {@link GridExtent#insertDimension(int, DimensionNameType, long, long, boolean)}.
*/
@Test
- public void testInsert() {
+ public void testInsertDimension() {
appendOrInsert(1, 2);
}
@@ -155,7 +155,7 @@ public final strictfp class GridExtentTest extends TestCase {
private void appendOrInsert(final int offset, final int rowIndex) {
GridExtent extent = new GridExtent(new DimensionNameType[] {DimensionNameType.COLUMN, DimensionNameType.ROW},
new long[] {100, 200}, new long[] {500, 800}, true);
- extent = extent.insert(offset, DimensionNameType.TIME, 40, 50, false);
+ extent = extent.insertDimension(offset, DimensionNameType.TIME, 40, 50, false);
assertEquals("dimension", 3, extent.getDimension());
assertExtentEquals(extent, 0, 100, 500);
assertExtentEquals(extent, rowIndex, 200, 800);
@@ -219,19 +219,19 @@ public final strictfp class GridExtentTest extends TestCase {
}
/**
- * Tests {@link GridExtent#reduce(int...)}.
+ * Tests {@link GridExtent#reduceDimension(int[])}.
*/
@Test
- public void testReduce() {
+ public void testReduceDimension() {
final GridExtent extent = create3D();
- GridExtent reduced = extent.reduce(0, 1);
+ GridExtent reduced = extent.reduceDimension(0, 1);
assertEquals("dimension", 2, reduced.getDimension());
assertExtentEquals(reduced, 0, 100, 499);
assertExtentEquals(reduced, 1, 200, 799);
assertEquals(DimensionNameType.COLUMN, reduced.getAxisType(0).get());
assertEquals(DimensionNameType.ROW, reduced.getAxisType(1).get());
- reduced = extent.reduce(2);
+ reduced = extent.reduceDimension(2);
assertEquals("dimension", 1, reduced.getDimension());
assertExtentEquals(reduced, 0, 40, 49);
assertEquals(DimensionNameType.TIME, reduced.getAxisType(0).get());
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
index 0e60107..6ed632f 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
@@ -350,7 +350,7 @@ public abstract class AbstractGridResource extends AbstractResource implements G
public GridExtent insertBandDimension(final GridExtent areaOfInterest, final int bandDimension) {
first = getSourceIndex(0);
last = getSourceIndex(packed.length - 1);
- return areaOfInterest.insert(bandDimension, DimensionNameType.valueOf("BAND"), first, last, true);
+ return areaOfInterest.insertDimension(bandDimension, DimensionNameType.valueOf("BAND"), first, last, true);
}
/**