VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
elevationWorld.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
14 
15 #include <vlutil/vlString.h>
16 
17 #include <osgEarth/TileKey>
18 
19 #include <boost/function.hpp>
20 #include <boost/optional.hpp>
21 #include <boost/shared_ptr.hpp>
22 
23 #include <boost/unordered_map.hpp>
24 #include <map>
25 
26 #include <tbb/spin_rw_mutex.h>
27 
28 #include <vector>
29 
30 class Coordinate_System;
31 class DtPoint;
32 class DtChord;
33 
35 {
36 public:
37  class ElevationGrid;
38  class BilinearInterpolationGrid;
39  class EmptyGrid;
40 
43 
45  virtual ~DtElevationWorld();
46 
47  virtual void setEnabled(bool);
48  virtual bool isEnabled() const;
49 
50  void setLocalCoordinateSystem(const Coordinate_System* cs) { myLocalCoordSys = cs; }
51  void setOsgEarthProfile(const osgEarth::Profile* profile) { myOsgEarthProfile = profile; }
52  void setLOD(unsigned lod) { myLOD = lod; }
53 
56  virtual void addElevationGrid(const osgEarth::TileKey& key, ElevationGrid* grid);
57 
60 
61  virtual void removeElevationGrid(const osgEarth::TileKey& key);
63 
64  virtual boost::optional<double> findElevationAt(const DtPoint& p, bool* dataAvailable = 0) const;
65 
66 protected:
68  const osgEarth::Profile* myOsgEarthProfile;
69  unsigned myLOD;
70 
72 
73  typedef tbb::spin_rw_mutex Mutex;
74  mutable Mutex myMutex;
75 
83 
84  typedef std::map<
85  osgEarth::TileKey,
86  boost::shared_ptr<ElevationGrid>
89 
90 private:
94  DtElevationWorld& operator=(const DtElevationWorld&);
95 };
96 
98 {
99 public:
101  virtual ~ElevationGrid();
102 
103  virtual boost::optional<double> valueAt(double x, double y) const = 0;
104 };
105 
106 class DT_DLL_vantageTerrainImplementation DtElevationWorld::BilinearInterpolationGrid
107  : public DtElevationWorld::ElevationGrid
108 {
109 public:
110  virtual boost::optional<double> valueAt(double x, double y) const;
111 
112  template <typename T>
113  struct XY
114  {
115  XY(T xv, T yv) : x(xv), y(yv) { }
116 
117  T x;
118  T y;
119  };
120 
122  virtual XY<double> offset() const = 0;
124  virtual XY<double> postSpacing() const = 0;
126  virtual XY<unsigned> size() const = 0;
127 
128  virtual double postAt(unsigned x, unsigned y) const = 0;
129 };
130 
132  : public DtElevationWorld::ElevationGrid
133 {
134 public:
135  virtual boost::optional<double> valueAt(double x, double y) const;
136 };

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)