OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfLabelHeaderV2_0.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // Author: Garrett Potts
7 //
8 // Description: Nitf support class
9 //
10 //********************************************************************
11 // $Id: ossimNitfLabelHeaderV2_0.cpp 9094 2006-06-13 19:12:40Z dburken $
12 
14 #include <ossim/base/ossimString.h>
15 #include <ossim/base/ossimDrect.h>
16 #include <cstring> // for memset
17 #include <iostream>
18 
20  "ossimNitfLabelHeaderV2_0",
22 
24 {
25  clearFields();
26 }
27 
29 {
30  if(in)
31  {
32  clearFields();
33 
34  in.read(theFilePartType, 2);
35  in.read(theLabelId, 10);
37  in.read(theLabelCodewords, 40);
38  in.read(theLabelControlAndHandling, 40);
39  in.read(theLabelReleasingInstructions, 40);
41  in.read(theLabelSecurityControlNumber, 20);
42  in.read(theLabelSecurityDowngrade, 6);
43  if(ossimString(theLabelSecurityDowngrade) == "999998")
44  {
45  in.read(theLabelDowngradingEvent, 40);
46  }
47  in.read(theLabelEncryption, 1);
48  in.read(theLabelFontStyle, 1);
49  in.read(theLabelCellWidth, 2);
50  in.read(theLabelCellHeight, 2);
51  in.read(theLabelDisplayLevel, 3);
52  in.read(theLabelAttachmentLevel, 3);
53  in.read(theLabelLocation, 10);
54  in.read(theLabelTextColor, 3);
55  in.read(theLabelBackgroundColor, 3);
56  in.read(theExtendedHeaderDataLength, 5);
57 
58  long dataLength = ossimString(theExtendedHeaderDataLength).toLong();
59  if(dataLength > 0)
60  {
61  in.read(theExtendedSubheaderOverflow, 3);
62 
63  // for now just ignore the extended header data
64  in.ignore(dataLength-3);
65  }
66  }
67 }
68 
70 {
71  out << "theFilePartType: " << theFilePartType << std::endl
72  << "theLabelId: " << theLabelId << std::endl
73  << "theLabelSecurityClassification: " << theLabelSecurityClassification << std::endl
74  << "theLabelCodewords: " << theLabelCodewords << std::endl
75  << "theLabelControlAndHandling: " << theLabelControlAndHandling << std::endl
76  << "theLabelReleasingInstructions: " << theLabelReleasingInstructions << std::endl
77  << "theLabelClassificationAuthority: " << theLabelClassificationAuthority << std::endl
78  << "theLabelSecurityControlNumber: " << theLabelSecurityControlNumber << std::endl
79  << "theLabelSecurityDowngrade: " << theLabelSecurityDowngrade << std::endl
80  << "theLabelEncryption: " << theLabelEncryption << std::endl
81  << "theLabelFontStyle: " << theLabelFontStyle << std::endl
82  << "theLabelCellWidth: " << theLabelCellWidth << std::endl
83  << "theLabelCellHeight: " << theLabelCellHeight << std::endl
84  << "theLabelDisplayLevel: " << theLabelDisplayLevel << std::endl
85  << "theLabelAttachmentLevel: " << theLabelAttachmentLevel << std::endl
86  << "theLabelLocation: " << theLabelLocation << std::endl
87  << "theLabelTextColor: " << theLabelTextColor << std::endl
88  << "theLabelBackgroundColor: " << theLabelBackgroundColor << std::endl
89  << "theExtendedHeaderDataLength: " << theExtendedHeaderDataLength << std::endl
90  << "theExtendedSubheaderOverflow: " << theExtendedSubheaderOverflow;
91  return out;
92 }
93 
95 {
97 }
98 
100 {
101  double ulx = ossimString((const char*)(&theLabelLocation[5]),
102  (const char*)(&theLabelLocation[10])).toDouble();
103  double uly = ossimString((const char*)theLabelLocation,
104  (const char*)(&theLabelLocation[5])).toDouble();
105 
106  return ossimDrect(ulx,
107  uly,
108  ulx + ossimString(theLabelCellWidth).toDouble(),
109  uly + ossimString(theLabelCellHeight).toDouble());
110 }
111 
113 {
114  memset(theFilePartType, ' ', 2);
115  memset(theLabelId, ' ', 10);
116  memset(theLabelSecurityClassification, ' ', 1);
117  memset(theLabelCodewords, ' ', 40);
118  memset(theLabelControlAndHandling, ' ', 40);
119  memset(theLabelReleasingInstructions, ' ', 40);
120  memset(theLabelClassificationAuthority, ' ', 20);
121  memset(theLabelSecurityControlNumber, ' ', 20);
122  memset(theLabelSecurityDowngrade, ' ', 6);
123  memset(theLabelDowngradingEvent, ' ', 40);
124  memset(theLabelEncryption, ' ', 1);
125  memset(theLabelFontStyle, ' ', 1);
126  memset(theLabelCellWidth, ' ', 2);
127  memset(theLabelCellHeight, ' ', 2);
128  memset(theLabelDisplayLevel, ' ', 3);
129  memset(theLabelAttachmentLevel, ' ', 3);
130  memset(theLabelLocation, ' ', 10);
131  memset(theLabelTextColor, ' ', 3);
132  memset(theLabelBackgroundColor, ' ', 3);
133  memset(theExtendedHeaderDataLength, ' ', 5);
134  memset(theExtendedSubheaderOverflow, ' ', 3);
135 
136  theFilePartType[2] = '\0';
137  theLabelId[10] = '\0';
139  theLabelCodewords[40] = '\0';
140  theLabelControlAndHandling[40] = '\0';
144  theLabelSecurityDowngrade[6] = '\0';
145  theLabelDowngradingEvent[40] = '\0';
146  theLabelEncryption[1] = '\0';
147  theLabelFontStyle[1] = '\0';
148  theLabelCellWidth[2] = '\0';
149  theLabelCellHeight[2] = '\0';
150  theLabelDisplayLevel[3] = '\0';
151  theLabelAttachmentLevel[3] = '\0';
152  theLabelLocation[10] = '\0';
153  theLabelTextColor[3] = '\0';
154  theLabelBackgroundColor[3] = '\0';
155  theExtendedHeaderDataLength[5] = '\0';
157 }
virtual ossim_int32 getDisplayLevel() const
ossim_int32 toInt32() const
double toDouble() const
virtual std::ostream & print(std::ostream &out) const
Generic print method.
virtual ossimDrect getImageRect() const
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
long toLong() const
toLong&#39;s deprecated, please use the toInts...
virtual void parseStream(std::istream &in)
RTTI_DEF1(ossimNitfLabelHeaderV2_0, "ossimNitfLabelHeaderV2_0", ossimNitfLabelHeader) ossimNitfLabelHeaderV2_0
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32