OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimNitfJ2klraTag Class Reference

#include <ossimNitfJ2klraTag.h>

Inheritance diagram for ossimNitfJ2klraTag:
ossimNitfRegisteredTag ossimObject ossimPropertyInterface ossimReferenced

Classes

class  ossimJ2klraLayer
 

Public Types

enum  {
  ORIG_SIZE = 1, NLEVELS_O_SIZE = 2, NBANDS_O_SIZE = 5, NLAYERS_O_SIZE = 3,
  LAYER_ID_SIZE = 3, BITRATE_SIZE = 9, NLEVELS_I_SIZE = 2, NBANDS_I_SIZE = 5,
  NLAYERS_I_SIZE = 3
}
 

Public Member Functions

 ossimNitfJ2klraTag ()
 default constructor More...
 
virtual void parseStream (std::istream &in)
 Parse method. More...
 
virtual void writeStream (std::ostream &out)
 Write method. More...
 
virtual ossim_uint32 getSizeInBytes () const
 
virtual void clearFields ()
 Clears all string fields within the record to some default nothingness. More...
 
virtual std::ostream & print (std::ostream &out, const std::string &prefix) const
 Print method that outputs a key/value type format adding prefix to keys. More...
 
ossim_uint32 getOriginNumber () const
 
ossim_uint32 getNumberOfLayersOriginal () const
 
bool setOrigin (ossim_uint32 origin)
 Sets origin: More...
 
bool setLevelsO (ossim_uint32 levels)
 Sets the number of wavelet levels in the original image. More...
 
bool setBandsO (ossim_uint32 bands)
 Sets the number of bands in the original image. More...
 
bool setLayersO (ossim_uint32 layers)
 Sets the number of layers in the original image. More...
 
bool setLevelsI (ossim_uint32 levels)
 Sets the number of wavelet levels in this image. More...
 
bool setBandsI (ossim_uint32 bands)
 Sets the number of bands in this image. More...
 
bool setLayersI (ossim_uint32 layers)
 Sets the number of layers in this image. More...
 
bool setLayerId (ossim_uint32 index, ossim_uint32 id)
 Sets the layer id for index. More...
 
bool setLayerBitRate (ossim_uint32 index, ossim_float64 bitRate)
 Sets the bitrate from index. More...
 
- Public Member Functions inherited from ossimNitfRegisteredTag
 ossimNitfRegisteredTag ()
 default constructor More...
 
 ossimNitfRegisteredTag (const std::string &tagName, ossim_uint32 tagLength)
 Constructor that takes name and size. More...
 
virtual ~ossimNitfRegisteredTag ()
 destructor More...
 
virtual std::string getRegisterTagName () const
 This will return the name of the registered tag for this user defined header. More...
 
virtual const std::string & getTagName () const
 This will return the name of the registered tag for this user defined header. More...
 
virtual void setTagName (const std::string &tagName)
 
virtual ossim_uint32 getTagLength () const
 Returns the length in bytes of the tag from the CEL or REL field. More...
 
virtual void setTagLength (ossim_uint32 length)
 Set the tag length. More...
 
virtual void parseStream (ossim::istream &in)=0
 This will allow the user defined data to parse the stream. More...
 
virtual void writeStream (ossim::ostream &out)=0
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual void getMetadata (ossimKeywordlist &kwl, const char *prefix=0) const
 Default interface to populate keyword list with metadata. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const ossimString &prefix) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 

Protected Member Functions

bool isParsed () const
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

char m_orig [ORIG_SIZE+1]
 FIELD: ORIG. More...
 
char m_levels_o [NLEVELS_O_SIZE+1]
 FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image. More...
 
char m_bands_o [NBANDS_O_SIZE+1]
 FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image. More...
 
char m_layers_o [NLAYERS_O_SIZE+1]
 FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image. More...
 
std::vector< ossimJ2klraLayerm_layer
 repeating fields More...
 
