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 2015/01/19 20:08:44 UTC
svn commit: r1653077 - in /sis/branches/JDK7: ./
core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/
core/sis-metadata/src/test/java/org/apache/sis/metadata/ core/sis-m...
Author: desruisseaux
Date: Mon Jan 19 19:08:43 2015
New Revision: 1653077
URL: http://svn.apache.org/r1653077
Log:
Merge from the JDK8 branch:
- Port of DefaultFormula
- Port of DefaultOperationMethod.
Added:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
- copied unchanged from r1653076, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
- copied unchanged from r1653076, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
- copied unchanged from r1653076, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java
- copied unchanged from r1653076, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java
- copied unchanged from r1653076, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/HardCoded.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/AbstractNameTest.java
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 19 19:08:43 2015
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1652464
+/sis/branches/JDK8:1584960-1653076
/sis/trunk:1394364-1508466,1519089-1519674
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -23,6 +23,7 @@ import org.opengis.referencing.crs.*;
import org.opengis.referencing.datum.*;
import org.opengis.referencing.operation.*;
import org.apache.sis.util.Static;
+import org.apache.sis.internal.util.Citations;
/**
@@ -90,7 +91,7 @@ public final class NameMeaning extends S
* @return {@code true} if the given code space is known to use the URN syntax.
*/
public static boolean usesURN(final String codeSpace) {
- return (codeSpace != null) && codeSpace.equalsIgnoreCase("EPSG");
+ return (codeSpace != null) && codeSpace.equalsIgnoreCase(Citations.EPSG);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -38,6 +38,9 @@ import org.apache.sis.util.resources.Err
* This class searches for the {@link org.apache.sis.internal.referencing.ServicesForMetadata}
* implementation using Java reflection.
*
+ * <p>This class also opportunistically defines some constants related to "referencing by coordinates"
+ * but needed by metadata.</p>
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.18)
* @version 0.5
@@ -45,12 +48,13 @@ import org.apache.sis.util.resources.Err
*/
public abstract class ReferencingServices extends SystemListener {
/**
- * The length of one nautical mile, in metres.
+ * The length of one nautical mile, which is {@value} metres.
*/
public static final double NAUTICAL_MILE = 1852;
/**
- * The GRS80 {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius() authalic radius}.
+ * The GRS80 {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius() authalic radius},
+ * which is {@value} metres.
*/
public static final double AUTHALIC_RADIUS = 6371007;
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -18,9 +18,9 @@ package org.apache.sis.metadata.iso.cita
import org.opengis.metadata.citation.Citation;
import org.apache.sis.util.Static;
+import org.apache.sis.util.CharSequences;
import org.apache.sis.xml.IdentifierSpace;
import org.apache.sis.internal.simple.SimpleCitation;
-import org.apache.sis.util.CharSequences;
/**
@@ -125,11 +125,17 @@ public final class Citations extends Sta
public static final IdentifierSpace<String> PROJ4 = new Authority<>("Proj.4", "PROJ4");
/**
- * The <a href="http://www.epsg.org">European Petroleum Survey Group</a> authority.
- * This citation is used as an authority for
+ * The <a href="http://www.epsg.org">EPSG</a> dataset. This citation is used as an authority for
* {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem coordinate reference system}
* identifiers.
*
+ * <div class="note"><b>Historical note:</b>
+ * The EPSG acronym meaning was <cite>European Petroleum Survey Group</cite>.
+ * But this meaning does not apply anymore since the European and American associations merged
+ * into the <cite>International Association of Oil & Gas producers</cite> (IOGP).
+ * The legacy acronym now applies only to the database Coordinate Reference System definitions,
+ * known as <cite>EPSG dataset</cite>.</div>
+ *
* @see #OGP
* @see #AUTO
* @see #AUTO2
@@ -138,7 +144,9 @@ public final class Citations extends Sta
*
* @since 0.4
*/
- public static final IdentifierSpace<Integer> EPSG = new Authority<>("EPSG", "EPSG");
+ public static final IdentifierSpace<Integer> EPSG = new Authority<>(
+ org.apache.sis.internal.util.Citations.EPSG,
+ org.apache.sis.internal.util.Citations.EPSG);
/**
* <cite>International Standard Book Number</cite> (ISBN) defined by ISO-2108.
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -40,7 +40,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static java.util.Collections.singleton;
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
@@ -253,7 +253,7 @@ public final strictfp class MetadataStan
assertEquals("title", "European Petroleum Survey Group", map.get("getTitle").toString());
final Object identifiers = map.get("identifiers");
assertInstanceOf("identifiers", Collection.class, identifiers);
- HardCodedCitations.assertIdentifiersFor("EPSG", (Collection<?>) identifiers);
+ assertContainsIdentifierCode("EPSG", (Collection<?>) identifiers);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -63,7 +63,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static java.util.Collections.singleton;
-import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
import static org.apache.sis.metadata.PropertyAccessor.APPEND;
import static org.apache.sis.metadata.PropertyAccessor.RETURN_NULL;
@@ -294,7 +294,7 @@ public final strictfp class PropertyAcce
// Collection of Identifiers
final Object identifiers = accessor.get(accessor.indexOf("identifiers", true), instance);
assertInstanceOf("identifiers", Collection.class, identifiers);
- HardCodedCitations.assertIdentifiersFor("ISO", (Collection<?>) identifiers);
+ assertContainsIdentifierCode("ISO", (Collection<?>) identifiers);
}
/**
@@ -608,7 +608,7 @@ public final strictfp class PropertyAcce
assertInstanceOf("identifiers", Collection.class, target);
assertNotSame("Distinct objects shall have distinct collections.", source, target);
assertEquals ("The two collections shall have the same content.", source, target);
- HardCodedCitations.assertIdentifiersFor("EPSG", (Collection<?>) target);
+ assertContainsIdentifierCode("EPSG", (Collection<?>) target);
// Set the identifiers to null, which should clear the collection.
assertEquals("Expected the previous value.", source, accessor.set(index, citation, null, RETURN_PREVIOUS));
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -17,8 +17,6 @@
package org.apache.sis.metadata.iso.citation;
import java.net.URI;
-import java.util.Collection;
-import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Role;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.citation.OnLineFunction;
@@ -27,7 +25,6 @@ import org.apache.sis.metadata.iso.Defau
import org.apache.sis.util.iso.SimpleInternationalString;
import org.apache.sis.util.Static;
-import static org.opengis.test.Assert.*;
import static java.util.Collections.singleton;
@@ -40,7 +37,7 @@ import static java.util.Collections.sing
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.4)
- * @version 0.4
+ * @version 0.5
* @module
*/
public final strictfp class HardCodedCitations extends Static {
@@ -169,23 +166,4 @@ public final strictfp class HardCodedCit
*/
private HardCodedCitations() {
}
-
- /**
- * Asserts that the given {@linkplain Identifier#getCode() identifier code}
- * is found in the collection of identifiers.
- *
- * @param expected The expected identifier code (typically {@code "ISO"} or {@code "EPSG"}).
- * @param identifiers The collection to validate. Should be a collection of {@link Identifier}.
- */
- public static void assertIdentifiersFor(final String expected, final Collection<?> identifiers) {
- assertNotNull("identifiers", identifiers);
- int count = 0;
- for (final Object id : identifiers) {
- assertInstanceOf("identifier", Identifier.class, id);
- if (((Identifier) id).getCode().equals(expected)) {
- count++;
- }
- }
- assertEquals("Unexpected amount of identifiers.", 1, count);
- }
}
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -16,10 +16,13 @@
*/
package org.apache.sis.test;
+import java.util.Collection;
+import org.opengis.metadata.Identifier;
import org.opengis.referencing.IdentifiedObject;
import org.apache.sis.io.wkt.Symbols;
import org.apache.sis.io.wkt.WKTFormat;
import org.apache.sis.io.wkt.Convention;
+import org.apache.sis.internal.util.Citations;
/**
@@ -28,7 +31,7 @@ import org.apache.sis.io.wkt.Convention;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4 (derived from geotk-3.00)
- * @version 0.4
+ * @version 0.5
* @module
*/
public strictfp class MetadataAssert extends Assert {
@@ -51,6 +54,44 @@ public strictfp class MetadataAssert ext
}
/**
+ * Asserts that the given identifier has the expected code and the {@code "EPSG"} code space.
+ * The authority is expected to have the {@code "OGP"} title or alternate title.
+ *
+ * @param expected The expected identifier code.
+ * @param identifier The identifier to verify.
+ *
+ * @since 0.5
+ */
+ public static void assertEpsgIdentifierEquals(final String expected, final Identifier identifier) {
+ assertNotNull(identifier);
+ assertEquals("code", expected, identifier.getCode());
+ assertEquals("codeSpace", Citations.EPSG, identifier.getCodeSpace());
+ assertEquals("authority", "OGP", Citations.getIdentifier(identifier.getAuthority()));
+ }
+
+ /**
+ * Asserts that the given collection contains exactly one identifier with the given
+ * {@linkplain Identifier#getCode() code}. The {@linkplain Identifier#getCodeSpace()
+ * code space} and authority are ignored.
+ *
+ * @param expected The expected identifier code (typically {@code "ISO"} or {@code "EPSG"}).
+ * @param identifiers The collection to validate. Should be a collection of {@link Identifier}.
+ *
+ * @since 0.5
+ */
+ public static void assertContainsIdentifierCode(final String expected, final Collection<?> identifiers) {
+ assertNotNull("identifiers", identifiers);
+ int count = 0;
+ for (final Object id : identifiers) {
+ assertInstanceOf("identifier", Identifier.class, id);
+ if (((Identifier) id).getCode().equals(expected)) {
+ count++;
+ }
+ }
+ assertEquals("Unexpected amount of identifiers.", 1, count);
+ }
+
+ /**
* Asserts that the WKT 2 of the given object is equal to the expected one.
* This method expected the {@code “…”} quotation marks instead of {@code "…"}
* for easier readability of {@link String} constants in Java code.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/HardCoded.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/HardCoded.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/HardCoded.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/HardCoded.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -17,6 +17,7 @@
package org.apache.sis.internal.referencing;
import org.apache.sis.util.Static;
+import org.apache.sis.internal.util.Citations;
/**
@@ -31,7 +32,7 @@ public final class HardCoded extends Sta
/**
* The {@value} code space.
*/
- public static final String EPSG = "EPSG";
+ public static final String EPSG = Citations.EPSG;
/**
* The {@value} code space.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -972,7 +972,7 @@ public class AbstractIdentifiedObject ex
}
/**
- * Formats the inner part of this <cite>Well Known Text</cite> (WKT) object into the given formatter.
+ * Formats the inner part of the <cite>Well Known Text</cite> (WKT) representation for this object.
* The default implementation writes the following elements:
*
* <ul>
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -438,7 +438,7 @@ public class AbstractCRS extends Abstrac
}
/**
- * Formats the inner part of a <cite>Well Known Text</cite> (WKT) CRS into the given formatter.
+ * Formats the inner part of the <cite>Well Known Text</cite> (WKT) representation of this CRS.
* The default implementation writes the following elements in WKT 2 format:
*
* <ul>
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -416,7 +416,7 @@ public class AbstractCS extends Abstract
}
/**
- * Formats the inner part of this <cite>Well Known Text</cite> (WKT) CS into the given formatter.
+ * Formats the inner part of the <cite>Well Known Text</cite> (WKT) representation of this coordinate system.
* This method does <strong>not</strong> format the axes, because they shall appear outside
* the {@code CS[…]} element for historical reasons. Axes shall be formatted by the enclosing
* element (usually an {@link org.apache.sis.referencing.crs.AbstractCRS}).
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -410,8 +410,8 @@ public class AbstractDatum extends Abstr
* have already been compared by the subclass.
*/
final Datum that = (Datum) object;
- return isHeuristicMatchForName(that. getName().getCode()) ||
- IdentifiedObjects.isHeuristicMatchForName(that, getName().getCode());
+ return isHeuristicMatchForName(that.getName().getCode())
+ || IdentifiedObjects.isHeuristicMatchForName(that, getName().getCode());
}
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -297,7 +297,7 @@ public class DefaultTemporalDatum extend
}
/**
- * The {@code TIMEORIGIN[…]} element inside an {@code TDATUM[…]}.
+ * The {@code TimeOrigin[…]} element inside a {@code TimeDatum[…]}.
*/
private static final class Origin extends FormattableObject {
/** The value of the origin to format. */
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -877,6 +877,9 @@ public abstract class AbstractMathTransf
* The default implementation formats all parameter values returned by {@link #getParameterValues()}.
* The parameter group name is used as the math transform name.
*
+ * <div class="note"><b>Compatibility note:</b>
+ * {@code Param_MT} is defined in the WKT 1 specification only.</div>
+ *
* @param formatter The formatter to use.
* @return The WKT element name, which is {@code "Param_MT"} in the default implementation.
*/
@@ -887,6 +890,9 @@ public abstract class AbstractMathTransf
WKTUtilities.appendName(parameters.getDescriptor(), formatter, null);
WKTUtilities.append(parameters, formatter);
}
+ if (formatter.getConvention().majorVersion() != 1) {
+ formatter.setInvalidWKT(MathTransform.class, null);
+ }
return "Param_MT";
}
@@ -1038,6 +1044,9 @@ public abstract class AbstractMathTransf
* WKT as in the {@linkplain AbstractMathTransform#formatWKT super-class method}.
* Otherwise this method formats the math transform as an {@code "Inverse_MT"} entity.
*
+ * <div class="note"><b>Compatibility note:</b>
+ * {@code Param_MT} and {@code Inverse_MT} are defined in the WKT 1 specification only.</div>
+ *
* @param formatter The formatter to use.
* @return The WKT element name, which is {@code "Param_MT"} or
* {@code "Inverse_MT"} in the default implementation.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -898,6 +898,9 @@ class ConcatenatedTransform extends Abst
/**
* Formats the inner part of a <cite>Well Known Text</cite> version 1 (WKT 1) element.
*
+ * <div class="note"><b>Compatibility note:</b>
+ * {@code Concat_MT} is defined in the WKT 1 specification only.</div>
+ *
* @param formatter The formatter to use.
* @return The WKT element name, which is {@code "Concat_MT"}.
*/
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -283,6 +283,71 @@ public final class MathTransforms extend
}
/**
+ * Returns what seems to be the "core" of the given math transform. This method should be used only
+ * for information purpose, since the definition of "core" is imprecise and may be adjusted in future
+ * SIS versions. The current algorithm is as below:
+ *
+ * <ul>
+ * <li>If the given transform can be decomposed in {@linkplain #getSteps(MathTransform) steps}, then the steps for
+ * {@linkplain org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes axis swapping and scaling} are
+ * ignored.</li>
+ * <li>If the given transform or one of its steps is a {@link PassThroughTransform}, then its sub-transform
+ * it taken.</li>
+ * </ul>
+ *
+ * @param transform The math transform from which to get the "core" transform, or {@code null}.
+ * @return The "core" (may be the whole math transform), or {@code null} if the given argument was null.
+ */
+ public static MathTransform getCore(final MathTransform transform) {
+ MathTransform step = transform;
+ while (!isIgnorable(step)) {
+ if (step instanceof ConcatenatedTransform) {
+ // Ignore axis switch and scaling (usually unit conversions).
+ final ConcatenatedTransform c = (ConcatenatedTransform) step;
+ if (isIgnorable(c.transform1)) {
+ step = c.transform2;
+ } else if (isIgnorable(c.transform2)) {
+ step = c.transform1;
+ } else {
+ return c; // Both components are non-ignorable: return the ConcatenatedTransform as a whole.
+ }
+ } else if (step instanceof PassThroughTransform) {
+ step = ((PassThroughTransform) step).subTransform;
+ } else {
+ return step;
+ }
+ }
+ return transform; // The full MathTransform is ignorable. Do not try to decompose it.
+ }
+
+ /**
+ * Returns {@code true} if the specified transform is likely to exists only for axis swapping
+ * and/or unit conversions. The heuristic rule checks if the transform is backed by a square
+ * matrix with exactly one non-null value in each row and each column. This method is used for
+ * implementation of the {@link #getCore(MathTransform)} method only.
+ */
+ private static boolean isIgnorable(final MathTransform transform) {
+ final Matrix matrix = getMatrix(transform);
+ if (matrix != null) {
+ final int size = matrix.getNumRow();
+ if (matrix.getNumCol() == size) {
+ for (int j=0; j<size; j++) {
+ int n1=0, n2=0;
+ for (int i=0; i<size; i++) {
+ if (matrix.getElement(j,i) != 0) n1++;
+ if (matrix.getElement(i,j) != 0) n2++;
+ }
+ if (n1 != 1 || n2 != 1) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* If the given transform is linear, returns its coefficients as a matrix.
* More specifically:
*
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -607,7 +607,10 @@ public class PassThroughTransform extend
}
/**
- * Formats the inner part of a <cite>Well Known Text</cite> version 1 (WKT 1) element.
+ * Formats this transform as a <cite>Well Known Text</cite> version 1 (WKT 1) element.
+ *
+ * <div class="note"><b>Compatibility note:</b>
+ * {@code PassThrough_MT} is defined in the WKT 1 specification only.</div>
*
* @param formatter The formatter to use.
* @return The WKT element name, which is {@code "PassThrough_MT"}.
@@ -618,6 +621,8 @@ public class PassThroughTransform extend
if (numTrailingOrdinates != 0) {
formatter.append(numTrailingOrdinates);
formatter.setInvalidWKT(PassThroughTransform.class, null);
+ } else if (formatter.getConvention().majorVersion() != 1) {
+ formatter.setInvalidWKT(PassThroughTransform.class, null);
}
formatter.append(subTransform);
return "PassThrough_MT";
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -50,7 +50,7 @@ public final strictfp class ParameterBui
public void testMercatorProjection() {
final ParameterBuilder builder = new ParameterBuilder();
builder.setCodeSpace(HardCodedCitations.OGP, "EPSG").setRequired(true);
- final ParameterDescriptor[] parameters = {
+ final ParameterDescriptor<?>[] parameters = {
builder.addName("Longitude of natural origin")
.addName(HardCodedCitations.OGC, "central_meridian")
.addName(HardCodedCitations.GEOTIFF, "NatOriginLong")
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformTest.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformTest.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -136,7 +136,7 @@ public final strictfp class Concatenated
matrix.m13 = 2;
transform = ConcatenatedTransform.create(MathTransforms.linear(matrix), passth);
assertInstanceOf("Expected a new passthrough transform.", PassThroughTransform.class, transform);
- final MathTransform subTransform = ((PassThroughTransform) transform).getSubTransform();
+ final MathTransform subTransform = ((PassThroughTransform) transform).subTransform;
assertInstanceOf("Expected a new concatenated transform.", ConcatenatedTransform.class, subTransform);
assertSame(kernel, ((ConcatenatedTransform) subTransform).transform2);
assertEquals("Source dimensions", 3, transform.getSourceDimensions());
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -54,6 +54,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.transform.PassThroughTransformTest.class,
org.apache.sis.referencing.operation.transform.ConcatenatedTransformTest.class,
org.apache.sis.referencing.operation.transform.TransferFunctionTest.class,
+ org.apache.sis.referencing.operation.transform.MathTransformsTest.class,
org.apache.sis.internal.referencing.VerticalDatumTypesTest.class,
org.apache.sis.internal.referencing.AxisDirectionsTest.class,
@@ -106,6 +107,9 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.CommonCRSTest.class,
org.apache.sis.referencing.CRSTest.class,
+ org.apache.sis.referencing.operation.DefaultFormulaTest.class,
+ org.apache.sis.referencing.operation.DefaultOperationMethodTest.class,
+
org.apache.sis.geometry.AbstractDirectPositionTest.class,
org.apache.sis.geometry.GeneralDirectPositionTest.class,
org.apache.sis.geometry.DirectPosition1DTest.class,
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -50,6 +50,11 @@ import java.util.Objects;
*/
public final class Citations extends Static {
/**
+ * The {@value} code space.
+ */
+ public static final String EPSG = "EPSG";
+
+ /**
* Do not allows instantiation of this class.
*/
private Citations() {
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -32,6 +32,7 @@ import org.apache.sis.util.Exceptions;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.DefinitionURI;
+import org.apache.sis.internal.util.Citations;
import org.apache.sis.internal.util.XPaths;
import static java.lang.Math.PI;
@@ -355,7 +356,7 @@ public final class Units extends Static
* we want to try to parse as a xpointer before to give up.
*/
if (isURI(uom)) {
- String code = DefinitionURI.codeOf("uom", "EPSG", uom);
+ String code = DefinitionURI.codeOf("uom", Citations.EPSG, uom);
if (code != null && code != uom) try { // Really identity check, see above comment.
return valueOfEPSG(Integer.parseInt(code));
} catch (NumberFormatException e) {
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/AbstractNameTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/AbstractNameTest.java?rev=1653077&r1=1653076&r2=1653077&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/AbstractNameTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/AbstractNameTest.java [UTF-8] Mon Jan 19 19:08:43 2015
@@ -21,8 +21,9 @@ import org.opengis.util.GenericName;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.Assert.*;
import static org.opengis.test.Validators.*;
+import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.internal.util.Citations.EPSG;
import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR_STRING;
@@ -43,7 +44,6 @@ public final strictfp class AbstractName
*/
@Test
public void testGlobalNamespace() {
- final String EPSG = "EPSG";
final DefaultLocalName name = new DefaultLocalName(null, EPSG);
assertSame(EPSG, name.toString());
assertSame(EPSG, name.toInternationalString().toString());
@@ -59,7 +59,6 @@ public final strictfp class AbstractName
*/
@Test
public void testEpsgNamespace() {
- final String EPSG = "EPSG";
final DefaultNameSpace ns = DefaultNameSpace.forName(new DefaultLocalName(null, EPSG),
DEFAULT_SEPARATOR_STRING, DEFAULT_SEPARATOR_STRING);
assertSame(EPSG, ns.name().toString());