OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDemGrid.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // Author: Ken Melero
6 // Orginally written by Jamie Moyers (jmoyers@geeks.com)
7 // Adapted from the package KDEM.
8 // Description: This class defines a DEM grid.
9 //
10 //********************************************************************
11 // $Id$
12 
13 #ifndef ossimDemGrid_HEADER
14 #define ossimDemGrid_HEADER 1
15 
17 #include <ossim/base/ossimIosFwd.h>
20 #include <vector>
21 
28 {
29 public:
30 
34  ossimDemGrid(ossim_float32 missingDataValue = -32768.0);
35 
36  ~ossimDemGrid();
37 
51  long read(ossim::istream& dem, bool incrementalRead = false);
52 
53  // Accessors
54  ossimDemHeader const& getHeader() const;
55 
59  long getWidth() const;
60 
64  long getHeight() const;
65 
70  ossim_float32 getElevation(long x, long y) const;
71 
76 
82  void getGroundCoords(long x, long y, double& ground_x, double& ground_y);
83 
84 private:
85 
88  long _width;
89  long _height;
91  bool _firstTime; // Whether or not we've started reading the DEM.
93  std::vector<ossimDemProfile> _profiles; // Used by fillUTM()
95 
96  void setElevation(long x, long y, ossim_float32 val);
97  long fillGeographic(ossim::istream& dem, bool incrementalRead);
98  long fillUTM(ossim::istream& dem, bool incrementalRead);
99 };
100 
101 inline void ossimDemGrid::setElevation(long x, long y, ossim_float32 val)
102 {
103  if (_grid == 0)
104  return;
105 
106  _grid[(_width * y) + x] = val;
107 }
108 
109 #endif // #ifndef ossimDemGrid_HEADER
ossim_uint32 x
ossimDemHeader _header
Definition: ossimDemGrid.h:87
double _northwest_y
Definition: ossimDemGrid.h:94
void getGroundCoords(long x, long y, double &ground_x, double &ground_y)
long getWidth() const
ossim_uint32 y
float ossim_float32
long fillUTM(ossim::istream &dem, bool incrementalRead)
ossim_float32 * _grid
Definition: ossimDemGrid.h:90
long _curProfile
Definition: ossimDemGrid.h:92
long fillGeographic(ossim::istream &dem, bool incrementalRead)
ossim_float32 getMissingDataValue() const
void setElevation(long x, long y, ossim_float32 val)
Definition: ossimDemGrid.h:101
long getHeight() const
std::vector< ossimDemProfile > _profiles
Definition: ossimDemGrid.h:93
long read(ossim::istream &dem, bool incrementalRead=false)
double _northwest_x
Definition: ossimDemGrid.h:94
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
ossimDemGrid(ossim_float32 missingDataValue=-32768.0)
ossimDemHeader const & getHeader() const
ossim_float32 _missDataVal
Definition: ossimDemGrid.h:86
ossim_float32 getElevation(long x, long y) const