char m_nlevels_i [NLEVELS_I_SIZE+1]
 FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9. More...
 
char m_nbands_i [NBANDS_I_SIZE+1]
 FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9. More...
 
char m_nlayers_i [NLAYERS_I_SIZE+1]
 FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9. More...
 
- Protected Attributes inherited from ossimNitfRegisteredTag
std::string m_tagName
 
ossim_uint32 m_tagLength
 

Detailed Description

Definition at line 26 of file ossimNitfJ2klraTag.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ORIG_SIZE 
NLEVELS_O_SIZE 
NBANDS_O_SIZE 
NLAYERS_O_SIZE 
LAYER_ID_SIZE 
BITRATE_SIZE 
NLEVELS_I_SIZE 
NBANDS_I_SIZE 
NLAYERS_I_SIZE 

Definition at line 29 of file ossimNitfJ2klraTag.h.

Constructor & Destructor Documentation

◆ ossimNitfJ2klraTag()

ossimNitfJ2klraTag::ossimNitfJ2klraTag ( )

default constructor

Definition at line 30 of file ossimNitfJ2klraTag.cpp.

References clearFields().

31  : ossimNitfRegisteredTag(std::string("J2KLRA"), 0),
32  m_layer(1)
33 {
34  clearFields();
35 }
virtual void clearFields()
Clears all string fields within the record to some default nothingness.
std::vector< ossimJ2klraLayer > m_layer
repeating fields
ossimNitfRegisteredTag()
default constructor

Member Function Documentation

◆ clearFields()

void ossimNitfJ2klraTag::clearFields ( )
virtual

Clears all string fields within the record to some default nothingness.

Definition at line 114 of file ossimNitfJ2klraTag.cpp.

References m_bands_o, m_layer, m_layers_o, m_levels_o, m_nbands_i, m_nlayers_i, m_nlevels_i, m_orig, NBANDS_I_SIZE, NBANDS_O_SIZE, NLAYERS_I_SIZE, NLAYERS_O_SIZE, NLEVELS_I_SIZE, NLEVELS_O_SIZE, ORIG_SIZE, and ossimNitfRegisteredTag::setTagLength().

Referenced by ossimNitfJ2klraTag(), and parseStream().

115 {
116  memset(m_orig, 0, ORIG_SIZE);
117 
118  memset(m_levels_o, 0, NLEVELS_O_SIZE);
119  memset(m_bands_o, 0, NBANDS_O_SIZE);
120  memset(m_layers_o, 0, NLAYERS_O_SIZE);
121 
122  m_layer.clear();
123 
124  memset(m_nlevels_i, 0, NLEVELS_I_SIZE);
125  memset(m_nbands_i, 0, NBANDS_I_SIZE);
126  memset(m_nlayers_i, 0, NLAYERS_I_SIZE);
127 
128  m_orig[ORIG_SIZE]= '\0';
129 
130  m_levels_o[NLEVELS_O_SIZE]= '\0';
131  m_bands_o[NBANDS_O_SIZE]= '\0';
132  m_layers_o[NLAYERS_O_SIZE]= '\0';
133 
135  m_nbands_i[NBANDS_I_SIZE] = '\0';
136  m_nlayers_i[NLAYERS_I_SIZE] = '\0';
137 
138  // Set the base tag length.
139  setTagLength( 0 );
140 }
char m_levels_o[NLEVELS_O_SIZE+1]
FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image.
char m_orig[ORIG_SIZE+1]
FIELD: ORIG.
std::vector< ossimJ2klraLayer > m_layer
repeating fields
virtual void setTagLength(ossim_uint32 length)
Set the tag length.
char m_nbands_i[NBANDS_I_SIZE+1]
FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9.
char m_bands_o[NBANDS_O_SIZE+1]
FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image. ...
char m_layers_o[NLAYERS_O_SIZE+1]
FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.
char m_nlayers_i[NLAYERS_I_SIZE+1]
FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9.
char m_nlevels_i[NLEVELS_I_SIZE+1]
FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9.

