25 static ossimTrace traceExec (
"ossimNitfMapModel:exec");
26 static ossimTrace traceDebug (
"ossimNitfMapModel:debug");
28 static const char* PIAIMC_TAG =
"PIAIMC";
29 static const char* USE26A_TAG =
"USE26A";
30 static const char* USE00A_TAG =
"USE00A";
31 static const char* IMAGE_ID_KW =
"image_id";
59 FILE* fptr = fopen (init_file.
chars(),
"r");
65 <<
" Aborting with error..." << std::endl;
74 char* header =
new char [6000];
75 fread(header, 6000, 1, fptr);
81 if (strncmp(header,
"NITF02.00", 9))
86 <<
"\n\tFailed attempt to open <" << init_file
87 <<
"> as NITF2.00."<<endl;
98 strncpy(charbuf, &header[447], 28);
105 strncpy(charbuf, &header[737], 8);
108 strncpy(charbuf, &header[745], 8);
115 strncpy(charbuf, &header[775], 1);
126 strncpy(charbuf, &header[780], 2);
128 second = atof(charbuf);
129 second = second / 60;
130 strncpy(charbuf, &header[778], 2);
132 minute = atof(charbuf);
133 minute = (minute + second) / 60;
134 strncpy(charbuf, &header[776], 2);
136 degreeLat = atof(charbuf);
137 degreeLat = degreeLat + minute;
138 strncpy(charbuf, &header[782], 1);
142 degreeLat = 0 - degreeLat;
143 strncpy(charbuf, &header[788], 2);
145 second = atof(charbuf);
146 second = second / 60;
147 strncpy(charbuf, &header[786], 2);
149 minute = atof(charbuf);
150 minute = (minute + second) / 60;
151 strncpy(charbuf, &header[783], 3);
153 degreeLon = atof(charbuf);
154 degreeLon = degreeLon + minute;
155 strncpy(charbuf, &header[790], 1);
159 degreeLon = 0 - degreeLon;
160 ossimDpt ip0 (degreeLon, degreeLat);
161 strncpy(charbuf, &header[795], 2);
163 second = atof(charbuf);
164 second = second / 60;
165 strncpy(charbuf, &header[793], 2);
167 minute = atof(charbuf);
168 minute = (minute + second) / 60;
169 strncpy(charbuf, &header[791], 2);
171 degreeLat = atof(charbuf);
172 degreeLat = degreeLat + minute;
173 strncpy(charbuf, &header[797], 1);
177 degreeLat = 0 - degreeLat;
178 strncpy(charbuf, &header[803], 2);
180 second = atof(charbuf);
181 second = second / 60;
182 strncpy(charbuf, &header[801], 2);
184 minute = atof(charbuf);
185 minute = (minute + second) / 60;
186 strncpy(charbuf, &header[798], 3);
188 degreeLon = atof(charbuf);
189 degreeLon = degreeLon + minute;
190 strncpy(charbuf, &header[805], 1);
194 degreeLon = 0 - degreeLon;
195 ossimDpt ip1 (degreeLon, degreeLat);
196 strncpy(charbuf, &header[810], 2);
198 second = atof(charbuf);
199 second = second / 60;
200 strncpy(charbuf, &header[808], 2);
202 minute = atof(charbuf);
203 minute = (minute + second) / 60;
204 strncpy(charbuf, &header[806], 2);
206 degreeLat = atof(charbuf);
207 degreeLat = degreeLat + minute;
208 strncpy(charbuf, &header[812], 1);
212 degreeLat = 0 - degreeLat;
213 strncpy(charbuf, &header[818], 2);
215 second = atof(charbuf);
216 second = second / 60;
217 strncpy(charbuf, &header[816], 2);
219 minute = atof(charbuf);
220 minute = (minute + second) / 60;
221 strncpy(charbuf, &header[813], 3);
223 degreeLon = atof(charbuf);
224 degreeLon = degreeLon + minute;
225 strncpy(charbuf, &header[820], 1);
229 degreeLon = 0 - degreeLon;
230 ossimDpt ip2 (degreeLon, degreeLat);
231 strncpy(charbuf, &header[825], 2);
233 second = atof(charbuf);
234 second = second / 60;
235 strncpy(charbuf, &header[823], 2);
237 minute = atof(charbuf);
238 minute = (minute + second) / 60;
239 strncpy(charbuf, &header[821], 2);
241 degreeLat = atof(charbuf);
242 degreeLat = degreeLat + minute;
243 strncpy(charbuf, &header[827], 1);
247 degreeLat = 0 - degreeLat;
248 strncpy(charbuf, &header[833], 2);
250 second = atof(charbuf);
251 second = second / 60;
252 strncpy(charbuf, &header[831], 2);
254 minute = atof(charbuf);
255 minute = (minute + second) / 60;
256 strncpy(charbuf, &header[828], 3);
258 degreeLon = atof(charbuf);
259 degreeLon = degreeLon + minute;
260 strncpy(charbuf, &header[835], 1);
264 degreeLon = 0 - degreeLon;
265 ossimDpt ip3 (degreeLon, degreeLat);
275 <<
" Aborting with error..." << std::endl;
284 const char* tag_ptr = strstr(header, PIAIMC_TAG);
290 strncpy(charbuf, &tag_ptr[348], 7);
300 <<
"> tag in the NITF file at: <" << init_file <<
"> to extract GSD." 301 <<
" Searching for alternate <" << USE26A_TAG <<
">... "<< std::endl;
308 const char* tag_ptr = strstr(header, USE26A_TAG);
314 strncpy(charbuf, &tag_ptr[15], 5);
324 <<
"> tag in the NITF file at: <" << init_file <<
"> to extract GSD." 325 <<
" Searching for alternate <" << USE00A_TAG <<
">... "<< std::endl;
331 const char* tag_ptr = strstr(header, USE00A_TAG);
337 <<
"> tag in the NITF file at: <" 338 << init_file <<
">." <<
" Aborting with error..." << std::endl;
348 strncpy(charbuf, &tag_ptr[15], 5);
359 init_file.
split(drivePart,
367 geom_filename.
merge(drivePart,
435 out <<
"\nDump of ossimNitfMapModel object at " << hex <<
this <<
":" 448 const char* prefix)
const 571 (ulcorner.
lat + lrcorner.
lat)/2,
575 (lrcorner.
lon + ulcorner.
lon)/2,
609 <<
"\nInput kwl: " << kwl
613 const char* value = 0;
614 const char* keyword = 0;
615 bool success =
false;
621 if (!value || (strcmp(value,
TYPE_NAME(
this))))
628 if (!success)
goto loadStateError;
639 <<
"<" << keyword <<
">. Check the keywordlist for proper syntax." 657 "//**************************************************************\n" 658 "// Template for LandSat model keywordlist\n" 659 "//**************************************************************\n" RTTI_DEF1(ossimNitfMapModel, "ossimNitfMapModel", ossimSensorModel)
virtual ~ossimNitfMapModel()
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
static const char * CENTRAL_MERIDIAN_KW
Represents serializable keyword/value map.
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
static const char * UL_LAT_KW
static const char * LR_X_KW
bool nextVertex(ossimDpt &tbd_vertex) const
METHOD: nextVertex() Assigns the ossimDpt tbd_vertex following the current vertex.
static void writeGeomTemplate(ostream &os)
const char * find(const char *key) const
static const char * NUMBER_LINES_KW
static const char * TIE_POINT_LON_KW
void split(ossimString &drivePart, ossimString &pathPart, ossimString &filePart, ossimString &extPart) const
static const char * LR_LON_KW
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
bool vertex(int index, ossimDpt &tbd_vertex) const
METHOD: vertex(index) Returns the ossimDpt vertex given the index.
static const char * METERS_PER_PIXEL_Y_KW
static const char * TYPE_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * LR_Y_KW
static const char * LR_LAT_KW
static const char * UL_X_KW
static const char * LL_LON_KW
const char * chars() const
For backward compatibility.
ossimPolygon theBoundGndPolygon
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
static const char * LL_LAT_KW
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual std::ostream & print(std::ostream &out) const
static const char * UL_Y_KW
ossimErrorCode theErrorStatus
static void writeGeomTemplate(ostream &os)
static const char * ORIGIN_LATITUDE_KW
virtual std::ostream & print(std::ostream &out) const
static const char * UL_LON_KW
static const char * UR_LAT_KW
void merge(const ossimString &drivePart, const ossimString &pathPart, const ossimString &filePart, const ossimString &extPart)
static const char * UR_LON_KW
static const char * TIE_POINT_LAT_KW
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
static const char * METERS_PER_PIXEL_X_KW
static const char * NUMBER_SAMPLES_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.