OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfImageDataMaskV2_1.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2007 Ball Aerspace & Technologies Corp
3 //
4 // LICENSE: See top level LICENSE.txt file.
5 //
6 // Author: Lucas Eckels
7 //
8 // Description: Nitf support class
9 //
10 //********************************************************************
11 // $Id: $
12 
14 #include <ossim/base/ossimEndian.h>
15 
17 {
18 }
19 
21 {
22  theIncludedBlocks.resize(blockCount, true);
23 }
24 
26 {
27  theBlockLength = blockLength;
28 }
29 
31 {
32  if (blockNumber < theIncludedBlocks.size())
33  {
34  theIncludedBlocks[blockNumber] = included;
35  }
36 }
37 
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 }
void setBlockLengthInBytes(ossim_uint32 blockLength)
void setBlockCount(ossim_uint32 blockCount)
unsigned short ossim_uint16
unsigned int ossim_uint32
void setIncludeBlock(ossim_uint32 blockNumber, bool included)
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23