Jody Garnett a écrit :
> In every case we were either directly returning the object provided by
> the no argument constructor, or we were producing a
> FactoryNotFoundException - at which point the later code would not work
> either (as it needs the no argument constructor to work so it gets an
> object back in order to get a Class to perform reflection on).
This is true - a no-argument constructor must exists and the factory must be
registered in the META-INF/services/ directory in order to work. The
no-argument
constructor should provides default hints for the most common (or most
"strict")
cases.
It will not prevent the GeometryFactory(Hints) constructor to be invoked later,
because FactoryRegistry should detect that the GeometryFactory created with the
no-arg constructor don't have 'Factory.getImplementationHints()' matching
user's
request.
Davis Graham a écrit :
> The code we are using is found in
> referencing->org.geotools.geometry->GeometryFactoryFinder.java
> and we have begun adding the Hints constructors to PrimitiveFactoryImpl in
the unsupported gometry module.
I see a problem in PrimitiveFactoryImpl. The no-argument constructor do not put
anything in the hintsWeUsed map. Consequently, ReferencingFactory believes that
PrimitiveFactoryImpl do not care about any hints, so the PrimitiveFactoryImpl
instance is always suitable no matter what are user hints.
Suggested fix:
* Rename "hintsWeUsed" by "hintsWeCareAbout" or something like that;
this is not the same thing.
* Modify the PrimitiveFactoryImpl(Hints) constructor so it accepts
a null Hints argument. If no hints are provided, use some default
(probably EPSG:4326 for the CRS...)
* Implements the PrimitiveFactoryImpl() constructor as below:
this(null);
The important point is that the PrimitiveFactoryImpl() constructor must put,
directly or indirectly, some Hints.CRS and Hints.WHATEVER keys in the
"hintsWeCareAbout" map, no matter if the value are null or anything else.
Martin
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel