sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/04: Move the `intersect` method close to `union` method, remove `public` modifier on constructors of package-privated classes and edit some comments. There is no significant code change in this commit.
Date Mon, 05 Oct 2020 11:04:27 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 674c34d5dc0bd7541062525793d28d86bc7b6b38
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sun Oct 4 20:46:26 2020 +0200

    Move the `intersect` method close to `union` method, remove `public` modifier on constructors
of package-privated classes and edit some comments.
    There is no significant code change in this commit.
---
 .../sis/coverage/grid/GridDerivationTest.java      |  6 +--
 .../java/org/apache/sis/geometry/Envelopes.java    | 56 +++++++++++-----------
 .../transform/ConcatenatedTransformDirect.java     |  4 +-
 .../transform/ConcatenatedTransformDirect2D.java   |  4 +-
 .../operation/transform/MathTransformTestCase.java |  2 +-
 5 files changed, 36 insertions(+), 36 deletions(-)

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 3e200fa..e32265d 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
@@ -429,7 +429,7 @@ public final strictfp class GridDerivationTest extends TestCase {
         /*
          * Longitudes from 100°E to 240°E (in WGS84 geographic CRS), which is equivalent
to 100°E to 120°W.
          * That [100 … 240]°E range is compatible with the [0 … 360]° longitude range
declared in the CRS.
-         * Latitude range is from 21°S to 60°N, but this is secondary for this test.
+         * Latitude range is from 21°S to 60°N, but this is not important for this test.
          */
         final GridGeometry grid = new GridGeometry(
                 new GridExtent(null, null, new long[] {8400, 4860}, true), PixelInCell.CELL_CENTER,
@@ -483,7 +483,7 @@ public final strictfp class GridDerivationTest extends TestCase {
     public void testAntiMeridianCrossingInBothGrids() {
         /*
          * Longitudes from 100°E to 240°E (in WGS84 geographic CRS), which is equivalent
to 100°E to 120°W.
-         * Latitude range is from 21°S to 60°N, but this is secondary for this test.
+         * Latitude range is from 21°S to 60°N, but this is not important for this test.
          */
         final GridGeometry grid = new GridGeometry(
                 new GridExtent(null, null, new long[] {8400, 4860}, true), PixelInCell.CELL_CENTER,
@@ -493,7 +493,7 @@ public final strictfp class GridDerivationTest extends TestCase {
                 HardCodedCRS.WGS84.forConvention(AxesConvention.POSITIVE_RANGE));
         /*
          * 22°27′34″W to 102°27′35″W in Mercator projection.
-         * Latitude range is about 66°S to 80°N, but it is not important for this test.
+         * Latitude range is about 66°S to 80°N, but this is not important for this test.
          */
         final GridGeometry areaOfInterest = new GridGeometry(
                 new GridExtent(null, null, new long[] {865, 725}, true), PixelInCell.CELL_CENTER,
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
index 08e36c3..cd9f78b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
@@ -180,6 +180,26 @@ public final class Envelopes extends Static {
     }
 
     /**
+     * Computes the intersection of all given envelopes, transforming them to a common CRS
if necessary.
+     * If all envelopes use the same CRS ({@link ComparisonMode#IGNORE_METADATA ignoring
metadata})
+     * or if the CRS of all envelopes is {@code null}, then the {@linkplain GeneralEnvelope#intersect(Envelope)
+     * intersection is computed} without transforming any envelope. Otherwise all envelopes
are transformed to a
+     * {@linkplain CRS#suggestCommonTarget common CRS} before intersection is computed.
+     * The CRS of the returned envelope may different than the CRS of all given envelopes.
+     *
+     * @param  envelopes  the envelopes for which to compute intersection. Null elements
are ignored.
+     * @return intersection of given envelopes, or {@code null} if the given array does not
contain non-null elements.
+     * @throws TransformException if this method can not determine a common CRS, or if a
transformation failed.
+     *
+     * @see GeneralEnvelope#intersect(Envelope)
+     *
+     * @since 1.0
+     */
+    public static GeneralEnvelope intersect(final Envelope... envelopes) throws TransformException
{
+        return EnvelopeReducer.INTERSECT.reduce(envelopes);
+    }
+
+    /**
      * Finds a mathematical operation from the CRS of the given source envelope to the CRS
of the given target envelope.
      * For non-null georeferenced envelopes, this method is equivalent to the following code
with {@code areaOfInterest}
      * computed as the union of the two envelopes:
@@ -230,8 +250,8 @@ public final class Envelopes extends Static {
                     }
                 } catch (TransformException e) {
                     /*
-                     * Note: we may succeed to transform 'source' and fail to transform 'target'
to geographic bounding box,
-                     * but the opposite is unlikely because 'source' should not have less
dimensions than 'target'.
+                     * Note: we may succeed to transform `source` and fail to transform `target`
to geographic bounding box,
+                     * but the opposite is unlikely because `source` should not have less
dimensions than `target`.
                      */
                     Logging.recoverableException(Logging.getLogger(Loggers.GEOMETRY), Envelopes.class,
"findOperation", e);
                 }
@@ -242,26 +262,6 @@ public final class Envelopes extends Static {
     }
 
     /**
-     * Computes the intersection of all given envelopes, transforming them to a common CRS
if necessary.
-     * If all envelopes use the same CRS ({@link ComparisonMode#IGNORE_METADATA ignoring
metadata})
-     * or if the CRS of all envelopes is {@code null}, then the {@linkplain GeneralEnvelope#intersect(Envelope)
-     * intersection is computed} without transforming any envelope. Otherwise all envelopes
are transformed to a
-     * {@linkplain CRS#suggestCommonTarget common CRS} before intersection is computed.
-     * The CRS of the returned envelope may different than the CRS of all given envelopes.
-     *
-     * @param  envelopes  the envelopes for which to compute intersection. Null elements
are ignored.
-     * @return intersection of given envelopes, or {@code null} if the given array does not
contain non-null elements.
-     * @throws TransformException if this method can not determine a common CRS, or if a
transformation failed.
-     *
-     * @see GeneralEnvelope#intersect(Envelope)
-     *
-     * @since 1.0
-     */
-    public static GeneralEnvelope intersect(final Envelope... envelopes) throws TransformException
{
-        return EnvelopeReducer.INTERSECT.reduce(envelopes);
-    }
-
-    /**
      * Invoked when a recoverable exception occurred. Those exceptions must be minor enough
      * that they can be silently ignored in most cases.
      */
@@ -437,7 +437,7 @@ public final class Envelopes extends Static {
         transformPoint: while (true) {
             /*
              * Compute the derivative (optional operation). If this operation fails, we will
-             * set a flag to 'false' so we don't try again for all remaining points. We try
+             * set a flag to `false` so we don't try again for all remaining points. We try
              * to compute the derivative and the transformed point in a single operation
if
              * we can. If we can not, we will compute those two information separately.
              *
@@ -459,7 +459,7 @@ public final class Envelopes extends Static {
             }
             /*
              * The transformed point has been saved for future reuse after the enclosing
-             * 'while' loop. Now add the transformed point to the destination envelope.
+             * `while` loop. Now add the transformed point to the destination envelope.
              */
             if (transformed == null) {
                 transformed = new GeneralEnvelope(targetDim);
@@ -472,11 +472,11 @@ public final class Envelopes extends Static {
                 transformed.add(ordinatesView);
             }
             /*
-             * Get the next point coordinate. The 'coordinateIndex' variable is an index
in base 3
+             * Get the next point coordinate. The `coordinateIndex` variable is an index
in base 3
              * having a number of digits equals to the number of source dimensions.  For
example a
              * 4-D space have indexes ranging from "0000" to "2222" (numbers in base 3).
The digits
              * are then mapped to minimal (0), maximal (1) or central (2) coordinates. The
outer loop
-             * stops when the counter roll back to "0000". Note that 'targetPt' must keep
the value
+             * stops when the counter roll back to "0000". Note that `targetPt` must keep
the value
              * of the last projected point, which must be the envelope center identified
by "2222"
              * in the 4-D case.
              */
@@ -807,7 +807,7 @@ poles:  for (int i=0; i<dimension; i++, dimensionBitMask <<=
1) {
             if ((includedMinValue & includedMaxValue & dimensionBitMask) == 0 &&
CoordinateOperations.isWrapAround(axis)) {
                 isWrapAroundAxis |= dimensionBitMask;
             }
-            // Restore 'targetPt' to its initial state, which is equals to 'centerPt'.
+            // Restore `targetPt` to its initial state, which is equals to `centerPt`.
             if (targetPt != null) {
                 targetPt.setOrdinate(i, centerPt[i]);
             }
@@ -852,7 +852,7 @@ poles:  for (int i=0; i<dimension; i++, dimensionBitMask <<=
1) {
                          * or skip c={2,3}.
                          */
                         double value = max;
-                        if ((c & 1) == 0) {         // 'true' if we are testing "wrapAroundMin".
+                        if ((c & 1) == 0) {         // `true` if we are testing "wrapAroundMin".
                             if (((c == 0 ? includedMinValue : includedMaxValue) & bm)
== 0) {
                                 c++;                // Skip also the case for "wrapAroundMax".
                                 continue;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect.java
index 851c51d..c713579 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect.java
@@ -40,8 +40,8 @@ class ConcatenatedTransformDirect extends ConcatenatedTransform {
     /**
      * Constructs a concatenated transform.
      */
-    public ConcatenatedTransformDirect(final MathTransform transform1,
-                                       final MathTransform transform2)
+    ConcatenatedTransformDirect(final MathTransform transform1,
+                                final MathTransform transform2)
     {
         super(transform1, transform2);
     }
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect2D.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect2D.java
index c3dedd0..678fef6 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect2D.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect2D.java
@@ -42,8 +42,8 @@ final class ConcatenatedTransformDirect2D extends ConcatenatedTransformDirect
im
     /**
      * Constructs a concatenated transform.
      */
-    public ConcatenatedTransformDirect2D(final MathTransform2D transform1,
-                                         final MathTransform2D transform2)
+    ConcatenatedTransformDirect2D(final MathTransform2D transform1,
+                                  final MathTransform2D transform2)
     {
         super(transform1, transform2);
     }
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
index 00a7c59..db7be06 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
@@ -204,7 +204,7 @@ public abstract strictfp class MathTransformTestCase extends TransformTestCase
{
      * @see Validators#validate(MathTransform)
      */
     protected final void validate() {
-        assertNotNull("The 'transform' field shall be assigned a value.", transform);
+        assertNotNull("The `transform` field shall be assigned a value.", transform);
         Validators.validate(transform);
         final int dimension = transform.getSourceDimensions();
         if (transform.getTargetDimensions() == dimension) {


Mime
View raw message