◆ getNumberOfLayersOriginal()

ossim_uint32 ossimNitfJ2klraTag::getNumberOfLayersOriginal ( ) const
Returns
NLAYERS_O field as a number.

Definition at line 180 of file ossimNitfJ2klraTag.cpp.

References m_layers_o, and ossimString::toUInt32().

Referenced by parseStream().

181 {
182  return ossimString(m_layers_o).toUInt32();
183 }
ossim_uint32 toUInt32() const
char m_layers_o[NLAYERS_O_SIZE+1]
FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.

◆ getOriginNumber()

ossim_uint32 ossimNitfJ2klraTag::getOriginNumber ( ) const
Returns
ORIG field as a number.

Definition at line 175 of file ossimNitfJ2klraTag.cpp.

References m_orig, and ossimString::toUInt32().

Referenced by getSizeInBytes(), and isParsed().

176 {
177  return ossimString(m_orig).toUInt32();
178 }
char m_orig[ORIG_SIZE+1]
FIELD: ORIG.
ossim_uint32 toUInt32() const

◆ getSizeInBytes()

ossim_uint32 ossimNitfJ2klraTag::getSizeInBytes ( ) const
virtual
Returns
The size of this record in bytes (123) within a nitf file.

Reimplemented from ossimNitfRegisteredTag.

Definition at line 98 of file ossimNitfJ2klraTag.cpp.

References getOriginNumber(), and m_layer.

Referenced by parseStream().

99 {
100  ossim_uint32 result = 11 + (m_layer.size() * 12);
101 
102  // Conditional:
103  ossim_uint32 orig = getOriginNumber();
104  if ( orig )
105  {
106  if ( orig % 2 ) // Odd origins are "parsed".
107  {
108  result += 10;
109  }
110  }
111  return result;
112 }
std::vector< ossimJ2klraLayer > m_layer
repeating fields
ossim_uint32 getOriginNumber() const
unsigned int ossim_uint32

◆ isParsed()

bool ossimNitfJ2klraTag::isParsed ( ) const
protected
Returns
true if origin byte is parsed; false if not.

Definition at line 325 of file ossimNitfJ2klraTag.cpp.

References getOriginNumber().

Referenced by parseStream(), print(), and writeStream().

326 {
327  bool result = false;
328  ossim_uint32 orig = getOriginNumber();
329  if ( orig )
330  {
331  /*
332  * 0 - Original NPJE
333  * 1 – Parsed NPJE
334  * 2 – Original EPJE
335  * 3 – Parsed EPJE*
336  * 4 - Original TPJE
337  * 5 - Parsed TPJE
338  * 6 - Original LPJE
339  * 7 - Parsed LPJE
340  * 8 – Original other
341  * 9 – Parsed other
342  */
343  if ( orig % 2 ) // Odd origins are "parsed".
344  {
345  result = true;
346  }
347  }
348  return result;
349 }
ossim_uint32 getOriginNumber() const
unsigned int ossim_uint32

◆ parseStream()

void ossimNitfJ2klraTag::parseStream ( std::istream &  in)
virtual

Parse method.

Parameters
inStream to parse.

Definition at line 37 of file ossimNitfJ2klraTag.cpp.

References BITRATE_SIZE, clearFields(), getNumberOfLayersOriginal(), getSizeInBytes(), isParsed(), LAYER_ID_SIZE, m_bands_o, m_layer, m_layers_o, m_levels_o, m_nbands_i, m_nlayers_i, m_nlevels_i, m_orig, NBANDS_I_SIZE, NBANDS_O_SIZE, NLAYERS_I_SIZE, NLAYERS_O_SIZE, NLEVELS_I_SIZE, NLEVELS_O_SIZE, ORIG_SIZE, and ossimNitfRegisteredTag::setTagLength().

