SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeoConvHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // static methods for processing the coordinates conversion for the current net
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GeoConvHelper_h
23 #define GeoConvHelper_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <map>
36 #include <string>
37 #include <utils/geom/Position.h>
38 #include <utils/geom/Boundary.h>
39 
40 #ifdef HAVE_PROJ
41 #include <proj_api.h>
42 #endif
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class OptionsCont;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
59 public:
60 
65 
68  GeoConvHelper(const std::string& proj, const Position& offset,
69  const Boundary& orig, const Boundary& conv, int shift = 0, bool inverse = false);
70 
71 
74 
75 
81  static void addProjectionOptions(OptionsCont& oc);
82 
84  static bool init(OptionsCont& oc);
85 
87  static void init(const std::string& proj,
88  const Position& offset,
89  const Boundary& orig,
90  const Boundary& conv,
91  int shift = 0);
92 
97  return myProcessing;
98  }
99 
100 
104  static void computeFinal();
105 
106 
110  static const GeoConvHelper& getFinal() {
111  return myFinal;
112  }
113 
114 
117  static void setLoaded(const GeoConvHelper& loaded);
118 
119 
122  static void resetLoaded();
123 
125  void cartesian2geo(Position& cartesian) const;
126 
131  bool x2cartesian(Position& from, bool includeInBoundary = true);
132 
134  bool x2cartesian_const(Position& from) const;
135 
137  bool usingGeoProjection() const;
138 
140  bool usingInverseGeoProjection() const;
141 
143  void moveConvertedBy(SUMOReal x, SUMOReal y);
144 
146  const Boundary& getOrigBoundary() const;
147 
149  const Boundary& getConvBoundary() const;
150 
152  void setConvBoundary(const Boundary& boundary) {
153  myConvBoundary = boundary;
154  }
155 
157  const Position getOffset() const;
158 
160  const Position getOffsetBase() const;
161 
163  const std::string& getProjString() const;
164 
165 private:
172  };
173 
175  std::string myProjString;
176 
177 #ifdef HAVE_PROJ
178 
179  projPJ myProjection;
180 #endif
181 
184 
186  double myGeoScale;
187 
190 
193 
196 
199 
202 
205 
208 
210  static int myNumLoaded;
211 
214 
217 
218 };
219 
220 
221 #endif
222 
223 /****************************************************************************/
224