Nitf::NitfImporterShell Class Reference

Base class for NITF importers. More...

#include <NitfImporterShell.h>

Inheritance diagram for Nitf::NitfImporterShell:

Inheritance graph

List of all members.

Public Member Functions

 NitfImporterShell ()
virtual ~NitfImporterShell ()
virtual std::vector
< ImportDescriptor * > 
getImportDescriptors (const std::string &filename)
virtual unsigned char getFileAffinity (const std::string &filename)
virtual bool validate (const DataDescriptor *pDescriptor, std::string &errorMessage) const
virtual SpatialDataViewcreateView () const
virtual PlugIngetGeoreferencePlugIn () const
virtual bool createRasterPager (RasterElement *pRaster) const

Static Public Member Functions

static EncodingType ossimImageHeaderToEncodingType (ossimNitfImageHeaderV2_X *pImgHeader)

Protected Member Functions

virtual int getValidationTest (const DataDescriptor *pDescriptor) const
virtual ImportDescriptorgetImportDescriptor (const std::string &filename, const std::string &imageName, const ossimNitfFile *pFile, const ossimNitfFileHeaderV2_X *pFileHeader, const ossimNitfImageHeaderV2_X *pImageSubheader)


Detailed Description

Base class for NITF importers.

Definition at line 28 of file NitfImporterShell.h.


Constructor & Destructor Documentation

Nitf::NitfImporterShell::NitfImporterShell (  ) 

Creates the NITF importer plug-in.

See also:
RasterElementImporterShell

virtual Nitf::NitfImporterShell::~NitfImporterShell (  )  [virtual]

Destroys the NITF importer plug-in.


Member Function Documentation

virtual std::vector<ImportDescriptor*> Nitf::NitfImporterShell::getImportDescriptors ( const std::string &  filename  )  [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

Default Implementation:
The default implementation returns image segments which can be imported by this importer.

Implements Importer.

virtual unsigned char Nitf::NitfImporterShell::getFileAffinity ( const std::string &  filename  )  [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.

Default Implementation:
The default implementation returns Importer::CAN_LOAD for all NITF 2.00 and NITF 2.10 files.

Implements Importer.

virtual bool Nitf::NitfImporterShell::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.
The default implementation also returns warnings when lookup tables (LUTs) or other issues are detected.

Reimplemented from RasterElementImporterShell.

virtual SpatialDataView* Nitf::NitfImporterShell::createView (  )  const [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.

Default Implementation:
The default implementation sets the background color.

Reimplemented from RasterElementImporterShell.

virtual PlugIn* Nitf::NitfImporterShell::getGeoreferencePlugIn (  )  const [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()

Default Implementation:
The default implementation returns the RPC Georeference plug-in when available and GCP Georeference otherwise.

Reimplemented from RasterElementImporterShell.

virtual bool Nitf::NitfImporterShell::createRasterPager ( RasterElement pRaster  )  const [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.

Default Implementation:
The default implementation creates an instance of the internal "NitfPager" plug-in.

Reimplemented from RasterElementImporterShell.

static EncodingType Nitf::NitfImporterShell::ossimImageHeaderToEncodingType ( ossimNitfImageHeaderV2_X *  pImgHeader  )  [static]

Return the data type of the specified image.

Parameters:
pImgHeader The parsed subheader for this image segment.
Returns:
The EncodingType to use for the specified image header.

virtual int Nitf::NitfImporterShell::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 RasterElementImporterShell.

virtual ImportDescriptor* Nitf::NitfImporterShell::getImportDescriptor ( const std::string &  filename,
const std::string &  imageName,
const ossimNitfFile *  pFile,
const ossimNitfFileHeaderV2_X *  pFileHeader,
const ossimNitfImageHeaderV2_X *  pImageSubheader 
) [protected, virtual]

Allocate and return an ImportDescriptor for the specified image.

This method should allocate an ImportDescriptor (if desired) and set whether it is imported by default. This method should not set any fields in the data descriptor or the file descriptor of the import descriptor. If changes to the defaults are required, the subclass should override getImportDescriptors(), call the base class implementation, and then make the necessary changes.

Parameters:
filename The full path and name of the file.
imageName The name which will be used for image identification. This is a string of the form "I1", "I2", etc. Using this name for the import descriptor is optional. This name will be used for the default pager and image segment.
pFile The NITF file being loaded.
pFileHeader The parsed header for this NITF file.
pImageSubheader The parsed subheader for this image segment.
Returns:
A pointer to a newly created ImportDescriptor or NULL if no ImportDescriptor should be created.
See also:
getImportDescriptors()
Default Implementation:
The default implementation returns a descriptor marked as imported for all image segments except those marked as NODISPLY.


Software Development Kit - Opticks 4.9.0 Build 16218