38 {
39  clearFields();
40 
41  in.read(m_orig, ORIG_SIZE);
42  in.read(m_levels_o, NLEVELS_O_SIZE);
43  in.read(m_bands_o, NBANDS_O_SIZE);
44  in.read(m_layers_o, NLAYERS_O_SIZE);
45 
47  if ( layers && (layers < 1000) ) // 999 max
48  {
49  m_layer.resize(layers);
50  for ( ossim_uint32 i = 0; i < layers; ++i )
51  {
52  in.read(m_layer[i].m_layer_id, LAYER_ID_SIZE);
53  in.read(m_layer[i].m_bitrate, BITRATE_SIZE);
54  m_layer[i].m_layer_id[LAYER_ID_SIZE] = '\0';
55  m_layer[i].m_bitrate[BITRATE_SIZE] = '\0';
56  }
57  }
58  else
59  {
60  m_layer.clear();
61  }
62 
63  // Conditional:
64  if ( isParsed() )
65  {
66  in.read(m_nlevels_i, NLEVELS_I_SIZE);
67  in.read(m_nbands_i, NBANDS_I_SIZE);
68  in.read(m_nlayers_i, NLAYERS_I_SIZE);
69  }
70 
71  // Set the base tag length.
73 }
char m_levels_o[NLEVELS_O_SIZE+1]
FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image.
char m_orig[ORIG_SIZE+1]
FIELD: ORIG.
virtual void clearFields()
Clears all string fields within the record to some default nothingness.
virtual ossim_uint32 getSizeInBytes() const
std::vector< ossimJ2klraLayer > m_layer
repeating fields
virtual void setTagLength(ossim_uint32 length)
Set the tag length.
char m_nbands_i[NBANDS_I_SIZE+1]
FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9.
char m_bands_o[NBANDS_O_SIZE+1]
FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image. ...
unsigned int ossim_uint32
char m_layers_o[NLAYERS_O_SIZE+1]
FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.
ossim_uint32 getNumberOfLayersOriginal() const
char m_nlayers_i[NLAYERS_I_SIZE+1]
FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9.
char m_nlevels_i[NLEVELS_I_SIZE+1]
FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9.

◆ print()

std::ostream & ossimNitfJ2klraTag::print ( std::ostream &  out,
const std::string &  prefix 
) const
virtual

Print method that outputs a key/value type format adding prefix to keys.

Parameters
outStream to output to.
prefixPrefix added to key like "image0.";

Reimplemented from ossimNitfRegisteredTag.

Definition at line 142 of file ossimNitfJ2klraTag.cpp.

References ossimNitfRegisteredTag::getTagLength(), ossimNitfRegisteredTag::getTagName(), isParsed(), m_bands_o, m_layer, m_layers_o, m_levels_o, m_nbands_i, m_nlayers_i, m_nlevels_i, m_orig, and size.

