OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ossimNitfWriter Class Reference

#include <ossimNitfWriter.h>

Inheritance diagram for ossimNitfWriter:
ossimNitfWriterBase ossimImageFileWriter ossimImageWriter ossimProcessInterface ossimConnectableObjectListener ossimOutputSource ossimListener ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimNitfWriter (const ossimFilename &filename=ossimFilename(""), ossimImageSource *inputSource=(ossimImageSource *) NULL)
 
virtual ~ossimNitfWriter ()
 
virtual bool isOpen () const
 
virtual bool open ()
 
virtual void close ()
 
virtual void getImageTypeList (std::vector< ossimString > &imageTypeList) const
 void getImageTypeList(std::vector<ossimString>& imageTypeList)const More...
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 Set the properties. More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 Gets a property. More...
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
void addRegisteredTag (ossimRefPtr< ossimNitfRegisteredTag > registeredTag, bool unique=true)
 
void addRegisteredTag (ossimRefPtr< ossimNitfRegisteredTag > registeredTag, bool unique, const ossim_uint32 &ownerIndex, const ossimString &tagType)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Saves the state of the writer to kwl with prefix then calls base class ossimImageFileWriter::saveState. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Initializes the state of the writer from kwl with prefix then calls base class ossimImageFileWriter::loadState. More...
 
virtual bool addTextToNitf (std::string &inputText)
 
virtual void getTileSize (ossimIpt &size) const
 Gets the block size. More...
 
virtual void setTileSize (const ossimIpt &tileSize)
 Sets the nitf output block size. More...
 
virtual ossimNitfImageHeaderV2_1getImageHeader ()
 Get the image header used for export. More...
 
virtual ossimNitfFileHeaderV2_1getFileHeader ()
 Get the file header used for export. More...
 
virtual void addDataExtensionSegment (const ossimNitfDataExtensionSegmentV2_1 &des, bool allowTreOverflow)
 Add a DES to the file. More...
 
- Public Member Functions inherited from ossimNitfWriterBase
 ossimNitfWriterBase ()
 default constructor More...
 
 ossimNitfWriterBase (const ossimFilename &filename, ossimImageSource *inputSource)
 Constructor that takes filename and input source. More...
 
virtual ~ossimNitfWriterBase ()
 
virtual ossimString getExtension () const
 Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions. More...
 
virtual void addRegisteredTag (ossimRefPtr< ossimNitfRegisteredTag > registeredTag)
 
virtual void setFileHeaderV2_1 (ossimRefPtr< ossimNitfFileHeaderV2_1 >, bool preferSource=false)
 
virtual void setImageHeaderV2_1 (ossimRefPtr< ossimNitfImageHeaderV2_1 >, bool preferSource=false)
 
- Public Member Functions inherited from ossimImageFileWriter
 ossimImageFileWriter (const ossimFilename &filename=ossimFilename(), ossimImageSource *inputSource=0, ossimObject *owner=0)
 The writer will own the sequencer. More...
 
virtual ~ossimImageFileWriter ()
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual bool getOutputHasInternalOverviews (void) const
 Examples of writers that always generate internal overviews are ossim_kakadu_jp2 and ossim_kakadu_nitf_j2k. More...
 
virtual bool hasImageType (const ossimString &imageType) const
 bool hasImageType(const ossimString& imageType) const More...
 
virtual bool writeEnviHeaderFile ()
 Will write an envi header file. More...
 
virtual bool writeErsHeaderFile ()
 Will write an ER Mapper header file. More...
 
virtual bool writeExternalGeometryFile ()
 Will write an external geometry file. More...
 
virtual bool writeFgdcFile ()
 Will write an fgdc file. More...
 
virtual bool writeHistogramFile ()
 Returns true on success, false on error. More...
 
virtual bool writeJpegWorldFile ()
 Will write a jpeg world file. More...
 
virtual bool writeOverviewFile (ossim_uint16 tiff_compress_type=1, ossim_int32 jpeg_compress_quality=75, bool includeR0=false)
 Write out an ossim overview file from the source_file. More...
 
virtual bool writeReadmeFile ()
 Will write a readme file. More...
 
virtual bool writeTiffWorldFile ()
 Will write a world file. More...
 
virtual bool writeWorldFile ()
 Will write a world file. More...
 
virtual bool writeMetaDataFiles ()
 Convenience method that calls meta data write methods that are flagged to be called. More...
 
virtual void setAreaOfInterest (const ossimIrect &inputRect)
 
virtual void changeSequencer (ossimImageSourceSequencer *sequencer)
 Sets the sequencer and connects it to the input of this. More...
 
virtual ossimImageSourceSequencergetSequencer ()
 
virtual void initialize ()
 Initialize method. More...
 
virtual bool execute ()
 Calls: writeFile() writeMetaDataFiles() More...
 
virtual bool writeStream ()
 Method to write the image to a stream. More...
 
virtual bool setOutputStream (ossimRefPtr< ossimOStream > stream)
 Sets the output stream to write to. More...
 
virtual bool setOutputStream (std::ostream &str)
 tmp drb More...
 
virtual ossimRefPtr< ossimOStreamgetOutputStream () const
 Method to return the stream attached to output. More...
 
virtual void setPercentComplete (double percentComplete)
 
virtual void setOutputImageType (ossim_int32 type)
 
virtual void setOutputImageType (const ossimString &type)
 
virtual ossim_int32 getOutputImageType () const
 
virtual ossimString getOutputImageTypeString () const
 
virtual void setOutputName (const ossimString &outputName)
 
virtual void setFilename (const ossimFilename &file)
 
virtual const ossimFilenamegetFilename () const
 
virtual bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual bool getWriteImageFlag () const
 Control flags... More...
 
virtual bool getWriteHistogramFlag () const
 
virtual bool getWriteOverviewFlag () const
 
virtual bool getScaleToEightBitFlag () const
 
virtual bool getWriteEnviHeaderFlag () const
 
virtual bool getWriteErsHeaderFlag () const
 
virtual bool getWriteExternalGeometryFlag () const
 
virtual bool getWriteFgdcFlag () const
 
virtual bool getWriteJpegWorldFileFlag () const
 
virtual bool getWriteReadmeFlag () const
 
virtual bool getWriteTiffWorldFileFlag () const
 
virtual bool getWriteWorldFileFlag () const
 
virtual void setWriteImageFlag (bool flag)
 
virtual void setWriteOverviewFlag (bool flag)
 
virtual void setWriteHistogramFlag (bool flag)
 
virtual void setScaleToEightBitFlag (bool flag)
 
virtual void setWriteEnviHeaderFlag (bool flag)
 
virtual void setWriteErsHeaderFlag (bool flag)
 
virtual void setWriteExternalGeometryFlag (bool flag)
 
virtual void setWriteFgdcFlag (bool flag)
 
virtual void setWriteJpegWorldFile (bool flag)
 
virtual void setWriteReadme (bool flag)
 
virtual void setWriteTiffWorldFile (bool flag)
 
virtual void setWriteWorldFile (bool flag)
 
virtual ossim_uint16 getOverviewCompressType () const
 
virtual ossim_int32 getOverviewJpegCompressQuality () const
 
virtual void setOverviewCompressType (ossim_uint16 type)
 
virtual void setOverviewJpegCompressQuality (ossim_int32 quality)
 
virtual bool addListener (ossimListener *listener)
 Overrides base "addListener" this will capture the pointer and then call the base class "addListener". More...
 
virtual bool removeListener (ossimListener *listener)
 Overrides base "removeListener". More...
 
