Skip to content

Commit 30f0541

Browse files
committed
Updates for new tag stuff.
1 parent 8351fca commit 30f0541

File tree

4 files changed

+407
-10
lines changed

4 files changed

+407
-10
lines changed

include/ossim/support_data/ossimNitfCsexrbTag.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,25 @@
2121

2222
class OSSIM_DLL ossimNitfCsexrbTag : public ossimNitfGenericTag
2323
{
24-
public:
25-
ossimNitfCsexrbTag(ossim_uint32 tagLength=0);
24+
public:
25+
26+
ossimNitfCsexrbTag();
27+
28+
ossimNitfCsexrbTag(ossim_uint32 tagLength);
29+
30+
virtual ossimString getClassName() const;
31+
32+
private:
33+
34+
/**
35+
* @brief Initializes ossimNitfGenericTag FIELD_DEFINITIONS.
36+
*/
37+
void initializeFieldDefinitions();
38+
39+
/**
40+
* @brief Initializes ossimNitfGenericTag m_fields_map required tags.
41+
*/
42+
void initializeDefaults();
2643

27-
virtual ossimString getClassName() const;
2844
};
2945
#endif

include/ossim/support_data/ossimNitfGenericTag.h

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define ossimNitfGenericTag_HEADER 1
1515

1616
#include <ossim/support_data/ossimNitfRegisteredTag.h>
17+
#include <ossim/base/ossimString.h>
1718
#include <map>
1819
#include <vector>
1920

@@ -36,16 +37,41 @@ class OSSIM_DLL ossimNitfGenericTag : public ossimNitfRegisteredTag
3637

3738
ossimString get(ossimString fieldName);
3839
void setField(ossimString fieldName, ossimString fieldValue);
40+
41+
protected:
42+
43+
/**
44+
* @brief Computes tag length from m_fields_map size.
45+
* @return Tag length in bytes.
46+
*/
47+
ossim_uint32 computeTagLength() const;
3948

40-
struct definition
49+
/**
50+
* @brief Prints out m_fields_map for debug.
51+
*/
52+
std::ostream& printMap(std::ostream& out ) const;
53+
54+
/**
55+
* @brief Prints out field definitions for debug.
56+
*/
57+
std::ostream& printFieldDefs(std::ostream& out ) const;
58+
59+
class definition
4160
{
61+
public:
62+
std::ostream& print(std::ostream& out) const;
63+
4264
ossimString field;
65+
66+
/** Size in bytes or if negative relative to specialFields enum. */
4367
ossim_int32 size;
68+
4469
std::vector<ossim_int8> formatMethod;
4570
};
4671

47-
protected:
48-
72+
friend std::ostream& operator<<(std::ostream& out,
73+
const ossimNitfGenericTag::definition& def);
74+
4975
std::vector<definition> FIELD_DEFINITIONS;
5076

5177
//Parses field value from reverse polish noatation for loop and if conditions
@@ -61,4 +87,6 @@ class OSSIM_DLL ossimNitfGenericTag : public ossimNitfRegisteredTag
6187
};
6288
};
6389

90+
91+
6492
#endif

src/support_data/ossimNitfCsexrbTag.cpp

Lines changed: 269 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,37 @@
1515
//----------------------------------------------------------------------------
1616

1717
#include <ossim/support_data/ossimNitfCsexrbTag.h>
18+
#include <ossim/base/ossimNotify.h>
19+
#include <ossim/base/ossimTrace.h>
20+
#include <utility> /* make_pair */
21+
22+
static ossimTrace traceDebug("ossimNitfCsexrbTag:debug");
23+
24+
ossimNitfCsexrbTag::ossimNitfCsexrbTag()
25+
: ossimNitfGenericTag("CSEXRB", 0)
26+
{
27+
// Uncomment to hard code on trace for class.
28+
// traceDebug.setTraceFlag(true);
29+
30+
initializeFieldDefinitions();
31+
initializeDefaults();
32+
setTagLength(computeTagLength());
33+
34+
if ( traceDebug() )
35+
{
36+
ossimNotify(ossimNotifyLevel_DEBUG)
37+
<< "ossimNitfCsexrbTag::ossimNitfCsexrbTag() DEBUG:\n"
38+
<< "Computed default tag length: " << getTagLength() << "\n";
39+
}
40+
}
1841

