VR-Forces 4.1.1 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 
60  class Bounds
61  {
62  public:
63  static Bounds Make(const DtProj& proj);
64 
65  Bounds(const DtProj& proj, double xmin, double ymin, double xmax, double ymax);
66  Bounds(const DtProj& proj);
67 
68  double xmin() const;
69  double ymin() const;
70  double xmax() const;
71  double ymax() const;
72 
73  const DtProj& projection() const;
74 
75  private:
76  double myXmin;
77  double myYmin;
78  double myXmax;
79  double myYmax;
81  };
82 
84  static DtProj::CPtr Make(
85  std::string projString, boost::optional<AngleUnits> = boost::optional<AngleUnits>());
86  static DtProj::CPtr Make(const Coordinate_System*);
87  static DtProj::CPtr Make(std::auto_ptr<Coordinate_System>);
88  static DtProj::CPtr Make(const OGRSpatialReference*);
89  static DtProj::CPtr Make(const osgEarth::SpatialReference*);
90 
91  static DtProj::Ptr MakeCopy(const DtProj&);
92 
93  static DtProj::CPtr LocalTopo(const DtProj &, DtPoint localposition);
94 
95  static DtProj::CPtr Geocentric();
96  static DtProj::CPtr FlatEarth();
97  static DtProj::CPtr Geodetic();
98  static DtProj::CPtr GeodeticInDegrees();
99 
100  std::string projString() const;
101 
102  void print(std::ostream&) const;
103  std::string print() const;
104 
105  const Coordinate_System* coordinateSystem() const;
106  const DtCoordTransform* transform() const;
107 
109  bool is2D() const;
110 
111  bool inRadians() const;
112  bool inDegrees() const;
113  bool isLatLong() const;
114  bool isLongLat() const;
115 
116  bool isGeodetic() const;
117  bool isGeocentric() const;
118  bool isFlatEarth() const;
119  bool isUTM() const;
120 
121  void setAngleUnits(AngleUnits);
122 
126  bool operator==(const DtProj &) const;
127  bool operator!=(const DtProj & p) const { return !(*this == p); }
129 
133  static void Convert(
134  const DtProj & from, const DtProj & to,
135  long count, int offset, double* x, double* y, double* z);
136 
137  static void Convert(const DtProj & from, const DtProj & to, long count, DtPoint* points);
138  static void Convert(const DtProj & from, const DtProj & to, DtPoint & point);
139  static void Convert(const DtProj & from, const DtProj & to, std::vector<DtPoint> & points);
140  static void Convert(const DtProj & from, const DtProj & to, std::list<DtPoint> & points);
142 
143  static void ConvertToSame2DProjection(DtFeatureGeometry &, DtFeatureGeometry &);
144 
145  struct ProjData
146  {
147  mutable DtMutex mutex;
148  std::string projString;
149  void* context;
150  void* proj;
151 
152  static ProjData* Make(const Coordinate_System*);
153 
154  ProjData();
155  ProjData(std::string);
156  ~ProjData();
157  };
158 
159 private:
160  //Create a proj from a proj string
161  explicit DtProj(std::string projString, boost::optional<AngleUnits>);
162 
163  //Create a proj from a Coordinate_System object
164  explicit DtProj(std::auto_ptr<Coordinate_System> cs);
165 
166  //Create a topo proj from a reference point
167  explicit DtProj(const DtProj&, DtPoint);
168 
169  //Copy constructor
170  explicit DtProj(const DtProj&);
171 
172  boost::shared_ptr<ProjData> myProjData;
173  boost::shared_ptr<Coordinate_System> myCS;
174  boost::optional<AngleUnits> myAngleUnits;
175  boost::optional<AngleOrder> myAngleOrder;
176  boost::optional<DtCoordTransform> myTransform;
177 };
178 
179 DT_DLL_features std::ostream& operator<<(std::ostream&, const DtProj&);
180 DT_DLL_features std::ostream& operator<<(std::ostream&, const DtProj::Bounds&);
181 
182 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)