144 {
145  std::string pfx = prefix;
146  pfx += getTagName();
147  pfx += ".";
148 
149  out << setiosflags(ios::left)
150  << pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
151  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
152  << pfx << std::setw(24) << "ORIG:" << m_orig << "\n"
153  << pfx << std::setw(24) << "NLEVELS_O:" << m_levels_o << "\n"
154  << pfx << std::setw(24) << "NBANDS_O:" << m_bands_o << "\n"
155  << pfx << std::setw(24) << "NLAYERS_O:" << m_layers_o << "\n";
156 
157  ossim_uint32 size = m_layer.size();
158  for ( ossim_uint32 i = 0; i < size; ++i )
159  {
160  out << pfx << "LAYER_ID[" << i << std::setw(14) << "]:" << m_layer[i].m_layer_id << "\n"
161  << pfx << "BITRATE[" << i << std::setw(15) << "]:" << m_layer[i].m_bitrate << "\n";
162  }
163 
164  // Conditional:
165  if ( isParsed() )
166  {
167  out << pfx << std::setw(24) << "NLEVELS_I:" << m_nlevels_i << "\n"
168  << pfx << std::setw(24) << "NBANDS_I_SIZE:" << m_nbands_i << "\n"
169  << pfx << std::setw(24) << "NLAYERS_I:" << m_nlayers_i << "\n";
170  }
171 
172  return out;
173 }
char m_levels_o[NLEVELS_O_SIZE+1]
FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image.
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
char m_orig[ORIG_SIZE+1]
FIELD: ORIG.
std::vector< ossimJ2klraLayer > m_layer
repeating fields
char m_nbands_i[NBANDS_I_SIZE+1]
FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
yy_size_t size
char m_bands_o[NBANDS_O_SIZE+1]
FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image. ...
unsigned int ossim_uint32
char m_layers_o[NLAYERS_O_SIZE+1]
FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.
char m_nlayers_i[NLAYERS_I_SIZE+1]
FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9.
char m_nlevels_i[NLEVELS_I_SIZE+1]
FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9.

◆ setBandsI()

bool ossimNitfJ2klraTag::setBandsI ( ossim_uint32  bands)

Sets the number of bands in this image.

Range: 00001 to 16384

Parameters
levels
Returns
true on success, false if out of range.

Definition at line 264 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), m_nbands_i, NBANDS_I_SIZE, ossimString::size(), and ossimString::string().

265 {
266  bool result = false;
267  if ( ( bands >= 1 ) && ( bands <= 16384 ) )
268  {
270  if ( os.size() == NBANDS_I_SIZE )
271  {
272  strncpy( m_nbands_i, os.string().c_str(), NBANDS_I_SIZE );
273  result = true;
274  }
275  }
276  return result;
277 }
char m_nbands_i[NBANDS_I_SIZE+1]
FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9.
std::string::size_type size() const
Definition: ossimString.h:405
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
const std::string & string() const
Definition: ossimString.h:414

◆ setBandsO()

bool ossimNitfJ2klraTag::setBandsO ( ossim_uint32  bands)

Sets the number of bands in the original image.

Range: 00001 to 16384

Parameters
levels
Returns
true on success, false if out of range.

Definition at line 215 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), m_bands_o, NBANDS_O_SIZE, ossimString::size(), and ossimString::string().

216 {
217  bool result = false;
218  if ( ( bands >= 1 ) && ( bands <= 16384 ) )
219  {
221  if ( os.size() == NBANDS_O_SIZE )
222  {
223  strncpy( m_bands_o, os.string().c_str(), NBANDS_O_SIZE );
224  result = true;
225  }
226  }
227  return result;
228 }
std::string::size_type size() const
Definition: ossimString.h:405
char m_bands_o[NBANDS_O_SIZE+1]
FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image. ...
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
const std::string & string() const
Definition: ossimString.h:414

◆ setLayerBitRate()

bool ossimNitfJ2klraTag::setLayerBitRate ( ossim_uint32  index,
ossim_float64  bitRate 
)

Sets the bitrate from index.

Range: 00.000000 – 37.000000

Note
Requires call to "setLayersO" prior to this to size the container m_layer.
Parameters
index
id
Returns
true on success, false if out of range.

Definition at line 309 of file ossimNitfJ2klraTag.cpp.

References BITRATE_SIZE, ossimNitfCommon::convertToDoubleString(), m_layer, ossimString::size(), and ossimString::string().

Referenced by ossimKakaduCompressor::initialize().

310 {
311  bool result = false;
312  if ( index < m_layer.size() && ( bitRate >= 0.0 ) && ( bitRate <= 37.0 ) )
313  {
314  // 00.000000 – 37.000000
316  if ( os.size() == BITRATE_SIZE)
317  {
318  strncpy( m_layer[index].m_bitrate, os.string().c_str(), BITRATE_SIZE);
319  result = true;
320  }
321  }
322  return result;
323 }
std::vector< ossimJ2klraLayer > m_layer
repeating fields
static ossimString convertToDoubleString(const ossim_float64 &aValue, ossim_uint32 precision, ossim_uint32 size)
This method takes a value and converts to a string of size with requested precision with a &#39;0&#39; fill...
std::string::size_type size() const
Definition: ossimString.h:405
const std::string & string() const
Definition: ossimString.h:414

◆ setLayerId()

bool ossimNitfJ2klraTag::setLayerId ( ossim_uint32  index,
ossim_uint32  id 
)

Sets the layer id for index.

Range: 001 to 999

Note
Requires call to "setLayersO" prior to this to size the container m_layer.
Parameters
index
id
Returns
true on success, false if out of range.

Definition at line 294 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), LAYER_ID_SIZE, m_layer, ossimString::size(), and ossimString::string().

Referenced by ossimKakaduCompressor::initialize().

295 {
296  bool result = false;
297  if ( index < m_layer.size() && ( id <= 998 ) )
298  {
300  if ( os.size() == LAYER_ID_SIZE)
301  {
302  strncpy( m_layer[index].m_layer_id, os.string().c_str(), LAYER_ID_SIZE );
303  result = true;
304  }
305  }
306  return result;
307 }
std::vector< ossimJ2klraLayer > m_layer
repeating fields
std::string::size_type size() const
Definition: ossimString.h:405
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
const std::string & string() const
Definition: ossimString.h:414

◆ setLayersI()

bool ossimNitfJ2klraTag::setLayersI ( ossim_uint32  layers)

Sets the number of layers in this image.

Range: 001 to 999

Parameters
levels
Returns
true on success, false if out of range.

Definition at line 279 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), m_nlayers_i, NLAYERS_I_SIZE, ossimString::size(), and ossimString::string().

280 {
281  bool result = false;
282  if ( ( layers >= 1 ) && ( layers <= 999 ) )
283  {
285  if ( os.size() == NLAYERS_I_SIZE )
286  {
287  strncpy( m_nlayers_i, os.string().c_str(), NLAYERS_I_SIZE );
288  result = true;
289  }
290  }
291  return result;
292 }
std::string::size_type size() const
Definition: ossimString.h:405
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
char m_nlayers_i[NLAYERS_I_SIZE+1]
FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9.
const std::string & string() const
Definition: ossimString.h:414

◆ setLayersO()

bool ossimNitfJ2klraTag::setLayersO ( ossim_uint32  layers)

Sets the number of layers in the original image.

Range: 001 to 999

Parameters
levels
Returns
true on success, false if out of range.

Definition at line 230 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), m_layer, m_layers_o, NLAYERS_O_SIZE, ossimString::size(), and ossimString::string().

Referenced by ossimKakaduCompressor::initialize().

231 {
232  bool result = false;
233  if ( ( layers >= 1 ) && ( layers <= 999 ) )
234  {
236  if ( os.size() == NLAYERS_O_SIZE )
237  {
238  strncpy( m_layers_o, os.string().c_str(), NLAYERS_O_SIZE );
239 
240  // Conditional repeating field:
241  m_layer.resize( layers );
242 
243  result = true;
244  }
245  }
246  return result;
247 }
std::vector< ossimJ2klraLayer > m_layer
repeating fields
std::string::size_type size() const
Definition: ossimString.h:405
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
char m_layers_o[NLAYERS_O_SIZE+1]
FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.
const std::string & string() const
Definition: ossimString.h:414

◆ setLevelsI()

bool ossimNitfJ2klraTag::setLevelsI ( ossim_uint32  levels)

Sets the number of wavelet levels in this image.

Range: 00 to 32

Parameters
levels
Returns
true on success, false if out of range.

Definition at line 249 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), m_nlevels_i, NLEVELS_I_SIZE, ossimString::size(), and ossimString::string().

