sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1683712 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/ sis-referencing/src/main/java/org/apache/sis/internal/referencing/ sis-referencing/src/main/java/org/apache/sis/io/wkt/
Date Fri, 05 Jun 2015 11:19:56 GMT
Author: desruisseaux
Date: Fri Jun  5 11:19:56 2015
New Revision: 1683712

URL: http://svn.apache.org/r1683712
Log:
OSGi: removed last direct "sis-referencing" dependencies from GeodeticObjectParser,
and oppostunistically reorganized method declaration orders in ReferencingServices.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.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/io/wkt/GeodeticObjectParser.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1683712&r1=1683711&r2=1683712&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
[UTF-8] Fri Jun  5 11:19:56 2015
@@ -28,6 +28,7 @@ import org.opengis.referencing.crs.Deriv
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.CoordinateOperationFactory;
@@ -185,49 +186,14 @@ public class ReferencingServices extends
         return new UnsupportedOperationException(Errors.format(Errors.Keys.MissingRequiredModule_1,
"sis-referencing"));
     }
 
-    /**
-     * Returns a fully implemented parameter descriptor.
-     *
-     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
-     * @return A fully implemented parameter descriptor, or {@code null} if the given argument
was null.
-     * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has
not been found on the classpath.
-     *
-     * @since 0.5
-     */
-    public ParameterDescriptor<?> toImplementation(ParameterDescriptor<?> parameter)
{
-        throw referencingModuleNotFound();
-    }
 
-    /**
-     * Converts the given object in a {@code FormattableObject} instance.
-     *
-     * @param  object The object to wrap.
-     * @return The given object converted to a {@code FormattableObject} instance.
-     * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has
not been found on the classpath.
-     *
-     * @see org.apache.sis.referencing.AbstractIdentifiedObject#castOrCopy(IdentifiedObject)
-     *
-     * @since 0.4
-     */
-    public FormattableObject toFormattableObject(IdentifiedObject object) {
-        throw referencingModuleNotFound();
-    }
 
