Eclipse SUMO - Simulation of Urban MObility
GeoConvHelper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // static methods for processing the coordinates conversion for the current net
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <map>
26 #include <cmath>
27 #include <cassert>
28 #include <climits>
30 #include <utils/common/ToString.h>
31 #include <utils/geom/GeomHelper.h>
34 #include "GeoConvHelper.h"
35 
36 
37 // ===========================================================================
38 // static member variables
39 // ===========================================================================
40 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
49 
50 GeoConvHelper::GeoConvHelper(const std::string& proj, const Position& offset,
51  const Boundary& orig, const Boundary& conv, double scale, double rot, bool inverse, bool flatten):
52  myProjString(proj),
53 #ifdef PROJ_API_FILE
54  myProjection(nullptr),
55  myInverseProjection(nullptr),
56  myGeoProjection(nullptr),
57 #endif
58  myOffset(offset),
59  myGeoScale(scale),
60  mySin(sin(DEG2RAD(-rot))), // rotate clockwise
61  myCos(cos(DEG2RAD(-rot))),
62  myProjectionMethod(NONE),
63  myUseInverseProjection(inverse),
64  myFlatten(flatten),
65  myOrigBoundary(orig),
66  myConvBoundary(conv) {
67  if (proj == "!") {
69  } else if (proj == "-") {
71  } else if (proj == "UTM") {
73  } else if (proj == "DHDN") {
75  } else if (proj == "DHDN_UTM") {
77 #ifdef PROJ_API_FILE
78  } else {
80 #ifdef PROJ_VERSION_MAJOR
81  myProjection = proj_create(PJ_DEFAULT_CTX, proj.c_str());
82 #else
83  myProjection = pj_init_plus(proj.c_str());
84 #endif
85  if (myProjection == nullptr) {
86  // !!! check pj_errno
87  throw ProcessError("Could not build projection!");
88  }
89 #endif
90  }
91 }
92 
93 
95 #ifdef PROJ_API_FILE
96  if (myProjection != nullptr) {
97 #ifdef PROJ_VERSION_MAJOR
98  proj_destroy(myProjection);
99 #else
100  pj_free(myProjection);
101 #endif
102  }
103  if (myInverseProjection != nullptr) {
104 #ifdef PROJ_VERSION_MAJOR
105  proj_destroy(myInverseProjection);
106 #else
107  pj_free(myInverseProjection);
108 #endif
109  }
110  if (myGeoProjection != nullptr) {
111 #ifdef PROJ_VERSION_MAJOR
112  proj_destroy(myGeoProjection);
113 #else
114  pj_free(myGeoProjection);
115 #endif
116  }
117 #endif
118 }
119 
120 bool
122  return (
123  myProjString == o.myProjString &&
124  myOffset == o.myOffset &&
128  myGeoScale == o.myGeoScale &&
129  myCos == o.myCos &&
130  mySin == o.mySin &&
132  myFlatten == o.myFlatten
133  );
134 }
135 
138  myProjString = orig.myProjString;
139  myOffset = orig.myOffset;
143  myGeoScale = orig.myGeoScale;
144  myCos = orig.myCos;
145  mySin = orig.mySin;
147  myFlatten = orig.myFlatten;
148 #ifdef PROJ_API_FILE
149  if (myProjection != nullptr) {
150 #ifdef PROJ_VERSION_MAJOR
151  proj_destroy(myProjection);
152 #else
153  pj_free(myProjection);
154 #endif
155  myProjection = nullptr;
156  }
157  if (myInverseProjection != nullptr) {
158 #ifdef PROJ_VERSION_MAJOR
159  proj_destroy(myInverseProjection);
160 #else
161  pj_free(myInverseProjection);
162 #endif
163  myInverseProjection = nullptr;
164  }
165  if (myGeoProjection != nullptr) {
166 #ifdef PROJ_VERSION_MAJOR
167  proj_destroy(myGeoProjection);
168 #else
169  pj_free(myGeoProjection);
170 #endif
171  myGeoProjection = nullptr;
172  }
173  if (orig.myProjection != nullptr) {
174 #ifdef PROJ_VERSION_MAJOR
175  myProjection = proj_create(PJ_DEFAULT_CTX, orig.myProjString.c_str());
176 #else
177  myProjection = pj_init_plus(orig.myProjString.c_str());
178 #endif
179  }
180  if (orig.myInverseProjection != nullptr) {
181 #ifdef PROJ_VERSION_MAJOR
182  myInverseProjection = orig.myInverseProjection;
183 #else
184  myInverseProjection = pj_init_plus(pj_get_def(orig.myInverseProjection, 0));
185 #endif
186  }
187  if (orig.myGeoProjection != nullptr) {
188 #ifdef PROJ_VERSION_MAJOR
189  myGeoProjection = orig.myGeoProjection;
190 #else
191  myGeoProjection = pj_init_plus(pj_get_def(orig.myGeoProjection, 0));
192 #endif
193  }
194 #endif
195  return *this;
196 }
197 
198 
199 bool
201  std::string proj = "!"; // the default
202  double scale = oc.getFloat("proj.scale");
203  double rot = oc.getFloat("proj.rotate");
204  Position offset = Position(oc.getFloat("offset.x"), oc.getFloat("offset.y"), oc.getFloat("offset.z"));
205  bool inverse = oc.exists("proj.inverse") && oc.getBool("proj.inverse");
206  bool flatten = oc.exists("flatten") && oc.getBool("flatten");
207 
208  if (oc.getBool("simple-projection")) {
209  proj = "-";
210  }
211 
212 #ifdef PROJ_API_FILE
213  if (oc.getBool("proj.inverse") && oc.getString("proj") == "!") {
214  WRITE_ERROR("Inverse projection works only with explicit proj parameters.");
215  return false;
216  }
217  unsigned numProjections = oc.getBool("simple-projection") + oc.getBool("proj.utm") + oc.getBool("proj.dhdn") + oc.getBool("proj.dhdnutm") + (oc.getString("proj").length() > 1);
218  if (numProjections > 1) {
219  WRITE_ERROR("The projection method needs to be uniquely defined.");
220  return false;
221  }
222 
223  if (oc.getBool("proj.utm")) {
224  proj = "UTM";
225  } else if (oc.getBool("proj.dhdn")) {
226  proj = "DHDN";
227  } else if (oc.getBool("proj.dhdnutm")) {
228  proj = "DHDN_UTM";
229  } else if (!oc.isDefault("proj")) {
230  proj = oc.getString("proj");
231  }
232 #endif
233  myProcessing = GeoConvHelper(proj, offset, Boundary(), Boundary(), scale, rot, inverse, flatten);
235  return true;
236 }
237 
238 
239 void
240 GeoConvHelper::init(const std::string& proj, const Position& offset, const Boundary& orig,
241  const Boundary& conv, double scale) {
242  myProcessing = GeoConvHelper(proj, offset, orig, conv, scale);
244 }
245 
246 
247 void
249  oc.addOptionSubTopic("Projection");
250 
251  oc.doRegister("simple-projection", new Option_Bool(false));
252  oc.addSynonyme("simple-projection", "proj.simple", true);
253  oc.addDescription("simple-projection", "Projection", "Uses a simple method for projection");
254 
255  oc.doRegister("proj.scale", new Option_Float(1.0));
256  oc.addDescription("proj.scale", "Projection", "Scaling factor for input coordinates");
257 
258  oc.doRegister("proj.rotate", new Option_Float(0.0));
259  oc.addDescription("proj.rotate", "Projection", "Rotation (clockwise degrees) for input coordinates");
260 
261 #ifdef PROJ_API_FILE
262  oc.doRegister("proj.utm", new Option_Bool(false));
263  oc.addDescription("proj.utm", "Projection", "Determine the UTM zone (for a universal transversal mercator projection based on the WGS84 ellipsoid)");
264 
265  oc.doRegister("proj.dhdn", new Option_Bool(false));
266  oc.addDescription("proj.dhdn", "Projection", "Determine the DHDN zone (for a transversal mercator projection based on the bessel ellipsoid, \"Gauss-Krueger\")");
267 
268  oc.doRegister("proj", new Option_String("!"));
269  oc.addDescription("proj", "Projection", "Uses STR as proj.4 definition for projection");
270 
271  oc.doRegister("proj.inverse", new Option_Bool(false));
272  oc.addDescription("proj.inverse", "Projection", "Inverses projection");
273 
274  oc.doRegister("proj.dhdnutm", new Option_Bool(false));
275  oc.addDescription("proj.dhdnutm", "Projection", "Convert from Gauss-Krueger to UTM");
276 #endif // PROJ_API_FILE
277 }
278 
279 
280 bool
282  return myProjectionMethod != NONE;
283 }
284 
285 
286 bool
288  return myUseInverseProjection;
289 }
290 
291 
292 void
294  cartesian.sub(getOffsetBase());
295  if (myProjectionMethod == NONE) {
296  return;
297  }
298  if (myProjectionMethod == SIMPLE) {
299  const double y = cartesian.y() / 111136.;
300  const double x = cartesian.x() / 111320. / cos(DEG2RAD(y));
301  cartesian.set(x, y);
302  return;
303  }
304 #ifdef PROJ_API_FILE
305 #ifdef PROJ_VERSION_MAJOR
306  PJ_COORD c;
307  c.xy.x = cartesian.x();
308  c.xy.y = cartesian.y();
309  c = proj_trans(myProjection, PJ_INV, c);
310  cartesian.set(proj_todeg(c.lp.lam), proj_todeg(c.lp.phi));
311 #else
312  projUV p;
313  p.u = cartesian.x();
314  p.v = cartesian.y();
315  p = pj_inv(p, myProjection);
317  p.u *= RAD_TO_DEG;
318  p.v *= RAD_TO_DEG;
319  cartesian.set((double) p.u, (double) p.v);
320 #endif
321 #endif
322 }
323 
324 
325 bool
326 GeoConvHelper::x2cartesian(Position& from, bool includeInBoundary) {
327  if (includeInBoundary) {
328  myOrigBoundary.add(from);
329  }
330  // init projection parameter on first use
331 #ifdef PROJ_API_FILE
332  if (myProjection == nullptr) {
333  double x = from.x() * myGeoScale;
334  switch (myProjectionMethod) {
335  case DHDN_UTM: {
336  int zone = (int)((x - 500000.) / 1000000.);
337  if (zone < 1 || zone > 5) {
338  WRITE_WARNING("Attempt to initialize DHDN_UTM-projection on invalid longitude " + toString(x));
339  return false;
340  }
341  myProjString = "+proj=tmerc +lat_0=0 +lon_0=" + toString(3 * zone) +
342  " +k=1 +x_0=" + toString(zone * 1000000 + 500000) +
343  " +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs";
344 #ifdef PROJ_VERSION_MAJOR
345  myInverseProjection = proj_create(PJ_DEFAULT_CTX, myProjString.c_str());
346  myGeoProjection = proj_create(PJ_DEFAULT_CTX, "+proj=latlong +datum=WGS84");
347 #else
348  myInverseProjection = pj_init_plus(myProjString.c_str());
349  myGeoProjection = pj_init_plus("+proj=latlong +datum=WGS84");
350 #endif
351  x = ((x - 500000.) / 1000000.) * 3; // continues with UTM
353  }
354  FALLTHROUGH;
355  case UTM: {
356  int zone = (int)(x + 180) / 6 + 1;
357  myProjString = "+proj=utm +zone=" + toString(zone) +
358  " +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
359 #ifdef PROJ_VERSION_MAJOR
360  myProjection = proj_create(PJ_DEFAULT_CTX, myProjString.c_str());
361 #else
362  myProjection = pj_init_plus(myProjString.c_str());
363 #endif
364  }
366  break;
367  case DHDN: {
368  int zone = (int)(x / 3);
369  if (zone < 1 || zone > 5) {
370  WRITE_WARNING("Attempt to initialize DHDN-projection on invalid longitude " + toString(x));
371  return false;
372  }
373  myProjString = "+proj=tmerc +lat_0=0 +lon_0=" + toString(3 * zone) +
374  " +k=1 +x_0=" + toString(zone * 1000000 + 500000) +
375  " +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs";
376 #ifdef PROJ_VERSION_MAJOR
377  myProjection = proj_create(PJ_DEFAULT_CTX, myProjString.c_str());
378 #else
379  myProjection = pj_init_plus(myProjString.c_str());
380 #endif
381  }
383  break;
384  default:
385  break;
386  }
387  }
388  if (myInverseProjection != nullptr) {
389 #ifdef PROJ_VERSION_MAJOR
390  PJ_COORD c;
391  c.xy.x = from.x();
392  c.xy.y = from.y();
393  c = proj_trans(myInverseProjection, PJ_INV, c);
394  from.set(proj_todeg(c.lp.lam), proj_todeg(c.lp.phi));
395 #else
396  double x = from.x();
397  double y = from.y();
398  if (pj_transform(myInverseProjection, myGeoProjection, 1, 1, &x, &y, nullptr)) {
399  WRITE_WARNING("Could not transform (" + toString(x) + "," + toString(y) + ")");
400  }
401  from.set(double(x * RAD_TO_DEG), double(y * RAD_TO_DEG));
402 #endif
403  }
404 #endif
405  // perform conversion
406  bool ok = x2cartesian_const(from);
407  if (ok) {
408  if (includeInBoundary) {
409  myConvBoundary.add(from);
410  }
411  }
412  return ok;
413 }
414 
415 
416 bool
418  double x2 = from.x() * myGeoScale;
419  double y2 = from.y() * myGeoScale;
420  double x = x2 * myCos - y2 * mySin;
421  double y = x2 * mySin + y2 * myCos;
422  if (myProjectionMethod == NONE) {
423  // do nothing
424  } else if (myUseInverseProjection) {
425  cartesian2geo(from);
426  } else {
427  if (x > 180.1 || x < -180.1) {
428  WRITE_WARNING("Invalid longitude " + toString(x));
429  return false;
430  }
431  if (y > 90.1 || y < -90.1) {
432  WRITE_WARNING("Invalid latitude " + toString(y));
433  return false;
434  }
435 #ifdef PROJ_API_FILE
436  if (myProjection != nullptr) {
437 #ifdef PROJ_VERSION_MAJOR
438  PJ_COORD c;
439  c.lp.lam = proj_torad(x);
440  c.lp.phi = proj_torad(y);
441  c = proj_trans(myProjection, PJ_FWD, c);
443  x = c.xy.x;
444  y = c.xy.y;
445 #else
446  projUV p;
447  p.u = x * DEG_TO_RAD;
448  p.v = y * DEG_TO_RAD;
449  p = pj_fwd(p, myProjection);
451  x = p.u;
452  y = p.v;
453 #endif
454  }
455 #endif
456  if (myProjectionMethod == SIMPLE) {
457  x *= 111320. * cos(DEG2RAD(y));
458  y *= 111136.;
460  }
461  }
462  if (x > std::numeric_limits<double>::max() ||
463  y > std::numeric_limits<double>::max()) {
464  return false;
465  }
466  from.set(x, y);
467  from.add(myOffset);
468  if (myFlatten) {
469  from.setz(0);
470  }
471  return true;
472 }
473 
474 
475 void
476 GeoConvHelper::moveConvertedBy(double x, double y) {
477  myOffset.add(x, y);
478  myConvBoundary.moveby(x, y);
479 }
480 
481 
482 const Boundary&
484  return myOrigBoundary;
485 }
486 
487 
488 const Boundary&
490  return myConvBoundary;
491 }
492 
493 
494 const Position
496  return myOffset;
497 }
498 
499 
500 const Position
502  return myOffset;
503 }
504 
505 
506 const std::string&
508  return myProjString;
509 }
510 
511 
512 void
514  if (myNumLoaded == 0) {
516  if (lefthand) {
517  myFinal.myOffset.mul(1, -1);
518  }
519  } else {
520  if (lefthand) {
521  myProcessing.myOffset.mul(1, -1);
522  }
524  // prefer options over loaded location
526  // let offset and boundary lead back to the original coords of the loaded data
529  // the new boundary (updated during loading)
531  }
532  if (lefthand) {
534  }
535 }
536 
537 
538 void
540  myNumLoaded++;
541  if (myNumLoaded > 1) {
542  WRITE_WARNING("Ignoring loaded location attribute nr. " + toString(myNumLoaded) + " for tracking of original location");
543  } else {
544  myLoaded = loaded;
545  }
546 }
547 
548 
549 void
551  myNumLoaded = 0;
552 }
553 
554 
555 void
560  if (myFinal.usingGeoProjection()) {
562  }
564  if (myFinal.usingGeoProjection()) {
565  into.setPrecision();
566  }
568  into.closeTag();
569  into.lf();
570 }
571 
572 
573 /****************************************************************************/
GeoConvHelper::writeLocation
static void writeLocation(OutputDevice &into)
writes the location element
Definition: GeoConvHelper.cpp:556
Boundary::moveby
void moveby(double x, double y, double z=0)
Moves the boundary by the given amount.
Definition: Boundary.cpp:368
GeoConvHelper::NONE
Definition: GeoConvHelper.h:167
ToString.h
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
GeoConvHelper::getConvBoundary
const Boundary & getConvBoundary() const
Returns the converted boundary.
Definition: GeoConvHelper.cpp:489
Option_Bool
Definition: Option.h:538
GeoConvHelper::operator=
GeoConvHelper & operator=(const GeoConvHelper &)
make assignment operator private
Definition: GeoConvHelper.cpp:137
GeoConvHelper::x2cartesian_const
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
Definition: GeoConvHelper.cpp:417
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
SUMO_ATTR_NET_OFFSET
Definition: SUMOXMLDefinitions.h:827
OptionsCont.h
MsgHandler.h
GeoConvHelper::myCos
double myCos
Definition: GeoConvHelper.h:197
GeoConvHelper::setLoaded
static void setLoaded(const GeoConvHelper &loaded)
sets the coordinate transformation loaded from a location element
Definition: GeoConvHelper.cpp:539
GeoConvHelper::PROJ
Definition: GeoConvHelper.h:172
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
OutputDevice::setPrecision
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
Definition: OutputDevice.cpp:221
OptionsCont::exists
bool exists(const std::string &name) const
Returns the information whether the named option is known.
Definition: OptionsCont.cpp:129
GeoConvHelper.h
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
GeoConvHelper::myLoaded
static GeoConvHelper myLoaded
coordinate transformation loaded from a location element
Definition: GeoConvHelper.h:218
GeoConvHelper::getOffset
const Position getOffset() const
Returns the network offset.
Definition: GeoConvHelper.cpp:495
GeoConvHelper
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:55
GeoConvHelper::init
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
Definition: GeoConvHelper.cpp:200
FALLTHROUGH
#define FALLTHROUGH
Definition: StdDefs.h:36
GeoConvHelper::x2cartesian
bool x2cartesian(Position &from, bool includeInBoundary=true)
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
Definition: GeoConvHelper.cpp:326
GeoConvHelper::usingGeoProjection
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
Definition: GeoConvHelper.cpp:281
GeoConvHelper::getProjString
const std::string & getProjString() const
Returns the original projection definition.
Definition: GeoConvHelper.cpp:507
gPrecisionGeo
int gPrecisionGeo
Definition: StdDefs.cpp:27
GeoConvHelper::myOrigBoundary
Boundary myOrigBoundary
The boundary before conversion (x2cartesian)
Definition: GeoConvHelper.h:209
SUMO_ATTR_ORIG_BOUNDARY
Definition: SUMOXMLDefinitions.h:829
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
GeoConvHelper::moveConvertedBy
void moveConvertedBy(double x, double y)
Shifts the converted boundary by the given amounts.
Definition: GeoConvHelper.cpp:476
SUMO_TAG_LOCATION
Definition: SUMOXMLDefinitions.h:263
GeoConvHelper::~GeoConvHelper
~GeoConvHelper()
Destructor.
Definition: GeoConvHelper.cpp:94
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
GeoConvHelper::myConvBoundary
Boundary myConvBoundary
The boundary after conversion (x2cartesian)
Definition: GeoConvHelper.h:212
OptionsCont::addDescription
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
Definition: OptionsCont.cpp:469
GeoConvHelper::myUseInverseProjection
bool myUseInverseProjection
Information whether inverse projection shall be used.
Definition: GeoConvHelper.h:203
OptionsCont::addSynonyme
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
Definition: OptionsCont.cpp:95
Position::set
void set(double x, double y)
set positions x and y
Definition: Position.h:86
GeoConvHelper::GeoConvHelper
GeoConvHelper(OptionsCont &oc)
Constructor based on the stored options.
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GeoConvHelper::addProjectionOptions
static void addProjectionOptions(OptionsCont &oc)
Adds projection options to the given container.
Definition: GeoConvHelper.cpp:248
SUMO_ATTR_ORIG_PROJ
Definition: SUMOXMLDefinitions.h:830
OutputDevice.h
OptionsCont::doRegister
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:74
ProcessError
Definition: UtilExceptions.h:39
GeoConvHelper::myProjString
std::string myProjString
A proj options string describing the proj.4-projection to use.
Definition: GeoConvHelper.h:176
GeoConvHelper::getOrigBoundary
const Boundary & getOrigBoundary() const
Returns the original boundary.
Definition: GeoConvHelper.cpp:483
GeoConvHelper::cartesian2geo
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Definition: GeoConvHelper.cpp:293
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
Option_String
Definition: Option.h:399
Position::sub
void sub(double dx, double dy)
Substracts the given position from this one.
Definition: Position.h:146
GeoConvHelper::getOffsetBase
const Position getOffsetBase() const
Returns the network base.
Definition: GeoConvHelper.cpp:501
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
GeoConvHelper::DHDN
Definition: GeoConvHelper.h:170
Position::mul
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:106
GeoConvHelper::SIMPLE
Definition: GeoConvHelper.h:168
GeoConvHelper::myFlatten
bool myFlatten
whether to discard z-data
Definition: GeoConvHelper.h:206
DEG2RAD
#define DEG2RAD(x)
Definition: GeomHelper.h:37
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:163
OptionsCont::addOptionSubTopic
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
Definition: OptionsCont.cpp:519
GeoConvHelper::operator==
bool operator==(const GeoConvHelper &o) const
Definition: GeoConvHelper.cpp:121
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
GeoConvHelper::myNumLoaded
static int myNumLoaded
the numer of coordinate transformations loaded from location elements
Definition: GeoConvHelper.h:224
SUMO_ATTR_CONV_BOUNDARY
Definition: SUMOXMLDefinitions.h:828
GeoConvHelper::DHDN_UTM
Definition: GeoConvHelper.h:171
GeoConvHelper::UTM
Definition: GeoConvHelper.h:169
Option_Float
Definition: Option.h:470
GeoConvHelper::myGeoScale
double myGeoScale
The scaling to apply to geo-coordinates.
Definition: GeoConvHelper.h:193
OutputDevice::lf
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:233
GeoConvHelper::myOffset
Position myOffset
The offset to apply.
Definition: GeoConvHelper.h:190
GeoConvHelper::computeFinal
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data,...
Definition: GeoConvHelper.cpp:513
GeoConvHelper::usingInverseGeoProjection
bool usingInverseGeoProjection() const
Returns the information whether an inverse transformation will happen.
Definition: GeoConvHelper.cpp:287
config.h
GeoConvHelper::myFinal
static GeoConvHelper myFinal
coordinate transformation to use for writing the location element and for tracking the original coord...
Definition: GeoConvHelper.h:221
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:126
GeomHelper.h
GeoConvHelper::myProjectionMethod
ProjectionMethod myProjectionMethod
Information whether no projection shall be done.
Definition: GeoConvHelper.h:200
Boundary::flipY
void flipY()
flips ymin and ymax
Definition: Boundary.cpp:322
Position::setz
void setz(double z)
set position z
Definition: Position.h:81
GeoConvHelper::resetLoaded
static void resetLoaded()
resets loaded location elements
Definition: GeoConvHelper.cpp:550
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
GeoConvHelper::mySin
double mySin
The rotation to apply to geo-coordinates.
Definition: GeoConvHelper.h:196
GeoConvHelper::myProcessing
static GeoConvHelper myProcessing
coordinate transformation to use for input conversion and processing
Definition: GeoConvHelper.h:215