250 {
251  bool result = false;
252  if ( levels <= 32 )
253  {
255  if ( os.size() == NLEVELS_I_SIZE )
256  {
257  strncpy( m_nlevels_i, os.string().c_str(), NLEVELS_I_SIZE );
258  result = true;
259  }
260  }
261  return result;
262 }
std::string::size_type size() const
Definition: ossimString.h:405
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
char m_nlevels_i[NLEVELS_I_SIZE+1]
FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9.
const std::string & string() const
Definition: ossimString.h:414

◆ setLevelsO()

bool ossimNitfJ2klraTag::setLevelsO ( ossim_uint32  levels)

Sets the number of wavelet levels in the original image.

Range: 00 to 32

Parameters
levels
Returns
true on success, false if out of range.

Definition at line 200 of file ossimNitfJ2klraTag.cpp.

References ossimNitfCommon::convertToUIntString(), m_levels_o, NLEVELS_O_SIZE, ossimString::size(), and ossimString::string().

Referenced by ossimKakaduCompressor::initialize().

201 {
202  bool result = false;
203  if ( levels <= 32 )
204  {
206  if ( os.size() == NLEVELS_O_SIZE )
207  {
208  strncpy( m_levels_o, os.string().c_str(), NLEVELS_O_SIZE );
209  result = true;
210  }
211  }
212  return result;
213 }
char m_levels_o[NLEVELS_O_SIZE+1]
FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image.
std::string::size_type size() const
Definition: ossimString.h:405
static ossimString convertToUIntString(ossim_uint32 aValue, ossim_uint32 size)
This method takes a value and converts to a string of size with with a &#39;0&#39; fill.
const std::string & string() const
Definition: ossimString.h:414

◆ setOrigin()

bool ossimNitfJ2klraTag::setOrigin ( ossim_uint32  origin)

Sets origin:

Range is 0 to 9

0 - Original NPJE 1 – Parsed NPJE 2 – Original EPJE 3 – Parsed EPJE* 4 - Original TPJE 5 - Parsed TPJE 6 - Original LPJE 7 - Parsed LPJE 8 – Original other 9 – Parsed other

Parameters
origin0 to 9
Returns
true on success, false if out of range.

Definition at line 185 of file ossimNitfJ2klraTag.cpp.

References m_orig.

Referenced by ossimKakaduCompressor::initialize().

186 {
187  bool result = true;
188  if ( origin <= 9 )
189  {
190  // Ascii 0 to 9
191  m_orig[0] = 0x30 + origin;
192  }
193  else
194  {
195  result = false;
196  }
197  return result;
198 }
char m_orig[ORIG_SIZE+1]
FIELD: ORIG.

◆ writeStream()

void ossimNitfJ2klraTag::writeStream ( std::ostream &  out)
virtual

Write method.

Parameters
outStream to write to.

Definition at line 75 of file ossimNitfJ2klraTag.cpp.

References BITRATE_SIZE, isParsed(), LAYER_ID_SIZE, m_bands_o, m_layer, m_layers_o, m_levels_o, m_nbands_i, m_nlayers_i, m_nlevels_i, m_orig, NBANDS_I_SIZE, NBANDS_O_SIZE, NLAYERS_I_SIZE, NLAYERS_O_SIZE, NLEVELS_I_SIZE, NLEVELS_O_SIZE, ORIG_SIZE, and size.

76 {
77  out.write(m_orig, ORIG_SIZE);
78  out.write(m_levels_o, NLEVELS_O_SIZE);
79  out.write(m_bands_o, NBANDS_O_SIZE);
80  out.write(m_layers_o, NLAYERS_O_SIZE);
81 
82  ossim_uint32 size = m_layer.size();
83  for ( ossim_uint32 i = 0; i < size; ++i )
84  {
85  out.write(m_layer[i].m_layer_id, LAYER_ID_SIZE);
86  out.write(m_layer[i].m_bitrate, BITRATE_SIZE);
87  }
88 
89  // Conditional:
90  if ( isParsed() )
91  {
92  out.write(m_nlevels_i, NLEVELS_I_SIZE);
93  out.write(m_nbands_i, NBANDS_I_SIZE);
94  out.write(m_nlayers_i, NLAYERS_I_SIZE);
95  }
96 }
char m_levels_o[NLEVELS_O_SIZE+1]
FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image.
char m_orig[ORIG_SIZE+1]
FIELD: ORIG.
std::vector< ossimJ2klraLayer > m_layer
repeating fields
char m_nbands_i[NBANDS_I_SIZE+1]
FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9.
yy_size_t size
char m_bands_o[NBANDS_O_SIZE+1]
FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image. ...
unsigned int ossim_uint32
char m_layers_o[NLAYERS_O_SIZE+1]
FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.
char m_nlayers_i[NLAYERS_I_SIZE+1]
FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9.
char m_nlevels_i[NLEVELS_I_SIZE+1]
FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9.

Member Data Documentation

◆ m_bands_o

char ossimNitfJ2klraTag::m_bands_o[NBANDS_O_SIZE+1]
protected

FIELD: NBANDS_O required 5 bytes 00000 - 16384 Number of bands in original image.

Definition at line 256 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), parseStream(), print(), setBandsO(), and writeStream().

◆ m_layer

std::vector<ossimJ2klraLayer> ossimNitfJ2klraTag::m_layer
protected

◆ m_layers_o

char ossimNitfJ2klraTag::m_layers_o[NLAYERS_O_SIZE+1]
protected

FIELD: NLAYERS_O required 3 bytes 000 - 999 Number of layers in original image.

Definition at line 264 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), getNumberOfLayersOriginal(), parseStream(), print(), setLayersO(), and writeStream().

◆ m_levels_o

char ossimNitfJ2klraTag::m_levels_o[NLEVELS_O_SIZE+1]
protected

FIELD: NLEVELS_O required 2 bytes 00 - 32 Number of wavelet levels in original image.

Definition at line 248 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), parseStream(), print(), setLevelsO(), and writeStream().

◆ m_nbands_i

char ossimNitfJ2klraTag::m_nbands_i[NBANDS_I_SIZE+1]
protected

FIELD: NBANDS_I Conditional 5 bytes if ORIG=1, 3,or 9.

00000 = 16384 Number of bands in this image.

Definition at line 283 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), parseStream(), print(), setBandsI(), and writeStream().

◆ m_nlayers_i

char ossimNitfJ2klraTag::m_nlayers_i[NLAYERS_I_SIZE+1]
protected

FIELD: NLAYERS_I Conditional 3 bytes if ORIG=1, 3, or 9.

000 - 999 Number of Layers in this image.

Definition at line 291 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), parseStream(), print(), setLayersI(), and writeStream().

◆ m_nlevels_i

char ossimNitfJ2klraTag::m_nlevels_i[NLEVELS_I_SIZE+1]
protected

FIELD: NLEVELS_I Conditional 2 bytes if ORIG=1, 3, or 9.

00 - 32 Number of wavelet levels in this image.

Definition at line 275 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), parseStream(), print(), setLevelsI(), and writeStream().

◆ m_orig

char ossimNitfJ2klraTag::m_orig[ORIG_SIZE+1]
protected

FIELD: ORIG.

Required 1 byte.

0 - Original NPJE 1 – Parsed NPJE 2 – Original EPJE 3 – Parsed EPJE* 4 - Original TPJE 5 - Parsed TPJE 6 - Original LPJE 7 - Parsed LPJE 8 – Original other 9 – Parsed other

Original compressed data.

Definition at line 240 of file ossimNitfJ2klraTag.h.

Referenced by clearFields(), getOriginNumber(), parseStream(), print(), setOrigin(), and writeStream().


The documentation for this class was generated from the following files: