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 29beeb73586d8a4bde5d57d3d50deb9d1b5d8f6f
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Sat Jul 2 16:57:08 2022 +0200

    Add `getDomain(…)` implementations for a few more map projections (only the 
easiest cases).
---
 .../operation/projection/LambertConicConformal.java | 21 ++++++++++++++++++++-
 .../operation/projection/PolarStereographic.java    | 19 ++++++++++++++++++-
 .../operation/projection/ZonedGridSystem.java       | 21 ++++++++++++++++++++-
 3 files changed, 58 insertions(+), 3 deletions(-)

diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
index a20dcb8a44..0a6923d1f8 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
@@ -17,7 +17,9 @@
 package org.apache.sis.referencing.operation.projection;
 
 import java.util.EnumMap;
+import java.util.Optional;
 import java.util.regex.Pattern;
+import org.opengis.geometry.Envelope;
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.operation.MathTransform;
@@ -26,8 +28,10 @@ import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.Matrix;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.parameter.Parameters;
+import org.apache.sis.geometry.Envelope2D;
 import org.apache.sis.referencing.operation.matrix.Matrix2;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.referencing.operation.transform.DomainDefinition;
 import org.apache.sis.referencing.operation.transform.ContextualParameters;
 import org.apache.sis.internal.referencing.provider.LambertConformal1SP;
 import org.apache.sis.internal.referencing.provider.LambertConformal2SP;
@@ -62,7 +66,7 @@ import static 
org.apache.sis.internal.referencing.Formulas.fastHypot;
  * @author  André Gosselin (MPO)
  * @author  Rueben Schulz (UBC)
  * @author  Rémi Maréchal (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   0.6
  * @module
  */
@@ -422,6 +426,21 @@ public class LambertConicConformal extends 
ConformalProjection {
         return context.completeTransform(factory, kernel);
     }
 
+    /**
+     * Returns the domain of input coordinates.
+     * The limits defined by this method are arbitrary and may change in any 
future implementation.
+     * Current implementation sets a longitude range of ±180° (i.e. the world) 
and a latitude range
+     * from pole to equator in the hemisphere of the projection.
+     *
+     * @since 1.3
+     */
+    @Override
+    public Optional<Envelope> getDomain(final DomainDefinition criteria) {
+        final double x = abs(θ_bound);
+        final double y = copySign(PI/2, -n);
+        return Optional.of(new Envelope2D(null, -x, Math.min(y, 0), 2*x, 
Math.abs(y)));
+    }
+
     /**
      * Converts the specified (θ,φ) coordinate (units in radians) and stores 
the result in {@code dstPts}.
      * In addition, opportunistically computes the projection derivative if 
{@code derivate} is {@code true}.
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
index 510bbd2251..0694632c59 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
@@ -17,15 +17,19 @@
 package org.apache.sis.referencing.operation.projection;
 
 import java.util.EnumMap;
+import java.util.Optional;
 import java.util.regex.Pattern;
+import org.opengis.geometry.Envelope;
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.geometry.Envelope2D;
 import org.apache.sis.referencing.operation.matrix.Matrix2;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.referencing.operation.transform.DomainDefinition;
 import org.apache.sis.referencing.operation.transform.ContextualParameters;
 import org.apache.sis.internal.referencing.provider.PolarStereographicA;
 import org.apache.sis.internal.referencing.provider.PolarStereographicB;
@@ -57,7 +61,7 @@ import static 
org.apache.sis.internal.referencing.Formulas.fastHypot;
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @author  Rueben Schulz (UBC)
  * @author  Rémi Maréchal (Geomatys)
- * @version 1.2
+ * @version 1.3
  *
  * @see ObliqueStereographic
  *
@@ -299,6 +303,19 @@ public class PolarStereographic extends 
ConformalProjection {
         return context.completeTransform(factory, kernel);
     }
 
+    /**
+     * Returns the domain of input coordinates.
+     * The limits defined by this method are arbitrary and may change in any 
future implementation.
+     * Current implementation sets a longitude range of ±180° (i.e. the world) 
and a latitude range
+     * from pole to equator in the hemisphere of the projection.
+     *
+     * @since 1.3
+     */
+    @Override
+    public Optional<Envelope> getDomain(final DomainDefinition criteria) {
+        return Optional.of(new Envelope2D(null, -PI, -PI/2, 2*PI, PI/2));
+    }
+
     /**
      * Converts the specified (θ,φ) coordinate (units in radians) and stores 
the result in {@code dstPts}.
      * In addition, opportunistically computes the projection derivative if 
{@code derivate} is {@code true}.
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
index b5b66a2a30..146f574add 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
@@ -17,7 +17,9 @@
 package org.apache.sis.referencing.operation.projection;
 
 import java.util.EnumMap;
+import java.util.Optional;
 import java.io.Serializable;
+import org.opengis.geometry.Envelope;
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterValueGroup;
@@ -30,12 +32,15 @@ import 
org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
 import org.apache.sis.referencing.operation.transform.AbstractMathTransform2D;
 import org.apache.sis.referencing.operation.transform.ContextualParameters;
+import org.apache.sis.referencing.operation.transform.DomainDefinition;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.parameter.Parameters;
+import org.apache.sis.geometry.Envelope2D;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.internal.util.Numerics;
 
+import static java.lang.Math.PI;
 import static java.lang.Math.floor;
 import static 
org.apache.sis.internal.referencing.provider.TransverseMercator.*;
 import static 
org.apache.sis.internal.referencing.provider.ZonedTransverseMercator.*;
@@ -59,7 +64,7 @@ import static 
org.apache.sis.internal.referencing.provider.ZonedTransverseMercat
  * EPSG:32600 (northern hemisphere) and EPSG:32700 (southern hemisphere).</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.3
  * @since   0.8
  * @module
  */
@@ -145,6 +150,20 @@ public class ZonedGridSystem extends 
AbstractMathTransform2D implements Serializ
         return projection.getParameterValues();
     }
 
+    /**
+     * Returns the domain of input coordinates.
+     * The limits defined by this method are arbitrary and may change in any 
future implementation.
+     * Current implementation sets a longitude range of ±180° (i.e. the world) 
and a latitude range
+     * from 84°S to 84°N.
+     *
+     * @since 1.3
+     */
+    @Override
+    public Optional<Envelope> getDomain(final DomainDefinition criteria) {
+        final double y = -PI/2 * (84d/90);
+        return Optional.of(new Envelope2D(null, -PI, y, 2*PI, -2*y));
+    }
+
     /**
      * Converts the specified (λ,φ) coordinate and stores the result in {@code 
dstPts}.
      * In addition, opportunistically computes the projection derivative if 
{@code derivate} is {@code true}.

Reply via email to