01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2004, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.referencing.factory;
18:
19: import org.geotools.factory.Hints;
20: import org.opengis.referencing.crs.CRSFactory;
21: import org.opengis.referencing.cs.CSFactory;
22: import org.opengis.referencing.datum.DatumFactory;
23: import org.opengis.referencing.operation.MathTransformFactory;
24:
25: /**
26: * A set of utilities methods working on factories. Many of those methods requires more than
27: * one factory. Consequently, they can't be a method in a single factory. Furthermore, since
28: * they are helper methods and somewhat implementation-dependent, they are not part of GeoAPI.
29: *
30: * @since 2.1
31: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/factory/FactoryGroup.java $
32: * @version $Id: FactoryGroup.java 25948 2007-06-20 14:36:14Z desruisseaux $
33: * @author Martin Desruisseaux
34: * @deprecated Renamed to ReferencingFactoryContainer in order to reflect use
35: */
36: public final class FactoryGroup extends ReferencingFactoryContainer {
37: /**
38: * Constructs an instance using the specified factories. If any factory is null,
39: * a default instance will be created by {@link ReferencingFactoryFinder} when first needed.
40: *
41: * @param datumFactory The {@linkplain Datum datum} factory.
42: * @param csFactory The {@linkplain CoordinateSystem coordinate system} factory.
43: * @param crsFactory The {@linkplain CoordinateReferenceSystem coordinate reference system}
44: * factory.
45: * @param mtFactory The {@linkplain MathTransform math transform} factory.
46: *
47: * @deprecated Use {@link #createInstance} instead. The fate of this constructor is
48: * incertain. It may be removed in Geotools 2.4, or refactored as a new
49: * {@code createInstance} convenience method.
50: */
51: public FactoryGroup(final DatumFactory datumFactory,
52: final CSFactory csFactory, final CRSFactory crsFactory,
53: final MathTransformFactory mtFactory) {
54: super (datumFactory, csFactory, crsFactory, mtFactory);
55: }
56:
57: /**
58: * Creates an instance from the specified hints. This constructor recognizes the
59: * {@link Hints#CRS_FACTORY CRS}, {@link Hints#CS_FACTORY CS}, {@link Hints#DATUM_FACTORY DATUM}
60: * and {@link Hints#MATH_TRANSFORM_FACTORY MATH_TRANSFORM} {@code FACTORY} hints.
61: * <p>
62: * This constructor is public mainly for {@link org.geotools.factory.FactoryCreator} usage.
63: * Consider invoking <code>{@linkplain #createInstance createInstance}(userHints)</code> instead.
64: *
65: * @param userHints The hints, or {@code null} if none.
66: *
67: * @since 2.2
68: */
69: public FactoryGroup(final Hints userHints) {
70: super (userHints);
71: }
72:
73: /**
74: * Creates an instance from the specified hints. This method recognizes the
75: * {@link Hints#CRS_FACTORY CRS}, {@link Hints#CS_FACTORY CS}, {@link Hints#DATUM_FACTORY DATUM}
76: * and {@link Hints#MATH_TRANSFORM_FACTORY MATH_TRANSFORM} {@code FACTORY} hints.
77: *
78: * @param hints The hints, or {@code null} if none.
79: * @return A factory group created from the specified set of hints.
80: *
81: * @since 2.2
82: */
83: public static FactoryGroup createInstance(final Hints hints) {
84: /* just so we can play the deprecation game */
85: ReferencingFactoryContainer tmp = ReferencingFactoryContainer
86: .instance(hints);
87: return new FactoryGroup(tmp.getDatumFactory(), tmp
88: .getCSFactory(), tmp.getCRSFactory(), tmp
89: .getMathTransformFactory());
90: }
91: }
|