forked from ossimlabs/ossim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathossimNitfCsccgaTag.cpp
More file actions
88 lines (79 loc) · 3.07 KB
/
Copy pathossimNitfCsccgaTag.cpp
File metadata and controls
88 lines (79 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//----------------------------------------------------------------------------
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts
//
// Description: CSCCGA tag source file
//
//----------------------------------------------------------------------------
// $Id$
#include <ossim/support_data/ossimNitfCsccgaTag.h>
#include <iomanip>
#include <iostream>
using namespace std;
ossimNitfCsccgaTag::ossimNitfCsccgaTag()
: ossimNitfRegisteredTag(std::string("CSCCGA"), CEL_SIZE)
{
clearFields();
}
void ossimNitfCsccgaTag::parseStream(std::istream& in)
{
in.read(m_ccgSource, CCG_SOURCE_SIZE);
in.read(m_regSensor, REG_SENSOR_SIZE);
in.read(m_originLine, ORIGIN_LINE_SIZE);
in.read(m_originSample, ORIGIN_SAMPLE_SIZE);
in.read(m_asCellSize, AS_CELL_SIZE_SIZE);
in.read(m_csCellSize, CS_CELL_SIZE_SIZE);
in.read(m_ccgMaxLine, CCG_MAX_LINE_SIZE);
in.read(m_ccgMaxSample, CCG_MAX_SAMPLE_SIZE);
}
void ossimNitfCsccgaTag::writeStream(std::ostream& out)
{
out.write(m_ccgSource, CCG_SOURCE_SIZE);
out.write(m_regSensor, REG_SENSOR_SIZE);
out.write(m_originLine, ORIGIN_LINE_SIZE);
out.write(m_originSample, ORIGIN_SAMPLE_SIZE);
out.write(m_asCellSize, AS_CELL_SIZE_SIZE);
out.write(m_csCellSize, CS_CELL_SIZE_SIZE);
out.write(m_ccgMaxLine, CCG_MAX_LINE_SIZE);
out.write(m_ccgMaxSample, CCG_MAX_SAMPLE_SIZE);
}
std::ostream& ossimNitfCsccgaTag::print(std::ostream& out,
const std::string& prefix) const
{
std::string pfx = prefix;
pfx += getTagName();
pfx += ".";
out << setiosflags(ios::left)
<< pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
<< pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
<< pfx << std::setw(24) << "CCG_SOURCE:" << m_ccgSource << "\n"
<< pfx << std::setw(24) << "CCG_SOURCE:" << m_regSensor << "\n"
<< pfx << std::setw(24) << "ORIGIN_LINE:" << m_originLine << "\n"
<< pfx << std::setw(24) << "ORIGIN_SAMPLE:" << m_originSample << "\n"
<< pfx << std::setw(24) << "AS_CELL_SIZE:" << m_asCellSize << "\n"
<< pfx << std::setw(24) << "CS_CELL_SIZE:" << m_csCellSize << "\n"
<< pfx << std::setw(24) << "CCG_MAX_LINE:" << m_ccgMaxLine << "\n"
<< pfx << std::setw(24) << "CCG_MAX_SAMPLE:" << m_ccgMaxSample << "\n";
return out;
}
void ossimNitfCsccgaTag::clearFields()
{
memset(m_ccgSource,' ', CCG_SOURCE_SIZE);
memset(m_regSensor, ' ', REG_SENSOR_SIZE);
memset(m_originLine, 0, ORIGIN_LINE_SIZE);
memset(m_originSample, 0, ORIGIN_SAMPLE_SIZE);
memset(m_asCellSize, 0, AS_CELL_SIZE_SIZE);
memset(m_csCellSize, 0, CS_CELL_SIZE_SIZE);
memset(m_ccgMaxLine, 0, CCG_MAX_LINE_SIZE);
memset(m_ccgMaxSample, 0, CCG_MAX_SAMPLE_SIZE);
m_ccgSource[CCG_SOURCE_SIZE] = '\0';
m_regSensor[REG_SENSOR_SIZE] = '\0';
m_originLine[ORIGIN_LINE_SIZE] = '\0';
m_originSample[ORIGIN_SAMPLE_SIZE] = '\0';
m_asCellSize[AS_CELL_SIZE_SIZE] = '\0';
m_csCellSize[CS_CELL_SIZE_SIZE] = '\0';
m_ccgMaxLine[CCG_MAX_LINE_SIZE] = '\0';
m_ccgMaxSample[CCG_MAX_SAMPLE_SIZE] = '\0';
}