OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDemInfo.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: David Burken
8 //
9 // Description: USGS DEM Info object.
10 //
11 //----------------------------------------------------------------------------
12 // $Id$
13 
14 #include <iostream>
15 
17 
21 
24 
26 {
27 }
28 
30 {
31 }
32 
34 {
35  std::string connectionString = file.c_str();
36  std::shared_ptr<ossim::istream> str = ossim::StreamFactoryRegistry::instance()->
37  createIstream( file.c_str(), std::ios_base::in|std::ios_base::binary);
38  if(!str) return false;
39  return open(str, connectionString);
40 }
41 
42 bool ossimDemInfo::open(std::shared_ptr<ossim::istream>& str,
43  const std::string& connectionString)
44 {
45  if(!str) return false;
46  bool result = ossimDemUtil::isUsgsDem(str, connectionString);
47 
48  if ( result )
49  {
50  m_fileStr = str;
51  m_connectionString = connectionString;
52  }
53  else
54  {
55  m_connectionString = "";
56  }
57 
58  return result;
59 
60 }
61 
63 {
64  if ( m_fileStr )
65  {
66  ossimDemHeader hdr;
67  m_fileStr->clear();
68  m_fileStr->seekg(0);
69  if ( hdr.open(m_fileStr, m_connectionString) )
70  {
71  // std::string prefix;
72  hdr.print(std::cout);
73  }
74  }
75  return out;
76 }
bool open(const ossimFilename &file)
open method that takes a file.
ossimDemInfo()
default constructor
std::shared_ptr< ossim::istream > m_fileStr
Definition: ossimDemInfo.h:59
static StreamFactoryRegistry * instance()
virtual std::ostream & print(std::ostream &out) const
Print method.
static bool isUsgsDem(const ossimFilename &file)
Does basic sanity checks to see if file is a dem.
virtual ~ossimDemInfo()
virtual destructor
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
virtual bool open(const ossimFilename &file)
open method.
std::string m_connectionString
Definition: ossimDemInfo.h:60
std::ostream & print(std::ostream &out) const
Print method.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23