-    /**
-     * Converts the given object in a {@code FormattableObject} instance. Callers should
verify that the given
-     * object is not already an instance of {@code FormattableObject} before to invoke this
method. This method
-     * returns {@code null} if it can not convert the object.
-     *
-     * @param  object The object to wrap.
-     * @param  internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
-     * @return The given object converted to a {@code FormattableObject} instance, or {@code
null}.
-     * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has
not been found on the classpath.
-     *
-     * @since 0.6
-     */
-    public FormattableObject toFormattableObject(MathTransform object, boolean internal)
{
-        throw referencingModuleNotFound();
-    }
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                        SERVICES FOR ISO 19115 METADATA                        ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
 
     /**
      * Sets a geographic bounding box from the specified envelope.
@@ -305,6 +271,155 @@ public class ReferencingServices extends
         throw referencingModuleNotFound();
     }
 
+
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                          SERVICES FOR WKT FORMATTING                          ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Returns a fully implemented parameter descriptor.
+     *
+     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
+     * @return A fully implemented parameter descriptor, or {@code null} if the given argument
was null.
+     * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has
not been found on the classpath.
+     *
+     * @since 0.5
+     */
+    public ParameterDescriptor<?> toImplementation(ParameterDescriptor<?> parameter)
{
+        throw referencingModuleNotFound();
+    }
+
+    /**
+     * Converts the given object in a {@code FormattableObject} instance.
+     *
+     * @param  object The object to wrap.
+     * @return The given object converted to a {@code FormattableObject} instance.
+     * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has
not been found on the classpath.
+     *
+     * @see org.apache.sis.referencing.AbstractIdentifiedObject#castOrCopy(IdentifiedObject)
+     *
+     * @since 0.4
+     */
+    public FormattableObject toFormattableObject(IdentifiedObject object) {
+        throw referencingModuleNotFound();
+    }
+
+    /**
+     * Converts the given object in a {@code FormattableObject} instance. Callers should
verify that the given
+     * object is not already an instance of {@code FormattableObject} before to invoke this
method. This method
+     * returns {@code null} if it can not convert the object.
+     *
+     * @param  object The object to wrap.
+     * @param  internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
+     * @return The given object converted to a {@code FormattableObject} instance, or {@code
null}.
+     * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has
not been found on the classpath.
+     *
+     * @since 0.6
+     */
+    public FormattableObject toFormattableObject(MathTransform object, boolean internal)
{
+        throw referencingModuleNotFound();
+    }
+
+
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                           SERVICES FOR WKT PARSING                            ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Returns the Greenwich prime meridian.
+     *
+     * @return The Greenwich prime meridian.
+     *
+     * @since 0.6
+     */
+    public PrimeMeridian getGreenwich() {
+        throw referencingModuleNotFound();
+    }
+
+    /**
+     * Returns the coordinate system of a geocentric CRS using axes in the given unit of
measurement.
+     *
+     * @param  unit The unit of measurement for the geocentric CRS axes.
+     * @return The coordinate system for a geocentric CRS with axes using the given unit
of measurement.
+     *
+     * @since 0.6
+     */
+    public CartesianCS getGeocentricCS(final Unit<Length> unit) {
+        throw referencingModuleNotFound();
+    }
+
+    /**
+     * Converts a geocentric coordinate system from the legacy WKT 1 to the current ISO 19111
standard.
+     * This method replaces the (Other, East, North) directions by (Geocentric X, Geocentric
Y, Geocentric Z).
+     *
+     * @param  cs The geocentric coordinate system to upgrade.
+     * @return The upgraded coordinate system, or {@code cs} if this method can not upgrade
the given CS.
+     *
+     * @since 0.6
+     */
+    public CartesianCS upgradeGeocentricCS(final CartesianCS cs) {
+        return cs;
+    }
+
+    /**
+     * Creates a coordinate system of unknown type. This method is used during parsing of
WKT version 1,
+     * since that legacy format did not specified any information about the coordinate system
in use.
+     * This method should not need to be invoked for parsing WKT version 2.
+     *
+     * @param  axes The axes of the unknown coordinate system.
+     * @return An "abstract" coordinate system using the given axes.
+     *
+     * @since 0.6
+     */
+    public CoordinateSystem createAbstractCS(final CoordinateSystemAxis[] axes) {
+        throw referencingModuleNotFound();
+    }
+
+    /**
+     * Creates a derived CRS from the information found in a WKT 1 {@code FITTED_CS} element.
+     * This coordinate system can not be easily constructed from the information provided
by the WKT 1 format.
+     * Note that this method is needed only for WKT 1 parsing, since WKT provides enough
information for using
+     * the standard factories.
+     *
+     * @param  properties    The properties to be given to the {@code DerivedCRS} and {@code
Conversion} objects.
+     * @param  baseCRS       Coordinate reference system to base the derived CRS on.
+     * @param  method        The coordinate operation method (mandatory in all cases).
+     * @param  baseToDerived Transform from positions in the base CRS to positions in this
target CRS.
+     * @param  derivedCS     The coordinate system for the derived CRS.
+     * @return The newly created derived CRS, potentially implementing an additional CRS
interface.
+     *
+     * @since 0.6
+     */
+    public DerivedCRS createDerivedCRS(final Map<String,?>    properties,
+                                       final SingleCRS        baseCRS,
+                                       final OperationMethod  method,
+                                       final MathTransform    baseToDerived,
+                                       final CoordinateSystem derivedCS)
+    {
+        throw referencingModuleNotFound();
+    }
+
+    /**
+     * Creates the {@code TOWGS84} element during parsing of a WKT version 1. This is an
optional operation:
+     * this method is allowed to return {@code null} if the "sis-referencing" module is not
in the classpath.
+     *
+     * @param  values The 7 Bursa-Wolf parameter values.
+     * @return The {@link org.apache.sis.referencing.datum.BursaWolfParameters}, or {@code
null}.
+     *
+     * @since 0.6
+     */
+    public Object createToWGS84(final double[] values) {
+        return null;
+    }
+
     /**
      * Returns the coordinate operation factory to use for the given properties and math
transform factory.
      * If the given properties are empty and the {@code mtFactory} is the system default,
then this method
@@ -313,6 +428,8 @@ public class ReferencingServices extends
      * @param  properties The default properties.
      * @param  mtFactory  The math transform factory to use.
      * @return The coordinate operation factory to use.
+     *
+     * @since 0.6
      */
     public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties,
MathTransformFactory mtFactory) {
         /*
@@ -336,6 +453,8 @@ public class ReferencingServices extends
      * @param  object The object for which to check the name or alias.
      * @param  name The name to compare with the object name or aliases.
      * @return {@code true} if the primary name of at least one alias matches the specified
{@code name}.
+     *
+     * @since 0.6
      */
     public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name)
{
         return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(),
name);
@@ -347,6 +466,8 @@ public class ReferencingServices extends
      * @param  method     The method to test for a match.
      * @param  identifier The name or identifier of the operation method to search.
      * @return {@code true} if the given method is a match for the given identifier.
+     *
+     * @since 0.6
      */
     private boolean matches(final OperationMethod method, final String identifier) {
         if (isHeuristicMatchForName(method, identifier)) {
@@ -376,6 +497,8 @@ public class ReferencingServices extends
      *
      * @see org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory#getOperationMethod(String)
      * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getOperationMethod(String)
+     *
+     * @since 0.6
      */
     public final OperationMethod getOperationMethod(final Iterable<? extends OperationMethod>
methods, final String identifier) {
         OperationMethod fallback = null;
@@ -395,59 +518,4 @@ public class ReferencingServices extends
         }
         return fallback;
     }
-
-    /**
-     * Returns the coordinate system of a geocentric CRS using axes in the given unit of
measurement.
-     *
-     * @param  unit The unit of measurement for the geocentric CRS axes.
-     * @return The coordinate system for a geocentric CRS with axes using the given unit
of measurement.
-     */
-    public CartesianCS getGeocentricCS(final Unit<Length> unit) {
-        throw referencingModuleNotFound();
-    }
-
-    /**
-     * Creates a coordinate system of unknown type. This method is used during parsing of
WKT version 1,
-     * since that legacy format did not specified any information about the coordinate system
in use.
-     * This method should not need to be invoked for parsing WKT version 2.
-     *
-     * @param  axes The axes of the unknown coordinate system.
-     * @return An "abstract" coordinate system using the given axes.
-     */
-    public CoordinateSystem createAbstractCS(final CoordinateSystemAxis[] axes) {
-        throw referencingModuleNotFound();
-    }
-
-    /**
-     * Creates a derived CRS from the information found in a WKT 1 {@code FITTED_CS} element.
-     * This coordinate system can not be easily constructed from the information provided
by the WKT 1 format.
-     * Note that this method is needed only for WKT 1 parsing, since WKT provides enough
information for using
-     * the standard factories.
-     *
-     * @param  properties    The properties to be given to the {@code DerivedCRS} and {@code
Conversion} objects.
-     * @param  baseCRS       Coordinate reference system to base the derived CRS on.
-     * @param  method        The coordinate operation method (mandatory in all cases).
-     * @param  baseToDerived Transform from positions in the base CRS to positions in this
target CRS.
-     * @param  derivedCS     The coordinate system for the derived CRS.
-     * @return The newly created derived CRS, potentially implementing an additional CRS
interface.
-     */
-    public DerivedCRS createDerivedCRS(final Map<String,?>    properties,
-                                       final SingleCRS        baseCRS,
-                                       final OperationMethod  method,
-                                       final MathTransform    baseToDerived,
-                                       final CoordinateSystem derivedCS)
-    {
-        throw referencingModuleNotFound();
-    }
-
-    /**
-     * Creates the {@code TOWGS84} element during parsing of a WKT version 1. This is an
optional operation:
-     * this method is allowed to return {@code null} if the "sis-referencing" module is not
in the classpath.
-     *
-     * @param  values The 7 Bursa-Wolf parameter values.
-     * @return The {@link org.apache.sis.referencing.datum.BursaWolfParameters}, or {@code
null}.
-     */
-    public Object createToWGS84(final double[] values) {
-        return null;
-    }
 }

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=1683712&r1=1683711&r2=1683712&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] Fri Jun  5 11:19:56 2015
@@ -37,6 +37,7 @@ import org.opengis.referencing.crs.Coord
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
@@ -95,62 +96,14 @@ public final class ServicesForMetadata e
     public ServicesForMetadata() {
     }
 