1942
ossimNitfCsexrbTag::ossimNitfCsexrbTag(ossim_uint32 tagLength)
2043
: ossimNitfGenericTag("CSEXRB", tagLength)
44+
{
45+
initializeFieldDefinitions();
46+
}
47+
48+
void ossimNitfCsexrbTag::initializeFieldDefinitions()
2149
{
2250
FIELD_DEFINITIONS =
2351
{
@@ -145,9 +173,249 @@ ossimNitfCsexrbTag::ossimNitfCsexrbTag(ossim_uint32 tagLength)
145173
{"RESERVED_FIELD_MASK:0 1 =", IF_STATEMENT_END},
146174
{"RESERVED_LEN 0 = !", IF_STATEMENT_END}
147175
};
148-
}
176+
177+
if (traceDebug())
178+
{
179+
ossimNotify(ossimNotifyLevel_DEBUG)
180+
<< "ossimNitfCsexrbTag::initializeFieldDefinitions() DEBUG\n"
181+
<< "Field definitions:\n";
182+
printFieldDefs(ossimNotify(ossimNotifyLevel_DEBUG));
183+
}
184+
185+
} // End: ossimNitfCsexrbTag::initializeFieldDefinitions()
149186

150187
ossimString ossimNitfCsexrbTag::getClassName() const
151188
{
152189
return ossimString("ossimNitfCsexrbTag");
153190
}
191+
192+
//---
193+
// See: Vol-2-APP M-GLAS-GFM
194+
// Table M.6-1: Common Sensor Exploitation Reference Data (CSEXRB) TRE
195+
//---
196+
void ossimNitfCsexrbTag::initializeDefaults()
197+
{
198+
clearFields();
199+
200+
ossimString key;
201+
ossimString val;
202+
203+
// 36 BCS-A R
204+
key = "IMAGE_UUID";
205+
val = "00000000-0000-0000-0000-000000000000";
206+
m_fields_map.insert(std::make_pair(key, val));
207+
208+
// 3 BCS-N 000 to 999 R
209+
key = "NUM_ASSOC_DES";
210+
val = "000";
211+
m_fields_map.insert(std::make_pair(key, val));
212+
213+
// ASSOC_DES_UUIDi 36 BCS-A C
214+
215+
// 6 BCS-A R
216+
key = "PLATFORM_ID";
217+
val.string().resize(6);
218+
val.string().replace(0,6,6,' ');
219+
m_fields_map.insert(std::make_pair(key, val));
220+
221+
// 6 BCS-A R
222+
key = "PAYLOAD_ID";
223+
m_fields_map.insert(std::make_pair(key, val));
224+
225+
// 6 BCS-A R
226+
key = "SENSOR_ID";
227+
m_fields_map.insert(std::make_pair(key, val));
228+
229+
// 1 BCS-A "F", "S" or BCS space if field is N/A <R>
230+
key = "SENSOR_TYPE";
231+
val = " ";
232+
m_fields_map.insert(std::make_pair(key, val));
233+
234+
// 12 BCS-A -99999999.99 to +99999999.99 or BCS spaces meters <R>
235+
key = "GROUND_REF_POINT_X";
236+
val.string().resize(12);
237+
val.string().replace(0,12,12,' ');
238+
m_fields_map.insert(std::make_pair(key, val));
239+
240+
// 12 BCS-A -99999999.99 to +99999999.99 or BCS spaces meters <R>
241+
key = "GROUND_REF_POINT_Y";
242+
m_fields_map.insert(std::make_pair(key, val));
243+
244+
// 12 BCS-A -99999999.99 to +99999999.99 or BCS spaces meters <R>
245+
key = "GROUND_REF_POINT_Z";
246+
m_fields_map.insert(std::make_pair(key, val));
247+
248+
// If (SENSOR_TYPE = S) conditional.
249+
250+
//---
251+
// Field: DAY_FIRST_LINE_IMAGE 8 BCS-N CCYYMMDD UTC C
252+
// Day of First Line of the Synthetic Array Image.
253+
//---
254+
255+
//---
256+
// Field: TIME_FIRST_LINE_IMAGE
257+
// 15 BCS-N 00000.000000000 to 86399.999999999 seconds UTC C
258+
//---
259+
260+
//---
261+
// Field: TIME_IMAGE_DURATION
262+
// 16 BCS-N -86399.999999999 to 86399.999999999 seconds UTC C
263+
//---
264+
265+
// END If (SENSOR_TYPE = S) conditional.
266+
267+
// If (SENSOR_TYPE = F)
268+
269+
// Field: TIME_STAMP_LOC 1 BCS-N 0 or 1 C
270+
271+
//---
272+
// Field: REFERENCE_FRAME_NUM 9 BCS-A 000000001 to 999999999 or BCS spaces <C>
273+
//---
274+
275+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
276+
key = "MAX_GSD";
277+
m_fields_map.insert(std::make_pair(key, val));
278+
279+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
280+
key = "ALONG_SCAN_GSD";
281+
m_fields_map.insert(std::make_pair(key, val));
282+
283+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
284+
key = "CROSS_SCAN_GSD";
285+
m_fields_map.insert(std::make_pair(key, val));
286+
287+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
288+
key = "GEO_MEAN_GSD";
289+
m_fields_map.insert(std::make_pair(key, val));
290+
291+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
292+
key = "A_S_VERT_GSD";
293+
m_fields_map.insert(std::make_pair(key, val));
294+
295+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
296+
key = "C_S_VERT_GSD";
297+
m_fields_map.insert(std::make_pair(key, val));
298+
299+
// 12 BCS-A 0000000000.0 to 9999999999.9 or BCS spaces inches <R>
300+
key = "GEO_MEAN_VERT_GSD";
301+
m_fields_map.insert(std::make_pair(key, val));
302+
303+
// 5 BCS-A 000.0 to 180.0 or BCS spaces degrees <R>
304+
key = "GSD_BETA_ANGLE";
305+
val.string().resize(5);
306+
val.string().replace(0,5,5,' ');
307+
m_fields_map.insert(std::make_pair(key, val));
308+
309+
// 5 BCS-A 00000 to 99999 or BCS spaces dn <R>
310+
key = "DYNAMIC_RANGE";
311+
m_fields_map.insert(std::make_pair(key, val));
312+
313+
// 7 BCS-N 0000000 to 9999999 R
314+
key = "NUM_LINES";
315+
val.string().resize(7);
316+
val.string().replace(0,7,7,'0');
317+
m_fields_map.insert(std::make_pair(key, val));
318+
319+
// 5 BCS-N 00000 to 99999 R
320+
key = "NUM_SAMPLES";
321+
val.string().resize(5);
322+
val.string().replace(0,5,5,'0');
323+
m_fields_map.insert(std::make_pair(key, val));
324+
325+
// 7 BCS-A 000.000 to 359.999 or BCS spaces degrees <R>
326+
key = "ANGLE_TO_NORTH";
327+
val.string().resize(7);
328+
val.string().replace(0,7,7,'0');
329+
m_fields_map.insert(std::make_pair(key, val));
330+
331+
// 6 BCS-A 00.000 to 90.000 or BCS spaces degrees <R>
332+
key = "OBLIQUITY_ANGLE";
333+
val.string().resize(6);
334+
val.string().replace(0,6,6,'0');
335+
m_fields_map.insert(std::make_pair(key, val));
336+
337+
// 7 BCS-A 000.000 to 359.999 or BCS spaces degrees <R>
338+
key = "AZ_OF_OBLIQUITY";
339+
val.string().resize(7);
340+
val.string().replace(0,7,7,'0');
341+
m_fields_map.insert(std::make_pair(key, val));
342+
343+
// 1 BCS-N 0 = Do not apply correction 1 = Apply correction R
344+
key = "ATM_REFR_FLAG";
345+
val.string().resize(1);
346+
val = "0";
347+
m_fields_map.insert(std::make_pair(key, val));
348+
349+
// 1 BCS-N 0 = Do not apply correction 1 = Apply correction R
350+
key = "VEL_ABER_FLAG";
351+
m_fields_map.insert(std::make_pair(key, val));
352+
353+
// 1 BCS-N 1 = Snow 0 = No Snow 9 - Not Available R
354+
key = "GRD_COVER";
355+
val = "9";
356+
m_fields_map.insert(std::make_pair(key, val));
357+
358+
//---
359+
// 1 BCS-N 0 = inches
360+
// 1 = 1 to 8 inches of ice and/or snow
361+
// 2 = 9 to 17 inches
362+
// 3 = greater than 17 inches
363+
// 9 = Not Available
364+
//---
365+
key = "SNOW_DEPTH_CATEGORY";
366+
val = "9";
367+
m_fields_map.insert(std::make_pair(key, val));
368+
369+
// 7 BCS-A -90.000 to +90.000 or BCS spaces degrees <R>
370+
key = "SUN_AZIMUTH";
371+
val.string().resize(7);
372+
val.string().replace(0,7,7,' ');
373+
m_fields_map.insert(std::make_pair(key, val));
374+
375+
// 7 BCS-A -90.000 to +90.000 or BCS spaces degrees <R>
376+
key = "SUN_ELEVATION";
377+
m_fields_map.insert(std::make_pair(key, val));
378+
379+
// 3 BCS-A 0.0 to 9.0 or BCS spaces NIIRS <R>
380+
key = "PREDICTED_NIIRS";
381+
val.string().resize(3);
382+
val.string().replace(0,3,3,' ');
383+
m_fields_map.insert(std::make_pair(key, val));
384+
385+
// 5 BCS-A 000.0 to 999.9 or BCS spaces feet <R>
386+
key = "CIRCL_ERR";
387+
val.string().resize(5);
388+
val.string().replace(0,5,5,' ');
389+
m_fields_map.insert(std::make_pair(key, val));
390+
391+
// 5 BCS-A 000.0 to 999.9 or BCS spaces feet <R>
392+
key = "LINEAR_ERR";
393+
m_fields_map.insert(std::make_pair(key, val));
394+
395+
// 3 BCS-A 000 to 100, 999 or BCS spaces percent <R>
396+
key = "CLOUD_COVER";
397+
val.string().resize(3);
398+
val.string().replace(0,3,3,' ');
399+
m_fields_map.insert(std::make_pair(key, val));
400+
401+
// 1 BCS-N 0 = no 1 = yes or BCS space <R>
402+
key = "UE_TIME_FLAG";
403+
val.string().resize(1);
404+
val = " ";
405+
m_fields_map.insert(std::make_pair(key, val));
406+
407+
// 5 BCS-A 00000 to 00063 Max or BCS spaces bytes R
408+
key = "RESERVED_LEN";
409+
val.string().resize(5);
410+
val.string().replace(0,5,5,'0');
411+
m_fields_map.insert(std::make_pair(key, val));
412+
413+
if (traceDebug())
414+
{
415+
ossimNotify(ossimNotifyLevel_DEBUG)
416+
<< "ossimNitfCsexrbTag::initializeDefaults() DEBUG\n"
417+
<< "Default map:\n";
418+
printMap(ossimNotify(ossimNotifyLevel_DEBUG));
419+
}
420+
421+
} // End: void ossimNitfCsexrbTag::initializeDefaults()

0 commit comments

Comments
 (0)