it.geosolutions.imageio.gdalframework
Class GDALCreateOptionsHandler

Object
  extended by GDALCreateOptionsHandler

public abstract class GDALCreateOptionsHandler
extends Object

Abstract class which allows to properly handle the set of "format specific" create options. Each Image I/O plugin exploiting a GDAL driver which supports create options, should extend this class and define the proper GDALCreateOptionsHandler constructor.
To write the extended GDALCreateOptionsHandler constructor you need to instantiate the createOptions array with the number of supported create options. Then, you need to set the proper fields of each GDALCreateOption using the constructor as shown in the example listed below.

...

Firstly: set the validityValues for the create option. See GDALCreateOption source code for more information about validityValues and others fields.

final String nameOfCreateOptionValidityValues[] = new String[N];
nameOfCreateOptionValidityValues[0] = "FIRST VALUE";
nameOfCreateOptionValidityValues[1] = "SECOND VALUE";
...
nameOfCreateOptionValidityValues[N-1] = "LAST VALUE";

Then, create a new GDALCreateOption setting the optionName, the validityCheckType, the validityValues array and the representedType.

createOptions[i] = new GDALCreateOption( "CREATEOPTIONNAME",
GDALCreateOption.VALIDITYCHECKTYPE_XXXX, nameOfCreateOptionValidityValues, GDALCreateOption.TYPE_XXXX);



PRACTICAL EXAMPLE: Suppose we are setting a Quality Create options which accepts integer values belonging the range [1,100]
final String qualityValues[] = new String[2]; qualityValues[0] = "1";
qualityValues[1] = "100";
...
createOptions[0]=new GDALCreateOption("Quality",
GDALCreateOption.VALIDITYCHECKTYPE_VALUE_BELONGINGRANGE_EXTREMESINCLUDED,
qualityValues, GDALCreateOption.TYPE_INT);
Available information about create options properties can be found at GDAL Supported formats list. Look at the proper format page to retrieve names and values.

Author:
Daniele Romagnoli, GeoSolutions., Simone Giannecchini, GeoSolutions

Constructor Summary
GDALCreateOptionsHandler()
           
 
Method Summary
 void addCreateOption(GDALCreateOption option)
          This method add a create option to this handler.
 void addCreateOptions(Collection<GDALCreateOption> options)
          This method add a collection of create options to this handler.
 List<String> getCreateOptions()
          Provides to return a List containing Strings representing all specified create options we need to give to the writer when it call GDAL's create/createCopy method.
 void setCreateOption(String optionName)
          Set the create option identified by optionName
 void setCreateOption(String optionName, float optionValue)
          Set the value of the create option identified by optionName to optionValue
 void setCreateOption(String optionName, int optionValue)
          Set the value of the create option identified by optionName to optionValue
 void setCreateOption(String optionName, String optionValue)
          Set the value of the create option identified by optionName to optionValue
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GDALCreateOptionsHandler

public GDALCreateOptionsHandler()
Method Detail

getCreateOptions

public List<String> getCreateOptions()
Provides to return a List containing Strings representing all specified create options we need to give to the writer when it call GDAL's create/createCopy method.


setCreateOption

public void setCreateOption(String optionName,
                            String optionValue)
Set the value of the create option identified by optionName to optionValue

Parameters:
optionName - name of the create option we want to set.
optionValue - value for the specified create option.

setCreateOption

public void setCreateOption(String optionName)
Set the create option identified by optionName

Parameters:
optionName - name of the create option we want to set.

addCreateOption

public void addCreateOption(GDALCreateOption option)
This method add a create option to this handler.

Parameters:
option - to add to this handler.

addCreateOptions

public void addCreateOptions(Collection<GDALCreateOption> options)
This method add a collection of create options to this handler.

Objects that are not of type GDALCreateOption are not added.

Parameters:
option - to add to this handler.

setCreateOption

public void setCreateOption(String optionName,
                            int optionValue)
Set the value of the create option identified by optionName to optionValue

Parameters:
optionName - name of the create option we want to set.
optionValue - value for the specified create option.

setCreateOption

public void setCreateOption(String optionName,
                            float optionValue)
Set the value of the create option identified by optionName to optionValue

Parameters:
optionName - name of the create option we want to set.
optionValue - value for the specified create option.


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.