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-2012 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, bool baseFound = 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 
96  return myProcessing;
97  }
98 
99 
103  static void computeFinal();
104 
105 
109  static const GeoConvHelper& getFinal() {
110  return myFinal;
111  }
112 
113 
116  static void setLoaded(const GeoConvHelper& loaded);
117 
118 
121  static void resetLoaded();
122 
124  void cartesian2geo(Position& cartesian) const;
125 
130  bool x2cartesian(Position& from, bool includeInBoundary = true);
131 
133  bool x2cartesian_const(Position& from) const;
134 
136  bool usingGeoProjection() const;
137 
139  bool usingInverseGeoProjection() const;
140 
142  void moveConvertedBy(SUMOReal x, SUMOReal y);
143 
145  const Boundary& getOrigBoundary() const;
146 
148  const Boundary& getConvBoundary() const;
149 
151  const Position getOffset() const;
152 
154  const Position getOffsetBase() const;
155 
157  const std::string& getProjString() const;
158 
159 private:
166  };
167 
169  std::string myProjString;
170 
171 #ifdef HAVE_PROJ
172 
173  projPJ myProjection;
174 #endif
175 
178 
180  double myGeoScale;
181 
184 
187 
190 
192  double myBaseX, myBaseY;
193 
196 
199 
202 
205 
208 
210  static int myNumLoaded;
211 
214 
217 
218 };
219 
220 
221 #endif
222 
223 /****************************************************************************/
224