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 2016/03/30 22:45:27 UTC
svn commit: r1737162 - in /sis/branches/JDK8/core/sis-referencing/src:
main/java/org/apache/sis/geometry/
main/java/org/apache/sis/internal/jaxb/referencing/
main/java/org/apache/sis/internal/referencing/
main/java/org/apache/sis/referencing/ main/java...
Author: desruisseaux
Date: Wed Mar 30 20:45:27 2016
New Revision: 1737162
URL: http://svn.apache.org/viewvc?rev=1737162&view=rev
Log:
Centralize the place where we fetch the CoordinateOperationFactory.
Fix javadoc and tests.
Added:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
- copied, changed from r1737161, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java
Removed:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -29,7 +29,6 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.CoordinateOperation;
-import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
@@ -42,9 +41,9 @@ import org.apache.sis.util.logging.Loggi
import org.apache.sis.util.resources.Errors;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.DirectPositionView;
import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Loggers;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -102,17 +101,6 @@ public final class Envelopes extends Sta
}
/**
- * Returns the coordinate operation factory to be used for transforming the envelope.
- */
- private static CoordinateOperationFactory getFactory() throws TransformException {
- final CoordinateOperationFactory factory = DefaultFactories.forClass(CoordinateOperationFactory.class);
- if (factory != null) {
- return factory;
- }
- throw new TransformException(Errors.format(Errors.Keys.MissingRequiredModule_1, "geotk-referencing")); // This is temporary.
- }
-
- /**
* Returns {@code true} if the given axis is of kind "Wrap Around".
*/
private static boolean isWrapAround(final CoordinateSystemAxis axis) {
@@ -184,7 +172,7 @@ public final class Envelopes extends Sta
} else {
final CoordinateOperation operation;
try {
- operation = getFactory().createOperation(sourceCRS, targetCRS);
+ operation = CoordinateOperations.factory().createOperation(sourceCRS, targetCRS);
} catch (FactoryException exception) {
throw new TransformException(Errors.format(Errors.Keys.CanNotTransformEnvelope), exception);
}
@@ -469,7 +457,7 @@ public final class Envelopes extends Sta
*/
final MathTransform mt;
try {
- mt = getFactory().createOperation(crs, sourceCRS).getMathTransform();
+ mt = CoordinateOperations.factory().createOperation(crs, sourceCRS).getMathTransform();
} catch (FactoryException e) {
throw new TransformException(Errors.format(Errors.Keys.CanNotTransformEnvelope), e);
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -30,10 +30,9 @@ import org.opengis.parameter.ParameterVa
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.referencing.operation.OperationMethod;
-import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gco.PropertyType;
-import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.provider.MapProjection;
import org.apache.sis.parameter.DefaultParameterValue;
import org.apache.sis.parameter.DefaultParameterValueGroup;
@@ -50,7 +49,7 @@ import org.apache.sis.util.ArraysExt;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.7
* @module
*/
public final class CC_OperationMethod extends PropertyType<CC_OperationMethod, OperationMethod> {
@@ -180,13 +179,13 @@ public final class CC_OperationMethod ex
* @return A parameter group containing at least the given descriptors, or equivalent descriptors.
*/
public static ParameterDescriptorGroup group(final Identifier name, final GeneralParameterDescriptor[] descriptors) {
- final CoordinateOperationFactory factory = DefaultFactories.forClass(CoordinateOperationFactory.class);
- OperationMethod method = null;
- if (factory != null) try {
- method = factory.getOperationMethod(name.getCode());
+ OperationMethod method;
+ try {
+ method = CoordinateOperations.factory().getOperationMethod(name.getCode());
} catch (FactoryException e) {
// Use DefaultOperationMethod as the source class because it is the first public class in callers.
Context.warningOccured(Context.current(), DefaultOperationMethod.class, "setDescriptors", e, true);
+ method = null;
}
final Map<String,?> properties = Collections.singletonMap(ParameterDescriptorGroup.NAME_KEY, name);
if (method != null) {
Copied: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java (from r1737161, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java&r1=1737161&r2=1737162&rev=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.referencing;
+package org.apache.sis.internal.referencing;
import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.system.SystemListener;
/**
@@ -30,16 +32,45 @@ import org.apache.sis.internal.system.De
* @version 0.7
* @module
*/
-final class CoordinateOperations {
+public final class CoordinateOperations extends SystemListener {
/**
* The factory.
*/
- static final DefaultCoordinateOperationFactory factory =
- DefaultFactories.forBuildin(CoordinateOperationFactory.class, DefaultCoordinateOperationFactory.class);
+ private static volatile DefaultCoordinateOperationFactory factory;
/**
- * Do not allows instantiation of this class.
+ * For system listener only.
*/
private CoordinateOperations() {
+ super(Modules.REFERENCING);
+ }
+
+ /**
+ * Discards the factory if the classpath changed.
+ */
+ static {
+ add(new CoordinateOperations());
+ }
+
+ /**
+ * Invoked when the classpath changed.
+ */
+ @Override
+ protected void classpathChanged() {
+ factory = null;
+ }
+
+ /**
+ * Returns the factory.
+ *
+ * @return The system-wide factory.
+ */
+ public static DefaultCoordinateOperationFactory factory() {
+ DefaultCoordinateOperationFactory c = factory;
+ if (c == null) {
+ // DefaultFactories.forBuildin(…) performs the necessary synchronization.
+ factory = c = DefaultFactories.forBuildin(CoordinateOperationFactory.class, DefaultCoordinateOperationFactory.class);
+ }
+ return c;
}
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -143,7 +143,7 @@ public class GeodeticObjectBuilder exten
*/
private CoordinateOperationFactory getCoordinateOperationFactory() {
if (copFactory == null) {
- copFactory = DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+ copFactory = CoordinateOperations.factory();
}
return copFactory;
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -151,7 +151,7 @@ public final class ServicesForMetadata e
!Utilities.equalsIgnoreMetadata(cs2.getAxis(1), cs1.getAxis(1)))
{
final CoordinateOperation operation;
- final CoordinateOperationFactory factory = DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+ final CoordinateOperationFactory factory = CoordinateOperations.factory();
try {
operation = factory.createOperation(crs, normalizedCRS);
} catch (FactoryException e) {
@@ -611,7 +611,7 @@ public final class ServicesForMetadata e
if (factory instanceof DefaultCoordinateOperationFactory) {
df = (DefaultCoordinateOperationFactory) factory;
} else {
- df = DefaultFactories.forBuildin(CoordinateOperationFactory.class, DefaultCoordinateOperationFactory.class);
+ df = CoordinateOperations.factory();
}
return df.createSingleOperation(properties, sourceCRS, targetCRS, interpolationCRS, method, null);
}
@@ -630,7 +630,7 @@ public final class ServicesForMetadata e
@Override
public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties, MathTransformFactory mtFactory) {
if (Containers.isNullOrEmpty(properties) && DefaultFactories.isDefaultInstance(MathTransformFactory.class, mtFactory)) {
- return DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+ return CoordinateOperations.factory();
} else {
return new DefaultCoordinateOperationFactory(properties, mtFactory);
}
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=1737162&r1=1737161&r2=1737162&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] Wed Mar 30 20:45:27 2016
@@ -45,6 +45,7 @@ import org.opengis.metadata.extent.Geogr
import org.opengis.referencing.operation.CoordinateOperation;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.referencing.cs.DefaultVerticalCS;
@@ -78,19 +79,21 @@ import static java.util.Collections.sing
*
* <div class="section">Usage example</div>
* The most frequently used methods in this class are {@link #forCode forCode(…)}, {@link #fromWKT fromWKT(…)}
- * and {@link #findOperation findOperation(…)}. An usage example is like below:
+ * and {@link #findOperation findOperation(…)}. An usage example is like below
+ * (see the <a href="http://sis.apache.org/book/tables/CoordinateReferenceSystems.html">Apache SIS™ Coordinate
+ * Reference System (CRS) codes</a> page for the complete list of EPSG codes):
*
* {@preformat java
- * CoordinateReferenceSystem sourceCRS = CRS.forCode("EPSG:4326"); // WGS 84
- * CoordinateReferenceSystem sourceCRS = CRS.forCode("EPSG:3395"); // WGS 84 / World Mercator
- * CoordinateOperation operation = CRS.findOperation(sourceCRS, targetCRS, null);
+ * CoordinateReferenceSystem source = CRS.forCode("EPSG:4326"); // WGS 84
+ * CoordinateReferenceSystem target = CRS.forCode("EPSG:3395"); // WGS 84 / World Mercator
+ * CoordinateOperation operation = CRS.findOperation(source, target, null);
* if (CRS.getLinearAccuracy(operation) < 100) {
* // If the accuracy is less than 100 metres (or any other threshold at application choice)
* // maybe the operation is not suitable. Decide here what to do (throw an exception, etc).
* }
* MathTransform mt = operation.getMathTransform();
- * DirectPosition position = new DirectPosition2D(20, 30); // 20°N 30°E (watchout axis order!)
- * position = operation.transform(position, position);
+ * DirectPosition position = new DirectPosition2D(20, 30); // 20°N 30°E (watch out axis order!)
+ * position = mt.transform(position, position);
* System.out.println(position);
* }
*
@@ -122,9 +125,10 @@ public final class CRS extends Static {
/**
* Returns the Coordinate Reference System for the given authority code.
* The set of available codes depends on the {@link CRSAuthorityFactory} instances available on the classpath.
- * There is many thousands of CRS defined by EPSG authority or by other authorities.
+ * There is many thousands of <a href="http://sis.apache.org/book/tables/CoordinateReferenceSystems.html">CRS
+ * defined by EPSG authority or by other authorities</a>.
* The following table lists a very small subset of codes which are guaranteed to be available
- * on any installation of Apache SIS version 0.4 or above:
+ * on any installation of Apache SIS:
*
* <blockquote><table class="sis">
* <caption>Minimal set of supported authority codes</caption>
@@ -304,7 +308,7 @@ public final class CRS extends Static {
context = new CoordinateOperationContext();
context.setGeographicBoundingBox(bbox);
}
- return CoordinateOperations.factory.createOperation(sourceCRS, targetCRS, context);
+ return CoordinateOperations.factory().createOperation(sourceCRS, targetCRS, context);
}
/**
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -38,7 +38,7 @@ import org.apache.sis.util.ArgumentCheck
* to choose the most suitable coordinate transformation between two CRS.
*
* <div class="note"><b>Example:</b>
- * if a transformation from NAD27 to NAD83 is requested without providing context, then Apache SIS will return the
+ * if a transformation from NAD27 to WGS84 is requested without providing context, then Apache SIS will return the
* transformation applicable to the widest North American surface. But if the user provides a context saying that
* he wants to transform coordinates in Texas, then Apache SIS may return another coordinate transformation with
* different {@linkplain org.apache.sis.referencing.datum.BursaWolfParameters Bursa-Wolf parameters} more suitable
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -36,12 +36,12 @@ import org.opengis.parameter.ParameterVa
import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
import org.apache.sis.internal.referencing.provider.GeographicToGeocentric;
import org.apache.sis.internal.referencing.provider.GeocentricToGeographic;
import org.apache.sis.internal.referencing.provider.GeocentricAffine;
import org.apache.sis.internal.referencing.provider.Affine;
-import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.measure.Units;
import org.apache.sis.metadata.iso.citation.Citations;
@@ -186,8 +186,8 @@ public class CoordinateOperationInferenc
{
ArgumentChecks.ensureNonNull("factory", factory);
this.factory = factory;
- factorySIS = (factory instanceof DefaultCoordinateOperationFactory) ? (DefaultCoordinateOperationFactory) factory
- : DefaultFactories.forBuildin(CoordinateOperationFactory.class, DefaultCoordinateOperationFactory.class);
+ factorySIS = (factory instanceof DefaultCoordinateOperationFactory)
+ ? (DefaultCoordinateOperationFactory) factory : CoordinateOperations.factory();
if (context != null) {
areaOfInterest = context.getAreaOfInterest();
desiredAccuracy = context.getDesiredAccuracy();
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -56,7 +56,7 @@
* <div class="section"><cite>Early binding</cite> versus <cite>late binding</cite> implementations</div>
* There is sometime multiple ways of transforming coordinates for a given pair of source and target CRS.
* For example the {@linkplain org.apache.sis.referencing.datum.BursaWolfParameters Bursa-Wolf parameters}
- * may vary depending on the area of interest, like in the transformations from NAD27 to NAD83.
+ * may vary depending on the area of interest, like in the transformations from NAD27 to WGS84.
* Even for a fixed set of Bursa-Wolf parameter, there is various ways to use them (<cite>Molodensky</cite>,
* <cite>Abridged Molodensky</cite>, <cite>Geocentric translation</cite>, <cite>etc.</cite>).
*
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -41,16 +41,16 @@
* a <cite>Universal Transverse Mercator</cite> projection in the zone of the coordinate:
*
* {@preformat java
- * CoordinateReferenceSystem sourceCRS = CommonCRS.WGS84.geographic();
- * CoordinateReferenceSystem sourceCRS = CommonCRS.WGS84.UTM(20, 30); // 20°N 30°E (watchout axis order!)
- * CoordinateOperation operation = CRS.findOperation(sourceCRS, targetCRS, null);
+ * GeographicCRS source = CommonCRS.WGS84.geographic();
+ * ProjectedCRS target = CommonCRS.WGS84.UTM(20, 30); // 20°N 30°E (watch out axis order!)
+ * CoordinateOperation operation = CRS.findOperation(source, target, null);
* if (CRS.getLinearAccuracy(operation) < 100) {
* // If the accuracy is less than 100 metres (or any other threshold at application choice)
* // maybe the operation is not suitable. Decide here what to do (throw an exception, etc).
* }
* MathTransform mt = operation.getMathTransform();
- * DirectPosition position = new DirectPosition2D(20, 30); // 20°N 30°E (watchout axis order!)
- * position = operation.transform(position, position);
+ * DirectPosition position = new DirectPosition2D(20, 30); // 20°N 30°E (watch out axis order!)
+ * position = mt.transform(position, position);
* System.out.println(position);
* }
*
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java?rev=1737162&r1=1737161&r2=1737162&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java [UTF-8] Wed Mar 30 20:45:27 2016
@@ -176,7 +176,7 @@ public final strictfp class CoordinateOp
"GEOGCS[“NAD27”,\n" +
" DATUM[“North American Datum 1927”,\n" +
" SPHEROID[“Clarke 1866”, 6378206.4, 294.9786982138982],\n" +
- " TOWGS84[-10, 158, 187]]," +
+ " TOWGS84[-8, 160, 176]]," + // EPSG:1173
" PRIMEM[“Greenwich”, 0.0]," +
" UNIT[“degree”, 0.017453292519943295],\n" +
" AXIS[“Latitude (φ)”, NORTH],\n" +
@@ -200,8 +200,8 @@ public final strictfp class CoordinateOp
39, -85,
38.26, -80.58
}, new double[] {
- 39.00011150, -84.99995603, // This is NOT the most accurate NAD27 to NAD83 transformation.
- 38.26011883, -80.57981725 // We use non-optimal TOWGS84[…] for the purpose of this test.
+ 39.00004480, -84.99993102, // This is NOT the most accurate NAD27 to WGS84 transformation.
+ 38.26005019, -80.57979096 // We use non-optimal TOWGS84[…] for the purpose of this test.
});
validate();
}