OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Attributes | List of all members
ossimEnviInfo Class Reference

ENVI info class. More...

#include <ossimEnviInfo.h>

Inheritance diagram for ossimEnviInfo:
ossimInfoBase ossimReferenced

Public Member Functions

 ossimEnviInfo ()
 default constructor More...
 
virtual ~ossimEnviInfo ()
 virtual destructor More...
 
virtual bool open (const ossimFilename &file)
 open method. More...
 
virtual std::ostream & print (std::ostream &out) const
 Print method. More...
 
- Public Member Functions inherited from ossimInfoBase
 ossimInfoBase ()
 default constructor More...
 
virtual bool open (std::shared_ptr< ossim::istream > &str, const std::string &connectionString)
 open method. More...
 
void setProcessOverviewFlag (bool flag)
 Sets the overview flag. More...
 
bool getProcessOverviewFlag () const
 Method to get the overview flag. More...
 
virtual bool getKeywordlist (ossimKeywordlist &kwl) const
 Method to dump info to a keyword list. More...
 
virtual bool getKeywordlist (ossimKeywordlist &kwl, ossim_uint32 entryIndex) const
 Method to dump info to a keyword list. More...
 
- 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
 

Private Attributes

ossimFilename m_file
 

Additional Inherited Members

- Protected Member Functions inherited from ossimInfoBase
virtual ~ossimInfoBase ()
 virtual destructor More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Attributes inherited from ossimInfoBase
bool theOverviewFlag
 

Detailed Description

ENVI info class.

Definition at line 21 of file ossimEnviInfo.h.

Constructor & Destructor Documentation

◆ ossimEnviInfo()

ossimEnviInfo::ossimEnviInfo ( )

default constructor

Definition at line 19 of file ossimEnviInfo.cpp.

20  : ossimInfoBase(),
21  m_file()
22 {
23 }
ossimFilename m_file
Definition: ossimEnviInfo.h:51
ossimInfoBase()
default constructor

◆ ~ossimEnviInfo()

ossimEnviInfo::~ossimEnviInfo ( )
virtual

virtual destructor

Definition at line 25 of file ossimEnviInfo.cpp.

26 {
27 }

Member Function Documentation

◆ open()

bool ossimEnviInfo::open ( const ossimFilename file)
virtual

open method.

Parameters
fileFile name to open.
Returns
true on success false on error.

Reimplemented from ossimInfoBase.

Definition at line 29 of file ossimEnviInfo.cpp.

References ossimString::clear(), ossimString::downcase(), ossimFilename::exists(), ossimFilename::ext(), ossimEnviHeader::isEnviHeader(), m_file, ossimFilename::setExtension(), and ossimString::string().

30 {
31  bool result = false;
32 
33  m_file = file;
34 
35  if ( file.ext().downcase() != "hdr" )
36  {
37  // Typical case, we were fed the image file. Look for a header file beside image.
38  m_file.setExtension("hdr"); // image.hdr
39  if ( !m_file.exists() )
40  {
41  m_file.setExtension("HDR"); // image.HDR
42  if ( !m_file.exists() )
43  {
44  m_file = file;
45  m_file.string() += ".hdr"; // image.ras.hdr
46  }
47  }
48  }
49 
50  if ( m_file.exists() )
51  {
53  {
54  result = true;
55  }
56  }
57 
58  if ( !result )
59  {
60  m_file.clear();
61  }
62 
63  return result;
64 }
void clear()
Erases the entire container.
Definition: ossimString.h:432
static bool isEnviHeader(const ossimFilename &file)
Global method to test first line of file for "ENVI".
bool exists() const
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
ossimString ext() const
ossimFilename m_file
Definition: ossimEnviInfo.h:51
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
const std::string & string() const
Definition: ossimString.h:414

◆ print()

std::ostream & ossimEnviInfo::print ( std::ostream &  out) const
virtual

Print method.

Parameters
outStream to print to.
Returns
std::ostream&

Implements ossimInfoBase.

Definition at line 66 of file ossimEnviInfo.cpp.

References ossimKeywordlist::addPrefixToAll(), ossimEnviHeader::getMap(), m_file, ossimEnviHeader::open(), and ossimString::size().

67 {
68  if ( m_file.size() )
69  {
70  ossimEnviHeader hdr;
71  if ( hdr.open( m_file ) )
72  {
73  hdr.getMap().addPrefixToAll( ossimString( "envi." ) );
74  out << hdr.getMap() << std::endl;
75  }
76  }
77  return out;
78 }
bool open(const ossimFilename &file)
Opens an envi header.
std::string::size_type size() const
Definition: ossimString.h:405
const ossimKeywordlist & getMap() const
void addPrefixToAll(const ossimString &prefix)
Class for reading and writing an ENVI (The Environment for Visualizing Images) header file...
ossimFilename m_file
Definition: ossimEnviInfo.h:51

Member Data Documentation

◆ m_file

ossimFilename ossimEnviInfo::m_file
private

Definition at line 51 of file ossimEnviInfo.h.

Referenced by open(), and print().


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