*/ public ReferencingObjectFactory() { this(null); } /** * Constructs a factory with the specified hints. Users should not instantiate this * factory directly, but use one of the following lines instead: * ** {@linkplain DatumFactory} factory = FactoryFinder.{@linkplain ReferencingFactoryFinder#getDatumFactory getDatumFactory}null); * {@linkplain CSFactory} factory = FactoryFinder.{@linkplain ReferencingFactoryFinder#getCSFactory getCSFactory}(null); * {@linkplain CRSFactory} factory = FactoryFinder.{@linkplain ReferencingFactoryFinder#getCRSFactory getCRSFactory}(null); *
* * @param hints An optional set of hints, or {@code null} if none. * * @since 2.5 */ public ReferencingObjectFactory(final Hints hints) { pool = CanonicalSet.newInstance(IdentifiedObject.class); if (hints != null && !hints.isEmpty()) { /* * Creates the dependencies (MathTransform factory, WKT parser...) now because * we need to process user's hints. Then, we will keep only the relevant hints. */ mtFactory = ReferencingFactoryFinder.getMathTransformFactory(hints); final DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory(hints); createParser(datumFactory, mtFactory); addHints(datumFactory); addHints(mtFactory); } } /** * Copies the hints from the supplied factory. Note that we do not expose the factories * themself (at the contrary of what we usually do) because it is a little bit strange * to declare that this factory depends on an other {@link DatumFactory}. It is only a * trick for getting the WKT paser to work with aliases. * * @todo We should remove this trick if we can. Possible alternatives may be: make * DatumAliases to implements CRSFactory with appropriate createWKT(String) * method; move the createWKT(String) method out of CRSFactory interface. */ private void addHints(final Object factory) { if (factory instanceof Factory) { hints.putAll(((Factory) factory).getImplementationHints()); } } /** * Returns the math transform factory for internal usage only. The hints given to * {@link ReferencingFactoryFinder} must be null, since the non-null case should * have been handled by the constructor. * * @see #createParser */ private synchronized MathTransformFactory getMathTransformFactory() { if (mtFactory == null) { mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null); } return mtFactory; } ///////////////////////////////////////////////////////////////////////////////////////// //////// //////// //////// D A T U M F A C T O R Y //////// //////// //////// ///////////////////////////////////////////////////////////////////////////////////////// /** * Creates an ellipsoid from radius values. * * @param properties Name and other properties to give to the new object. * @param semiMajorAxis Equatorial radius in supplied linear units. * @param semiMinorAxis Polar radius in supplied linear units. * @param unit Linear units of ellipsoid axes. * @throws FactoryException if the object creation failed. */ public Ellipsoid createEllipsoid(Map* {@linkplain DatumFactory} factory = FactoryFinder.{@linkplain ReferencingFactoryFinder#getDatumFactory getDatumFactory}(hints); * {@linkplain CSFactory} factory = FactoryFinder.{@linkplain ReferencingFactoryFinder#getCSFactory getCSFactory}(hints); * {@linkplain CRSFactory} factory = FactoryFinder.{@linkplain ReferencingFactoryFinder#getCRSFactory getCRSFactory}(hints); *
* NOTE:
* It is the user's responsability to ensure that the {@code baseToDerived} transform performs
* all required steps, including {@linkplain AbstractCS#swapAndScaleAxis unit conversions and
* change of axis order}, if needed. The {@link ReferencingFactoryContainer} class provides
* conveniences methods for this task.
*
* @param properties Name and other properties to give to the new object.
* @param method A description of the {@linkplain Conversion#getMethod method for the
* conversion}.
* @param base Coordinate reference system to base the derived CRS on.
* @param baseToDerived The transform from the base CRS to returned CRS.
* @param derivedCS The coordinate system for the derived CRS.
* @throws FactoryException if the object creation failed.
*
* @deprecated Use {@link CoordinateOperationFactory#createDefiningConversion} followed by
* {@link #createDerivedCRS} instead.
*/
public DerivedCRS createDerivedCRS(Map
* NOTE:
* It is the user's responsability to ensure that the {@code baseToDerived} transform performs
* all required steps, including {@linkplain AbstractCS#swapAndScaleAxis unit conversions and
* change of axis order}, if needed. The {@link ReferencingFactoryContainer} class provides
* conveniences methods for this task.
*
* @param properties Name and other properties to give to the new object.
* @param method A description of the {@linkplain Conversion#getMethod method for the
* projection}.
* @param base Geographic coordinate reference system to base projection on.
* @param baseToDerived The transform from the geographic to the projected CRS.
* @param derivedCS The coordinate system for the projected CRS.
* @throws FactoryException if the object creation failed.
*
* @deprecated Use {@link CoordinateOperationFactory#createDefiningConversion} followed by
* {@link #createProjectedCRS} instead.
*/
public ProjectedCRS createProjectedCRS(Map