/usr/include/ossim/elevation/ossimImageElevationHandler.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | //----------------------------------------------------------------------------
//
// File: ossimImageElevationHandler.h
//
// License: MIT
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: See description for class below.
//
//----------------------------------------------------------------------------
// $Id$
#ifndef ossimImageElevationHandler_HEADER
#define ossimImageElevationHandler_HEADER 1
#include <ossim/elevation/ossimElevCellHandler.h>
#include <ossim/base/ossimDrect.h>
#include <ossim/base/ossimIpt.h>
#include <ossim/imaging/ossimImageGeometry.h>
#include <ossim/imaging/ossimImageHandler.h>
#include <ossim/imaging/ossimTileCache.h>
#include <mutex>
/**
* @class ossimImageElevationHandler
*
* Elevation source for a generic image opened via ossimImageHandler.
*/
class OSSIM_DLL ossimImageElevationHandler : public ossimElevCellHandler
{
public:
/** default constructor */
ossimImageElevationHandler();
ossimImageElevationHandler(const ossimFilename& file);
/**
* METHOD: getHeightAboveMSL
* Height access methods.
*/
virtual double getHeightAboveMSL(const ossimGpt&);
/**
* METHOD: getSizeOfElevCell
* Returns the number of post in the cell. Satisfies pure virtual.
* Note: x = longitude, y = latitude
*/
virtual ossimIpt getSizeOfElevCell() const;
/**
* METHOD: getPostValue
* Returns the value at a given grid point as a double.
* Satisfies pure virtual.
*/
virtual double getPostValue(const ossimIpt& gridPt) const;
/** @return True if open, false if not. */
virtual bool isOpen()const;
/**
* Opens a stream to the srtm cell.
*
* @return Returns true on success, false on error.
*/
virtual bool open(const ossimFilename& file);
/** @brief Closes the stream to the file. */
virtual void close();
/**
* @brief pointHasCoverage(gpt)
*
* Overrides ossimElevCellHandler::pointHasCoverage
* @return TRUE if coverage exists over gpt.
*/
virtual bool pointHasCoverage(const ossimGpt&) const;
virtual ossimObject* dup () const { return new ossimImageElevationHandler(this->getFilename()); }
protected:
/**
* @Brief Protected destructor.
*
* This class is derived from ossimReferenced so users should always use
* ossimRefPtr<ossimImageElevationHandler> to hold instance.
*/
virtual ~ossimImageElevationHandler();
private:
class TileCacheEntry
{
public:
TileCacheEntry() : id(99999) {}
TileCacheEntry(ossim_uint32 xid, ossimImageData* xdata) : id(xid), data(xdata) {}
TileCacheEntry(const TileCacheEntry& copy) : id(copy.id), data(copy.data) {}
const TileCacheEntry& operator=(const TileCacheEntry& copy)
{ id = copy.id; data = copy.data; return *this; }
ossim_uint32 id;
ossimRefPtr<ossimImageData> data;
};
/** Hidden from use copy constructor */
ossimImageElevationHandler(const ossimImageElevationHandler&);
/** Hidden from use assignment operator */
const ossimImageElevationHandler& operator= (const ossimImageElevationHandler& rhs);
/** Looks for an elevation tile in the cache first before reading the tile from the input handler */
ossimImageData* getTile(ossim_uint32 x, ossim_uint32 y) const;
/** Pointers to links in chain. */
mutable ossimRefPtr<ossimImageHandler> m_ih;
ossimRefPtr<ossimImageGeometry> m_geom;
mutable std::vector<TileCacheEntry> m_tileCache;
/** Image space rect stored as drect for inlined pointHasCoverage method. */
ossimDrect m_rect;
ossimIpt m_tileSize;
ossim_uint32 m_numTilesPerRow;
mutable std::mutex m_mutex;
TYPE_DATA
};
inline bool ossimImageElevationHandler::isOpen() const
{
return m_ih.valid();
}
inline void ossimImageElevationHandler::close()
{
m_geom = 0;
m_ih = 0;
}
inline bool ossimImageElevationHandler::pointHasCoverage(const ossimGpt& gpt) const
{
if ( m_geom.valid() )
{
ossimDpt dpt;
m_geom->worldToLocal(gpt, dpt);
return m_rect.pointWithin(dpt);
}
return false;
}
#endif /* ossimImageElevationHandler_HEADER */
|