OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitf20Writer.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 //*******************************************************************
10 // $Id: ossimNitf20Writer.cpp 2982 2011-10-10 21:28:55Z david.burken $
11 
12 
15 #include <ossim/base/ossimDate.h>
17 #include <ossim/base/ossimRefPtr.h>
18 #include <ossim/base/ossimTrace.h>
19 #include <ossim/base/ossimEndian.h>
33 // #include <ossim/support_data/ossimNitfGeoPositioningTag.h>
34 // #include <ossim/support_data/ossimNitfLocalGeographicTag.h>
35 // #include <ossim/support_data/ossimNitfLocalCartographicTag.h>
36 // #include <ossim/support_data/ossimNitfProjectionParameterTag.h>
37 // #include <ossim/support_data/ossimNitfNameConversionTables.h>
38 // #include <ossim/support_data/ossimNitfBlockaTag.h>
39 #include <tiffio.h>
40 #include <fstream>
41 #include <algorithm>
42 #include <sstream>
43 #include <iomanip>
44 
45 RTTI_DEF1(ossimNitf20Writer, "ossimNitf20Writer", ossimNitfWriterBase);
46 
47 static ossimTrace traceDebug(ossimString("ossimNitfWriter:debug"));
48 
49 static ossimString monthConversionTable[] = {" ", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
50 
52  ossimImageSource* inputSource)
53  : ossimNitfWriterBase(filename, inputSource),
54  theOutputStream(0),
55  theFileHeader(),
56  theImageHeader(),
57  theEnableRpcbTagFlag(false),
58  theEnableBlockaTagFlag(true),
59  theCopyFieldsFlag(false)
60 {
61  //---
62  // Since the internal nitf tags are not very accurate, write an external
63  // geometry out as default behavior. Users can disable this via the
64  // property interface or keyword list.
65  //---
67 
70  theOutputImageType = "nitf20_block_band_separate";
71 
72  // These are always set:
75 
76  // Set any site defaults.
78  dynamic_cast<ossimNitfFileHeaderV2_X*>(theFileHeader.get()),
79  dynamic_cast<ossimNitfImageHeaderV2_X*>(theImageHeader.get()) );
80 }
81 
83 {
84  //---
85  // This looks like a leak but it's not as both of these are ossimRefPtr's.
86  //---
87  theFileHeader=0;
89 
90  close();
91 }
92 
94 {
95  return (theOutputStream != 0);
96 }
97 
99 {
100  if(isOpen())
101  {
102  close();
103  }
105  theOutputStream->open(theFilename.c_str(), ios::out|ios::binary);
106 
107  return theOutputStream->good();
108 }
109 
111 {
112  if(theOutputStream)
113  {
114  theOutputStream->close();
115  delete theOutputStream;
117  }
118 }
119 
121 {
123  {
125 
126  return true;
127  }
128 
129  open();
130 
131  if (!isOpen())
132  {
133  if (traceDebug())
134  {
136  << "ossimNitf20Writer::writeFile ERROR:"
137  << " Could not open! Returning..."
138  << std::endl;
139  }
140 
141  return false;
142  }
143 
144  // Write out the geometry info.
146 
147  addTags();
148 
149  bool result = false;
150  if((theOutputImageType == "nitf20_block_band_separate")||
151  (theOutputImageType == "image/nitf20"))
152  {
153  result = writeBlockBandSeparate();
154  }
155  else if(theOutputImageType == "nitf20_block_band_sequential")
156  {
157  result = writeBlockBandSequential();
158  }
159 
160  close();
161 
162  return result;
163 }
164 
165 void ossimNitf20Writer::getImageTypeList(std::vector<ossimString>& imageTypeList)const
166 {
167  imageTypeList.push_back(ossimString("nitf20_block_band_separate"));
168  imageTypeList.push_back(ossimString("nitf20_block_band_sequential"));
169 }
170 
172 {
173  if(!property) return;
174 
175  ossimString name = property->getName();
176 
177  if(name == "file_header")
178  {
180  property.get());
181  if(containerProperty)
182  {
183  std::vector<ossimRefPtr<ossimProperty> > propertyList;
184  containerProperty->getPropertyList(propertyList);
185  theFileHeader->setProperties(propertyList);
186  }
187  }
188  else if(name == "image_header")
189  {
191  property.get());
192  if(containerProperty)
193  {
194  std::vector<ossimRefPtr<ossimProperty> > propertyList;
195  containerProperty->getPropertyList(propertyList);
196  theImageHeader->setProperties(propertyList);
197  }
198  }
199  else if (name == "enable_rpcb_tag")
200  {
201  theEnableRpcbTagFlag = property->valueToString().toBool();
202  }
203  else if (name == "enable_blocka_tag")
204  {
205  theEnableBlockaTagFlag = property->valueToString().toBool();
206  }
207  else if(name == "copy_fields_flag")
208  {
209  theCopyFieldsFlag = property->valueToString().toBool();
210  }
211  else
212  {
213  // just in case it was an nitf specific tag we can pass it safely like this
214  theFileHeader->setProperty(property);
215  theImageHeader->setProperty(property);
217  }
218 }
219 
221 {
222  ossimRefPtr<ossimProperty> result = 0;
223 
224  if(name == "file_header")
225  {
226  ossimContainerProperty* container = new ossimContainerProperty(name);
227  std::vector<ossimRefPtr<ossimProperty> > propertyList;
228 
229  theFileHeader->getPropertyList(propertyList);
230  container->addChildren(propertyList);
231 
232  result = container;
233  }
234  else if(name == "image_header")
235  {
236  ossimContainerProperty* container = new ossimContainerProperty(name);
237  std::vector<ossimRefPtr<ossimProperty> > propertyList;
238 
239  theImageHeader->getPropertyList(propertyList);
240  container->addChildren(propertyList);
241 
242  result = container;
243  }
244  else if(name == "enable_rpcb_tag")
245  {
246  ossimBooleanProperty* boolProperty =
248 
249  result = boolProperty;
250  }
251  else if(name == "enable_blocka_tag")
252  {
253  ossimBooleanProperty* boolProperty =
255 
256  result = boolProperty;
257  }
258  else if(name == "copy_fields_flag")
259  {
260  ossimBooleanProperty* boolProperty =
262 
263  result = boolProperty;
264  }
265  else
266  {
268  }
269 
270  return result;
271 }
272 
273 void ossimNitf20Writer::getPropertyNames(std::vector<ossimString>& propertyNames)const
274 {
276 
277  propertyNames.push_back("file_header");
278  propertyNames.push_back("image_header");
279  propertyNames.push_back("enable_rpcb_tag");
280  propertyNames.push_back("enable_blocka_tag");
281  propertyNames.push_back("copy_fields_flag");
282 }
283 
285 {
287  ossim_uint64 byteSize = ossim::scalarSizeInBytes(scalarType);
290  ossim_uint64 idx = 0;
291  ossim_uint64 headerStart = (ossim_uint64)theOutputStream->tellp();
292 
293  ossimIpt blockSize(64, 64);
294  ossim_uint64 blocksHorizontal = (ossim_uint32)ceil(((double)rect.width()/(double)blockSize.x));
295  ossim_uint64 blocksVertical = (ossim_uint32)ceil(((double)rect.height()/(double)blockSize.y));
296 
297  ossimNitfImageInfoRecordV2_0 imageInfoRecord;
298  //imageInfoRecord.setSubheaderLength(439); // ok if no tags
299  imageInfoRecord.setImageLength(bands*byteSize*blocksVertical*blockSize.y*blocksHorizontal*blockSize.x);
300 
301  theFileHeader->addImageInfoRecord(imageInfoRecord);
302 
303  //---
304  // This makes space for the file header; it is written again at the end of
305  // this method with updated values
306  // need a better way to get the length. This should be queried on the
307  // header before writing
308  //---
310  ossim_uint64 headerLength = ((ossim_uint64)theOutputStream->tellp() - headerStart) /* + 1 */;
311 
312  ossimString representation;
314  ossim::getActualBitsPerPixel(scalarType));
318  theImageHeader->setImageMode('B');// blocked
319 
320  if((bands == 3)&&
321  (scalarType == OSSIM_UCHAR))
322  {
324  theImageHeader->setCategory("VIS");
325  }
326  else if(bands == 1)
327  {
330  }
331  else
332  {
335  }
336 
337  theImageHeader->setBlocksPerRow(blocksHorizontal);
338  theImageHeader->setBlocksPerCol(blocksVertical);
343 
344  ossimNitfImageBandV2_0 bandInfo;
345  for(idx = 0; idx < bands; ++idx)
346  {
347  std::ostringstream out;
348 
349  out << std::setfill('0')
350  << std::setw(2)
351  << idx;
352 
353  bandInfo.setBandRepresentation(out.str().c_str());
355  bandInfo);
356  }
357 
358  ossim_uint64 imageHeaderStart = theOutputStream->tellp();
360  ossim_uint64 imageHeaderEnd = theOutputStream->tellp();
361  ossim_uint64 imageHeaderSize = imageHeaderEnd - imageHeaderStart;
362 
363  theInputConnection->setTileSize(blockSize);
368  ossimEndian endian;
369 
370 
371  while( data.valid() && !needsAborting())
372  {
374  {
375  switch(data->getScalarType())
376  {
377  case OSSIM_USHORT16:
378  case OSSIM_USHORT11:
379  case OSSIM_USHORT12:
380  case OSSIM_USHORT13:
381  case OSSIM_USHORT14:
382  case OSSIM_USHORT15:
383  {
384  endian.swap((ossim_uint16*)data->getBuf(),
385  data->getWidth()*data->getHeight()*data->getNumberOfBands());
386  break;
387  }
388  case OSSIM_SSHORT16:
389  {
390  endian.swap((ossim_sint16*)data->getBuf(),
391  data->getWidth()*data->getHeight()*data->getNumberOfBands());
392  break;
393  }
394  case OSSIM_FLOAT:
396  {
397  endian.swap((ossim_float32*)data->getBuf(),
398  data->getWidth()*data->getHeight()*data->getNumberOfBands());
399  break;
400  }
401  case OSSIM_DOUBLE:
403  {
404  endian.swap((ossim_float64*)data->getBuf(),
405  data->getWidth()*data->getHeight()*data->getNumberOfBands());
406  break;
407  }
408  default:
409  break;
410  }
411  }
412 
413  theOutputStream->write((char*)(data->getBuf()),
414  data->getSizeInBytes());
415 
416  setPercentComplete(((double)tileNumber / (double)numberOfTiles) * 100);
417 
418  if(!needsAborting())
419  {
421  }
422  ++tileNumber;
423  }
424 
425  std::streamoff pos = theOutputStream->tellp();
426 
428 
429  /*
430  * Need to change the way I compute file length and header length later
431  * We need to figure out a better way to compute.
432  */
433  theFileHeader->setFileLength(static_cast<ossim_uint64>(pos));
434  theFileHeader->setHeaderLength(headerLength);
435  theOutputStream->seekp(0, ios::beg);
436  imageInfoRecord.setSubheaderLength(imageHeaderSize);
437  theFileHeader->replaceImageInfoRecord(0, imageInfoRecord);
439 
440  return true;
441 }
442 
444 {
446  ossim_uint64 byteSize = ossim::scalarSizeInBytes(scalarType);
449  ossim_uint64 idx = 0;
450  ossim_uint64 headerStart = (ossim_uint64)theOutputStream->tellp();
451 
452  ossimIpt blockSize(64, 64);
453 
456  theInputConnection->setTileSize(blockSize);
459 
460  ossimNitfImageInfoRecordV2_0 imageInfoRecord;
461  // imageInfoRecord.setSubheaderLength(439);
462  imageInfoRecord.setImageLength(bands*byteSize*blocksHorizontal*blocksVertical*blockSize.x*blockSize.y);
463 
464  ossimDate currentDate;
465 
466  theFileHeader->setDate(currentDate);
467  theFileHeader->addImageInfoRecord(imageInfoRecord);
468 
469  //---
470  // This makes space for the file header; it is written again at the end of
471  // this method with updated values
472  // need a better way to get the length. This should be queried on the
473  // header before writing
474  //---
476  ossim_uint64 headerLength = ((ossim_uint64)theOutputStream->tellp() - headerStart) /* + 1 */;
477 
478  ossimString representation;
480  ossim::getActualBitsPerPixel(scalarType));
484  theImageHeader->setImageMode('S');// blocked
485 
486  if((bands == 3)&&
487  (scalarType == OSSIM_UCHAR))
488  {
490  theImageHeader->setCategory("VIS");
491  }
492  else if(bands == 1)
493  {
496  }
497  else
498  {
501  }
502  theImageHeader->setBlocksPerRow(blocksHorizontal);
503  theImageHeader->setBlocksPerCol(blocksVertical);
508 
509  ossimNitfImageBandV2_0 bandInfo;
510  for(idx = 0; idx < bands; ++idx)
511  {
512  std::ostringstream out;
513 
514  out << std::setfill('0')
515  << std::setw(2)
516  << idx;
517 
518  bandInfo.setBandRepresentation(out.str().c_str());
520  bandInfo);
521  }
522 
523  int imageHeaderStart = theOutputStream->tellp();
525  int imageHeaderEnd = theOutputStream->tellp();
526  int imageHeaderSize = imageHeaderEnd - imageHeaderStart;
527 
528  // ossimIpt ul = rect.ul();
531  ossimEndian endian;
532 
533  // get the start to the first band of data block
534  //
535  ossim_uint64 streamOffset = theOutputStream->tellp();
536 
537  // holds the total pixels to the next band
538 
539  ossim_uint64 blockSizeInBytes = blockSize.x*blockSize.y*ossim::scalarSizeInBytes(data->getScalarType());
540  ossim_uint64 bandOffsetInBytes = (blockSizeInBytes*blocksHorizontal*blocksVertical);
541 
542  bool needSwapping = endian.getSystemEndianType() == OSSIM_LITTLE_ENDIAN;
543  while(data.valid() && !needsAborting())
544  {
545  if(needSwapping)
546  {
547  switch(data->getScalarType())
548  {
549  case OSSIM_USHORT16:
550  case OSSIM_USHORT11:
551  case OSSIM_USHORT12:
552  case OSSIM_USHORT13:
553  case OSSIM_USHORT14:
554  case OSSIM_USHORT15:
555  {
556  endian.swap((ossim_uint16*)data->getBuf(),
557  data->getWidth()*data->getHeight()*data->getNumberOfBands());
558  break;
559  }
560  case OSSIM_SSHORT16:
561  {
562  endian.swap((ossim_sint16*)data->getBuf(),
563  data->getWidth()*data->getHeight()*data->getNumberOfBands());
564  break;
565  }
566  case OSSIM_FLOAT:
568  {
569  endian.swap((ossim_float32*)data->getBuf(),
570  data->getWidth()*data->getHeight()*data->getNumberOfBands());
571  break;
572  }
573  case OSSIM_DOUBLE:
575  {
576  endian.swap((ossim_float64*)data->getBuf(),
577  data->getWidth()*data->getHeight()*data->getNumberOfBands());
578  break;
579  }
580  default:
581  break;
582  }
583  }
584 
585  for(idx = 0; idx < bands; ++idx)
586  {
587  theOutputStream->seekp(streamOffset+ // start of image stream
588  tileNumber*blockSizeInBytes + // start of block for band separate output
589  bandOffsetInBytes*idx, // which band offset is it
590  ios::beg);
591 
592  theOutputStream->write((char*)(data->getBuf(idx)),
593  blockSizeInBytes);
594  }
595  ++tileNumber;
596 
597  setPercentComplete(((double)tileNumber / (double)numberOfTiles) * 100);
598 
599  if(!needsAborting())
600  {
602  }
603  }
604 
605  std::streamoff pos = theOutputStream->tellp();
606 
608 
609  /*
610  * Need to change the way I compute file length and header length later
611  * We need to figure out a better way to compute.
612  */
613  theFileHeader->setFileLength(static_cast<ossim_uint64>(pos));
614  theFileHeader->setHeaderLength(headerLength);
615  theOutputStream->seekp(0, ios::beg);
616  imageInfoRecord.setSubheaderLength(imageHeaderSize);
617  theFileHeader->replaceImageInfoRecord(0, imageInfoRecord);
619 
620  return true;
621 }
622 
623 
626 {
627  ossimNitfTagInformation tagInfo;
628  tagInfo.setTagData(registeredTag.get());
629  theImageHeader->addTag(tagInfo);
630 }
631 
633 {
634  ossimDate currentDate;
635  theFileHeader->setDate(currentDate);
636 
638  {
639  ossimTypeNameVisitor visitor(ossimString("ossimNitfTileSource"),
640  true,
642  accept(visitor);
643 
644  // If there are multiple image handlers, e.g. a mosaic do not uses.
646  if ( visitor.getObjects().size() == 1 )
647  {
648  nitf = visitor.getObjectAs<ossimNitfTileSource>( 0 );
649  }
650 
651  if( nitf.valid() )
652  {
653  ossimString value;
654  ossimPropertyInterface* fileHeaderProperties = dynamic_cast<ossimPropertyInterface*>(theFileHeader.get());
655  ossimPropertyInterface* imageHeaderProperties = dynamic_cast<ossimPropertyInterface*>(theImageHeader.get());
656  bool nitf21Flag = false;
657  const ossimNitfFileHeader* header = nitf->getFileHeader();
658  const ossimNitfImageHeader* imageHeader = nitf->getCurrentImageHeader();
659  if(header)
660  {
661  ossimString version = header->getPropertyValueAsString("fhdr");
662  nitf21Flag = version.contains("2.1");
663  value = header->getPropertyValueAsString("stype");
664  if(value.size())
665  {
666  fileHeaderProperties->setProperty("stype", value);
667  }
668  value = header->getPropertyValueAsString("ostaid");
669  if(value.size())
670  {
671  fileHeaderProperties->setProperty("ostaid", value);
672  }
673  value = header->getPropertyValueAsString("ftitle");
674  if(value.size())
675  {
676  fileHeaderProperties->setProperty("ftitle", value);
677  }
678  value = header->getPropertyValueAsString("fsclas");
679  if(value.size())
680  {
681  fileHeaderProperties->setProperty("fsclas", value);
682  }
683  value = header->getPropertyValueAsString("oname");
684  if(value.size())
685  {
686  fileHeaderProperties->setProperty("oname", value);
687  }
688  value = header->getPropertyValueAsString("ophone");
689  if(value.size())
690  {
691  fileHeaderProperties->setProperty("ophone", value);
692  }
693  int idx = 0;
694  for(idx = 0; idx < header->getNumberOfTags(); ++idx)
695  {
697  header->getTagInformation(info,
698  idx);
699  theFileHeader->addTag(info);
700  }
701  value = header->getPropertyValueAsString("");
702  if(value.size())
703  {
704  fileHeaderProperties->setProperty("", value);
705  }
706  value = header->getPropertyValueAsString("fdt");
707  if(value.size()==14)
708  {
709  if(nitf21Flag)
710  {
711  ossimString year(value.begin()+2, value.begin()+4);
712  ossimString mon(value.begin()+4, value.begin()+6);
713  ossimString day(value.begin()+6, value.begin()+8);
714  ossimString hour(value.begin()+8, value.begin()+10);
715  ossimString min(value.begin()+10, value.begin()+12);
716  ossimString sec(value.begin()+12, value.begin()+14);
717  if(mon.toUInt32() < 13)
718  {
719  mon = monthConversionTable[mon.toUInt32()];
720  }
721  fileHeaderProperties->setProperty("fdt", day+hour+min+sec+"Z"+mon+year);
722  }
723  else
724  {
725  fileHeaderProperties->setProperty("fdt", value);
726  }
727  }
728  }
729  if(imageHeader)
730  {
731  ossim_uint32 idx = 0;
732  for(idx = 0; idx < imageHeader->getNumberOfTags(); ++idx)
733  {
735  imageHeader->getTagInformation(info,
736  idx);
737  theImageHeader->addTag(info);
738  }
739  value = imageHeader->getPropertyValueAsString("tgtid");
740  if(value.size())
741  {
742  imageHeaderProperties->setProperty("tgtid", value);
743  }
744  value = imageHeader->getPropertyValueAsString("isclas");
745  if(value.size())
746  {
747  imageHeaderProperties->setProperty("isclas", value);
748  }
749  value = imageHeader->getPropertyValueAsString("igeolo");
750  if(value.size())
751  {
752  imageHeaderProperties->setProperty("igeolo", value);
753  }
754  value = imageHeader->getPropertyValueAsString("ititle");
755  if(nitf21Flag)
756  {
757  value = imageHeader->getPropertyValueAsString("iid2");
758  }
759  if(value.size())
760  {
761  imageHeaderProperties->setProperty("ititle", value);
762  }
763  if(!nitf21Flag)
764  {
765  value = imageHeader->getPropertyValueAsString("iscaut");
766  if(value.size())
767  {
768  imageHeaderProperties->setProperty("iscaut", value);
769  }
770  value = imageHeader->getPropertyValueAsString("iscode");
771  if(value.size())
772  {
773  imageHeaderProperties->setProperty("iscode", value);
774  }
775  value = imageHeader->getPropertyValueAsString("isctlh");
776  if(value.size())
777  {
778  imageHeaderProperties->setProperty("isctlh", value);
779  }
780  value = imageHeader->getPropertyValueAsString("isrel");
781  if(value.size())
782  {
783  imageHeaderProperties->setProperty("isrel", value);
784  }
785  value = imageHeader->getPropertyValueAsString("isctln");
786  if(value.size())
787  {
788  imageHeaderProperties->setProperty("isctln", value);
789  }
790  value = imageHeader->getPropertyValueAsString("isdwng");
791  if(value.size())
792  {
793  imageHeaderProperties->setProperty("isdevt", value);
794  }
795  value = imageHeader->getPropertyValueAsString("isorce");
796  if(value.size())
797  {
798  imageHeaderProperties->setProperty("isorce", value);
799  }
800  }
801  value = imageHeader->getPropertyValueAsString("idatim");
802  if(value.size()==14)
803  {
804  if(nitf21Flag)
805  {
806  ossimString year(value.begin()+2, value.begin()+4);
807  ossimString mon(value.begin()+4, value.begin()+6);
808  ossimString day(value.begin()+6, value.begin()+8);
809  ossimString hour(value.begin()+8, value.begin()+10);
810  ossimString min(value.begin()+10, value.begin()+12);
811  ossimString sec(value.begin()+12, value.begin()+14);
812  if(mon.toUInt32() < 13)
813  {
814  mon = monthConversionTable[mon.toUInt32()];
815  }
816  imageHeaderProperties->setProperty("idatim", day+hour+min+sec+"Z"+mon+year);
817  }
818  else
819  {
820  imageHeaderProperties->setProperty("idatim", value);
821  }
822  }
823  }
824 
825  // we will port over only a selected few
826  }
827  }
828 }
829 
831  const char* prefix) const
832 {
833  return ossimNitfWriterBase::saveState(kwl, prefix);
834 }
835 
837  const char* prefix)
838 {
839  return ossimNitfWriterBase::loadState(kwl, prefix);
840 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Set the properties.
virtual void setNumberOfCols(ossim_uint32 cols)
void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
void setPixelType(const ossimString &pixelType=ossimString("INT"))
void setProperties(std::vector< ossimRefPtr< ossimProperty > > &propertyList)
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() 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 writeStream(ossim::ostream &out)
void setNumberOfPixelsPerBlockRow(ossim_uint32 pixels)
virtual void getPropertyList(std::vector< ossimRefPtr< ossimProperty > > &children) const
void setActualBitsPerPixel(ossim_uint32 bitsPerPixel)
ossim_uint32 tileNumber
Represents serializable keyword/value map.
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.
bool valid() const
Definition: ossimRefPtr.h:75
bool theEnableRpcbTagFlag
If true user wants to set RPC00B tag.
virtual void replaceImageInfoRecord(ossim_uint32 i, const ossimNitfImageInfoRecordV2_0 &recordInfo)
float ossim_float32
ossim_uint32 height() const
Definition: ossimIrect.h:487
bool contains(char aChar) const
Definition: ossimString.h:58
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
static ossimString getNitfPixelType(ossimScalarType scalarType)
Get the nitf pixel type string from scalar type.
bool theCopyFieldsFlag
If true this will enable searching the input connnection for another NITF handler and bring the field...
void setSubheaderLength(ossim_uint32 length)
virtual void addTag(const ossimNitfTagInformation &tag, bool unique=true)
virtual void getImageTypeList(std::vector< ossimString > &imageTypeList) const
void getImageTypeList(std::vector<ossimString>& imageTypeList)const
virtual ossim_uint32 getNumberOfTags() const
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
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual void setHeaderLength(ossim_uint64 headerLength)
Sets header length (HL) field.
virtual bool getTagInformation(ossimNitfTagInformation &tag, int idx) const
virtual void addImageInfoRecord(const ossimNitfImageInfoRecordV2_0 &recordInfo)
void setBitsPerPixel(ossim_uint32 bitsPerPixel)
virtual bool writeFile()
double ossim_float64
void setBlocksPerRow(ossim_uint32 blocks)
void setTagData(ossimRefPtr< ossimNitfRegisteredTag > tagData)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimNitfFileHeaderV2_0 > theFileHeader
virtual void setNumberOfBands(ossim_uint32 nbands)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual ossim_uint32 getSizeInBytes() const
Returns the total number of bytes for all bands.
virtual void setBandInfo(ossim_uint32 idx, const ossimNitfImageBandV2_0 &info)
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property.
signed short ossim_sint16
void setCategory(const ossimString &category)
std::string::size_type size() const
Definition: ossimString.h:405
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
std::string::iterator begin()
Definition: ossimString.h:420
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned long long ossim_uint64
virtual void setProperty(ossimRefPtr< ossimProperty > property)
unsigned int ossim_uint32
32 bit normalized floating point
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual void setFileLength(ossim_uint64 fileLength)
Sets file length (FL) field.
OSSIM nitf writer base class to hold methods common to all nitf writers.
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
void addRegisteredTag(ossimRefPtr< ossimNitfRegisteredTag > registeredTag)
virtual bool isOpen() const
const ossimNitfImageHeader * getCurrentImageHeader() const
bool theEnableBlockaTagFlag
If true user wants to set BLOCKA tag.
void setNumberOfPixelsPerBlockCol(ossim_uint32 pixels)
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossim_uint32 width() const
Definition: ossimIrect.h:500
void setEncryption(const ossimString &encryption)
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
virtual void writeStream(ossim::ostream &out)
ossimScalarType
OSSIM_DLL ossim_uint32 getBitsPerPixel(ossimScalarType scalarType)
Get bits per pixel for a given scalar type.
virtual void addChildren(std::vector< ossimRefPtr< ossimProperty > > &propertyList)
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
RTTI_DEF1(ossimNitf20Writer, "ossimNitf20Writer", ossimNitfWriterBase)
const ossimNitfFileHeader * getFileHeader() const
virtual bool getTagInformation(ossimNitfTagInformation &tagInfo, ossim_uint32 idx) const
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)
virtual void initializeDefaultsFromConfigFile(ossimNitfFileHeaderV2_X *fileHdr, ossimNitfImageHeaderV2_X *imgHdr)
Sets file header and image header defaults from config file if found in preferences.
T * getObjectAs(ossim_uint32 idx=0)
Definition: ossimVisitor.h:64
void setRepresentation(const ossimString &rep)
virtual void setNumberOfRows(ossim_uint32 rows)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void writeGeometry(ossimNitfImageHeaderV2_X *hdr, ossimImageSourceSequencer *seq)
Populates tags with geometry info from projection.
ossim_int32 y
Definition: ossimIpt.h:142
virtual void setWriteExternalGeometryFlag(bool flag)
void setImageLength(ossim_uint64 length)
virtual const void * getBuf() const
virtual void setProperty(const ossimString &name, const ossimString &value)
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.
virtual bool writeBlockBandSequential()
Outputs in band sequential format.
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
std::ofstream * theOutputStream
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
ossim_int32 x
Definition: ossimIpt.h:141
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
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::...
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 int getNumberOfTags() 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 swap(ossim_sint8 &)
Definition: ossimEndian.h:26
virtual ossimString getPropertyValueAsString(const ossimString &name) const
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
ossimNitf20Writer(const ossimFilename &filename=ossimFilename(""), ossimImageSource *inputSource=(ossimImageSource *) NULL)
ossimRefPtr< ossimNitfImageHeaderV2_0 > theImageHeader
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
virtual bool writeBlockBandSeparate()
write out block band separate
void addTag(const ossimNitfTagInformation &tag, bool unique=true)
8 bit unsigned iteger
#define min(a, b)
Definition: auxiliary.h:75
void setJustification(const ossimString &value)
16 bit unsigned integer (12 bits used)