-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathGenericHeader.cpp
More file actions
145 lines (119 loc) · 2.67 KB
/
GenericHeader.cpp
File metadata and controls
145 lines (119 loc) · 2.67 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include "stdafx.h"
#include "GenericHeader.h"
//# include <fstream>
//# include <stdio.h>
//# include <io.h>
using namespace std;
/**********************************************************
This class is the C++ Exported Grid Header class
not the implementation of IGridHeader COM Class
**********************************************************/
//CONSTRUCTORS
header::header()
{ ncols = 0;
nrows = 0;
dx = 1.0;
dy = 1.0;
nodataValue = -1;
xllcenter = 0;
yllcenter = 0;
}
header::header( const header & h )
{ ncols = h.ncols;
nrows = h.nrows;
dx = h.dx;
dy = h.dy;
nodataValue = h.nodataValue;
xllcenter = h.xllcenter;
yllcenter = h.yllcenter;
projection = h.projection;
notes = h.notes;
}
//Destructor
header::~header()
{
}
//OPERATORS
header header::operator=( const header & h )
{ ncols = h.ncols;
nrows = h.nrows;
dx = h.dx;
dy = h.dy;
nodataValue = h.nodataValue;
xllcenter = h.xllcenter;
yllcenter = h.yllcenter;
projection = h.projection;
notes = h.notes;
return *this;
}
//DATA ACCESS MEMBERS
inline long header::getNumberCols()
{ return ncols;
}
inline long header::getNumberRows()
{ return nrows;
}
inline double header::getNodataValue()
{ return nodataValue;
}
inline double header::getDx()
{ return dx;
}
inline double header::getDy()
{ return dy;
}
inline double header::getXllcenter()
{ return xllcenter;
}
inline double header::getYllcenter()
{ return yllcenter;
}
char * header::getProjection()
{ if( projection.GetLength() > 0 )
{ char * retval = new char[ projection.GetLength() + 1 ];
strcpy( retval, projection );
return retval;
}
else
return "";
}
char * header::getNotes()
{ if( notes.GetLength() > 0 )
{ char * retval = new char[ notes.GetLength() + 1 ];
strcpy( retval, notes );
return retval;
}
else
return "";
}
void header::setNumberCols( long p_ncols )
{ ncols = p_ncols;
}
void header::setNumberRows( long p_nrows )
{ nrows = p_nrows;
}
void header::setNodataValue( double p_nodata_value )
{ nodataValue = p_nodata_value;
}
void header::setDx( double p_dx )
{ if( p_dx > 0 )
dx = p_dx;
}
void header::setDy( double p_dy )
{ if( p_dy > 0 )
dy = p_dy;
}
void header::setXllcenter( double p_xllcenter )
{ xllcenter = p_xllcenter;
}
void header::setYllcenter( double p_yllcenter )
{ yllcenter = p_yllcenter;
}
void header::setProjection( const char * c_projection )
{ CString p_projection = c_projection;
projection = p_projection.Left( MAX_STRING_LENGTH );
}
void header::setNotes( const char * c_notes )
{ CString p_notes = c_notes;
notes = p_notes.Left( MAX_STRING_LENGTH );
}