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

#include <ossimNitfImageDataMaskV2_1.h>

Public Member Functions

 ossimNitfImageDataMaskV2_1 ()
 
void setBlockCount (ossim_uint32 blockCount)
 
void setBlockLengthInBytes (ossim_uint32 blockLength)
 
void setIncludeBlock (ossim_uint32 blockNumber, bool included)
 
void writeStream (std::ostream &out)
 

Private Attributes

std::vector< bool > theIncludedBlocks
 
ossim_uint32 theBlockLength
 

Detailed Description

Definition at line 20 of file ossimNitfImageDataMaskV2_1.h.

Constructor & Destructor Documentation

◆ ossimNitfImageDataMaskV2_1()

ossimNitfImageDataMaskV2_1::ossimNitfImageDataMaskV2_1 ( )

Definition at line 16 of file ossimNitfImageDataMaskV2_1.cpp.

16  : theBlockLength(0)
17 {
18 }

Member Function Documentation

◆ setBlockCount()

void ossimNitfImageDataMaskV2_1::setBlockCount ( ossim_uint32  blockCount)

Definition at line 20 of file ossimNitfImageDataMaskV2_1.cpp.

References theIncludedBlocks.

Referenced by ossimNitfWriter::writeBlockBandSeparate().

21 {
22  theIncludedBlocks.resize(blockCount, true);
23 }

◆ setBlockLengthInBytes()

void ossimNitfImageDataMaskV2_1::setBlockLengthInBytes ( ossim_uint32  blockLength)

Definition at line 25 of file ossimNitfImageDataMaskV2_1.cpp.

References theBlockLength.

Referenced by ossimNitfWriter::writeBlockBandSeparate().

26 {
27  theBlockLength = blockLength;
28 }

◆ setIncludeBlock()

void ossimNitfImageDataMaskV2_1::setIncludeBlock ( ossim_uint32  blockNumber,
bool  included 
)

Definition at line 30 of file ossimNitfImageDataMaskV2_1.cpp.

References theIncludedBlocks.

Referenced by ossimNitfWriter::writeBlockBandSeparate().

31 {
32  if (blockNumber < theIncludedBlocks.size())
33  {
34  theIncludedBlocks[blockNumber] = included;
35  }
36 }

◆ writeStream()

void ossimNitfImageDataMaskV2_1::writeStream ( std::ostream &  out)

Definition at line 38 of file ossimNitfImageDataMaskV2_1.cpp.

References ossimEndian::getSystemEndianType(), OSSIM_LITTLE_ENDIAN, ossimEndian::swap(), theBlockLength, and theIncludedBlocks.

Referenced by ossimNitfWriter::writeBlockBandSeparate().

39 {
40  ossimEndian endian;
41 
42  ossim_uint32 imdatoff = 4 + 2 + 2 + 2 + 4 * theIncludedBlocks.size();
43  ossim_uint16 bmrlnth = 4; // only support band mask
44  ossim_uint16 tmrlnth = 0;
45  ossim_uint16 tpxcdlnth = 0;
46 
48  {
49  endian.swap(imdatoff);
50  endian.swap(bmrlnth);
51  endian.swap(tmrlnth);
52  endian.swap(tpxcdlnth);
53  }
54 
55  out.write(reinterpret_cast<char*>(&imdatoff), sizeof(imdatoff));
56  out.write(reinterpret_cast<char*>(&bmrlnth), sizeof(bmrlnth));
57  out.write(reinterpret_cast<char*>(&tmrlnth), sizeof(tmrlnth));
58  out.write(reinterpret_cast<char*>(&tpxcdlnth), sizeof(tpxcdlnth));
59 
60  ossim_uint32 position = 0;
61  // Band Masks
62  for (std::vector<bool>::const_iterator iter = theIncludedBlocks.begin();
63  iter != theIncludedBlocks.end(); ++iter)
64  {
65  ossim_uint32 offset = 0xFFFFFFFF;
66  if (*iter)
67  {
68  offset = position;
69  position += theBlockLength;
70  }
72  {
73  endian.swap(offset);
74  }
75  out.write(reinterpret_cast<char*>(&offset), sizeof(offset));
76  }
77 
78  // Pad pixels not supported, always set to length 0, so don't need to write anything
79 }
unsigned short ossim_uint16
unsigned int ossim_uint32
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26

Member Data Documentation

◆ theBlockLength

ossim_uint32 ossimNitfImageDataMaskV2_1::theBlockLength
private

Definition at line 34 of file ossimNitfImageDataMaskV2_1.h.

Referenced by setBlockLengthInBytes(), and writeStream().

◆ theIncludedBlocks

std::vector<bool> ossimNitfImageDataMaskV2_1::theIncludedBlocks
private

Definition at line 33 of file ossimNitfImageDataMaskV2_1.h.

Referenced by setBlockCount(), setIncludeBlock(), and writeStream().


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