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 2022/02/01 19:47:48 UTC

[sis] branch geoapi-4.0 updated (c541c4e -> 8983130)

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 c541c4e  Clarify the meaning of axis rotation (the last rotation in "Pole rotation" operation method).
     new fa203fe  Temporary disallow non-zero axis rotation for the "North pole rotation" case, until we resolved an ambiguity about the sign of this rotation angle.
     new 8983130  Fix a few typos in javadoc.

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:
 .../sis/referencing/operation/transform/PoleRotation.java |  8 ++++++++
 .../referencing/operation/transform/PoleRotationTest.java | 15 ++++++++++++---
 .../apache/sis/internal/storage/inflater/CCITTRLE.java    |  4 ++--
 .../sis/internal/storage/inflater/CompressionChannel.java |  2 +-
 .../internal/storage/inflater/HorizontalPredictor.java    |  2 +-
 .../org/apache/sis/internal/storage/inflater/LZW.java     | 12 ++++++------
 .../apache/sis/internal/storage/inflater/PackBits.java    |  4 ++--
 .../sis/internal/storage/inflater/PixelChannel.java       |  2 +-
 .../sis/internal/storage/inflater/PredictorChannel.java   |  4 ++--
 .../org/apache/sis/internal/storage/inflater/ZIP.java     |  6 +++---
 10 files changed, 38 insertions(+), 21 deletions(-)

[sis] 02/02: Fix a few typos in javadoc.

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 8983130bd4463b568f553c53fe4f6744532c14d2
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Feb 1 19:47:25 2022 +0100

    Fix a few typos in javadoc.
---
 .../org/apache/sis/internal/storage/inflater/CCITTRLE.java   |  4 ++--
 .../sis/internal/storage/inflater/CompressionChannel.java    |  2 +-
 .../sis/internal/storage/inflater/HorizontalPredictor.java   |  2 +-
 .../java/org/apache/sis/internal/storage/inflater/LZW.java   | 12 ++++++------
 .../org/apache/sis/internal/storage/inflater/PackBits.java   |  4 ++--
 .../apache/sis/internal/storage/inflater/PixelChannel.java   |  2 +-
 .../sis/internal/storage/inflater/PredictorChannel.java      |  4 ++--
 .../java/org/apache/sis/internal/storage/inflater/ZIP.java   |  6 +++---
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CCITTRLE.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CCITTRLE.java
index 0d7bac2..cf44863 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CCITTRLE.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CCITTRLE.java
@@ -131,7 +131,7 @@ final class CCITTRLE extends CompressionChannel {
      * Prepares this inflater for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
@@ -184,7 +184,7 @@ final class CCITTRLE extends CompressionChannel {
     }
 
     /**
-     * Decompresses some bytes from the {@linkplain #input} into the given destination buffer.
+     * Decompresses some bytes from the {@linkplain #input input} into the given destination buffer.
      *
      * @param  target  the buffer into which bytes are to be transferred.
      * @return the number of bytes read, or -1 if end-of-stream.
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
index ec97aa3..95e5473 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
@@ -64,7 +64,7 @@ abstract class CompressionChannel extends PixelChannel {
      * Prepares this inflater for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/HorizontalPredictor.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/HorizontalPredictor.java
index 263a01c..54da470 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/HorizontalPredictor.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/HorizontalPredictor.java
@@ -122,7 +122,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
      * Prepares this predictor for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/LZW.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/LZW.java
index 07d4e84..583732f 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/LZW.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/LZW.java
@@ -26,7 +26,7 @@ import org.apache.sis.internal.storage.io.ChannelDataInput;
 
 /**
  * Inflater for values encoded with the LZW compression.
- * This compression is described in section 13 of TIFF 6 specification. "LZW Compression".
+ * This compression is described in section 13 of TIFF 6 specification, "LZW Compression".
  * Each code is written using at least 9 bits and at most 12 bits.
  *
  * <h2>Legal note</h2>
@@ -41,7 +41,7 @@ import org.apache.sis.internal.storage.io.ChannelDataInput;
 final class LZW extends CompressionChannel {
     /**
      * A 12 bits code meaning that we have exhausted the 4093 available codes
-     * and most reset the table to the initial set of 9 bits code.
+     * and must reset the table to the initial set of 9 bits code.
      */
     private static final int CLEAR_CODE = 256;
 
@@ -51,7 +51,7 @@ final class LZW extends CompressionChannel {
     private static final int EOI_CODE = 257;
 
     /**
-     * First code which is not one of the predefined nodes.
+     * First code which is not one of the predefined codes.
      */
     private static final int FIRST_ADAPTATIVE_CODE = 258;
 
@@ -91,7 +91,7 @@ final class LZW extends CompressionChannel {
 
     /**
      * Number of bits to read for the next code. This number starts at 9 and increases until {@value #MAX_CODE_SIZE}.
-     * After {@value #MAX_CODE_SIZE} bits, a {@link #CLEAR_CODE} should occurs in the stream of LZW data.
+     * After {@value #MAX_CODE_SIZE} bits, a {@link #CLEAR_CODE} should occur in the stream of LZW data.
      */
     private int codeSize;
 
@@ -122,7 +122,7 @@ final class LZW extends CompressionChannel {
      * Prepares this inflater for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
@@ -136,7 +136,7 @@ final class LZW extends CompressionChannel {
     }
 
     /**
-     * Decompresses some bytes from the {@linkplain #input} into the given destination buffer.
+     * Decompresses some bytes from the {@linkplain #input input} into the given destination buffer.
      *
      * @param  target  the buffer into which bytes are to be transferred.
      * @return the number of bytes read, or -1 if end-of-stream.
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PackBits.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PackBits.java
index 51b1e59..650633f 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PackBits.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PackBits.java
@@ -63,7 +63,7 @@ final class PackBits extends CompressionChannel {
      * Prepares this inflater for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
@@ -74,7 +74,7 @@ final class PackBits extends CompressionChannel {
     }
 
     /**
-     * Decompresses some bytes from the {@linkplain #input} into the given destination buffer.
+     * Decompresses some bytes from the {@linkplain #input input} into the given destination buffer.
      *
      * @param  target  the buffer into which bytes are to be transferred.
      * @return the number of bytes read, or -1 if end-of-stream.
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PixelChannel.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PixelChannel.java
index a4f2ba9..5247497 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PixelChannel.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PixelChannel.java
@@ -48,7 +48,7 @@ abstract class PixelChannel implements ReadableByteChannel {
      * Prepares this channel for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     public abstract void setInputRegion(long start, long byteCount) throws IOException;
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PredictorChannel.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PredictorChannel.java
index 00f8876..e10fc76 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PredictorChannel.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/PredictorChannel.java
@@ -64,7 +64,7 @@ abstract class PredictorChannel extends PixelChannel {
      * Prepares this predictor for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
@@ -85,7 +85,7 @@ abstract class PredictorChannel extends PixelChannel {
     protected abstract int uncompress(ByteBuffer buffer, int start);
 
     /**
-     * Decompresses some bytes from the {@linkplain #input} into the given destination buffer.
+     * Decompresses some bytes from the {@linkplain #input input} into the given destination buffer.
      *
      * @param  target  the buffer into which bytes are to be transferred.
      * @return the number of bytes read, or -1 if end-of-stream.
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/ZIP.java b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/ZIP.java
index 1810e9b..a4f5c1f 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/ZIP.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/ZIP.java
@@ -47,7 +47,7 @@ final class ZIP extends CompressionChannel {
      *
      * @param  input      the source of data to decompress.
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     public ZIP(final ChannelDataInput input) {
@@ -59,7 +59,7 @@ final class ZIP extends CompressionChannel {
      * Prepares this inflater for reading a new tile or a new band of a tile.
      *
      * @param  start      stream position where to start reading.
-     * @param  byteCount  number of byte to read from the input.
+     * @param  byteCount  number of bytes to read from the input.
      * @throws IOException if the stream can not be seek to the given start position.
      */
     @Override
@@ -69,7 +69,7 @@ final class ZIP extends CompressionChannel {
     }
 
     /**
-     * Decompresses some bytes from the {@linkplain #input} into the given destination buffer.
+     * Decompresses some bytes from the {@linkplain #input input} into the given destination buffer.
      *
      * @param  target  the buffer into which bytes are to be transferred.
      * @return the number of bytes read, or -1 if end-of-stream.

[sis] 01/02: Temporary disallow non-zero axis rotation for the "North pole rotation" case, until we resolved an ambiguity about the sign of this rotation angle.

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 fa203febfbdea627bf58a55285633c18cb700226
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Feb 1 18:40:09 2022 +0100

    Temporary disallow non-zero axis rotation for the "North pole rotation" case,
    until we resolved an ambiguity about the sign of this rotation angle.
---
 .../sis/referencing/operation/transform/PoleRotation.java |  8 ++++++++
 .../referencing/operation/transform/PoleRotationTest.java | 15 ++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
index d147032..0674050 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
@@ -233,10 +233,18 @@ public class PoleRotation extends AbstractMathTransform2D implements Serializabl
      *                  looking from the northern to the southern pole.
      * @return the conversion doing a north pole rotation.
      * @throws FactoryException if an error occurred while creating a transform.
+     *
+     * @todo Current implementation does not accept non-zero {@code pa} argument value,
+     *       because we have not yet resolved an ambiguity about the sign of this parameter.
+     *       Should it be a rotation clockwise or anti-clockwise? Looking from northern to
+     *       southern pole or the opposite direction?
      */
     public static MathTransform rotateNorthPole(final MathTransformFactory factory,
             final double φp, final double λp, final double pa) throws FactoryException
     {
+        if (pa != 0) {
+            throw new IllegalArgumentException("Non-zero axis rotation not yet accepted.");
+        }
         final PoleRotation kernel = new PoleRotation(false, φp, λp, pa);
         return kernel.context.completeTransform(factory, kernel);
     }
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
index 62f1894..15bb190 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
@@ -72,7 +72,7 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase {
      */
     private void inverseNorthPoleTransform() throws FactoryException, TransformException {
         final ParameterValueGroup pg = ((Parameterized) transform.inverse()).getParameterValues();
-        transform = PoleRotation.rotateNorthPole(factory(),
+        rotateNorthPole(
                 pg.parameter("grid_north_pole_latitude") .doubleValue(),
                 pg.parameter("grid_north_pole_longitude").doubleValue(),
                 pg.parameter("north_pole_grid_longitude").doubleValue());
@@ -187,6 +187,15 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase {
     }
 
     /**
+     * Temporary workaround for {@code PoleRotation.rotateNorthPole(…)} which does not accept
+     * non-zero {@code pa} argument. To be deleted after we resolved the sign ambiguity.
+     */
+    private void rotateNorthPole(final double φp, final double λp, final double pa) throws FactoryException {
+        final PoleRotation kernel = new PoleRotation(false, φp, λp, pa);
+        transform = kernel.getContextualParameters().completeTransform(factory(), kernel);
+    }
+
+    /**
      * Tests a rotation of north pole with the pole on arbitrary meridian.
      * Result can be compared with PROJ using the following command, where
      * {@code coords.txt} is a file containing input coordinates in (λ,φ)
@@ -203,7 +212,7 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase {
     @Test
     @DependsOnMethod("testRotateNorthPoleOnGreenwich")
     public void testRotateNorthPole() throws FactoryException, TransformException {
-        transform = PoleRotation.rotateNorthPole(factory(), 70, 40, 10);
+        rotateNorthPole(70, 40, 10);
         final double[] coordinates = {      // (λ,φ) coordinates to convert.
              0, 54,
             20, 62,
@@ -227,7 +236,7 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase {
      */
     @Test
     public void testRotateNorthToOppositeHemisphere() throws FactoryException, TransformException {
-        transform = PoleRotation.rotateNorthPole(factory(), -50, 20, -10);
+        rotateNorthPole(-50, 20, -10);
         final double[] coordinates = {      // (λ,φ) coordinates to convert.
              20, -51,
              80, -44,