120 m_str = std::make_shared<ossim::ofstream>();
122 if(!
m_str->is_open())
159 <<
"ossimNitfWriter::writeFile ERROR:" 160 <<
" Could not open! Returning..." 190 imageTypeList.push_back(
ossimString(
"nitf_block_band_separate"));
191 imageTypeList.push_back(
ossimString(
"nitf_block_band_sequential"));
196 if(!property)
return;
200 if(name ==
"file_header")
204 if(containerProperty)
206 std::vector<ossimRefPtr<ossimProperty> > propertyList;
211 else if(name ==
"image_header")
215 if(containerProperty)
217 std::vector<ossimRefPtr<ossimProperty> > propertyList;
222 else if(name ==
"block_size")
225 blockSize.
x =
property->valueToString().toInt32();
226 blockSize.
y = blockSize.
x;
239 if(name ==
"file_header")
242 std::vector<ossimRefPtr<ossimProperty> > propertyList;
249 else if(name ==
"image_header")
252 std::vector<ossimRefPtr<ossimProperty> > propertyList;
259 else if(name ==
"des_header")
262 std::vector<ossimRefPtr<ossimProperty> > propertyList;
271 else if(name ==
"block_size")
294 std::vector<ossimString>& propertyNames)
const 298 propertyNames.push_back(
"file_header");
299 propertyNames.push_back(
"image_header");
300 propertyNames.push_back(
"des_header");
301 propertyNames.push_back(
"block_size");
349 headerOut << std::setw(4)
351 << std::setiosflags(ios::right)
352 << iter->getHeaderLength();
356 dataOut << std::setw(9)
358 << std::setiosflags(ios::right)
359 << iter->getDataLength();
386 std::vector<char> blockZeros;
414 for(idx = 0; idx < bands; ++idx)
418 out << std::setfill(
'0')
429 ossim_uint64 imageHeaderSize = imageHeaderEnd - imageHeaderStart;
441 blockZeros.resize(blockLength);
442 memset(&blockZeros.front(),
'\0', blockLength);
490 if (memcmp(data->
getBuf(), &blockZeros.front(), blockLength) == 0)
524 iter->writeStream( *
m_str );
529 m_str->seekp(imageHeaderEnd);
534 std::streamoff pos =
m_str->tellp();
544 m_str->seekp(0, ios::beg);
625 for(idx = 0; idx < bands; ++idx)
629 out << std::setfill(
'0')
640 ossim_uint64 imageHeaderSize = imageHeaderEnd - imageHeaderStart;
658 ossim_uint64 bandOffsetInBytes = (blockSizeInBytes*blocksHorizontal*blocksVertical);
703 for(idx = 0; idx < bands; ++idx)
705 m_str->seekp(streamOffset+
707 bandOffsetInBytes*idx,
741 m_str->seekp(0, ios::beg);
802 if ( (tileSize.
x % MIN_BLOCK_SIZE) || (tileSize.
y % MIN_BLOCK_SIZE) )
807 <<
"ossimNitfWriter::setTileSize ERROR:" 808 <<
"\nBlock size must be a multiple of " << MIN_BLOCK_SIZE
820 void ossimNitfWriter::addStandardTags()
853 parameterTag->
setName(nitfName);
854 parameterTag->
setCode(nitfCode);
858 tagInfo.setTagData(parameterTag.
get());
866 const char* prefix)
const 889 if (allowTreOverflow ==
false)
906 std::vector<ossimNitfTagInformation> overflowTags;
920 if (overflowTags.empty() ==
false)
virtual void getImageTypeList(std::vector< ossimString > &imageTypeList) const
void getImageTypeList(std::vector<ossimString>& imageTypeList)const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Set the properties.
virtual void setTileSize(const ossimIpt &tileSize)
Sets the nitf output block size.
16 bit unsigned integer (15 bits used)
virtual void valueToString(ossimString &valueResult) const =0
virtual ossim_uint32 getWidth() const
virtual void slaveProcessTiles()
virtual ~ossimNitfWriter()
void setBlockLengthInBytes(ossim_uint32 blockLength)
void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
void setProperties(std::vector< ossimRefPtr< ossimProperty > > &propertyList)
void setFalseX(double falseX)
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
virtual ossim_uint32 getNumberOfBands() const
virtual double getFalseNorthing() const
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...
virtual void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &children) const
ossimString theOutputImageType
bool needsAborting() const
virtual bool isMaster() const
Represents serializable keyword/value map.
virtual void setToStartOfSequence()
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
void setBlockCount(ossim_uint32 blockCount)
std::shared_ptr< ossim::ofstream > m_str
Currently disabled...
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual bool addTextToNitf(std::string &inputText)
ossim_int64 getNumberOfTiles() const
static const ossimString DE_KW
void setSubheaderLength(ossim_uint32 length)
ossim_uint32 height() const
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.
static ossimString toString(bool aValue)
Numeric to string methods.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
virtual ossimString getClassName() const
OSSIM_DLL ossim_uint32 getActualBitsPerPixel(ossimScalarType scalarType)
Get actual bits per pixel for a given scalar type.
16 bit unsigned integer (13 bits used)
void addConstraint(const ossimString &value)
char theDataExtSegSubheaderLength[5]
Is a 4 byte numeric 200-9999.
virtual bool writeBlockBandSequential()
Outputs in band sequential format.
void setCode(const ossimString &code)
unsigned short ossim_uint16
virtual ossimNitfFileHeaderV2_1 * getFileHeader()
Get the file header used for export.
void setFalseY(double falseY)
virtual bool writeBlockBandSeparate()
write out block band separate
virtual void addDataExtensionSegment(const ossimNitfDataExtensionSegmentV2_1 &des, bool allowTreOverflow)
Add a DES to the file.
ossimNitfWriter(const ossimFilename &filename=ossimFilename(""), ossimImageSource *inputSource=(ossimImageSource *) NULL)
#define OSSIM_DEFAULT_TILE_WIDTH
ossimString convertMapProjectionNameToNitfCode(const ossimString &mapProjectionName) const
RTTI_DEF1(ossimNitfWriter, "ossimNitfWriter", ossimNitfWriterBase)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
void takeOverflowTags(bool useFileHeader, bool userDefinedTags)
virtual void getTileSize(ossimIpt &size) const
Gets the block size.
static const ossimString DESID_KW
virtual ossim_uint32 getSizeInBytes() const
Returns the total number of bytes for all bands.
signed short ossim_sint16
std::vector< ossimNitfDataExtensionSegmentV2_1 > m_dataExtensionSegments
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
ossimFilename theFilename
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned long long ossim_uint64
void writeStream(std::ostream &out)
void setImageLength(ossim_uint64 length)
unsigned int ossim_uint32
32 bit normalized floating point
void setName(const ossimString &name)
OSSIM nitf writer base class to hold methods common to all nitf writers.
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
void setIncludeBlock(ossim_uint32 blockNumber, bool included)
static const ossimString DESOFLW_KW
virtual void setTagList(const std::vector< ossimNitfTagInformation > &tagList)
ossim_uint32 width() const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
ossimByteOrder getSystemEndianType() const
ossimRefPtr< ossimNitfFileHeaderV2_1 > m_fileHeader
static const ossimString DESVER_KW
OSSIM_DLL ossim_uint32 getBitsPerPixel(ossimScalarType scalarType)
Get bits per pixel for a given scalar type.
virtual void addChildren(std::vector< ossimRefPtr< ossimProperty > > &propertyList)
static ossimProjectionFactoryRegistry * instance()
virtual double getFalseEasting() const
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
void addRegisteredTag(ossimRefPtr< ossimNitfRegisteredTag > registeredTag, bool unique=true)
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::...
ossim_int64 getNumberOfTilesHorizontal() const
virtual void initializeDefaultsFromConfigFile(ossimNitfFileHeaderV2_X *fileHdr, ossimNitfImageHeaderV2_X *imgHdr)
Sets file header and image header defaults from config file if found in preferences.
static const ossimString DESITEM_KW
void writeGeometry(ossimNitfImageHeaderV2_X *hdr, ossimImageSourceSequencer *seq)
Populates tags with geometry info from projection.
void setTextLength(ossim_uint64 length)
virtual ossimNitfImageHeaderV2_1 * getImageHeader()
Get the image header used for export.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Set the properties.
virtual bool isOpen() const
virtual const void * getBuf() const
ossimRefPtr< ossimNitfImageHeaderV2_1 > m_imageHeader
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::...
void setComplexityLevel(std::streamoff, ossimNitfFileHeaderV2_X *hdr)
Sets the complexity level of theFileHeader.
ossimRefPtr< ossimNitfTextHeaderV2_1 > m_textHeader
#define OSSIM_DEFAULT_TILE_HEIGHT
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
str write(os2.str().data(), os2.str().size())
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property.
virtual void setBandRepresentation(const ossimString &rep)
Sets the band representation.
virtual void setPercentComplete(double percentComplete)
virtual void setTileSize(const ossimIpt &tileSize)
ossimString convertNitfCodeToNitfProjectionName(const ossimString &nitfProjectionCode) const
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...
void setSubheaderLength(ossim_uint64 length)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
16 bit unsigned integer (12 bits used)