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 2017/02/28 17:36:39 UTC
svn commit: r1784786 - in /sis/branches/JDK8/core:
sis-metadata/src/main/resources/org/apache/sis/metadata/sql/
sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/
sis-referencing-by-identifiers/src/main/java/org/apache/sis/...
Author: desruisseaux
Date: Tue Feb 28 17:36:39 2017
New Revision: 1784786
URL: http://svn.apache.org/viewvc?rev=1784786&view=rev
Log:
Verify MGRS metadata.
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql
sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.java
sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.properties
sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources_fr.properties
sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
sis/branches/JDK8/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
Modified: sis/branches/JDK8/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql?rev=1784786&r1=1784785&r2=1784786&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Create.sql [UTF-8] Tue Feb 28 17:36:39 2017
@@ -102,13 +102,15 @@ INSERT INTO metadata."CI_Responsibility"
('Apache', 'Apache', 'principalInvestigator'),
('OGC', 'OGC', 'principalInvestigator'),
('ISO', 'ISO', 'principalInvestigator'),
- ('IOGP', 'IOGP', 'principalInvestigator');
+ ('IOGP', 'IOGP', 'principalInvestigator'),
+ ('NATO', 'NATO', 'principalInvestigator');
INSERT INTO metadata."CI_Citation" (ID, "edition", "citedResponsibleParty", "title") VALUES
('SIS', NULL, 'Apache', 'Apache Spatial Information System'),
('ISO 19115-1', 'ISO 19115-1:2014(E)', 'ISO', 'Geographic Information \u2014 Metadata Part 1: Fundamentals'),
('ISO 19115-2', 'ISO 19115-2:2009(E)', 'ISO', 'Geographic Information \u2014 Metadata Part 2: Extensions for imagery and gridded data'),
- ('EPSG', NULL, 'IOGP', 'EPSG Geodetic Parameter Dataset');
+ ('EPSG', NULL, 'IOGP', 'EPSG Geodetic Parameter Dataset'),
+ ('MGRS', NULL, 'NATO', 'Military Grid Reference System');
--
Modified: sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.java?rev=1784786&r1=1784785&r2=1784786&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.java [UTF-8] Tue Feb 28 17:36:39 2017
@@ -67,7 +67,7 @@ public final class Resources extends Ind
public static final short ChildAlreadyExists_1 = 8;
/**
- * Grid coordinates
+ * Grid coordinate
*/
public static final short GridCoordinates = 12;
@@ -118,6 +118,11 @@ public final class Resources extends Ind
public static final short LocationTypeNotFound_1 = 10;
/**
+ * Military Grid Reference System
+ */
+ public static final short MGRS = 15;
+
+ /**
* Can not determine dimension of \u201c{0}\u201d because of odd number of characters.
*/
public static final short OddGridCoordinateLength_1 = 7;
Modified: sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.properties?rev=1784786&r1=1784785&r2=1784786&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources.properties [ISO-8859-1] Tue Feb 28 17:36:39 2017
@@ -21,8 +21,9 @@
#
# Vocabulary
#
-GridCoordinates = Grid coordinates
+GridCoordinates = Grid coordinate
GridZoneDesignator = Grid zone designator
+MGRS = Military Grid Reference System
SquareIdentifier100 = 100\u00a0km square identifier
#
Modified: sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources_fr.properties?rev=1784786&r1=1784785&r2=1784786&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/internal/gazetteer/Resources_fr.properties [ISO-8859-1] Tue Feb 28 17:36:39 2017
@@ -26,8 +26,9 @@
#
# Vocabulary
#
-GridCoordinates = Coordonn\u00e9es sur la grille
+GridCoordinates = Coordonn\u00e9e sur la grille
GridZoneDesignator = D\u00e9signation de la zone du quadrillage
+MGRS = Syst\u00e8me de r\u00e9f\u00e9rence de carroyage militaire
SquareIdentifier100 = Identifiant du carr\u00e9 de 100\u00a0km
#
Modified: sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java?rev=1784786&r1=1784785&r2=1784786&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] Tue Feb 28 17:36:39 2017
@@ -34,6 +34,7 @@ import org.apache.sis.internal.referenci
import org.apache.sis.internal.gazetteer.Resources;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.crs.DefaultProjectedCRS;
import org.apache.sis.referencing.cs.AxesConvention;
@@ -79,6 +80,11 @@ import org.opengis.referencing.gazetteer
*/
public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers {
/**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 8337394374656125471L;
+
+ /**
* Height of latitude bands, in degrees.
* Those bands are labeled from {@code 'C'} to {@code 'X'} inclusive, excluding {@code 'I'} and {@code 'O'}.
*/
@@ -200,16 +206,19 @@ public class MilitaryGridReferenceSystem
*/
@Workaround(library="JDK", version="1.8")
private static Map<String,?> properties() {
- final Map<String,Object> properties = new HashMap<>();
- properties.put(NAME_KEY, "Military Grid Reference System");
- properties.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD);
- properties.put(THEME_KEY, Vocabulary.formatInternational(Vocabulary.Keys.Mapping));
+ Party party;
try {
- properties.put(OVERALL_OWNER_KEY, MetadataSource.getProvided().lookup(Party.class, "NATO"));
+ party = MetadataSource.getProvided().lookup(Party.class, "NATO");
} catch (MetadataStoreException e) {
+ party = null;
Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING_BY_IDENTIFIERS),
MilitaryGridReferenceSystem.class, "<init>", e);
}
+ final Map<String,Object> properties = new HashMap<>(6);
+ properties.put(NAME_KEY, new NamedIdentifier(null, "NATO", Resources.formatInternational(Resources.Keys.MGRS), null, null));
+ properties.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD);
+ properties.put(THEME_KEY, Vocabulary.formatInternational(Vocabulary.Keys.Mapping));
+ properties.put(OVERALL_OWNER_KEY, party);
return properties;
}
Modified: sis/branches/JDK8/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java?rev=1784786&r1=1784785&r2=1784786&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] Tue Feb 28 17:36:39 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.referencing.gazetteer;
+import java.util.Locale;
import java.util.Random;
import org.opengis.referencing.operation.TransformException;
import org.opengis.referencing.crs.ProjectedCRS;
@@ -31,6 +32,9 @@ import org.junit.Test;
import static org.junit.Assert.*;
+// Branch-dependent imports
+import org.opengis.referencing.gazetteer.LocationType;
+
/**
* Tests {@link MilitaryGridReferenceSystem}.
@@ -43,10 +47,25 @@ import static org.junit.Assert.*;
@DependsOn(ReferencingByIdentifiersTest.class)
public final strictfp class MilitaryGridReferenceSystemTest extends TestCase {
/**
- * Returns a coder instance to test.
+ * Verifies the metadata.
*/
- private MilitaryGridReferenceSystem.Coder coder() {
- return new MilitaryGridReferenceSystem().createCoder();
+ @Test
+ public void verifyMetadata() {
+ final MilitaryGridReferenceSystem rs = new MilitaryGridReferenceSystem();
+ assertEquals("theme", "Mapping", rs.getTheme().toString(Locale.ENGLISH));
+ assertEquals("theme", "Cartographie", rs.getTheme().toString(Locale.FRENCH));
+
+ final LocationType gzd = TestUtilities.getSingleton(rs.getLocationTypes());
+ assertEquals("type", "Grid zone designator", gzd.getName().toString(Locale.ENGLISH));
+ assertEquals("parent", 0, gzd.getParents().size());
+
+ final LocationType sid = TestUtilities.getSingleton(gzd.getChildren());
+ assertEquals("type", "100�km square identifier", sid.getName().toString(Locale.ENGLISH));
+ assertSame("parent", gzd, TestUtilities.getSingleton(sid.getParents()));
+
+ final LocationType gc = TestUtilities.getSingleton(sid.getChildren());
+ assertEquals("type", "Grid coordinate", gc.getName().toString(Locale.ENGLISH));
+ assertSame("parent", sid, TestUtilities.getSingleton(gc.getParents()));
}
/**
@@ -91,6 +110,13 @@ public final strictfp class MilitaryGrid
}
/**
+ * Returns a coder instance to test.
+ */
+ private MilitaryGridReferenceSystem.Coder coder() {
+ return new MilitaryGridReferenceSystem().createCoder();
+ }
+
+ /**
* Tests encoding of various coordinates in Universal Transverse Mercator (UTM) projection.
*
* @throws TransformException if an error occurred while computing the MGRS label.