VR-Forces 4.2 Class Documentation
proj.h
Go to the documentation of this file.
1 
2 
3 
4 
5 #pragma once
6 
8 
9 #include <boost/enable_shared_from_this.hpp>
10 
11 #include <iosfwd>
12 
13 #include <matrix/coordTransform.h>
14 
15 class Coordinate_System;
16 class OGRSpatialReference;
17 
18 namespace osgEarth {
19  class SpatialReference;
20 }
21 
22 namespace MAKVRinTerra
23 {
24 
25 class DtFeatureGeometry;
26 
36 class DT_DLL_features DtProj : public boost::enable_shared_from_this<DtProj>
37 {
38 public:
39  typedef boost::shared_ptr<DtProj> Ptr;
40  typedef boost::shared_ptr<const DtProj> CPtr;
41 
43  typedef boost::error_info<DtProj, DtProj::CPtr> ErrorInfo;
44  typedef boost::tuple<ErrorInfo,ErrorInfo> ConvertErrorInfo;
46  friend class TaggedException<DtProj>;
47 
49  {
51  Radians
52  };
53 
55  {
57  LongLat
58  };
59 
61  {
62  public:
63  static Bounds Make(const DtProj& proj);
64 
65  Bounds();
66 
67  Bounds(const DtProj& proj, double xmin, double ymin, double xmax, double ymax);
68  Bounds(const DtProj& proj);
69 
70  bool isValid() const;
71 
72  double xmin() const;
73  double ymin() const;
74  double xmax() const;
75  double ymax() const;
76 
77  const DtProj& projection() const;
78 
79  private:
80  double myXmin;
81  double myYmin;
82  double myXmax;
83  double myYmax;
85  };
86 
88  static DtProj::CPtr Make(
89  std::string projString, boost::optional<AngleUnits> = boost::optional<AngleUnits>());
90  static DtProj::CPtr Make(const Coordinate_System*);
91  static DtProj::CPtr Make(std::auto_ptr<Coordinate_System>);
92  static DtProj::CPtr Make(const OGRSpatialReference*);
93  static DtProj::CPtr Make(const osgEarth::SpatialReference*);
94 
95  static DtProj::Ptr MakeCopy(const DtProj&);
96 
97  static DtProj::CPtr LocalTopo(const DtProj &, DtPoint localposition);
98 
99  static DtProj::CPtr Geocentric();
100  static DtProj::CPtr FlatEarth();
101  static DtProj::CPtr Geodetic();
102  static DtProj::CPtr GeodeticInDegrees();
103 
104  std::string projString() const;
105 
106  std::string print() const;
107  std::string printDetailed() const;
108 
109  const Coordinate_System* coordinateSystem() const;
110  const DtCoordTransform* transform() const;
111 
113  bool is2D() const;
114 
116  bool isRectangular() const;
117 
118  bool isLocalTopo() const;
119 
120  bool inRadians() const;
121  bool inDegrees() const;
122  bool isLatLong() const;
123  bool isLongLat() const;
124 
125  bool isGeodetic() const;
126  bool isGeocentric() const;
127  bool isFlatEarth() const;
128  bool isUTM() const;
129 
130  void setAngleUnits(AngleUnits);
131 
135  bool operator==(const DtProj &) const;
136  bool operator!=(const DtProj & p) const { return !(*this == p); }
138 
142  static void Convert(
143  const DtProj & from, const DtProj & to,
144  long count, int offset, double* x, double* y, double* z);
145 
146  static void Convert(const DtProj & from, const DtProj & to, long count, DtPoint* points);
147  static void Convert(const DtProj & from, const DtProj & to, DtPoint & point);
148  static void Convert(const DtProj & from, const DtProj & to, std::vector<DtPoint> & points);
149  static void Convert(const DtProj & from, const DtProj & to, std::list<DtPoint> & points);
151 
153  static void ConvertToSame2DProjection(DtFeatureGeometry &, DtFeatureGeometry &);
154 
155  struct ProjData
156  {
157  mutable DtMutex mutex;
158  std::string projString;
159  void* context;
160  void* proj;
161 
162  static ProjData* Make(const Coordinate_System*);
163 
164  ProjData();
165  ProjData(std::string);
166  ~ProjData();
167 
168  bool operator==(const ProjData&) const;
169  bool operator!=(const ProjData&) const;
170  };
171 
172 private:
173  //Create a proj from a proj string
174  explicit DtProj(std::string projString, boost::optional<AngleUnits>);
175 
176  //Create a proj from a Coordinate_System object
177  explicit DtProj(std::auto_ptr<Coordinate_System> cs);
178 
179  //Create a topo proj from a reference point
180  explicit DtProj(const DtProj&, DtPoint);
181 
182  //Copy constructor
183  explicit DtProj(const DtProj&);
184 
185  boost::shared_ptr<ProjData> myProjData;
186  boost::shared_ptr<Coordinate_System> myCS;
187  boost::optional<AngleUnits> myAngleUnits;
188  boost::optional<AngleOrder> myAngleOrder;
189  boost::optional<DtCoordTransform> myTransform;
190 };
191 
192 DT_DLL_features std::ostream& operator<<(std::ostream&, const DtProj&);
193 DT_DLL_features std::ostream& operator<<(std::ostream&, const DtProj::Bounds&);
194 
195 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)