|
From: Jody G. <jga...@re...> - 2007-03-16 19:25:55
|
Thanks Martin - that is a good summary :-) I am using it to update the long request instructions on how to use hints: - http://docs.codehaus.org/display/GEOTDOC/01+Factory+and+Hint+Tutorial Cheers, Jody Martin Desruisseaux wrote: > I think that this use case is already well covered by current design: > > - User create the following in its own application space > (not a geotools global setting): > > private static final Hints myApplicationSetting = new Hints(); > static { > myApplicationSetting.put(Hints.CRS_AUTHORITY_FACTORY, > myOwnCrsFactory); > myApplicationSetting.put(Hints.CRS_GEOMETRY_FACTORY, > myOwnGeomFactory); > myApplicationSetting.put(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE); > myApplicationSetting.put(Hints.EPSG_DATA_SOURCE, "jdbc/MyOwnEPSG"); > // etc. > } > > void anyUserMethodWantingFactory() { > FeatureFactory f = > FactoryFinder.getFeatureFactory(myApplicationSetting); > Feature fe = f.createFoo(...); > // etc. > } > > The feature factory will use the user's "myOwnCrsFactory" and > "myOwnGeomFactory", which are propagated through the hints. A > different application using Geotools in the same JVM can have is own > application-wide setting if it define and use its own > "myApplicationSetting" in the same way. > > Note that the hints is not just about factory dependencies. It is also > about boolean value, name as a string, etc. In brief, everything that > could be specified as argument to a Factory constructor. > > Martin > |