/usr/include/ossim/elevation/ossimElevManager.h is in libossim-dev 1.7.21-3ubuntu2.
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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | //*****************************************************************************
// FILE: ossimElevManager.h
//
// License: See top level LICENSE.txt file.
//
// DESCRIPTION:
// Contains declaration of class ossimElevManager. This object provides a
// single interface to an imaging chain for accessing multiple elevation
// sources. This object owns one or more elevation sources in an ordered
// list. When queried for an elevation at a particular point, it searches
// the available sources for the best result, instantiating new sources if
// necessary.
//
// SOFTWARE HISTORY:
//>
// 13Apr2001 Oscar Kramer
// Initial coding.
//<
//*****************************************************************************
#ifndef ossimElevManager_HEADER
#define ossimElevManager_HEADER
#include <vector>
#include <ossim/base/ossimConstants.h>
#include <ossim/elevation/ossimElevSource.h>
#include <ossim/elevation/ossimElevSourceFactory.h>
#include <OpenThreads/ReadWriteMutex>
class ossimDrect;
class ossimKeywordlist;
class ossimGeoidManager;
// class ossimDtedManager;
/******************************************************************************
* CLASS: ossimElevManager
*
*****************************************************************************/
class OSSIMDLLEXPORT ossimElevManager : public ossimElevSource
{
public:
virtual ~ossimElevManager();
/**
* METHOD: instance()
* Implements singelton pattern
*/
static ossimElevManager* instance();
/**
* Height access methods:
* Return OSSIM_DBL_NAN if point is not found.
*/
virtual double getHeightAboveMSL(const ossimGpt& gpt);
virtual double getHeightAboveEllipsoid(const ossimGpt& gpt);
/**
* Method to check if the ground point elevation is defined:
*/
virtual bool pointHasCoverage(const ossimGpt& gpt) const;
/**
* Method to load new elevation data given ground rectangle:
*/
void loadElevData(const ossimDrect& ground_rect);
/**
* METHODS: accuracyLE90(), accuracyCE90()
* Returns the vertical and horizontal accuracy (90% confidence) in the
* region of gpt:
*/
virtual double getAccuracyLE90(const ossimGpt& gpt) const;
virtual double getAccuracyCE90(const ossimGpt& gpt) const;
/**
* METHOD: meanSpacingMeters() const
* Returns the mean spacing in meters between posts in the region of gpt.
*/
virtual double getMeanSpacingMeters() const;
/**
* Method to save the state of an object to a keyword list.
* Return true if ok or false on error.
*/
virtual bool saveState(ossimKeywordlist& kwl,
const char* prefix=0) const;
/**
* Method to the load (recreate) the state of an object from a keyword
* list. Return true if ok or false on error.
*/
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix=0);
/**
* @brief This method adds an ossimElevSource to the list.
* A mutex lock/unlock is placed around its code to prevent
* someone else from mucking with theElevSourceList on a different thread.
*
* @param source ossimElevSource to add.
*/
virtual void addElevSource(ossimElevSource* source);
virtual void addElevSourceFactory(
ossimRefPtr<ossimElevSourceFactory> factory);
// Auto loading control...
virtual void enableAutoLoad();
virtual void disableAutoLoad();
virtual bool isAutoLoadEnabled() const;
/**
* Auto sorting control...
* Auto sorting sorts cell on add by mean post spacing putting cells with
* lowest(best) post spacing at the top.
*/
virtual void enableAutoSort();
virtual void disableAutoSort();
virtual bool isAutoSortEnabled() const;
/**
* METHOD: bool isCellOpen(const ossimFilename& cell) const
* Returns true if cell is currently opened(in theElevSourceList).
*/
virtual bool isCellOpen(const ossimFilename& cell) const;
/**
* @return Returns the cell file name used for a given point.
* Will return empty file name if point is not handled by any
* factories.
*/
ossimFilename getCellFilenameForPoint(const ossimGpt& gpt) const;
virtual ossimRefPtr<ossimElevSourceFactory> findFactoryFromDir(
const ossimFilename& dir);
virtual const ossimRefPtr<ossimElevSourceFactory> findFactoryFromDir(
const ossimFilename& dir)const;
/**
* METHOD: bool openDirectory(const ossimFilename& dir)
* Method to open a directory of elevation cells.
* Returns true on success, false on error.
*/
virtual bool openDirectory(const ossimFilename& dir);
/**
* METHOD: bool openCell(const ossimFilename& cell)
* Method to open an elevation cell.
* Returns true on success, false on error.
*/
virtual bool openCell(const ossimFilename& cell);
/**
* METHOD: bool closeCell(const ossimFilename& cell)
* Method to close an elevation cell.
* Returns true on success, false on error.
*/
virtual bool closeCell(const ossimFilename& cell);
/**
* METHOD: void closeAllCells()
* Method to close all open elevation cells.
*/
virtual void closeAllCells();
/**
* METHOD: bool moveCellUpOne(const ossimFilename& cell)
* Method to move an elevation cell on the list up by one.
* Returns true on success, false on error.
*/
virtual bool moveCellUpOne(const ossimFilename& cell);
/**
* METHOD: bool moveCellDownOne(const ossimFilename& cell)
* Method to move an elevation cell on the list down by one.
* Returns true on success, false on error.
*/
virtual bool moveCellDownOne(const ossimFilename& cell);
/**
* METHOD: bool moveCellToTop(const ossimFilename& cell)
* Method to move an elevation cell to the top of the list.
* Returns true on success, false on error.
*/
virtual bool moveCellToTop(const ossimFilename& cell);
/**
* METHOD: bool moveCellToBottomconst ossimFilename& cell)
* Method to move an elevation cell to the bottom of the list.
* Returns true on success, false on error.
*/
virtual bool moveCellToBottom(const ossimFilename& cell);
/**
* @param list List to initialize with open cells.
*
* @note list is clear prior to stuffing.
*/
void getOpenCellList(std::vector<ossimFilename>& list) const;
ossimFilename getDefaultElevationPath() const;
void setDefaultElevationPath(const ossimFilename& path);
ossim_uint32 getNumberOfFactories()const;
const ossimRefPtr<ossimElevSourceFactory> getFactory(ossim_uint32 idx)const;
bool loadElevationPath(const ossimFilename& elevationPath);
const std::vector<ossimFilename>& elevationSearchPaths()const;
/**
* Method to determine if a file name is of dted format.
*
* @param f File to look at.
*
* @return true if dted format, false if not.
*/
bool isDtedFilenameFormat(const ossimFilename& file) const;
/**
* Method to determine if a file name is of srtm format.
*
* @param f File to look at.
*
* @return true if dted format, false if not.
*/
bool isSrtmFilenameFormat(const ossimFilename& file) const;
/**
* Method to determine if a directory is of dted structure.
*
* @param dir Directory to look at.
*
* @return true if dted directory structure, false if not.
*/
bool isDtedDirectory(const ossimFilename& dir) const;
/**
* Method to determine if a directory looks like srtm.
*
* @param dir Directory to look at.
*
* @return true if srtm directory structure, false if not.
*/
bool isSrtmDirectory(const ossimFilename& dir) const;
/**
* Method to determine if a file or directory looks like general raster.
*
* @param file File to look at. This can be a file or directory.
*
* @note This should always be called after isSrtmDirectory as srtm is
* just a specialized general raster so you should use srtm first.
*
* @return true if general raster (directory or file), false if not.
*/
bool isGeneralRaster(const ossimFilename& file)const;
protected:
/**
* @brief Returns elevation source that has coverage for point.
*
* Does no mutex locking so callers should handle lock. Also this only
* checks for cell has coverage does not check point for null post. So you
* could get a source that has coverage but a null post for the individual
* point. Does not add newly opened cells to list.
*
* @return ossimElevSource wrapped in a ossimRefPtr. The pointer will be
* null if no coverage is found so callers should check.
*/
ossimRefPtr<ossimElevSource> getElevSourceForPoint(
const ossimGpt& gpt) const;
typedef std::vector<ossimRefPtr<ossimElevSourceFactory> >::iterator ossimElevSourceFactoryIterator;
typedef std::vector<ossimRefPtr<ossimElevSourceFactory> >::const_iterator ossimElevSourceFactoryConstIterator;
typedef std::vector<ossimRefPtr<ossimElevSource> >::iterator ossimElevSourceListIterator;
typedef std::vector<ossimRefPtr<ossimElevSource> >::const_iterator ossimElevSourceListConstIterator;
/** Protected constructor. */
ossimElevManager();
void updateMinMax();
/**
* Searches keyword list for "elevation_directory" keywords and adds
* factories if found. Will look for key words in this order.
*
* 1) "elevation_directory"
* 2) "elevation_directory0"
* 3) "elevation_directory1"
* ...
* ...
* Until count of all elevation_directory keywords is reached.
*
* @param kwl Keyword list to search.
*
* @prefix Prefix for keys.
*/
void addElevFactories(const ossimKeywordlist& kwl, const char* prefix=0);
/**
* Searches keyword list for "dted_directory" keywords and adds factories
* if found. Will look for key words in this order.
*
* 1) "dted_directory"
* 2) "dted_directory0"
* 3) "dted_directory1"
* ...
* ...
* Until count of all dted_directory keywords is reached.
*
* @param kwl Keyword list to search.
*
* @prefix Prefix for keys.
*/
void addDtedFactories(const ossimKeywordlist& kwl, const char* prefix=0);
/**
* Searches keyword list for "srtm_directory" keywords and adds factories
* if found. Will look for key words in this order.
*
* 1) "srtm_directory"
* 2) "srtm_directory0"
* 3) "srtm_directory1"
* ...
* ...
* Until count of all srtm_directory keywords is reached.
*
* @param kwl Keyword list to search.
*
* @prefix Prefix for keys.
*/
void addSrtmFactories(const ossimKeywordlist& kwl, const char* prefix=0);
/**
* Searches keyword list for "elevation_cell" keywords and adds
* factories if found. Will look for key words in this order.
*
* 1) "elevation_cell"
* 2) "elevation_cell0"
* 3) "elevation_cell1"
* ...
* ...
* Until count of all elevation_cell keywords is reached.
*
* @param kwl Keyword list to search.
*
* @prefix Prefix for keys.
*/
void addElevCells(const ossimKeywordlist& kwl, const char* prefix=0);
bool openDtedCell(const ossimFilename& file);
bool openSrtmCell(const ossimFilename& file);
bool openGeneralRasterCell(const ossimFilename& file);
void addDtedFactory(const ossimFilename& file);
void addSrtmFactory(const ossimFilename& file);
void addGeneralRasterElevFactory(const ossimFilename& file);
void loadStandardElevationPaths();
/**
* @brief This protected method adds an ossimElevSource to the list.
* Does no mutex locking so callers should handle lock.
*
* @param source ossimElevSource to add.
*/
void protectedAddElevSource(ossimElevSource* source);
/**
* Data members:
*/
static ossimElevManager* theInstance;
OpenThreads::ReadWriteMutex theElevSourceListMutex;
std::vector<ossimRefPtr<ossimElevSource> > theElevSourceList;
std::vector<ossimRefPtr<ossimElevSourceFactory> > theElevSourceFactoryList;
/**
* theCurrentElevSourceIdx is the index to the last used ossimElevSource
* in theElevSourceList. This is unsigned by design. Users should key off
* of theElevSourceList.size().
*/
mutable ossim_uint32 theCurrentElevSourceIdx;
ossimGeoidManager* theGeoidManager;
bool theAutoLoadFlag;
bool theAutoSortFlag;
ossimFilename theDefaultElevationPath;
//mutable OpenThreads::ReentrantMutex theMutex;
std::vector<ossimFilename> TheElevationSearchPaths;
TYPE_DATA
};
#endif
|