sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1804945 - /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
Date Sun, 13 Aug 2017 20:43:16 GMT
Author: desruisseaux
Date: Sun Aug 13 20:43:16 2017
New Revision: 1804945

URL: http://svn.apache.org/viewvc?rev=1804945&view=rev
Log:
If a CoordinateOperation has not explicit domain of validity, use the intersection of CRS
domain of validity.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1804945&r1=1804944&r2=1804945&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] Sun Aug 13 20:43:16 2017
@@ -667,6 +667,10 @@ public final class CRS extends Static {
      * associated with the given operation. If more than one geographic bounding box is found,
then this method
      * computes their {@linkplain DefaultGeographicBoundingBox#add(GeographicBoundingBox)
union}.
      *
+     * <p><b>Fallback:</b> if the given operation does not declare explicitely
a domain of validity, then this
+     * method computes the intersection of the domain of validity declared by source and
target CRS. If no CRS
+     * declare a domain of validity, then this method returns {@code null}.</p>
+     *
      * @param  operation  the coordinate operation for which to get the domain of validity,
or {@code null}.
      * @return the geographic area where the operation is valid, or {@code null} if unspecified.
      *
@@ -678,7 +682,15 @@ public final class CRS extends Static {
      * @since 0.7
      */
     public static GeographicBoundingBox getGeographicBoundingBox(final CoordinateOperation
operation) {
-        return (operation != null) ? Extents.getGeographicBoundingBox(operation.getDomainOfValidity())
: null;
+        if (operation == null) {
+            return null;
+        }
+        GeographicBoundingBox bbox = Extents.getGeographicBoundingBox(operation.getDomainOfValidity());
+        if (bbox == null) {
+            bbox = Extents.intersection(getGeographicBoundingBox(operation.getSourceCRS()),
+                                        getGeographicBoundingBox(operation.getTargetCRS()));
+        }
+        return bbox;
     }
 
     /**



Mime
View raw message