RasterElementImporterShell Class Reference
[Plug-In Shells]

Provides a shell class for importers loading RasterElement objects. More...

#include <RasterElementImporterShell.h>

Inheritance diagram for RasterElementImporterShell:

Inheritance graph

List of all members.

Public Member Functions

 RasterElementImporterShell ()
virtual ~RasterElementImporterShell ()
virtual bool getInputSpecification (PlugInArgList *&pArgList)
virtual bool getOutputSpecification (PlugInArgList *&pArgList)
virtual bool execute (PlugInArgList *pInArgList, PlugInArgList *pOutArgList)
virtual bool validate (const DataDescriptor *pDescriptor, std::string &errorMessage) const
virtual bool isProcessingLocationSupported (ProcessingLocation location) const
virtual QWidget * getPreview (const DataDescriptor *pDescriptor, Progress *pProgress)

Protected Member Functions

virtual bool parseInputArgList (PlugInArgList *pInArgList)
ProgressgetProgress () const
RasterElementgetRasterElement () const
virtual int getValidationTest (const DataDescriptor *pDescriptor) const
virtual bool performImport () const
virtual SpatialDataViewcreateView () const
virtual RasterLayercreateRasterLayer (SpatialDataView *pView, Step *pStep) const
virtual GcpLayercreateGcpLayer (SpatialDataView *pView, Step *pStep) const
virtual LatLonLayercreateLatLonLayer (SpatialDataView *pView, Step *pStep) const
virtual GcpListcreateGcpList () const
GcpListgetGcpList () const
virtual PlugIngetGeoreferencePlugIn () const
virtual bool createRasterPager (RasterElement *pRaster) const
bool copyData (const RasterElement *pSrcElement) const

Protected Attributes

Service< DesktopServicesmpDesktop
Service< ModelServicesmpModel
Service< PlugInManagerServicesmpPlugInManager
Service< UtilityServicesmpUtilities


Detailed Description

Provides a shell class for importers loading RasterElement objects.

This class provides capabilities for importers to load data from a file which is stored in a RasterElement object. The default input arg list contains two objects: Progress and RasterElement. The default output arg list contains a single View object in interactive mode.

On a typical import from interactive mode, derived importers must override the getImportDescriptors() method to parse a file for the valid data set parameters. The user may then modify the fields in the DataDescriptor, and a RasterElement object is created from the modified DataDescriptor. This RasterElement object is then set into the input arg list before execute() is called.

The default implementation of the execute() method calls createRasterPager() and copies the selected data into the import RasterElement. A view is automatically created if the plug-in is in interactive mode. If the DataDescriptor input arg is NULL, one is created and the getImportDescriptors() method is called to set the values. The plug-in contains aborting capabilities which aborts the copy in progress.

Importers that have a special format to load data from the file only need to override createRasterPager() to create the format-specific RasterPager. Importers that desire more control can do so by overriding execute(). The parseInputArgList() method can be called to extract the Progress and RasterElement values from the arg list, and the createView() method can be called to create a view for the RasterElement in interactive mode. A derived importer can also override abort() to properly allow the user to abort the import.

See also:
ImporterShell
Examples:

SampleRasterElementImporter.h.

Definition at line 66 of file RasterElementImporterShell.h.


Constructor & Destructor Documentation

RasterElementImporterShell::RasterElementImporterShell (  ) 

Creates a raster element importer plug-in.

The constructor sets the plug-in subtype to "Raster Element" and sets the plug-in to allow multiple instances.

See also:
getSubtype(), areMultipleInstancesAllowed()

virtual RasterElementImporterShell::~RasterElementImporterShell (  )  [virtual]

Destroys the raster element importer plug-in.


Member Function Documentation

virtual bool RasterElementImporterShell::getInputSpecification ( PlugInArgList *&  pArgList  )  [virtual]

Retrieves the plug-in input parameters.

This method queries the plug-in for its input parameters that are needed to execute properly. The input arguments may be different in interactive mode and batch mode.

Parameters:
pArgList A plug-in arg list pointer that is set to a created input argument list specifying the plug-in input parameters. NULL is a valid pointer value if the plug-in does not require any input arguments.
Returns:
Returns true if the input parameter argument list was successfully created. If the plug-in does not require input arguments, true is returned, but the given plug-in arg list pointer may be NULL.
See also:
PlugInArgList

Default Implementation:
The default implementation adds a Progress arg and a RasterElement arg to the arg list.

Implements Executable.

virtual bool RasterElementImporterShell::getOutputSpecification ( PlugInArgList *&  pArgList  )  [virtual]

Retrieves the plug-in output parameters.

This method queries the plug-in for its output parameters that are created during execution. The output arguments may be different in interactive mode and batch mode.

Parameters:
pArgList A plug-in arg list pointer that is set to a created output argument list specifying the plug-in output parameters. NULL is a valid pointer value if the plug-in does not provide any output arguments.
Returns:
Returns true if the output parameter argument list was successfully created. If the plug-in does not provide output arguments, true is returned, but the given plug-in arg list pointer may be NULL.
See also:
PlugInArgList

Default Implementation:
The default implementation adds a SpatialDataView arg to the arg list if the plug-in is in interactive mode and does nothing if the plug-in is in batch mode.

Implements Executable.

virtual bool RasterElementImporterShell::execute ( PlugInArgList pInArgList,
PlugInArgList pOutArgList 
) [virtual]

Executes the plug-in.

Parameters:
pInArgList On input, pInArgList contains a complete input argument list for the plug-in. The actual values are used as inputs when executing the plug-in. Default values may be used if an actual value is not present.
pOutArgList On input, pOutArgList contains a complete output argument list for the plug-in, although actual values and default values will be ignored. On return, the actual values in the argument list will be updated to include all output parameters defined by the plug-in.
Returns:
Returns true if the execution was successful. Returns false if an error occurred or if the user cancelled the plug-in while in interactive mode.
See also:
getInputSpecification(), getOutputSpecification()

Default Implementation:
The default implementation imports the RasterElement in the input arg list by creating a RasterPager if the processing location is ProcessingLocation::ON_DISK_READ_ONLY or by creating a separate RasterElement and RasterPager and copying the data into the original RasterElement in the input arg list. A RasterElement arg needs to be present in the input arg list for the method to complete successfully.

Implements Executable.

virtual bool RasterElementImporterShell::validate ( const DataDescriptor pDescriptor,
std::string &  errorMessage 
) const [virtual]

Queries whether a given data descriptor can be successfully loaded by the importer.

This method is called for the importer to parse the current settings in the data descriptor to see if it supports loading the data as currently specified in the data descriptor. This allows importers that do not support certain combinations of values to indicate as such. This method is called each time the user changes a value in the import options dialog. This method is also called by ImportAgent::execute() before executing the importer.

Parameters:
pDescriptor The data descriptor to query if it can be successfully imported.
errorMessage An error message that is populated with the reason why the importer cannot load the given data descriptor. This message will be displayed to the user via the importer's Progress object. If this method returns true, this message will be displayed to the user as a warning. If this method returns false, this message will be displayed to the user as an error.
Returns:
Returns true if the importer can successfully import the given data descriptor; otherwise returns false.
See also:
DataDescriptor, FileDescriptor

Default Implementation:
The default implementation calls the base class implementation and provides better error messages where appropriate based on the test conditions in getValidationTest(). If the base class implementation validates successfully, the gray, red, green, and blue display bands in the RasterDataDescriptor are checked against the loaded bands. If the display band will not be loaded, a warning is added to errorMessage and the method returns true.

Reimplemented from ImporterShell.

Reimplemented in HdfImporterShell, and Nitf::NitfImporterShell.

virtual bool RasterElementImporterShell::isProcessingLocationSupported ( ProcessingLocation  location  )  const [virtual]

Queries whether the user can select the given processing location.

Parameters:
location The processing location being queried to determine if it is supported.
Returns:
Returns true if the user can select the given processing location, otherwise returns false.
See also:
ProcessingLocation

Default Implementation:
All processing locations are supported, so the default implementation returns true for any valid ProcessingLocation value.

Reimplemented from ImporterShell.

Examples:
SampleRasterElementImporter.h.

virtual QWidget* RasterElementImporterShell::getPreview ( const DataDescriptor pDescriptor,
Progress pProgress 
) [virtual]

Returns a preview of a given data set.

This method provides the means by which the user can preview a data set before importing. Derived importers can override this method to create a Qt widget displaying preview contents.

This method is called by the core when the user views a preview of a data set before importing. The core application assumes ownership of the Qt widget, so the importer should not delete it. A View object can also be created for the preview, where the returned value should be View::getWidget().

Parameters:
pDescriptor The data set to preview.
pProgress A progress object in which the importer can report progress while getting the preview.
Returns:
A pointer to a Qt widget containing the preview contents that will be displayed to the user. The core application assumes ownership of the widget and will delete it when necessary. NULL is returned if no preview is available for the given data set.

Default Implementation:
The default implementation creates and returns a preview of the given data set. A SpatialDataView is created in grayscale mode using only the data in the first band of the data descriptor. The data is loaded on-disk read-only to avoid unnecessary memory allocation. However, if the data cannot be loaded on-disk as determined with a call to validate(), it will be loaded into memory to create the preview.

Reimplemented from ImporterShell.

virtual bool RasterElementImporterShell::parseInputArgList ( PlugInArgList pInArgList  )  [protected, virtual]

Extracts the progress and sensor data from the given input arg list.

This method extracts the progress and sensor data values from the input args in the given arg list. The values are stored and can be retrieved by calling the getProgress() and getRasterElement() methods.

Parameters:
pInArgList The input arg list for which to extract the progress and raster element values.
Returns:
Returns true if the sensor data value was successfully extracted from the arg list. false is returned if the raster element value could not be extracted from the arg list. The return value does not depend on successfully extracting the progress value since the Progress object is not required to successfully load the element.
See also:
getProgress(), getRasterElement()

Progress* RasterElementImporterShell::getProgress (  )  const [protected]

Returns the Progress object extracted from the input arg list.

Returns:
A pointer to the Progress object extracted from the input arg list. NULL is returned if the parseInputArgList() method has not been called or if the parsed input arg list does not contain a valid Progress arg value.
See also:
parseInputArgList()

RasterElement* RasterElementImporterShell::getRasterElement (  )  const [protected]

Returns the RasterElement object extracted from the input arg list.

Returns:
A pointer to the RasterElement object extracted from the input arg list. NULL is returned if the parseInputArgList() method has not been called or if the parsed input arg list does not contain a valid RasterElement arg value.
See also:
parseInputArgList()

virtual int RasterElementImporterShell::getValidationTest ( const DataDescriptor pDescriptor  )  const [protected, virtual]

Returns the test that should be performed when validating the given data set for import.

This method is called by validate() to determine which tests should be performed to validate the import. This method should be overridden by derived importers to add additional tests or remove default tests.

Parameters:
pDescriptor The data descriptor for the data set that is being imported.
Returns:
Returns the test that should be used to validate the import. The value should be an OR'd combination of ValidationTest values.
Default Implementation:
The default implementation of this method returns the OR'd combination of the following tests:

The following raster-specific tests are added to the base class defaults listed above:
Additionally, the following test is added if the ProcessingLocation is IN_MEMORY:
The following tests are added if the ProcessingLocation is ON_DISK_READ_ONLY:
The following tests are added if the InterleaveFormatType is not BSQ:
The following test is added if multiple band files are present:

Reimplemented from ImporterShell.

Reimplemented in HdfImporterShell, and Nitf::NitfImporterShell.

virtual bool RasterElementImporterShell::performImport (  )  const [protected, virtual]

Perform the a default import.

This method performs a default import by creating a RasterPager if the processing location is ProcessingLocation::ON_DISK_READ_ONLY or by creating a separate RasterElement and RasterPager and copying the data into the original RasterElement.

parseInputArgList() must be called before calling this method. This method is called from the default implementation of execute().

Returns:
true if the operation succeeded, or false otherwise. Failure may be due to an abort. In case of failure, the Progress will have an appropriate message.

virtual SpatialDataView* RasterElementImporterShell::createView (  )  const [protected, virtual]

Creates a view for the imported data set.

This method creates a view for the imported data set in interactive mode only. Prior to calling this method, the parseInputArgList() method must be called to extract the RasterElement. This method is called from the default implementation of execute() after the createGcpList() method.

A new message log step is created and the initially displayed bands and display mode are added as properties to the step.

Returns:
A pointer to the created view. NULL is returned if the plug-in is in batch mode or the raster element has not been extracted from the input arg list.

Reimplemented in Nitf::NitfImporterShell.

virtual RasterLayer* RasterElementImporterShell::createRasterLayer ( SpatialDataView pView,
Step pStep 
) const [protected, virtual]

Creates a raster layer in the given view.

This method is called from the default implementation of createView() after the view is created.

Parameters:
pView The view in which to create the raster layer.
pStep The message log step for creating the view.
Returns:
A pointer to the created raster layer.
Default Implementation:
The default implementation of this method calls SpatialDataView::createLayer() with the raster element extracted from the input arg list as the element to display in the layer.
See also:
getRasterElement()

virtual GcpLayer* RasterElementImporterShell::createGcpLayer ( SpatialDataView pView,
Step pStep 
) const [protected, virtual]

Creates a GCP layer in the given view.

This method is called from the default implementation of createView() after the raster layer is created.

Parameters:
pView The view in which to create the GCP layer.
pStep The message log step for creating the view.
Returns:
A pointer to the created GCP layer.
Default Implementation:
The default implementation of this method calls SpatialDataView::createLayer() with the GCP list returned from createGcpList() as the element to display in the layer. If createGcpList() returns NULL, the default implementation does nothing.
See also:
createRasterLayer()

virtual LatLonLayer* RasterElementImporterShell::createLatLonLayer ( SpatialDataView pView,
Step pStep 
) const [protected, virtual]

Creates a latitude/longitude layer in the given view.

This method is called from the default implementation of createView() after the GCP layer is created. This method is not called if the Georeference::CreateLatLonLayer setting is false.

Parameters:
pView The view in which to create the latitude/longitude layer.
pStep The message log step for creating the view.
Returns:
A pointer to the created latitude/longitude layer.
Default Implementation:
The default implementation of this method executes the "Georeference" plug-in to create the latitude/longitude layer based on the previously georeferenced raster element. If the layer is successfully created, the layer is shown or hidden based on the value of the Georeference::DisplayLatLonLayer setting. If the raster element was not successfully georeferenced, the default implementation does nothing.
See also:
createGcpLayer()

virtual GcpList* RasterElementImporterShell::createGcpList (  )  const [protected, virtual]

Creates a GcpList element for the GCPs contained in the raster element file descriptor.

Prior to calling this method, the parseInputArgList() method must be called to extract the raster element. This method is called from the default implementation of execute() after the performImport() method.

Returns:
A pointer to the created GCP list. NULL is returned if the raster element has not been extracted from the input arg list.
See also:
getRasterElement()

GcpList* RasterElementImporterShell::getGcpList (  )  const [protected]

Returns the GcpList object returned from createGcpList().

Returns:
A pointer to the GcpList object created as a result of the call to createGcpList(). NULL is returned if the createGcpList() method has not yet been called.

virtual PlugIn* RasterElementImporterShell::getGeoreferencePlugIn (  )  const [protected, virtual]

Creates a Georeference plug-in that can be used to georeference the raster data.

This method is called from within execute() if the configuration settings to auto-georeference and to get the georeference plug-in from the importer are enabled. The method is called after calling createGcpList(), regardless of whether a valid GCP list is returned.

The default implementation of this method creates an instance of the GCP Georeference plug-in and calls Georeference::canHandleRasterElement() to see if it can georeference the raster data. If the plug-in supports the raster data, it is returned. Otherwise the plug-in is destroyed and NULL is returned.

Derived importers should override this method if a better Georeference plug-in is available for the raster data.

Returns:
A pointer to the Georeference plug-in that will be used to georeference the raster data. The plug-in should support the raster element returned by getRasterElement() such that Georeference::canHandleRasterElement() returns true. Ownership of the plug-in is transferred to the shell and will be destroyed automatically. NULL is returned if no plug-in is available to georeference the raster data, or if the raster data does not contain georeference information.
See also:
getRasterElement(), Georeference::getSettingAutoGeoreference(), Georeference::getSettingImporterGeoreferencePlugIn()

Reimplemented in Nitf::NitfImporterShell.

virtual bool RasterElementImporterShell::createRasterPager ( RasterElement pRaster  )  const [protected, virtual]

Create and set a RasterPager for a given RasterElement.

Most importers should override this method instead of execute(). Overriding this method will allow the importer to get all of the copy and conversion capabilities provided by the default execute().

Parameters:
pRaster The RasterElement to create the RasterPager for.
Returns:
True if the pager was successfully created, false otherwise.

Reimplemented in HdfImporterShell, and Nitf::NitfImporterShell.

Examples:
SampleRasterElementImporter.h.

bool RasterElementImporterShell::copyData ( const RasterElement pSrcElement  )  const [protected]

Copy data from the source element to the imported one.

Parameters:
pSrcElement The source element to copy from. The active rows, columns, and bands should be a superset of those being imported.
Returns:
True if the copy was successful, false otherwise.


Member Data Documentation

Definition at line 418 of file RasterElementImporterShell.h.

Definition at line 419 of file RasterElementImporterShell.h.

Definition at line 420 of file RasterElementImporterShell.h.

Definition at line 421 of file RasterElementImporterShell.h.


Software Development Kit - Opticks 4.9.0 Build 16218