-    /**
-     * Returns a fully implemented parameter descriptor.
-     *
-     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
-     * @return A fully implemented parameter descriptor, or {@code null} if the given argument
was null.
-     */
-    @Override
-    public ParameterDescriptor<?> toImplementation(final ParameterDescriptor<?>
parameter) {
-        return DefaultParameterDescriptor.castOrCopy(parameter);
-    }
 
-    /**
-     * Converts the given object in a {@code FormattableObject} instance.
-     *
-     * @param  object The object to wrap.
-     * @return The given object converted to a {@code FormattableObject} instance.
-     */
-    @Override
-    public FormattableObject toFormattableObject(final IdentifiedObject object) {
-        return AbstractIdentifiedObject.castOrCopy(object);
-    }
 
-    /**
-     * Converts the given object in a {@code FormattableObject} instance. Callers should
verify that the given
-     * object is not already an instance of {@code FormattableObject} before to invoke this
method. This method
-     * returns {@code null} if it can not convert the object.
-     *
-     * @param  object The object to wrap.
-     * @param  internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
-     * @return The given object converted to a {@code FormattableObject} instance, or {@code
null}.
-     *
-     * @since 0.6
-     */
-    @Override
-    public FormattableObject toFormattableObject(final MathTransform object, boolean internal)
{
-        Matrix matrix;
-        final ParameterValueGroup parameters;
-        if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
-            parameters = Affine.parameters(matrix);
-        } else if (object instanceof Parameterized) {
-            parameters = ((Parameterized) object).getParameterValues();
-        } else {
-            matrix = MathTransforms.getMatrix(object);
-            if (matrix == null) {
-                return null;
-            }
-            parameters = Affine.parameters(matrix);
-        }
-        return new FormattableObject() {
-            @Override
-            protected String formatTo(final Formatter formatter) {
-                WKTUtilities.appendParamMT(parameters, formatter);
-                return WKTKeywords.Param_MT;
-            }
-        };
-    }
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                        SERVICES FOR ISO 19115 METADATA                        ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
 
     /**
      * Creates an exception message for a spatial, vertical or temporal dimension not found.
@@ -419,35 +372,91 @@ public final class ServicesForMetadata e
         }
     }
 
+
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                          SERVICES FOR WKT FORMATTING                          ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
+
     /**
-     * Returns {@code true} if the {@linkplain AbstractIdentifiedObject#getName() primary
name} or an aliases
-     * of the given object matches the given name.
+     * Returns a fully implemented parameter descriptor.
      *
-     * @param  object The object for which to check the name or alias.
-     * @param  name The name to compare with the object name or aliases.
-     * @return {@code true} if the primary name of at least one alias matches the specified
{@code name}.
+     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
+     * @return A fully implemented parameter descriptor, or {@code null} if the given argument
was null.
      */
     @Override
-    public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name)
{
-        return IdentifiedObjects.isHeuristicMatchForName(object, name);
+    public ParameterDescriptor<?> toImplementation(final ParameterDescriptor<?>
parameter) {
+        return DefaultParameterDescriptor.castOrCopy(parameter);
     }
 
     /**
-     * Returns the coordinate operation factory to use for the given properties and math
transform factory.
-     * If the given properties are empty and the {@code mtFactory} is the system default,
then this method
-     * returns the system default {@code CoordinateOperationFactory} instead of creating
a new one.
+     * Converts the given object in a {@code FormattableObject} instance.
      *
-     * @param  properties The default properties.
-     * @param  mtFactory  The math transform factory to use.
-     * @return The coordinate operation factory to use.
+     * @param  object The object to wrap.
+     * @return The given object converted to a {@code FormattableObject} instance.
      */
     @Override
-    public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties,
MathTransformFactory mtFactory) {
-        if (Containers.isNullOrEmpty(properties) && DefaultFactories.isDefaultInstance(MathTransformFactory.class,
mtFactory)) {
-            return DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+    public FormattableObject toFormattableObject(final IdentifiedObject object) {
+        return AbstractIdentifiedObject.castOrCopy(object);
+    }
+
+    /**
+     * Converts the given object in a {@code FormattableObject} instance. Callers should
verify that the given
+     * object is not already an instance of {@code FormattableObject} before to invoke this
method. This method
+     * returns {@code null} if it can not convert the object.
+     *
+     * @param  object The object to wrap.
+     * @param  internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
+     * @return The given object converted to a {@code FormattableObject} instance, or {@code
null}.
+     *
+     * @since 0.6
+     */
+    @Override
+    public FormattableObject toFormattableObject(final MathTransform object, boolean internal)
{
+        Matrix matrix;
+        final ParameterValueGroup parameters;
+        if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
+            parameters = Affine.parameters(matrix);
+        } else if (object instanceof Parameterized) {
+            parameters = ((Parameterized) object).getParameterValues();
         } else {
-            return new DefaultCoordinateOperationFactory(properties, mtFactory);
+            matrix = MathTransforms.getMatrix(object);
+            if (matrix == null) {
+                return null;
+            }
+            parameters = Affine.parameters(matrix);
         }
+        return new FormattableObject() {
+            @Override
+            protected String formatTo(final Formatter formatter) {
+                WKTUtilities.appendParamMT(parameters, formatter);
+                return WKTKeywords.Param_MT;
+            }
+        };
+    }
+
+
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                           SERVICES FOR WKT PARSING                            ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Returns the Greenwich prime meridian.
+     *
+     * @return The Greenwich prime meridian.
+     *
+     * @since 0.6
+     */
+    @Override
+    public PrimeMeridian getGreenwich() {
+        return CommonCRS.WGS84.primeMeridian();
     }
 
     /**
@@ -455,6 +464,8 @@ public final class ServicesForMetadata e
      *
      * @param  unit The unit of measurement for the geocentric CRS axes.
      * @return The coordinate system for a geocentric CRS with axes using the given unit
of measurement.
+     *
+     * @since 0.6
      */
     @Override
     public CartesianCS getGeocentricCS(final Unit<Length> unit) {
@@ -470,12 +481,28 @@ public final class ServicesForMetadata e
     }
 
     /**
+     * Converts a geocentric coordinate system from the legacy WKT 1 to the current ISO 19111
standard.
+     * This method replaces the (Other, East, North) directions by (Geocentric X, Geocentric
Y, Geocentric Z).
+     *
+     * @param  cs The geocentric coordinate system to upgrade.
+     * @return The upgraded coordinate system, or {@code cs} if there is no change to apply.
+     *
+     * @since 0.6
+     */
+    @Override
+    public CartesianCS upgradeGeocentricCS(final CartesianCS cs) {
+        return Legacy.forGeocentricCRS(cs, false);
+    }
+
+    /**
      * Creates a coordinate system of unknown type. This method is used during parsing of
WKT version 1,
      * since that legacy format did not specified any information about the coordinate system
in use.
      * This method should not need to be invoked for parsing WKT version 2.
      *
      * @param  axes The axes of the unknown coordinate system.
      * @return An "abstract" coordinate system using the given axes.
+     *
+     * @since 0.6
      */
     @Override
     public CoordinateSystem createAbstractCS(final CoordinateSystemAxis[] axes) {
@@ -495,6 +522,8 @@ public final class ServicesForMetadata e
      * @param  baseToDerived Transform from positions in the base CRS to positions in this
target CRS.
      * @param  derivedCS     The coordinate system for the derived CRS.
      * @return The newly created derived CRS, potentially implementing an additional CRS
interface.
+     *
+     * @since 0.6
      */
     @Override
     public DerivedCRS createDerivedCRS(final Map<String,?>    properties,
@@ -511,6 +540,8 @@ public final class ServicesForMetadata e
      *
      * @param  values The 7 Bursa-Wolf parameter values.
      * @return The {@link BursaWolfParameters}.
+     *
+     * @since 0.6
      */
     @Override
     public Object createToWGS84(final double[] values) {
@@ -518,4 +549,39 @@ public final class ServicesForMetadata e
         info.setValues(values);
         return info;
     }
+
+    /**
+     * Returns the coordinate operation factory to use for the given properties and math
transform factory.
+     * If the given properties are empty and the {@code mtFactory} is the system default,
then this method
+     * returns the system default {@code CoordinateOperationFactory} instead of creating
a new one.
+     *
+     * @param  properties The default properties.
+     * @param  mtFactory  The math transform factory to use.
+     * @return The coordinate operation factory to use.
+     *
+     * @since 0.6
+     */
+    @Override
+    public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties,
MathTransformFactory mtFactory) {
+        if (Containers.isNullOrEmpty(properties) && DefaultFactories.isDefaultInstance(MathTransformFactory.class,
mtFactory)) {
+            return DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+        } else {
+            return new DefaultCoordinateOperationFactory(properties, mtFactory);
+        }
+    }
+
+    /**
+     * Returns {@code true} if the {@linkplain AbstractIdentifiedObject#getName() primary
name} or an aliases
+     * of the given object matches the given name.
+     *
+     * @param  object The object for which to check the name or alias.
+     * @param  name The name to compare with the object name or aliases.
+     * @return {@code true} if the primary name of at least one alias matches the specified
{@code name}.
+     *
+     * @since 0.6
+     */
+    @Override
+    public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name)
{
+        return IdentifiedObjects.isHeuristicMatchForName(object, name);
+    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1683712&r1=1683711&r2=1683712&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] Fri Jun  5 11:19:56 2015
@@ -48,13 +48,11 @@ import org.opengis.referencing.datum.*;
 import org.opengis.referencing.operation.*;
 
 import org.apache.sis.measure.Units;
-import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.internal.metadata.ReferencingServices;
-import org.apache.sis.internal.referencing.Legacy;
 import org.apache.sis.internal.util.LocalizedParseException;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.resources.Errors;
@@ -276,7 +274,7 @@ final class GeodeticObjectParser extends
                 if (keyword.equalsIgnoreCase(WKTKeywords.Spheroid))    return parseSpheroid
 (element);
                 if (keyword.equalsIgnoreCase(WKTKeywords.Vert_Datum))  return parseVertDatum
(element);
                 if (keyword.equalsIgnoreCase(WKTKeywords.Local_Datum)) return parseLocalDatum(element);
-                if (keyword.equalsIgnoreCase(WKTKeywords.Datum))       return parseDatum
    (element, CommonCRS.WGS84.primeMeridian());
+                if (keyword.equalsIgnoreCase(WKTKeywords.Datum))       return parseDatum
    (element, referencing.getGreenwich());
             }
         }
         throw element.keywordNotFound(keyword, keyword == WKTKeywords.GeogCS);
@@ -715,7 +713,7 @@ final class GeodeticObjectParser extends
             final Map<String,?> properties = parseAuthorityAndClose(element, name);
             if (axis0 != null && !isAxisIgnored) {
                 cs = csFactory.createCartesianCS(properties, axis0, axis1, axis2);
-                cs = Legacy.forGeocentricCRS(cs, false);
+                cs = referencing.upgradeGeocentricCS(cs);
             } else {
                 cs = referencing.getGeocentricCS(linearUnit);
             }



Mime
View raw message