sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1560046 - in /sis/branches/JDK7/core/sis-referencing/src: main/java/org/apache/sis/referencing/StandardDefinitions.java test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
Date Tue, 21 Jan 2014 15:51:00 GMT
Author: desruisseaux
Date: Tue Jan 21 15:51:00 2014
New Revision: 1560046

URL: http://svn.apache.org/r1560046
Log:
Provide Extent information for world-wide CRS.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1560046&r1=1560045&r2=1560046&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] Tue Jan 21 15:51:00 2014
@@ -34,6 +34,7 @@ import org.opengis.referencing.cs.Coordi
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.VerticalCRS;
+import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.referencing.datum.DefaultEllipsoid;
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
@@ -50,6 +51,7 @@ import org.apache.sis.measure.Latitude;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
 import static org.opengis.referencing.IdentifiedObject.ALIAS_KEY;
 import static org.opengis.referencing.IdentifiedObject.IDENTIFIERS_KEY;
+import static org.opengis.referencing.datum.Datum.DOMAIN_OF_VALIDITY_KEY;
 import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
 
 
@@ -80,13 +82,17 @@ final class StandardDefinitions {
      * @param  code  The EPSG code.
      * @param  name  The object name.
      * @param  alias The alias, or {@code null} if none.
+     * @param  world {@code true} if the properties shall have an entry for the domain of
validity.
      * @return The map of properties to give to constructors or factory methods.
      */
-    private static Map<String,Object> properties(final short code, final String name,
final String alias) {
+    private static Map<String,Object> properties(final short code, final String name,
final String alias, final boolean world) {
         final Map<String,Object> map = new HashMap<>(8);
         map.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, String.valueOf(code)));
         map.put(NAME_KEY, new NamedIdentifier(Citations.EPSG, name));
         map.put(ALIAS_KEY, alias); // May be null, which is okay.
+        if (world) {
+            map.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD);
+        }
         return map;
     }
 
@@ -101,17 +107,18 @@ final class StandardDefinitions {
     static GeographicCRS createGeographicCRS(final short code, final GeodeticDatum datum,
final EllipsoidalCS cs) {
         final String name;
         String alias = null;
+        boolean world = false;
         switch (code) {
-            case 4326: name = "WGS 84"; break;
-            case 4322: name = "WGS 72"; break;
+            case 4326: name = "WGS 84"; world = true; break;
+            case 4322: name = "WGS 72"; world = true; break;
             case 4258: name = "ETRS89"; alias = "ETRS89-GRS80"; break;
-            case 4269: name = "NAD83"; break;
-            case 4267: name = "NAD27"; break;
-            case 4230: name = "ED50"; break;
-            case 4047: name = "Unspecified datum based upon the GRS 1980 Authalic Sphere";
break;
+            case 4269: name = "NAD83";  break;
+            case 4267: name = "NAD27";  break;
+            case 4230: name = "ED50";   break;
+            case 4047: name = "Unspecified datum based upon the GRS 1980 Authalic Sphere";
world = true; break;
             default:   throw new AssertionError(code);
         }
-        return new DefaultGeographicCRS(properties(code, name, alias), datum, cs);
+        return new DefaultGeographicCRS(properties(code, name, alias, world), datum, cs);
     }
 
     /**
@@ -125,17 +132,18 @@ final class StandardDefinitions {
     static GeodeticDatum createGeodeticDatum(final short code, final Ellipsoid ellipsoid,
final PrimeMeridian meridian) {
         final String name;
         final String alias;
+        boolean world = false;
         switch (code) {
-            case 6326: name = "World Geodetic System 1984";                        alias
= "WGS 84"; break;
-            case 6322: name = "World Geodetic System 1972";                        alias
= "WGS 72"; break;
-            case 6258: name = "European Terrestrial Reference System 1989";        alias
= "ETRS89"; break;
-            case 6269: name = "North American Datum 1983";                         alias
= "NAD83";  break;
-            case 6267: name = "North American Datum 1927";                         alias
= "NAD27";  break;
-            case 6230: name = "European Datum 1950";                               alias
= "ED50";   break;
-            case 6047: name = "Not specified (based on GRS 1980 Authalic Sphere)"; alias
= null;     break;
+            case 6326: name = "World Geodetic System 1984";                        alias
= "WGS 84"; world = true; break;
+            case 6322: name = "World Geodetic System 1972";                        alias
= "WGS 72"; world = true; break;
+            case 6258: name = "European Terrestrial Reference System 1989";        alias
= "ETRS89";               break;
+            case 6269: name = "North American Datum 1983";                         alias
= "NAD83";                break;
+            case 6267: name = "North American Datum 1927";                         alias
= "NAD27";                break;
+            case 6230: name = "European Datum 1950";                               alias
= "ED50";                 break;
+            case 6047: name = "Not specified (based on GRS 1980 Authalic Sphere)"; alias
= null;     world = true; break;
             default:   throw new AssertionError(code);
         }
-        return new DefaultGeodeticDatum(properties(code, name, alias), ellipsoid, meridian);
+        return new DefaultGeodeticDatum(properties(code, name, alias, world), ellipsoid,
meridian);
     }
 
     /**
@@ -160,7 +168,7 @@ final class StandardDefinitions {
             case 7048: name  = "GRS 1980 Authalic Sphere"; ivfDefinitive = false;  semiMajorAxis
= other = AUTHALIC_RADIUS;          break;
             default:   throw new AssertionError(code);
         }
-        final Map<String,Object> map = properties(code, name, alias);
+        final Map<String,Object> map = properties(code, name, alias, false);
         if (ivfDefinitive) {
             return DefaultEllipsoid.createFlattenedSphere(map, semiMajorAxis, other, unit);
         } else {
@@ -194,8 +202,8 @@ final class StandardDefinitions {
             case 5715: name = "MSL depth";  alias = "mean sea level depth";  cs = "Vertical
CS. Axis: depth (D).";  c = 6498; axis = 113; break;
             default:   throw new AssertionError(code);
         }
-        return new DefaultVerticalCRS(properties(code, name, alias), datum,
-                new DefaultVerticalCS(properties(c, cs, null), createAxis(axis)));
+        return new DefaultVerticalCRS(properties(code, name, alias, true), datum,
+                new DefaultVerticalCS(properties(c, cs, null, false), createAxis(axis)));
     }
 
     /**
@@ -211,7 +219,7 @@ final class StandardDefinitions {
             case 5100: name = "Mean Sea Level"; alias = "MSL"; break;
             default:   throw new AssertionError(code);
         }
-        return new DefaultVerticalDatum(properties(code, name, alias), VerticalDatumType.GEOIDAL);
+        return new DefaultVerticalDatum(properties(code, name, alias, true), VerticalDatumType.GEOIDAL);
     }
 
     /**
@@ -230,7 +238,7 @@ final class StandardDefinitions {
             case 6423: name = "Ellipsoidal 3D"; xc = 108; yc = 109; zc = 110; break;
             default:   throw new AssertionError(code);
         }
-        final Map<String,?> properties = properties(code, name, null);
+        final Map<String,?> properties = properties(code, name, null, false);
         final CoordinateSystemAxis xAxis = createAxis(xc);
         final CoordinateSystemAxis yAxis = createAxis(yc);
         if (zc != 0) {
@@ -287,6 +295,6 @@ final class StandardDefinitions {
                        break;
             default:   throw new AssertionError(code);
         }
-        return new DefaultCoordinateSystemAxis(properties(code, name, null), abrv, dir, unit,
min, max, rm);
+        return new DefaultCoordinateSystemAxis(properties(code, name, null, false), abrv,
dir, unit, min, max, rm);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java?rev=1560046&r1=1560045&r2=1560046&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
[UTF-8] Tue Jan 21 15:51:00 2014
@@ -60,7 +60,7 @@ public final strictfp class GeodeticObje
     public void testWGS84() {
         final GeographicCRS geographic = GeodeticObjects.WGS84.geographic();
         Validators.validate(geographic);
-        GeodeticObjectVerifier.assertIsWGS84(geographic, false, true);
+        GeodeticObjectVerifier.assertIsWGS84(geographic, true, true);
         assertSame("Cached value", geographic, GeodeticObjects.WGS84.geographic());
         /*
          * Verifies the variant using (longitude, latitude) axis order.



Mime
View raw message