Hi list.
I'm developing additional GeoTools plugins (to handle ECW, MrSID and some
other raster formats) and, with Simone, we have decided to customize data
access.
Basically, we would like to specify in some manner whether data should be
accessed with a Jai-ImageRead operation (leveraging on Tiling,
DeferredExecution,...) or data should be accessed with a simple/direct
ImageReader.read(...params).
As a first step, I have added a new DefaultParameterDescriptor in the
AbstractGridFormat in org.geotools.coverage.grid.io (gt2-coverage module),
like this:
public static final DefaultParameterDescriptor USE_JAI_IMAGEREAD = new
DefaultParameterDescriptor("UseJaiImageRead", Boolean.class, null, null);
Moreover I would like supporting Hints.
So, I have defined a new Hint in Hints class (in org.geotools.factory) like
this:
public static final Key USE_JAI_IMAGEREAD = new Key(
Boolean.class);
By this way, when using the constructor of
org.geotools.gce.myformat.MyFormatReader I can specify a Hint which should
be used to customize data access.
Prior to perform data access, the MyFormatReader should check (following
checks are ordered from higher priority to lower priority):
1) If the GeneralParameterValue[] parameters list as argument of the read
operation contains a defined USE_JAI_IMAGEREAD ParameterDescriptor.
In case it exists, the read access will be performed compliantly with this
parameter.
2) if a USE_JAI_IMAGEREAD Hint has been specified at construction time.
(data access will be performed compliantly with the value of this Hint)
3) if a default Hint is available.
I would like to set a Default USE_JAI_IMAGEREAD Hint (TRUE).
http://docs.codehaus.org/display/GEOTDOC/01+Factory+and+Hint+Tutorialprovides
some instructions about how to set Default Hints.
However, I'm a bit confused about where I need to set Default Hints. All
MyFormatFactory classes implement GridFormatFactorySpi.
I guess I need to do something like this (however, I'm not sure about this):
static {
Hints hints = new Hints(Hints.USE_JAI_IMAGEREAD, Boolean.TRUE);
Hints defHints = GeoTools.getDefaultHints();
defHints.add(hints);
GeoTools.init(defHints);
}
For the moment, (just for testing purposes) I placed this code in
AbstractGridFormat but I'm really sure this is the wrong place.
I'm not really experienced about Hints and a help (with some additional
suggestion) would be really appreciated.
Thx a lot.
--
Best Regards,
Daniele Romagnoli
-------------------------------------------------------------------------
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