Importer Class Reference

Interface specific to importer plug-ins. More...

#include <Importer.h>

Inheritance diagram for Importer:

Inheritance graph

List of all members.

Public Member Functions

virtual std::string getDefaultExtensions () const =0
virtual bool isProcessingLocationSupported (ProcessingLocation location) const =0
virtual std::vector
< ImportDescriptor * > 
getImportDescriptors (const std::string &filename)=0
virtual unsigned char getFileAffinity (const std::string &filename)=0
virtual QWidget * getPreview (const DataDescriptor *pDescriptor, Progress *pProgress)=0
virtual bool validate (const DataDescriptor *pDescriptor, std::string &errorMessage) const =0
virtual QWidget * getImportOptionsWidget (DataDescriptor *pDescriptor)=0
virtual void polishDataDescriptor (DataDescriptor *pDescriptor)=0

Static Public Member Functions

static std::string ImportElementArg ()

Static Public Attributes

static const unsigned char CAN_NOT_LOAD = 0
static const unsigned char CAN_LOAD_WITH_USER_INPUT = 64
static const unsigned char CAN_LOAD_FILE_TYPE = 128
static const unsigned char CAN_LOAD = 192

Protected Member Functions

virtual ~Importer ()


Detailed Description

Interface specific to importer plug-ins.

Defines the importer specific interface to all importer plug-ins. This interface contains all importer specific operations.

Definition at line 29 of file Importer.h.


Constructor & Destructor Documentation

virtual Importer::~Importer (  )  [protected, virtual]

Since the Importer interface is usually used in conjunction with the PlugIn and Executable interfaces, this should be destroyed by casting to the PlugIn interface and calling PlugInManagerServices::destroyPlugIn().

Definition at line 258 of file Importer.h.


Member Function Documentation

static std::string Importer::ImportElementArg (  )  [static]

The name for an import element argument.

Input arguments with this name will be automatically populated with the created DataElement whose data should be populated by the importer when the plug-in is executed with an ImportAgent. Arguments with this name should be of the type DataElement or one of its subclasses.

See also:
ImportAgent::execute()

Definition at line 42 of file Importer.h.

virtual std::string Importer::getDefaultExtensions (  )  const [pure virtual]

Returns the default file extensions recognized by the importer.

Returns:
The file extensions recognized by the importer as a string. The string consists of a description followed by one or more file extensions separated by a space. Multiple file types may be specified with a double semicolon. Examples include "ENVI Header Files (*.hdr)", "TIFF Files (*.tif *.tiff)", and "Source Files (*.c*);;Header Files (*.h)".

Implemented in ImporterShell.

virtual bool Importer::isProcessingLocationSupported ( ProcessingLocation  location  )  const [pure 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

Implemented in ImporterShell, and RasterElementImporterShell.

virtual std::vector<ImportDescriptor*> Importer::getImportDescriptors ( const std::string &  filename  )  [pure virtual]

Returns import descriptors for each valid data element in a given file.

This method is called for the importer to parse a given file and create valid import descriptors for each data element in the file that can be used to import the data. The import descriptor objects can be created by calling ModelServices::createImportDescriptor().

Parameters:
filename Full path and name of the file to parse for data elements to import.
Returns:
A vector containing valid import descriptors for each data element in the file. An empty vector should be returned if the importer does not support the data in the given file.
See also:
ImportDescriptor

Implemented in Nitf::NitfImporterShell.

Examples:
SampleRasterElementImporter.h.

virtual unsigned char Importer::getFileAffinity ( const std::string &  filename  )  [pure virtual]

Returns a value indicating if this importer can load this file and how well it can load this file.

The Importer should look at as little of the file as required as quickly as possible when determining the affinity.

Parameters:
filename Full path and name of the file.
Returns:
The value returned should be one of the following: It can be any unsigned char value if a specific Importer requires more granularity.

Implemented in Nitf::NitfImporterShell.

Examples:
SampleRasterElementImporter.h.

virtual QWidget* Importer::getPreview ( const DataDescriptor pDescriptor,
Progress pProgress 
) [pure 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.

Implemented in ImporterShell, and RasterElementImporterShell.

virtual bool Importer::validate ( const DataDescriptor pDescriptor,
std::string &  errorMessage 
) const [pure 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

Implemented in ImporterShell, RasterElementImporterShell, HdfImporterShell, and Nitf::NitfImporterShell.

virtual QWidget* Importer::getImportOptionsWidget ( DataDescriptor pDescriptor  )  [pure virtual]

Returns a widget to display custom import option values.

This method provides an interface for which specialized import options for a data set can be displayed to the user. The method returns a Qt widget that is added to the default import options dialog. The importer should create the widget with a NULL parent, and should destroy the widget when the importer itself is destroyed.

Importers should call QWidget::setWindowTitle() on the widget that is returned to set the name that appears on the tab in the import options dialog. If the window title is not set, the importer name is displayed.

Parameters:
pDescriptor The data set for which to set the current values in the widget.
Returns:
A QWidget that will be displayed as an additional tab in the default import options dialog. NULL should be returned if the importer does not have custom options to display to the user.

Implemented in ImporterShell.

virtual void Importer::polishDataDescriptor ( DataDescriptor pDescriptor  )  [pure virtual]

Modifies a data descriptor before it is imported.

This method is called after the user has made changes to the data descriptor contained in an ImportDescriptor returned in getImportDescriptors() and before the element is created for import.

Warning:
It is generally not recommended for an importer to modify values that the user has the capability to change in the import options dialog since any value that the user sets would be overridden without the user's knowledge.
Parameters:
pDescriptor The data set to modify before import.

Implemented in ImporterShell.


Member Data Documentation

const unsigned char Importer::CAN_NOT_LOAD = 0 [static]

When an importer returns this value from getFileAffinity() it means the importer can not load any data from the given file.

Examples:
SampleRasterElementImporter.cpp.

Definition at line 114 of file Importer.h.

const unsigned char Importer::CAN_LOAD_WITH_USER_INPUT = 64 [static]

When an importer returns this value from getFileAffinity() it means the importer may be able to load data from the file if provided additional user input.

The given Importer should return a non-empty vector of a single default constructed Data Descriptor from getImportDescriptors() if given the same filename. For example, the "Generic Importer" will load raw data from any file as long as it formatted BIP, BSQ, or BIL, but will still require additional information from the user.

Definition at line 126 of file Importer.h.

const unsigned char Importer::CAN_LOAD_FILE_TYPE = 128 [static]

When an importer returns this value from getFileAffinity() it means the importer may be able to load data from the file if provided additional user input.

The given Importer should return a non-empty vector of DataDescriptors that are partially completed from getImportDescriptors() if given the same filename that will require additional user input. For example, the "Generic Hdf5 Importer" will locate all data within a Hdf5 file it could possibly load and return DataDescriptors for each, but will still require additional information from the user.

Definition at line 139 of file Importer.h.

const unsigned char Importer::CAN_LOAD = 192 [static]

When an importer returns this value from getFileAffinity() it means the importer can load data from the given file and the Importer will return a non-empty vector from getImportDescriptors() if given the same filename.

An importer can return a value greater than Importer::CAN_LOAD if it wishes to override a particular importer. For example, a specialized NITF importer may know details of how to load NITF files from a particular source.

Examples:
SampleRasterElementImporter.cpp.

Definition at line 152 of file Importer.h.


Software Development Kit - Opticks 4.9.0 Build 16218