virtual void setPixelType (ossimPixelType type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual void setPixelType (const ossimString &type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual ossimPixelType getPixelType () const
 
virtual void getPixelTypeString (ossimString &type) const
 
- Public Member Functions inherited from ossimImageWriter
 ossimImageWriter (ossimObject *owner=NULL)
 
 ossimImageWriter (ossimObject *owner, ossim_uint32 numberOfInputs, ossim_uint32 numberOfOutputs, bool inputListIsFixed, bool outputListIsFixed)
 
virtual ~ossimImageWriter ()
 
virtual bool setViewingRect (const ossimIrect &aRect)
 
virtual ossimIrect getAreaOfInterest () const
 
- Public Member Functions inherited from ossimOutputSource
 ossimOutputSource (ossimObject *owner=NULL)
 
 ossimOutputSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimOutputSource ()
 
virtual bool open (const ossimString &outputName)
 
virtual const ossimStringgetOutputName ()
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
virtual void abort ()
 
bool needsAborting () const
 
bool isAbortRequested () const
 
bool isAborted () const
 
bool isExecuting () const
 
ossimProcessStatus getProcessStatus () const
 
virtual void setProcessStatus (ossimProcessStatus processStatus)
 
virtual double getPercentComplete () const
 
virtual ossimListenerManagergetManager ()
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
virtual void refreshEvent (ossimRefreshEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Protected Member Functions

virtual bool writeFile ()
 
virtual bool writeBlockBandSeparate ()
 write out block band separate More...
 
virtual bool writeBlockBandSequential ()
 Outputs in band sequential format. More...
 
- Protected Member Functions inherited from ossimNitfWriterBase
void writeGeometry (ossimNitfImageHeaderV2_X *hdr, ossimImageSourceSequencer *seq)
 Populates tags with geometry info from projection. More...
 
void addBlockaTag (ossimMapProjectionInfo &mapInfo, ossimNitfImageHeaderV2_X *hdr)
 Adds the BLOCKA tag. More...
 
void addGeolobTag (const ossimMapProjection *mapProj, ossimNitfImageHeaderV2_X *hdr)
 Adds the GEOLOB tag. More...
 
void addRpcbTag (const ossimIrect &rect, ossimProjection *proj, ossimNitfImageHeaderV2_X *hdr)
 Adds the RPC00B tag. More...
 
void setComplexityLevel (std::streamoff, ossimNitfFileHeaderV2_X *hdr)
 Sets the complexity level of theFileHeader. More...
 
void setComplexityLevel (ossimNitfFileHeaderV2_X *hdr, ossim_uint64 width=0, ossim_uint64 height=0)
 
virtual void initializeDefaultsFromConfigFile (ossimNitfFileHeaderV2_X *fileHdr, ossimNitfImageHeaderV2_X *imgHdr)
 Sets file header and image header defaults from config file if found in preferences. More...
 
- Protected Member Functions inherited from ossimImageFileWriter
bool writeWorldFile (const ossimFilename &file)
 Common world file writer method. More...
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

std::shared_ptr< ossim::ofstreamm_str
 Currently disabled... More...
 
ossimRefPtr< ossimNitfFileHeaderV2_1m_fileHeader
 
ossimRefPtr< ossimNitfImageHeaderV2_1m_imageHeader
 
std::vector< ossimNitfDataExtensionSegmentV2_1m_dataExtensionSegments
 
ossimRefPtr< ossimNitfTextHeaderV2_1m_textHeader
 
std::string m_textEntry
 
ossimIpt m_blockSize
 
- Protected Attributes inherited from ossimNitfWriterBase
bool theEnableRpcbTagFlag
 If true user wants to set RPC00B tag. More...
 
bool theEnableBlockaTagFlag
 If true user wants to set BLOCKA tag. More...
 
bool theEnableGeolobTagFlag
 If true user wants to set GEOLOG tag. More...
 
- Protected Attributes inherited from ossimImageFileWriter
ossimRefPtr< ossimImageSourceSequencertheInputConnection
 
ossimRefPtr< ossimViewControllertheViewController
 
ossimListenertheProgressListener
 
ossimFilename theFilename
 
ossimString theOutputImageType
 
bool theWriteImageFlag
 
bool theWriteOverviewFlag
 
bool theWriteHistogramFlag
 
bool theScaleToEightBitFlag
 
ossim_uint16 theOverviewCompressType
 
ossim_int32 theOverviewJpegCompressQuality
 
bool theWriteEnviHeaderFlag
 External meta data writer flags. More...
 
bool theWriteErsHeaderFlag
 
bool theWriteExternalGeometryFlag
 
bool theWriteFgdcFlag
 
bool theWriteJpegWorldFileFlag
 
bool theWriteReadmeFlag
 
bool theWriteTiffWorldFileFlag
 
bool theWriteWorldFileFlag
 
bool theAutoCreateDirectoryFlag
 
ossimUnitType theLinearUnits
 If not a geographic projection this allows the user to set the linear units of the output tag to be: More...
 
ossimPixelType thePixelType
 OSSIM_PIXEL_IS_POINT = 0, OSSIM_PIXEL_IS_AREA = 1. More...
 
- Protected Attributes inherited from ossimImageWriter
ossimIrect theAreaOfInterest
 
- Protected Attributes inherited from ossimOutputSource
ossimString theOutputName
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Private Member Functions

void takeOverflowTags (bool useFileHeader, bool userDefinedTags)
 

Additional Inherited Members

- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 
- Public Types inherited from ossimProcessInterface
enum  ossimProcessStatus {
  PROCESS_STATUS_UNKNOWN = 0, PROCESS_STATUS_EXECUTING = 1, PROCESS_STATUS_ABORTED = 2, PROCESS_STATUS_ABORT_REQUEST = 3,
  PROCESS_STATUS_NOT_EXECUTING = 4
}
 

Detailed Description

Definition at line 32 of file ossimNitfWriter.h.

Constructor & Destructor Documentation

◆ ossimNitfWriter()

ossimNitfWriter::ossimNitfWriter ( const ossimFilename filename = ossimFilename(""),
ossimImageSource inputSource = (ossimImageSource*)NULL 
)

Definition at line 50 of file ossimNitfWriter.cpp.

References ossim::defaultTileSize(), ossimRefPtr< T >::get(), ossimNitfWriterBase::initializeDefaultsFromConfigFile(), m_blockSize, m_fileHeader, m_imageHeader, ossimNitfFileHeaderV2_X::setEncryption(), ossimNitfImageHeaderV2_X::setJustification(), and ossimImageFileWriter::theOutputImageType.

52  : ossimNitfWriterBase(filename, inputSource),
53  m_str(0),
54  m_fileHeader(0),
55  m_imageHeader(0),
56  m_textHeader(0),
57  m_textEntry(),
59 {
60  //---
61  // Since the internal nitf tags are not very accurate, write an external
62  // geometry out as default behavior. Users can disable this via the
63  // property interface or keyword list.
64  //---
65  // Added GEOLOB tag for geographic output. UTM is good with BLOCKA.
66  // No longer needed. (drb - 30 March 2018)
67  // setWriteExternalGeometryFlag(true);
68 
71 
72  // m_textHeader is conditional so we will not new here.
73 
74  theOutputImageType = "nitf_block_band_separate";
75 
76  //---
77  // The tile size can be set in the preferences via "tile_size" keyword.
78  // This will get it if set; else, set to default.
79  //---
81 
82  // These are always set:
85 
86  // Set any site defaults.
88  dynamic_cast<ossimNitfFileHeaderV2_X*>(m_fileHeader.get()),
89  dynamic_cast<ossimNitfImageHeaderV2_X*>(m_imageHeader.get()) );
90 }
ossimNitfWriterBase()
default constructor
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
#define OSSIM_DEFAULT_TILE_WIDTH
void setEncryption(const ossimString &encryption)
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
virtual void initializeDefaultsFromConfigFile(ossimNitfFileHeaderV2_X *fileHdr, ossimNitfImageHeaderV2_X *imgHdr)
Sets file header and image header defaults from config file if found in preferences.
std::string m_textEntry
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
ossimRefPtr< ossimNitfTextHeaderV2_1 > m_textHeader
#define OSSIM_DEFAULT_TILE_HEIGHT
void setJustification(const ossimString &value)

◆ ~ossimNitfWriter()

ossimNitfWriter::~ossimNitfWriter ( )
virtual

Definition at line 92 of file ossimNitfWriter.cpp.

References close(), m_fileHeader, m_imageHeader, and m_textHeader.

93 {
94  //---
95  // This looks like a leak but it's not as both of these are ossimRefPtr's.
96  //---
97  m_fileHeader=0;
98  m_imageHeader=0;
99  m_textHeader=0;
100 
101  close();
102 }
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
ossimRefPtr< ossimNitfTextHeaderV2_1 > m_textHeader
virtual void close()

Member Function Documentation

◆ addDataExtensionSegment()

void ossimNitfWriter::addDataExtensionSegment ( const ossimNitfDataExtensionSegmentV2_1 des,
bool  allowTreOverflow 
)
virtual

Add a DES to the file.

Parameters
desThe DES to add to the file.

Definition at line 887 of file ossimNitfWriter.cpp.

References ossimNitfDataExtensionSegmentV2_1::DESID_KW, ossimNitfDataExtensionSegmentV2_1::getProperty(), m_dataExtensionSegments, ossimRefPtr< T >::valid(), and ossimProperty::valueToString().

Referenced by takeOverflowTags().

888 {
889  if (allowTreOverflow == false)
890  {
892  if ( !pId.valid() ||
893  pId->valueToString() == "TRE_OVERFLOW" ||
894  pId->valueToString() == "REGISTERED EXTENSIONS" ||
895  pId->valueToString() == "CONTROLLED EXTENSIONS")
896  {
897  return;
898  }
899  }
900 
901  m_dataExtensionSegments.push_back(des);
902 }
virtual void valueToString(ossimString &valueResult) const =0
bool valid() const
Definition: ossimRefPtr.h:75
std::vector< ossimNitfDataExtensionSegmentV2_1 > m_dataExtensionSegments
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const

◆ addRegisteredTag() [1/2]

void ossimNitfWriter::addRegisteredTag ( ossimRefPtr< ossimNitfRegisteredTag registeredTag,
bool  unique = true 
)
virtual

Reimplemented from ossimNitfWriterBase.

Definition at line 749 of file ossimNitfWriter.cpp.

751 {
752  addRegisteredTag(registeredTag, unique, 1, ossimString("IXSHD"));
753 }
void addRegisteredTag(ossimRefPtr< ossimNitfRegisteredTag > registeredTag, bool unique=true)

◆ addRegisteredTag() [2/2]

void ossimNitfWriter::addRegisteredTag ( ossimRefPtr< ossimNitfRegisteredTag registeredTag,
bool  unique,
const ossim_uint32 ownerIndex,
const ossimString tagType 
)
virtual

Reimplemented from ossimNitfWriterBase.

Definition at line 755 of file ossimNitfWriter.cpp.

References ossimNitfImageHeader::addTag(), ossimNitfFileHeaderV2_1::addTag(), ossimRefPtr< T >::get(), m_fileHeader, m_imageHeader, ossimNitfTagInformation::setTagData(), and ossimNitfTagInformation::setTagType().

757 {
758  ossimNitfTagInformation tagInfo;
759  tagInfo.setTagData(registeredTag.get());
760  tagInfo.setTagType(tagType);
761 
762  switch (ownerIndex)
763  {
764  case 0:
765  {
766  m_fileHeader->addTag(tagInfo, unique);
767  break;
768  }
769 
770  case 1:
771  {
772  m_imageHeader->addTag(tagInfo, unique);
773  break;
774  }
775 
776  default:
777  {
778  // Do nothing
779  }
780  }
781 }
void addTag(ossimNitfTagInformation tag, bool unique=true)
void setTagType(const ossimString &tagType) const
virtual void addTag(const ossimNitfTagInformation &tag, bool unique=true)
void setTagData(ossimRefPtr< ossimNitfRegisteredTag > tagData)
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader

◆ addTextToNitf()

bool ossimNitfWriter::addTextToNitf ( std::string &  inputText)
virtual

Definition at line 783 of file ossimNitfWriter.cpp.

References m_textEntry, m_textHeader, and ossimRefPtr< T >::valid().

784 {
785  // Initialize the m_textHeader
786  m_textEntry = inputText;
787  if ( m_textHeader.valid() == false )
788  {
789  // Only created if we need it.
791  }
792  return true;
793 }
bool valid() const
Definition: ossimRefPtr.h:75
std::string m_textEntry
ossimRefPtr< ossimNitfTextHeaderV2_1 > m_textHeader

◆ close()

void ossimNitfWriter::close ( )
virtual

Generic interface to allow one to close a consumer. For displays this might minimize the window and free up internal pointers for file writers it will make sure the file stream is closed and flushed.

Implements ossimOutputSource.

Definition at line 134 of file ossimNitfWriter.cpp.

References m_str.

Referenced by open(), and ~ossimNitfWriter().

135 {
136  if(m_str)
137  {
138  m_str->close();
139  m_str.reset();
140  }
141 }
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...

◆ getFileHeader()

ossimNitfFileHeaderV2_1 * ossimNitfWriter::getFileHeader ( )
virtual

Get the file header used for export.

Warning
Many values will be overwritten at export time.
Returns
The file header.

Definition at line 882 of file ossimNitfWriter.cpp.

References ossimRefPtr< T >::get(), and m_fileHeader.

883 {
884  return m_fileHeader.get();
885 }
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader

◆ getImageHeader()

ossimNitfImageHeaderV2_1 * ossimNitfWriter::getImageHeader ( )
virtual

Get the image header used for export.

Warning
Many values will be overwritten at export time. This includes the ossimNitfImageBandV2_1, if the number of bands on the image header does not match that on the writer.
Returns
The image header.

Definition at line 877 of file ossimNitfWriter.cpp.

References ossimRefPtr< T >::get(), and m_imageHeader.

878 {
879  return m_imageHeader.get();
880 }
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader

◆ getImageTypeList()

void ossimNitfWriter::getImageTypeList ( std::vector< ossimString > &  imageTypeList) const
virtual

void getImageTypeList(std::vector<ossimString>& imageTypeList)const

Appends this writer image types to list "imageTypeList".

This writer has the following types: nitf_block_band_separate nitf_block_band_sequential

Parameters
imageTypeListstl::vector<ossimString> list to append to.

Implements ossimImageFileWriter.

Definition at line 188 of file ossimNitfWriter.cpp.

189 {
190  imageTypeList.push_back(ossimString("nitf_block_band_separate"));
191  imageTypeList.push_back(ossimString("nitf_block_band_sequential"));
192 }

◆ getProperty()

ossimRefPtr< ossimProperty > ossimNitfWriter::getProperty ( const ossimString name) const
virtual

Gets a property.

Parameters
Thename of the property to get.
Returns
The property if found.

Reimplemented from ossimNitfWriterBase.

Definition at line 235 of file ossimNitfWriter.cpp.

References ossimContainerProperty::addChildren(), ossimStringProperty::addConstraint(), ossimNitfWriterBase::getProperty(), ossimPropertyInterface::getPropertyList(), m_blockSize, m_fileHeader, m_imageHeader, ossimString::toString(), and ossimIpt::x.

236 {
237  ossimRefPtr<ossimProperty> result = 0;
238 
239  if(name == "file_header")
240  {
241  ossimContainerProperty* container = new ossimContainerProperty(name);
242  std::vector<ossimRefPtr<ossimProperty> > propertyList;
243 
244  m_fileHeader->getPropertyList(propertyList);
245  container->addChildren(propertyList);
246 
247  result = container;
248  }
249  else if(name == "image_header")
250  {
251  ossimContainerProperty* container = new ossimContainerProperty(name);
252  std::vector<ossimRefPtr<ossimProperty> > propertyList;
253 
254  m_imageHeader->getPropertyList(propertyList);
255  container->addChildren(propertyList);
256 
257  result = container;
258  }
259  else if(name == "des_header")
260  {
261  ossimContainerProperty* container = new ossimContainerProperty(name);
262  std::vector<ossimRefPtr<ossimProperty> > propertyList;
263 
264  // Create a temporary DES in order to populate propertyList.
266  des.getPropertyList(propertyList);
267  container->addChildren(propertyList);
268 
269  result = container;
270  }
271  else if(name == "block_size")
272  {
273  ossimStringProperty* stringProp =
274  new ossimStringProperty(name,
276  false); // editable flag
277  stringProp->addConstraint(ossimString("64"));
278  stringProp->addConstraint(ossimString("128"));
279  stringProp->addConstraint(ossimString("256"));
280  stringProp->addConstraint(ossimString("512"));
281  stringProp->addConstraint(ossimString("1024"));
282  stringProp->addConstraint(ossimString("2048"));
283  return stringProp;
284  }
285  else
286  {
288  }
289 
290  return result;
291 }
void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
static ossimString toString(bool aValue)
Numeric to string methods.
void addConstraint(const ossimString &value)
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
virtual void addChildren(std::vector< ossimRefPtr< ossimProperty > > &propertyList)
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
ossim_int32 x
Definition: ossimIpt.h:141
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property.

◆ getPropertyNames()

void ossimNitfWriter::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual
Parameters
propertyNamesArray to populate with property names.
Note
The following names are handled: file_header image_header des_header

Reimplemented from ossimNitfWriterBase.

Definition at line 293 of file ossimNitfWriter.cpp.

References ossimNitfWriterBase::getPropertyNames().

295 {
297 
298  propertyNames.push_back("file_header");
299  propertyNames.push_back("image_header");
300  propertyNames.push_back("des_header");
301  propertyNames.push_back("block_size");
302 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getTileSize()

void ossimNitfWriter::getTileSize ( ossimIpt size) const
virtual

Gets the block size.

Definition at line 794 of file ossimNitfWriter.cpp.

References m_blockSize, and size.

795 {
796  size = m_blockSize;
797 }
yy_size_t size

◆ isOpen()

bool ossimNitfWriter::isOpen ( ) const
virtual

Implements ossimOutputSource.

Definition at line 104 of file ossimNitfWriter.cpp.

References m_str.

Referenced by open(), and writeFile().

105 {
106  return (m_str ? m_str->is_open() : false);
107 }
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...

◆ loadState()

bool ossimNitfWriter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Initializes the state of the writer from kwl with prefix then calls base class ossimImageFileWriter::loadState.

Parameters
kwlKeyword list to initialize from.
prefixUsually something like: "object2."
Returns
true on success, false on failure.

Reimplemented from ossimNitfWriterBase.

Definition at line 871 of file ossimNitfWriter.cpp.

References ossimNitfWriterBase::loadState().

873 {
874  return ossimNitfWriterBase::loadState(kwl, prefix);
875 }
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Initializes the state of the writer from kwl with prefix then calls base class ossimImageFileWriter::...

◆ open()

bool ossimNitfWriter::open ( )
virtual

Allows a generic interface to open a consumer for writing. If you are a display writer then you would probably show the window or init the device context for writing.

Implements ossimOutputSource.

Definition at line 109 of file ossimNitfWriter.cpp.

References ossimString::c_str(), close(), isOpen(), m_str, and ossimImageFileWriter::theFilename.

Referenced by writeFile().

110 {
111  bool result = true;
112  if(isOpen())
113  {
114  close();
115  }
116 
117  // there is a bug in gcc < 5.0 and we can't use constructors in the
118  // C++11 build. Will refactor to do a new ifstream then use open
119  //
120  m_str = std::make_shared<ossim::ofstream>();
121  m_str->open(theFilename.c_str(), ios::out|ios::binary);
122  if(!m_str->is_open())
123  {
124  m_str.reset();
125  result = false;
126  }
127 
128  //new std::ofstream;
129  //m_str->open(theFilename.c_str(), ios::out|ios::binary);
130 
131  return result;
132 }
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...
virtual bool isOpen() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
virtual void close()

◆ saveState()

bool ossimNitfWriter::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Saves the state of the writer to kwl with prefix then calls base class ossimImageFileWriter::saveState.

Parameters
kwlKeyword list to save to.
prefixUsually something like: "object2."
Returns
true on success, false on failure.

Reimplemented from ossimNitfWriterBase.

Definition at line 865 of file ossimNitfWriter.cpp.

References ossimNitfWriterBase::saveState().

867 {
868  return ossimNitfWriterBase::saveState(kwl, prefix);
869 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the state of the writer to kwl with prefix then calls base class ossimImageFileWriter::saveStat...

◆ setProperty()

void ossimNitfWriter::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Set the properties.

Parameters
propertyThe property to set.

Reimplemented from ossimNitfWriterBase.

Definition at line 194 of file ossimNitfWriter.cpp.

References ossimRefPtr< T >::get(), ossimContainerProperty::getPropertyList(), m_fileHeader, m_imageHeader, PTR_CAST, ossimPropertyInterface::setProperties(), ossimNitfWriterBase::setProperty(), setTileSize(), ossimIpt::x, and ossimIpt::y.

195 {
196  if(!property) return;
197 
198  ossimString name = property->getName();
199 
200  if(name == "file_header")
201  {
203  property.get());
204  if(containerProperty)
205  {
206  std::vector<ossimRefPtr<ossimProperty> > propertyList;
207  containerProperty->getPropertyList(propertyList);
208  m_fileHeader->setProperties(propertyList);
209  }
210  }
211  else if(name == "image_header")
212  {
214  property.get());
215  if(containerProperty)
216  {
217  std::vector<ossimRefPtr<ossimProperty> > propertyList;
218  containerProperty->getPropertyList(propertyList);
219  m_imageHeader->setProperties(propertyList);
220  }
221  }
222  else if(name == "block_size")
223  {
224  ossimIpt blockSize;
225  blockSize.x = property->valueToString().toInt32();
226  blockSize.y = blockSize.x;
227  setTileSize(blockSize);
228  }
229  else
230  {
232  }
233 }
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Set the properties.
virtual void setTileSize(const ossimIpt &tileSize)
Sets the nitf output block size.
void setProperties(std::vector< ossimRefPtr< ossimProperty > > &propertyList)
virtual void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &children) const
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
ossim_int32 y
Definition: ossimIpt.h:142
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
ossim_int32 x
Definition: ossimIpt.h:141

◆ setTileSize()

void ossimNitfWriter::setTileSize ( const ossimIpt tileSize)
virtual

Sets the nitf output block size.

Must be divisible by 16.

Note: This is not called setBlockSize just because there was already a virtual setTileSize.

Parameters
tileSizeBlock size.

Reimplemented from ossimImageFileWriter.

Definition at line 799 of file ossimNitfWriter.cpp.

References ossimIpt::x, and ossimIpt::y.

Referenced by setProperty().

800 {
801  const ossim_int32 MIN_BLOCK_SIZE = 64;
802  if ( (tileSize.x % MIN_BLOCK_SIZE) || (tileSize.y % MIN_BLOCK_SIZE) )
803  {
804  if(traceDebug())
805  {
807  << "ossimNitfWriter::setTileSize ERROR:"
808  << "\nBlock size must be a multiple of " << MIN_BLOCK_SIZE
809  << "\nSize remains: " << m_blockSize
810  << std::endl;
811  }
812  }
813  else
814  {
815  m_blockSize = tileSize;
816  }
817 }
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ takeOverflowTags()

void ossimNitfWriter::takeOverflowTags ( bool  useFileHeader,
bool  userDefinedTags 
)
private

Definition at line 903 of file ossimNitfWriter.cpp.

References addDataExtensionSegment(), ossimNitfDataExtensionSegment::DE_KW, ossimNitfDataExtensionSegmentV2_1::DESID_KW, ossimNitfDataExtensionSegment::DESITEM_KW, ossimNitfDataExtensionSegment::DESOFLW_KW, ossimNitfDataExtensionSegment::DESVER_KW, m_dataExtensionSegments, m_fileHeader, m_imageHeader, ossimNitfDataExtensionSegmentV2_1::setProperty(), ossimNitfDataExtensionSegmentV2_1::setTagList(), ossimNitfImageHeaderV2_1::takeOverflowTags(), and ossimNitfFileHeaderV2_1::takeOverflowTags().

Referenced by writeBlockBandSeparate().

904 {
905  ossimString itemIndex;
906  std::vector<ossimNitfTagInformation> overflowTags;
907  const ossim_uint32 potentialDesIndex = m_dataExtensionSegments.size() + 1;
908 
909  if (useFileHeader)
910  {
911  m_fileHeader->takeOverflowTags(overflowTags, potentialDesIndex, userDefinedTags);
912  itemIndex = "0";
913  }
914  else
915  {
916  m_imageHeader->takeOverflowTags(overflowTags, potentialDesIndex, userDefinedTags);
917  itemIndex = "1";
918  }
919 
920  if (overflowTags.empty() == false)
921  {
925  des.setProperty(pDe);
926 
929  des.setProperty(pId);
930 
931  ossimRefPtr<ossimProperty> pVersion =
933  des.setProperty(pVersion);
934 
935  ossimRefPtr<ossimProperty> pOverflow =
936  new ossimStringProperty(ossimNitfDataExtensionSegmentV2_1::DESOFLW_KW, overflowTags[0].getTagType());
937  des.setProperty(pOverflow);
938 
941  des.setProperty(pItem);
942 
943  des.setTagList(overflowTags);
944  addDataExtensionSegment(des, true);
945  }
946 }
virtual bool takeOverflowTags(std::vector< ossimNitfTagInformation > &overflowTags, ossim_uint32 potentialDesIndex, bool userDefinedTags=false)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
bool takeOverflowTags(std::vector< ossimNitfTagInformation > &overflowTags, ossim_uint32 potentialDesIndex, bool userDefinedTags=false)
virtual void addDataExtensionSegment(const ossimNitfDataExtensionSegmentV2_1 &des, bool allowTreOverflow)
Add a DES to the file.
std::vector< ossimNitfDataExtensionSegmentV2_1 > m_dataExtensionSegments
unsigned int ossim_uint32
virtual void setTagList(const std::vector< ossimNitfTagInformation > &tagList)
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader

◆ writeBlockBandSeparate()

bool ossimNitfWriter::writeBlockBandSeparate ( )
protectedvirtual

write out block band separate

Returns
true on success and false on error

Definition at line 304 of file ossimNitfWriter.cpp.

References ossimNitfFileHeaderV2_1::addDataExtSegInfoRecord(), ossimNitfFileHeaderV2_1::addImageInfoRecord(), ossimNitfFileHeaderV2_1::addTextInfoRecord(), ossimRefPtr< T >::get(), ossim::getActualBitsPerPixel(), ossim::getBitsPerPixel(), ossimImageSourceSequencer::getBoundingRect(), ossimImageData::getBuf(), ossimNitfImageHeaderV2_X::getCompressionCode(), ossimImageData::getHeight(), ossimImageSourceSequencer::getNextTile(), ossimNitfCommon::getNitfPixelType(), ossimImageData::getNumberOfBands(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceSequencer::getNumberOfTiles(), ossimImageSourceSequencer::getNumberOfTilesHorizontal(), ossimImageSourceSequencer::getNumberOfTilesVertical(), ossimImageSourceSequencer::getOutputScalarType(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getSizeInBytes(), ossimEndian::getSystemEndianType(), ossimImageData::getWidth(), ossimIrect::height(), m_blockSize, m_dataExtensionSegments, m_fileHeader, m_imageHeader, m_str, m_textEntry, m_textHeader, ossimProcessInterface::needsAborting(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_LITTLE_ENDIAN, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, ossimNitfFileHeaderV2_1::replaceImageInfoRecord(), ossim::scalarSizeInBytes(), ossimNitfImageHeaderV2_X::setActualBitsPerPixel(), ossimNitfImageHeaderV2_1::setBandInfo(), ossimNitfImageBandV2_0::setBandRepresentation(), ossimNitfImageHeaderV2_X::setBitsPerPixel(), ossimNitfImageDataMaskV2_1::setBlockCount(), ossimNitfImageDataMaskV2_1::setBlockLengthInBytes(), ossimNitfImageHeaderV2_X::setBlocksPerCol(), ossimNitfImageHeaderV2_X::setBlocksPerRow(), ossimNitfImageHeaderV2_X::setCategory(), ossimNitfWriterBase::setComplexityLevel(), ossimNitfFileHeaderV2_X::setDate(), ossimNitfFileHeaderV2_1::setFileLength(), ossimNitfFileHeaderV2_1::setHeaderLength(), ossimNitfImageInfoRecordV2_1::setImageLength(), ossimNitfImageHeaderV2_X::setImageMode(), ossimNitfImageDataMaskV2_1::setIncludeBlock(), ossimNitfImageHeaderV2_1::setNumberOfBands(), ossimNitfImageHeaderV2_1::setNumberOfCols(), ossimNitfImageHeaderV2_X::setNumberOfPixelsPerBlockCol(), ossimNitfImageHeaderV2_X::setNumberOfPixelsPerBlockRow(), ossimNitfImageHeaderV2_1::setNumberOfRows(), ossimImageFileWriter::setPercentComplete(), ossimNitfImageHeaderV2_X::setPixelType(), ossimNitfImageHeaderV2_X::setRepresentation(), ossimNitfImageInfoRecordV2_1::setSubheaderLength(), ossimNitfTextFileInfoRecordV2_1::setSubheaderLength(), ossimNitfTextFileInfoRecordV2_1::setTextLength(), ossimImageSourceSequencer::setTileSize(), ossimImageSourceSequencer::setToStartOfSequence(), ossimEndian::swap(), takeOverflowTags(), ossimNitfDataExtSegInfoRecordV2_1::theDataExtSegLength, ossimNitfDataExtSegInfoRecordV2_1::theDataExtSegSubheaderLength, ossimImageFileWriter::theInputConnection, tileNumber, ossimRefPtr< T >::valid(), ossimIrect::width(), write(), ossimNitfTextHeaderV2_1::writeStream(), ossimNitfImageHeaderV2_1::writeStream(), ossimNitfImageDataMaskV2_1::writeStream(), ossimNitfFileHeaderV2_1::writeStream(), ossimIpt::x, and ossimIpt::y.

305 {
307  ossim_uint64 byteSize = ossim::scalarSizeInBytes(scalarType);
310  ossim_uint64 idx = 0;
311  ossim_uint64 headerStart = (ossim_uint64)m_str->tellp();
312 
313  // Set the sequencer block size to be the same as output.
315 
319 
320  ossimNitfImageInfoRecordV2_1 imageInfoRecord;
321  imageInfoRecord.setSubheaderLength(439); // ok if no tags
322  imageInfoRecord.setImageLength(bands*byteSize*blocksVertical*m_blockSize.y*blocksHorizontal*m_blockSize.x);
323 
325  m_fileHeader->addImageInfoRecord(imageInfoRecord);
326 
327  if ( m_textHeader.valid() )
328  {
329  // Add any text headers
330  ossimNitfTextFileInfoRecordV2_1 textInfoRecord;
331  textInfoRecord.setSubheaderLength(285); //default
332  // Set length of text to be that of input text
333  textInfoRecord.setTextLength(m_textEntry.length());
334  m_fileHeader->addTextInfoRecord(textInfoRecord);
335  }
336 
337  // Get the overflow tags from the file header and the image subheader
338  takeOverflowTags(true, true);
339  takeOverflowTags(true, false);
340  takeOverflowTags(false, true);
341  takeOverflowTags(false, false);
342 
343  for (vector<ossimNitfDataExtensionSegmentV2_1>::iterator iter = m_dataExtensionSegments.begin();
344  iter != m_dataExtensionSegments.end(); iter++)
345  {
346  ossimNitfDataExtSegInfoRecordV2_1 desInfoRecord;
347  iter->setSecurityMarkings(*m_fileHeader);
348  std::ostringstream headerOut;
349  headerOut << std::setw(4)
350  << std::setfill('0')
351  << std::setiosflags(ios::right)
352  << iter->getHeaderLength();
353  strcpy(desInfoRecord.theDataExtSegSubheaderLength, headerOut.str().c_str());
354 
355  std::ostringstream dataOut;
356  dataOut << std::setw(9)
357  << std::setfill('0')
358  << std::setiosflags(ios::right)
359  << iter->getDataLength();
360  strcpy(desInfoRecord.theDataExtSegLength, dataOut.str().c_str());
361 
362  m_fileHeader->addDataExtSegInfoRecord(desInfoRecord);
363  }
364 
365  //---
366  // This makes space for the file header; it is written again at the end of
367  // this method with updated values
368  // need a better way to get the length. This should be queried on the
369  // header before writing
370  //---
372  ossim_uint64 headerLength = ((ossim_uint64)m_str->tellp() - headerStart) /* + 1 */;
373 
374  ossimString representation;
379  m_imageHeader->setImageMode('B');// blocked
380 
381  bool masked = (m_imageHeader->getCompressionCode() == "NM");
383  datamask.setBlockCount(blocksVertical * blocksHorizontal);
384  ossim_uint64 blockLength = bands * byteSize * m_blockSize.x * m_blockSize.y;
385  datamask.setBlockLengthInBytes(blockLength);
386  std::vector<char> blockZeros;
387 
388 
389  if((bands == 3)&&
390  (scalarType == OSSIM_UCHAR))
391  {
393  m_imageHeader->setCategory("VIS");
394  }
395  else if(bands == 1)
396  {
398  m_imageHeader->setCategory("VIS");
399  }
400  else
401  {
403  m_imageHeader->setCategory("MS");
404  }
405 
406  m_imageHeader->setBlocksPerRow(blocksHorizontal);
407  m_imageHeader->setBlocksPerCol(blocksVertical);
412 
413  ossimNitfImageBandV2_1 bandInfo;
414  for(idx = 0; idx < bands; ++idx)
415  {
416  std::ostringstream out;
417 
418  out << std::setfill('0')
419  << std::setw(2)
420  << idx;
421 
422  bandInfo.setBandRepresentation(out.str().c_str());
423  m_imageHeader->setBandInfo(idx, bandInfo);
424  }
425 
426  ossim_uint64 imageHeaderStart = m_str->tellp();
428  ossim_uint64 imageHeaderEnd = m_str->tellp();
429  ossim_uint64 imageHeaderSize = imageHeaderEnd - imageHeaderStart;
430 
431  // Start the sequence through tiles:
433 
436  ossimEndian endian;
437 
438  // write out mask if needed
439  if(masked)
440  {
441  blockZeros.resize(blockLength);
442  memset(&blockZeros.front(), '\0', blockLength);
443  datamask.writeStream( *m_str );
444  }
445  while( data.valid() && !needsAborting())
446  {
447  bool write = true;
449  {
450  switch(data->getScalarType())
451  {
452  case OSSIM_USHORT16:
453  case OSSIM_USHORT11:
454  case OSSIM_USHORT12:
455  case OSSIM_USHORT13:
456  case OSSIM_USHORT14:
457  case OSSIM_USHORT15:
458  {
459  endian.swap((ossim_uint16*)data->getBuf(),
460  data->getWidth()*data->getHeight()*data->getNumberOfBands());
461  break;
462  }
463  case OSSIM_SSHORT16:
464  {
465  endian.swap((ossim_sint16*)data->getBuf(),
466  data->getWidth()*data->getHeight()*data->getNumberOfBands());
467  break;
468  }
469  case OSSIM_FLOAT:
471  {
472  endian.swap((ossim_float32*)data->getBuf(),
473  data->getWidth()*data->getHeight()*data->getNumberOfBands());
474  break;
475  }
476  case OSSIM_DOUBLE:
478  {
479  endian.swap((ossim_float64*)data->getBuf(),
480  data->getWidth()*data->getHeight()*data->getNumberOfBands());
481  break;
482  }
483  default:
484  break;
485  }
486  }
487 
488  if (masked)
489  {
490  if (memcmp(data->getBuf(), &blockZeros.front(), blockLength) == 0)
491  {
492  write = false;
493  datamask.setIncludeBlock(tileNumber-1, false);
494  }
495  }
496  if(write)
497  {
498  m_str->write((char*)(data->getBuf()), data->getSizeInBytes());
499  }
500 
501  setPercentComplete(((double)tileNumber / (double)numberOfTiles) * 100);
502 
503  if(!needsAborting())
504  {
506  }
507  ++tileNumber;
508  }
509 
510  // ossim_uint64 imageSegmentEnd = m_str->tellp();
511 
512  // Let's write our text header
513  if ( m_textHeader.valid() )
514  {
516  //Now write the text
517  m_str->write((char*)(m_textEntry.c_str()), m_textEntry.length());
518  }
519 
520 
521  for (vector<ossimNitfDataExtensionSegmentV2_1>::iterator iter = m_dataExtensionSegments.begin();
522  iter != m_dataExtensionSegments.end(); iter++)
523  {
524  iter->writeStream( *m_str );
525  }
526 
527  if (masked)
528  {
529  m_str->seekp(imageHeaderEnd);
530  datamask.writeStream( *m_str );
531  //delete [] blockZeros;
532  }
533 
534  std::streamoff pos = m_str->tellp();
535 
537 
538  /*
539  * Need to change the way I compute file length and header length later
540  * We need to figure out a better way to compute.
541  */
542  m_fileHeader->setFileLength(static_cast<ossim_uint64>(pos));
543  m_fileHeader->setHeaderLength(headerLength);
544  m_str->seekp(0, ios::beg);
545  imageInfoRecord.setSubheaderLength(imageHeaderSize);
546  m_fileHeader->replaceImageInfoRecord(0, imageInfoRecord);
548 
549  return true;
550 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
void setBlockLengthInBytes(ossim_uint32 blockLength)
void setPixelType(const ossimString &pixelType=ossimString("INT"))
virtual void setFileLength(ossim_uint64 fileLength)
Sets file length (FL) field.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() const
void setNumberOfPixelsPerBlockRow(ossim_uint32 pixels)
void setActualBitsPerPixel(ossim_uint32 bitsPerPixel)
virtual void setNumberOfBands(ossim_uint32 nbands)
ossim_uint32 tileNumber
void setDate(const ossimLocalTm &d)
Sets field FDT.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual void addDataExtSegInfoRecord(const ossimNitfDataExtSegInfoRecordV2_1 &recordInfo)
virtual void writeStream(std::ostream &out)
bool valid() const
Definition: ossimRefPtr.h:75
void setBlockCount(ossim_uint32 blockCount)
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...
float ossim_float32
virtual void writeStream(std::ostream &out)
void setSubheaderLength(ossim_uint32 length)
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
static ossimString getNitfPixelType(ossimScalarType scalarType)
Get the nitf pixel type string from scalar type.
char theDataExtSegLength[10]
Is a 9 byte numeric 0-999999999.
virtual void setHeaderLength(ossim_uint64 headerLength)
Sets header length (HL) field.
virtual void replaceImageInfoRecord(int i, const ossimNitfImageInfoRecordV2_1 &recordInfo)
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
OSSIM_DLL ossim_uint32 getActualBitsPerPixel(ossimScalarType scalarType)
Get actual bits per pixel for a given scalar type.
16 bit unsigned integer (13 bits used)
char theDataExtSegSubheaderLength[5]
Is a 4 byte numeric 200-9999.
unsigned short ossim_uint16
void setBitsPerPixel(ossim_uint32 bitsPerPixel)
double ossim_float64
void setBlocksPerRow(ossim_uint32 blocks)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
void takeOverflowTags(bool useFileHeader, bool userDefinedTags)
virtual ossim_uint32 getSizeInBytes() const
Returns the total number of bytes for all bands.
signed short ossim_sint16
std::vector< ossimNitfDataExtensionSegmentV2_1 > m_dataExtensionSegments
void setCategory(const ossimString &category)
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned long long ossim_uint64
void setImageLength(ossim_uint64 length)
32 bit normalized floating point
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
void setIncludeBlock(ossim_uint32 blockNumber, bool included)
void setNumberOfPixelsPerBlockCol(ossim_uint32 pixels)
ossim_uint32 width() const
Definition: ossimIrect.h:500
virtual void setNumberOfRows(ossim_uint32 rows)
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
ossimScalarType
OSSIM_DLL ossim_uint32 getBitsPerPixel(ossimScalarType scalarType)
Get bits per pixel for a given scalar type.
virtual void addImageInfoRecord(const ossimNitfImageInfoRecordV2_1 &recordInfo)
virtual void setNumberOfCols(ossim_uint32 cols)
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
ossim_int64 getNumberOfTilesHorizontal() const
void setBlocksPerCol(ossim_uint32 blocks)
void setRepresentation(const ossimString &rep)
std::string m_textEntry
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
void setComplexityLevel(std::streamoff, ossimNitfFileHeaderV2_X *hdr)
Sets the complexity level of theFileHeader.
ossimRefPtr< ossimNitfTextHeaderV2_1 > m_textHeader
virtual void writeStream(ossim::ostream &out)
str write(os2.str().data(), os2.str().size())
ossim_int32 x
Definition: ossimIpt.h:141
virtual void setBandRepresentation(const ossimString &rep)
Sets the band representation.
virtual void setPercentComplete(double percentComplete)
virtual void setTileSize(const ossimIpt &tileSize)
32 bit floating point
virtual void addTextInfoRecord(const ossimNitfTextFileInfoRecordV2_1 &recordInfo)
void setSubheaderLength(ossim_uint64 length)
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
ossim_int64 getNumberOfTilesVertical() const
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)
virtual void setBandInfo(ossim_uint32 idx, const ossimNitfImageBandV2_1 &info)

◆ writeBlockBandSequential()

bool ossimNitfWriter::writeBlockBandSequential ( )
protectedvirtual

Outputs in band sequential format.

Band 1 is followed by band 2, ... etc.

Definition at line 552 of file ossimNitfWriter.cpp.

References ossimNitfFileHeaderV2_1::addImageInfoRecord(), ossimNitfFileHeaderV2_1::addTextInfoRecord(), ossimRefPtr< T >::get(), ossim::getActualBitsPerPixel(), ossim::getBitsPerPixel(), ossimImageSourceSequencer::getBoundingRect(), ossimImageData::getBuf(), ossimImageData::getHeight(), ossimImageSourceSequencer::getNextTile(), ossimNitfCommon::getNitfPixelType(), ossimImageData::getNumberOfBands(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceSequencer::getNumberOfTiles(), ossimImageSourceSequencer::getNumberOfTilesHorizontal(), ossimImageSourceSequencer::getNumberOfTilesVertical(), ossimImageSourceSequencer::getOutputScalarType(), ossimRectilinearDataObject::getScalarType(), ossimEndian::getSystemEndianType(), ossimImageData::getWidth(), ossimIrect::height(), m_blockSize, m_fileHeader, m_imageHeader, m_str, m_textEntry, m_textHeader, ossimProcessInterface::needsAborting(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_LITTLE_ENDIAN, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, ossimNitfFileHeaderV2_1::replaceImageInfoRecord(), ossim::scalarSizeInBytes(), ossimNitfImageHeaderV2_X::setActualBitsPerPixel(), ossimNitfImageHeaderV2_1::setBandInfo(), ossimNitfImageBandV2_0::setBandRepresentation(), ossimNitfImageHeaderV2_X::setBitsPerPixel(), ossimNitfImageHeaderV2_X::setBlocksPerCol(), ossimNitfImageHeaderV2_X::setBlocksPerRow(), ossimNitfImageHeaderV2_X::setCategory(), ossimNitfWriterBase::setComplexityLevel(), ossimNitfFileHeaderV2_X::setDate(), ossimNitfFileHeaderV2_1::setFileLength(), ossimNitfFileHeaderV2_1::setHeaderLength(), ossimNitfImageInfoRecordV2_1::setImageLength(), ossimNitfImageHeaderV2_X::setImageMode(), ossimNitfImageHeaderV2_1::setNumberOfBands(), ossimNitfImageHeaderV2_1::setNumberOfCols(), ossimNitfImageHeaderV2_X::setNumberOfPixelsPerBlockCol(), ossimNitfImageHeaderV2_X::setNumberOfPixelsPerBlockRow(), ossimNitfImageHeaderV2_1::setNumberOfRows(), ossimImageFileWriter::setPercentComplete(), ossimNitfImageHeaderV2_X::setPixelType(), ossimNitfImageHeaderV2_X::setRepresentation(), ossimNitfImageInfoRecordV2_1::setSubheaderLength(), ossimNitfTextFileInfoRecordV2_1::setSubheaderLength(), ossimNitfTextFileInfoRecordV2_1::setTextLength(), ossimImageSourceSequencer::setTileSize(), ossimImageSourceSequencer::setToStartOfSequence(), ossimEndian::swap(), ossimImageFileWriter::theInputConnection, tileNumber, ossimRefPtr< T >::valid(), ossimIrect::width(), ossimNitfTextHeaderV2_1::writeStream(), ossimNitfImageHeaderV2_1::writeStream(), ossimNitfFileHeaderV2_1::writeStream(), ossimIpt::x, and ossimIpt::y.

553 {
555  ossim_uint64 byteSize = ossim::scalarSizeInBytes(scalarType);
558  ossim_uint64 idx = 0;
559  ossim_uint64 headerStart = (ossim_uint64)m_str->tellp();
560 
561  // Set the sequencer block size to be the same as output.
563 
567 
568  ossimNitfImageInfoRecordV2_1 imageInfoRecord;
569  imageInfoRecord.setSubheaderLength(439);
570  imageInfoRecord.setImageLength(bands*byteSize*blocksHorizontal*blocksVertical*m_blockSize.x*m_blockSize.y);
571 
573  m_fileHeader->addImageInfoRecord(imageInfoRecord);
574 
575  if ( m_textHeader.valid() )
576  {
577  // Add any text headers
578  ossimNitfTextFileInfoRecordV2_1 textInfoRecord;
579  textInfoRecord.setSubheaderLength(285); //default
580  // Set length of text to be that of input text
581  textInfoRecord.setTextLength(m_textEntry.length());
582  m_fileHeader->addTextInfoRecord(textInfoRecord);
583  }
584 
585  //---
586  // This makes space for the file header; it is written again at the end of
587  // this method with updated values
588  // need a better way to get the length. This should be queried on the
589  // header before writing
590  //---
592  ossim_uint64 headerLength = ((ossim_uint64)m_str->tellp() - headerStart) /* + 1 */;
593 
594  ossimString representation;
599  m_imageHeader->setImageMode('S');// blocked
600 
601  if((bands == 3)&&
602  (scalarType == OSSIM_UCHAR))
603  {
605  m_imageHeader->setCategory("VIS");
606  }
607  else if(bands == 1)
608  {
610  m_imageHeader->setCategory("VIS");
611  }
612  else
613  {
615  m_imageHeader->setCategory("MS");
616  }
617  m_imageHeader->setBlocksPerRow(blocksHorizontal);
618  m_imageHeader->setBlocksPerCol(blocksVertical);
623 
624  ossimNitfImageBandV2_1 bandInfo;
625  for(idx = 0; idx < bands; ++idx)
626  {
627  std::ostringstream out;
628 
629  out << std::setfill('0')
630  << std::setw(2)
631  << idx;
632 
633  bandInfo.setBandRepresentation(out.str().c_str());
634  m_imageHeader->setBandInfo(idx, bandInfo);
635  }
636 
637  ossim_uint64 imageHeaderStart = m_str->tellp();
639  ossim_uint64 imageHeaderEnd = m_str->tellp();
640  ossim_uint64 imageHeaderSize = imageHeaderEnd - imageHeaderStart;
641 
642  // ossimIpt ul = rect.ul();
643 
644  // Start the sequence through tiles:
646 
649  ossimEndian endian;
650 
651  // get the start to the first band of data block
652  //
653  ossim_uint64 streamOffset = m_str->tellp();
654 
655  // holds the total pixels to the next band
656 
658  ossim_uint64 bandOffsetInBytes = (blockSizeInBytes*blocksHorizontal*blocksVertical);
659 
660  bool needSwapping = endian.getSystemEndianType() == OSSIM_LITTLE_ENDIAN;
661  while(data.valid() && !needsAborting())
662  {
663  if(needSwapping)
664  {
665  switch(data->getScalarType())
666  {
667  case OSSIM_USHORT16:
668  case OSSIM_USHORT11:
669  case OSSIM_USHORT12:
670  case OSSIM_USHORT13:
671  case OSSIM_USHORT14:
672  case OSSIM_USHORT15:
673  {
674  endian.swap((ossim_uint16*)data->getBuf(),
675  data->getWidth()*data->getHeight()*data->getNumberOfBands());
676  break;
677  }
678  case OSSIM_SSHORT16:
679  {
680  endian.swap((ossim_sint16*)data->getBuf(),
681  data->getWidth()*data->getHeight()*data->getNumberOfBands());
682  break;
683  }
684  case OSSIM_FLOAT:
686  {
687  endian.swap((ossim_float32*)data->getBuf(),
688  data->getWidth()*data->getHeight()*data->getNumberOfBands());
689  break;
690  }
691  case OSSIM_DOUBLE:
693  {
694  endian.swap((ossim_float64*)data->getBuf(),
695  data->getWidth()*data->getHeight()*data->getNumberOfBands());
696  break;
697  }
698  default:
699  break;
700  }
701  }
702 
703  for(idx = 0; idx < bands; ++idx)
704  {
705  m_str->seekp(streamOffset+ // start of image stream
706  tileNumber*blockSizeInBytes + // start of block for band separate output
707  bandOffsetInBytes*idx, // which band offset is it
708  ios::beg);
709 
710  m_str->write((char*)(data->getBuf(idx)),
711  blockSizeInBytes);
712  }
713  ++tileNumber;
714 
715  setPercentComplete(((double)tileNumber / (double)numberOfTiles) * 100);
716 
717  if(!needsAborting())
718  {
720  }
721  }
722 
723  // Let's write our text header
724  if ( m_textHeader.valid() )
725  {
727  //Now write the text
728  m_str->write((char*)(m_textEntry.c_str()), m_textEntry.length());
729  }
730 
731  ossim_uint64 pos = m_str->tellp();
732 
734 
735  /*
736  * Need to change the way I compute file length and header length later
737  * We need to figure out a better way to compute.
738  */
739  m_fileHeader->setFileLength(static_cast<ossim_uint64>(pos));
740  m_fileHeader->setHeaderLength(headerLength);
741  m_str->seekp(0, ios::beg);
742  imageInfoRecord.setSubheaderLength(imageHeaderSize);
743  m_fileHeader->replaceImageInfoRecord(0, imageInfoRecord);
745 
746  return true;
747 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
void setPixelType(const ossimString &pixelType=ossimString("INT"))
virtual void setFileLength(ossim_uint64 fileLength)
Sets file length (FL) field.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() const
void setNumberOfPixelsPerBlockRow(ossim_uint32 pixels)
void setActualBitsPerPixel(ossim_uint32 bitsPerPixel)
virtual void setNumberOfBands(ossim_uint32 nbands)
ossim_uint32 tileNumber
void setDate(const ossimLocalTm &d)
Sets field FDT.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual void writeStream(std::ostream &out)
bool valid() const
Definition: ossimRefPtr.h:75
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...
float ossim_float32
virtual void writeStream(std::ostream &out)
void setSubheaderLength(ossim_uint32 length)
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
static ossimString getNitfPixelType(ossimScalarType scalarType)
Get the nitf pixel type string from scalar type.
virtual void setHeaderLength(ossim_uint64 headerLength)
Sets header length (HL) field.
virtual void replaceImageInfoRecord(int i, const ossimNitfImageInfoRecordV2_1 &recordInfo)
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
OSSIM_DLL ossim_uint32 getActualBitsPerPixel(ossimScalarType scalarType)
Get actual bits per pixel for a given scalar type.
16 bit unsigned integer (13 bits used)
unsigned short ossim_uint16
void setBitsPerPixel(ossim_uint32 bitsPerPixel)
double ossim_float64
void setBlocksPerRow(ossim_uint32 blocks)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
signed short ossim_sint16
void setCategory(const ossimString &category)
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned long long ossim_uint64
void setImageLength(ossim_uint64 length)
32 bit normalized floating point
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
void setNumberOfPixelsPerBlockCol(ossim_uint32 pixels)
ossim_uint32 width() const
Definition: ossimIrect.h:500
virtual void setNumberOfRows(ossim_uint32 rows)
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
ossimScalarType
OSSIM_DLL ossim_uint32 getBitsPerPixel(ossimScalarType scalarType)
Get bits per pixel for a given scalar type.
virtual void addImageInfoRecord(const ossimNitfImageInfoRecordV2_1 &recordInfo)
virtual void setNumberOfCols(ossim_uint32 cols)
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
ossim_int64 getNumberOfTilesHorizontal() const
void setBlocksPerCol(ossim_uint32 blocks)
void setRepresentation(const ossimString &rep)
std::string m_textEntry
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
void setComplexityLevel(std::streamoff, ossimNitfFileHeaderV2_X *hdr)
Sets the complexity level of theFileHeader.
ossimRefPtr< ossimNitfTextHeaderV2_1 > m_textHeader
virtual void writeStream(ossim::ostream &out)
ossim_int32 x
Definition: ossimIpt.h:141
virtual void setBandRepresentation(const ossimString &rep)
Sets the band representation.
virtual void setPercentComplete(double percentComplete)
virtual void setTileSize(const ossimIpt &tileSize)
32 bit floating point
virtual void addTextInfoRecord(const ossimNitfTextFileInfoRecordV2_1 &recordInfo)
void setSubheaderLength(ossim_uint64 length)
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
ossim_int64 getNumberOfTilesVertical() const
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)
virtual void setBandInfo(ossim_uint32 idx, const ossimNitfImageBandV2_1 &info)

◆ writeFile()

bool ossimNitfWriter::writeFile ( )
protectedvirtual
Returns
true on success false on error.

Implements ossimImageFileWriter.

Definition at line 143 of file ossimNitfWriter.cpp.

References ossimImageSourceSequencer::isMaster(), isOpen(), open(), ossimImageSourceSequencer::slaveProcessTiles(), and ossimImageFileWriter::theInputConnection.

144 {
146  {
148 
149  return true;
150  }
151 
152  open();
153 
154  if (!isOpen())
155  {
156  if (traceDebug())
157  {
159  << "ossimNitfWriter::writeFile ERROR:"
160  << " Could not open! Returning..."
161  << std::endl;
162  }
163 
164  return false;
165  }
166 
167  // Write out the geometry info.
169 
170  // addStandardTags();
171 
172  bool result = false;
173  if((theOutputImageType == "nitf_block_band_separate")||
174  (theOutputImageType == "image/nitf"))
175  {
176  result = writeBlockBandSeparate();
177  }
178  else if(theOutputImageType == "nitf_block_band_sequential")
179  {
180  result = writeBlockBandSequential();
181  }
182 
183  close();
184 
185  return result;
186 }
virtual bool writeBlockBandSequential()
Outputs in band sequential format.
virtual bool writeBlockBandSeparate()
write out block band separate
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
void writeGeometry(ossimNitfImageHeaderV2_X *hdr, ossimImageSourceSequencer *seq)
Populates tags with geometry info from projection.
virtual bool isOpen() const
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
virtual void close()
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool open()

Member Data Documentation

◆ m_blockSize

ossimIpt ossimNitfWriter::m_blockSize
protected

◆ m_dataExtensionSegments

std::vector<ossimNitfDataExtensionSegmentV2_1> ossimNitfWriter::m_dataExtensionSegments
protected

◆ m_fileHeader

ossimRefPtr<ossimNitfFileHeaderV2_1> ossimNitfWriter::m_fileHeader
protected

◆ m_imageHeader

ossimRefPtr<ossimNitfImageHeaderV2_1> ossimNitfWriter::m_imageHeader
protected

◆ m_str

std::shared_ptr<ossim::ofstream> ossimNitfWriter::m_str
protected

Currently disabled...

Definition at line 160 of file ossimNitfWriter.h.

Referenced by close(), isOpen(), open(), writeBlockBandSeparate(), and writeBlockBandSequential().

◆ m_textEntry

std::string ossimNitfWriter::m_textEntry
protected

◆ m_textHeader

ossimRefPtr<ossimNitfTextHeaderV2_1> ossimNitfWriter::m_textHeader
protected

The documentation for this class was generated from the following files: