OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
src
support_data
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
13
#include <
ossim/support_data/ossimNitfLabelHeaderV2_0.h
>
14
#include <
ossim/base/ossimString.h
>
15
#include <
ossim/base/ossimDrect.h
>
16
#include <cstring>
// for memset
17
#include <iostream>
18
19
RTTI_DEF1
(
ossimNitfLabelHeaderV2_0
,
20
"ossimNitfLabelHeaderV2_0"
,
21
ossimNitfLabelHeader
)
22
23
ossimNitfLabelHeaderV2_0::ossimNitfLabelHeaderV2_0
()
24
{
25
clearFields
();
26
}
27
28
void
ossimNitfLabelHeaderV2_0::parseStream
(
std::istream
&in)
29
{
30
if
(in)
31
{
32
clearFields
();
33
34
in.read(
theFilePartType
, 2);
35
in.read(
theLabelId
, 10);
36
in.read(
theLabelSecurityClassification
, 1);
37
in.read(
theLabelCodewords
, 40);
38
in.read(
theLabelControlAndHandling
, 40);
39
in.read(
theLabelReleasingInstructions
, 40);
40
in.read(
theLabelClassificationAuthority
, 20);
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
69
std::ostream
&
ossimNitfLabelHeaderV2_0::print
(
std::ostream
&out)
const
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
94
ossim_int32
ossimNitfLabelHeaderV2_0::getDisplayLevel
()
const
95
{
96
return
ossimString
(
theLabelDisplayLevel
).
toInt32
();
97
}
98
99
ossimDrect
ossimNitfLabelHeaderV2_0::getImageRect
()
const
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
112
void
ossimNitfLabelHeaderV2_0::clearFields
()
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'
;
138
theLabelSecurityClassification
[1] =
'\0'
;
139
theLabelCodewords
[40] =
'\0'
;
140
theLabelControlAndHandling
[40] =
'\0'
;
141
theLabelReleasingInstructions
[40] =
'\0'
;
142
theLabelClassificationAuthority
[20] =
'\0'
;
143
theLabelSecurityControlNumber
[20] =
'\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'
;
156
theExtendedSubheaderOverflow
[3] =
'\0'
;
157
}
ossimNitfLabelHeaderV2_0::theLabelDowngradingEvent
char theLabelDowngradingEvent[41]
Definition:
ossimNitfLabelHeaderV2_0.h:89
ossimNitfLabelHeaderV2_0::theLabelId
char theLabelId[11]
Definition:
ossimNitfLabelHeaderV2_0.h:41
ossimNitfLabelHeaderV2_0::theLabelTextColor
char theLabelTextColor[4]
Definition:
ossimNitfLabelHeaderV2_0.h:139
ossimNitfLabelHeaderV2_0::ossimNitfLabelHeaderV2_0
ossimNitfLabelHeaderV2_0()
ossimNitfLabelHeaderV2_0::theLabelSecurityDowngrade
char theLabelSecurityDowngrade[7]
Definition:
ossimNitfLabelHeaderV2_0.h:83
ossimNitfLabelHeaderV2_0::theLabelBackgroundColor
char theLabelBackgroundColor[4]
Definition:
ossimNitfLabelHeaderV2_0.h:147
ossimNitfLabelHeaderV2_0::theExtendedHeaderDataLength
char theExtendedHeaderDataLength[6]
Definition:
ossimNitfLabelHeaderV2_0.h:152
ossimNitfLabelHeaderV2_0::getDisplayLevel
virtual ossim_int32 getDisplayLevel() const
Definition:
ossimNitfLabelHeaderV2_0.cpp:94
ossimNitfLabelHeaderV2_0::theLabelLocation
char theLabelLocation[11]
Definition:
ossimNitfLabelHeaderV2_0.h:131
ossimNitfLabelHeaderV2_0::theLabelCellWidth
char theLabelCellWidth[3]
Definition:
ossimNitfLabelHeaderV2_0.h:107
ossimNitfLabelHeaderV2_0::theLabelSecurityClassification
char theLabelSecurityClassification[2]
Definition:
ossimNitfLabelHeaderV2_0.h:53
ossimString::toInt32
ossim_int32 toInt32() const
Definition:
ossimString.cpp:613
ossimNitfLabelHeaderV2_0.h
ossimNitfLabelHeaderV2_0::clearFields
void clearFields()
Definition:
ossimNitfLabelHeaderV2_0.cpp:112
ossimNitfLabelHeaderV2_0::theLabelCellHeight
char theLabelCellHeight[3]
Definition:
ossimNitfLabelHeaderV2_0.h:112
ossimString.h
ossimNitfLabelHeaderV2_0::theLabelReleasingInstructions
char theLabelReleasingInstructions[41]
Definition:
ossimNitfLabelHeaderV2_0.h:68
ossimString::toDouble
double toDouble() const
Definition:
ossimString.cpp:870
ossimNitfLabelHeaderV2_0::theFilePartType
char theFilePartType[3]
Definition:
ossimNitfLabelHeaderV2_0.h:36
ossimNitfLabelHeaderV2_0::theLabelAttachmentLevel
char theLabelAttachmentLevel[4]
Definition:
ossimNitfLabelHeaderV2_0.h:122
ossimDrect.h
ossimDrect
Definition:
ossimDrect.h:53
ossimNitfLabelHeaderV2_0::theLabelControlAndHandling
char theLabelControlAndHandling[41]
Definition:
ossimNitfLabelHeaderV2_0.h:63
ossimNitfLabelHeaderV2_0::print
virtual std::ostream & print(std::ostream &out) const
Generic print method.
Definition:
ossimNitfLabelHeaderV2_0.cpp:69
ossimNitfLabelHeaderV2_0::theLabelEncryption
char theLabelEncryption[2]
Definition:
ossimNitfLabelHeaderV2_0.h:96
ossimNitfLabelHeaderV2_0::theExtendedSubheaderOverflow
char theExtendedSubheaderOverflow[4]
Definition:
ossimNitfLabelHeaderV2_0.h:158
ossimNitfLabelHeaderV2_0::theLabelCodewords
char theLabelCodewords[41]
Definition:
ossimNitfLabelHeaderV2_0.h:58
ossimNitfLabelHeaderV2_0::getImageRect
virtual ossimDrect getImageRect() const
Definition:
ossimNitfLabelHeaderV2_0.cpp:99
ossimNitfLabelHeaderV2_0::theLabelSecurityControlNumber
char theLabelSecurityControlNumber[21]
Definition:
ossimNitfLabelHeaderV2_0.h:78
ossim::istream
std::basic_istream< char > istream
Base class for char input streams.
Definition:
ossimIosFwd.h:20
ossimString::toLong
long toLong() const
toLong's deprecated, please use the toInts...
Definition:
ossimString.cpp:749
ossimNitfLabelHeaderV2_0::theLabelClassificationAuthority
char theLabelClassificationAuthority[21]
Definition:
ossimNitfLabelHeaderV2_0.h:73
ossimNitfLabelHeaderV2_0
Definition:
ossimNitfLabelHeaderV2_0.h:17
ossimNitfLabelHeaderV2_0::theLabelFontStyle
char theLabelFontStyle[2]
Definition:
ossimNitfLabelHeaderV2_0.h:102
ossimNitfLabelHeaderV2_0::parseStream
virtual void parseStream(std::istream &in)
Definition:
ossimNitfLabelHeaderV2_0.cpp:28
RTTI_DEF1
RTTI_DEF1(ossimNitfLabelHeaderV2_0, "ossimNitfLabelHeaderV2_0", ossimNitfLabelHeader) ossimNitfLabelHeaderV2_0
Definition:
ossimNitfLabelHeaderV2_0.cpp:19
ossimNitfLabelHeader
Definition:
ossimNitfLabelHeader.h:20
ossimNitfLabelHeaderV2_0::theLabelDisplayLevel
char theLabelDisplayLevel[4]
Definition:
ossimNitfLabelHeaderV2_0.h:117
ossim::ostream
std::basic_ostream< char > ostream
Base class for char output streams.
Definition:
ossimIosFwd.h:23
ossimString
Definition:
ossimString.h:22
ossim_int32
int ossim_int32
Definition:
ossimConstants.h:234
Generated on Fri Aug 3 2018 08:46:51 for OSSIM - Open Source Software Image Map by
1.8.14