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/26 19:31:23 UTC
svn commit: r1654859 - in /sis/branches/JDK8/core/sis-referencing/src:
main/java/org/apache/sis/referencing/crs/
main/java/org/apache/sis/referencing/datum/
main/java/org/apache/sis/referencing/operation/
test/java/org/apache/sis/referencing/datum/
Author: desruisseaux
Date: Mon Jan 26 18:31:23 2015
New Revision: 1654859
URL: http://svn.apache.org/r1654859
Log:
Enable the check for identifier (before to check the name) for Datum and OperationMethod.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1654859&r1=1654858&r2=1654859&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] Mon Jan 26 18:31:23 2015
@@ -415,10 +415,8 @@ public class AbstractCRS extends Abstrac
Objects.equals(coordinateSystem, that.coordinateSystem);
}
default: {
- return deepEquals(datum,
- (object instanceof SingleCRS) ? ((SingleCRS) object).getDatum() : null, mode) &&
- deepEquals(getCoordinateSystem(),
- ((CoordinateReferenceSystem) object).getCoordinateSystem(), mode);
+ return deepEquals(datum, (object instanceof SingleCRS) ? ((SingleCRS) object).getDatum() : null, mode) &&
+ deepEquals(getCoordinateSystem(), ((CoordinateReferenceSystem) object).getCoordinateSystem(), mode);
}
}
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1654859&r1=1654858&r2=1654859&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] Mon Jan 26 18:31:23 2015
@@ -32,6 +32,7 @@ import org.apache.sis.referencing.Identi
import org.apache.sis.util.iso.Types;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.referencing.OperationMethods;
import static org.apache.sis.util.Utilities.deepEquals;
import static org.apache.sis.util.collection.Containers.property;
@@ -404,12 +405,19 @@ public class AbstractDatum extends Abstr
}
default: {
/*
- * Tests for name, since datum with different name have completely
- * different meaning. We don't perform this comparison if the user
- * asked for metadata comparison, because in such case the names
- * have already been compared by the subclass.
+ * Tests for identifiers or name since datum with different identification may have completely
+ * different meaning. We do not perform this check if the user asked for metadata comparison,
+ * because in such case the name and identifiers have already been compared by the subclass.
+ *
+ * According ISO 19162 (Well Known Text representation of Coordinate Reference Systems),
+ * identifiers shall have precedence over name at least in the case of operation methods
+ * and parameters. We extend this rule to datum as well.
*/
final Datum that = (Datum) object;
+ final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+ if (match != null) {
+ return match;
+ }
return isHeuristicMatchForName(that.getName().getCode())
|| IdentifiedObjects.isHeuristicMatchForName(that, getName().getCode());
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1654859&r1=1654858&r2=1654859&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Mon Jan 26 18:31:23 2015
@@ -258,9 +258,7 @@ public class BursaWolfParameters extends
* @return {@code true} if the given datum is equal to WGS84 for computational purpose.
*/
final boolean isToWGS84() {
- return (targetDatum != null) &&
- (IdentifiedObjects.isHeuristicMatchForName(targetDatum, "WGS 84") ||
- IdentifiedObjects.isHeuristicMatchForName(targetDatum, "WGS84"));
+ return (targetDatum != null) && IdentifiedObjects.isHeuristicMatchForName(targetDatum, "WGS84");
}
/**
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1654859&r1=1654858&r2=1654859&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] Mon Jan 26 18:31:23 2015
@@ -33,6 +33,7 @@ import org.apache.sis.parameter.Paramete
import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.internal.referencing.OperationMethods;
import org.apache.sis.io.wkt.Formatter;
import static org.apache.sis.util.ArgumentChecks.*;
@@ -415,10 +416,21 @@ public class DefaultOperationMethod exte
break;
}
default: {
- // Name and identifiers have been ignored by super.equals(object, mode).
- // Since they are significant for OperationMethod, compare them here.
+ /*
+ * Name and identifiers have been ignored by super.equals(object, mode).
+ * Since they are significant for OperationMethod, we compare them here.
+ *
+ * According ISO 19162 (Well Known Text representation of Coordinate Reference Systems),
+ * identifiers shall have precedence over name at least in the case of operation methods
+ * and parameters.
+ */
final OperationMethod that = (OperationMethod) object;
- if (!isHeuristicMatchForName(that.getName().getCode())
+ final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+ if (match != null) {
+ if (!match) {
+ return false;
+ }
+ } else if (!isHeuristicMatchForName(that.getName().getCode())
&& !IdentifiedObjects.isHeuristicMatchForName(that, getName().getCode()))
{
return false;
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1654859&r1=1654858&r2=1654859&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Mon Jan 26 18:31:23 2015
@@ -103,7 +103,7 @@ public final strictfp class HardCodedDat
* Mean sea level, which can be used as an approximation of geoid.
*/
public static final DefaultVerticalDatum MEAN_SEA_LEVEL = new DefaultVerticalDatum(
- properties("Mean Sea Level", "5700"), VerticalDatumType.GEOIDAL);
+ properties("Mean Sea Level", "5100"), VerticalDatumType.GEOIDAL);
/**
* Ellipsoid for measurements of height above the ellipsoid.