SUMO - Simulation of Urban MObility
|
static methods for processing the coordinates conversion for the current net More...
#include <GeoConvHelper.h>
Public Member Functions | |
void | cartesian2geo (Position &cartesian) const |
Converts the given cartesian (shifted) position to its geo (lat/long) representation. More... | |
GeoConvHelper (OptionsCont &oc) | |
Constructor based on the stored options. More... | |
GeoConvHelper (const std::string &proj, const Position &offset, const Boundary &orig, const Boundary &conv, int shift=0, bool inverse=false) | |
Constructor. More... | |
const Boundary & | getConvBoundary () const |
Returns the converted boundary. More... | |
const Position | getOffset () const |
Returns the network offset. More... | |
const Position | getOffsetBase () const |
Returns the network base. More... | |
const Boundary & | getOrigBoundary () const |
Returns the original boundary. More... | |
const std::string & | getProjString () const |
Returns the network offset. More... | |
void | moveConvertedBy (SUMOReal x, SUMOReal y) |
Shifts the converted boundary by the given amounts. More... | |
void | setConvBoundary (const Boundary &boundary) |
sets the converted boundary More... | |
bool | usingGeoProjection () const |
Returns whether a transformation from geo to metric coordinates will be performed. More... | |
bool | usingInverseGeoProjection () const |
Returns the information whether an inverse transformation will happen. More... | |
bool | x2cartesian (Position &from, bool includeInBoundary=true) |
bool | x2cartesian_const (Position &from) const |
Converts the given coordinate into a cartesian using the previous initialisation. More... | |
~GeoConvHelper () | |
Destructor. More... | |
Static Public Member Functions | |
static void | addProjectionOptions (OptionsCont &oc) |
Adds projection options to the given container. More... | |
static void | computeFinal () |
compute the location attributes which will be used for output based on the loaded location data, the given options and the transformations applied during processing More... | |
static const GeoConvHelper & | getFinal () |
the coordinate transformation for writing the location element and for tracking the original coordinate system More... | |
static GeoConvHelper & | getProcessing () |
the coordinate transformation to use for input conversion and processing More... | |
static bool | init (OptionsCont &oc) |
Initialises the processing and the final instance using the given options. More... | |
static void | init (const std::string &proj, const Position &offset, const Boundary &orig, const Boundary &conv, int shift=0) |
Initialises the processing and the final instance using the given proj.4-definition and complete network parameter. More... | |
static void | resetLoaded () |
resets loaded location elements More... | |
static void | setLoaded (const GeoConvHelper &loaded) |
sets the coordinate transformation loaded from a location element More... | |
Private Types | |
enum | ProjectionMethod { NONE, SIMPLE, UTM, DHDN, PROJ } |
Private Member Functions | |
GeoConvHelper (const GeoConvHelper &) | |
invalidated copy constructor. More... | |
GeoConvHelper & | operator= (const GeoConvHelper &) |
assignment operator. More... | |
Private Attributes | |
Boundary | myConvBoundary |
The boundary after conversion (x2cartesian) More... | |
double | myGeoScale |
The scaling to apply to geo-coordinates. More... | |
Position | myOffset |
The offset to apply. More... | |
Boundary | myOrigBoundary |
The boundary before conversion (x2cartesian) More... | |
ProjectionMethod | myProjectionMethod |
Information whether no projection shall be done. More... | |
std::string | myProjString |
A proj options string describing the proj.4-projection to use. More... | |
bool | myUseInverseProjection |
Information whether inverse projection shall be used. More... | |
Static Private Attributes | |
static GeoConvHelper | myFinal |
coordinate transformation to use for writing the location element and for tracking the original coordinate system More... | |
static GeoConvHelper | myLoaded |
coordinate transformation loaded from a location element More... | |
static int | myNumLoaded = 0 |
the numer of coordinate transformations loaded from location elements More... | |
static GeoConvHelper | myProcessing |
coordinate transformation to use for input conversion and processing More... | |
static methods for processing the coordinates conversion for the current net
Definition at line 59 of file GeoConvHelper.h.
|
private |
Enumerator | |
---|---|
NONE | |
SIMPLE | |
UTM | |
DHDN | |
PROJ |
Definition at line 167 of file GeoConvHelper.h.
GeoConvHelper::GeoConvHelper | ( | OptionsCont & | oc | ) |
Constructor based on the stored options.
[in] | oc | The OptionsCont from which to read options |
Referenced by computeFinal(), and init().
GeoConvHelper::GeoConvHelper | ( | const std::string & | proj, |
const Position & | offset, | ||
const Boundary & | orig, | ||
const Boundary & | conv, | ||
int | shift = 0 , |
||
bool | inverse = false |
||
) |
Constructor.
Definition at line 59 of file GeoConvHelper.cpp.
References DHDN, myProjectionMethod, NONE, PROJ, SIMPLE, and UTM.
GeoConvHelper::~GeoConvHelper | ( | ) |
Destructor.
Definition at line 92 of file GeoConvHelper.cpp.
|
private |
invalidated copy constructor.
|
static |
Adds projection options to the given container.
[in] | oc | The options container to add the options to |
Definition at line 171 of file GeoConvHelper.cpp.
References OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), OptionsCont::addSynonyme(), and OptionsCont::doRegister().
Referenced by fillOptions().
void GeoConvHelper::cartesian2geo | ( | Position & | cartesian | ) | const |
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Definition at line 211 of file GeoConvHelper.cpp.
References getOffsetBase(), myProjectionMethod, NONE, Position::set(), Position::sub(), SUMOReal, Position::x(), and Position::y().
Referenced by TraCIServerAPI_Simulation::commandPositionConversion(), MSVTypeProbe::execute(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), NBNetBuilder::transformCoordinates(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_DlrNavteq::writeTrafficSignals(), and x2cartesian_const().
|
static |
compute the location attributes which will be used for output based on the loaded location data, the given options and the transformations applied during processing
Definition at line 358 of file GeoConvHelper.cpp.
References GeoConvHelper(), getConvBoundary(), getOffset(), getOrigBoundary(), getProjString(), myFinal, myLoaded, myNumLoaded, myProcessing, and usingGeoProjection().
Referenced by NBNetBuilder::compute().
const Boundary & GeoConvHelper::getConvBoundary | ( | ) | const |
Returns the converted boundary.
Definition at line 334 of file GeoConvHelper.cpp.
References myConvBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), main(), TraCIServerAPI_Simulation::processGet(), NWWriter_SUMO::writeLocation(), and NWWriter_OpenDrive::writeNetwork().
|
inlinestatic |
the coordinate transformation for writing the location element and for tracking the original coordinate system
Definition at line 111 of file GeoConvHelper.h.
References myFinal.
Referenced by NLHandler::addPOI(), GUIGlObject::buildPositionCopyEntry(), TraCIServerAPI_Simulation::commandPositionConversion(), MSVTypeProbe::execute(), main(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), TraCIServerAPI_Simulation::processGet(), NLHandler::setLocation(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeLocation(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), and NWWriter_DlrNavteq::writeTrafficSignals().
const Position GeoConvHelper::getOffset | ( | ) | const |
Returns the network offset.
Definition at line 340 of file GeoConvHelper.cpp.
References myOffset.
Referenced by computeFinal().
const Position GeoConvHelper::getOffsetBase | ( | ) | const |
Returns the network base.
Definition at line 346 of file GeoConvHelper.cpp.
References myOffset.
Referenced by cartesian2geo(), NBNetBuilder::compute(), and NWWriter_SUMO::writeLocation().
const Boundary & GeoConvHelper::getOrigBoundary | ( | ) | const |
Returns the original boundary.
Definition at line 328 of file GeoConvHelper.cpp.
References myOrigBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), and NWWriter_SUMO::writeLocation().
|
inlinestatic |
the coordinate transformation to use for input conversion and processing
Definition at line 97 of file GeoConvHelper.h.
References myProcessing.
Referenced by NGNode::buildNBNode(), GUISUMOAbstractView::checkGDALImage(), NBNetBuilder::compute(), NILoader::load(), PCLoaderVisum::load(), PCLoaderArcView::load(), PCLoaderOSM::loadIfSet(), PCLoaderDlrNavteq::loadPOIFile(), PCLoaderDlrNavteq::loadPolyFile(), PCLoaderXML::myStartElement(), and NBNetBuilder::transformCoordinates().
const std::string & GeoConvHelper::getProjString | ( | ) | const |
Returns the network offset.
Definition at line 352 of file GeoConvHelper.cpp.
References myProjString.
Referenced by computeFinal(), and NWWriter_SUMO::writeLocation().
|
static |
Initialises the processing and the final instance using the given options.
Definition at line 124 of file GeoConvHelper.cpp.
References OptionsCont::exists(), GeoConvHelper(), OptionsCont::getBool(), OptionsCont::getFloat(), OptionsCont::getInt(), OptionsCont::getString(), myFinal, myProcessing, and WRITE_ERROR.
Referenced by main(), PCNetProjectionLoader::myStartElement(), and NLHandler::setLocation().
|
static |
Initialises the processing and the final instance using the given proj.4-definition and complete network parameter.
Definition at line 160 of file GeoConvHelper.cpp.
References GeoConvHelper(), myFinal, and myProcessing.
Shifts the converted boundary by the given amounts.
Definition at line 321 of file GeoConvHelper.cpp.
References Position::add(), Boundary::moveby(), myConvBoundary, and myOffset.
Referenced by NBNetBuilder::moveToOrigin().
|
private |
assignment operator.
Definition at line 102 of file GeoConvHelper.cpp.
References myConvBoundary, myGeoScale, myOffset, myOrigBoundary, myProjectionMethod, myProjString, and myUseInverseProjection.
|
static |
resets loaded location elements
Definition at line 386 of file GeoConvHelper.cpp.
References myNumLoaded.
|
inline |
sets the converted boundary
Definition at line 153 of file GeoConvHelper.h.
References myConvBoundary.
Referenced by NBNetBuilder::moveToOrigin().
|
static |
sets the coordinate transformation loaded from a location element
Definition at line 375 of file GeoConvHelper.cpp.
References myLoaded, myNumLoaded, toString(), and WRITE_WARNING.
Referenced by NIImporter_SUMO::loadLocation().
bool GeoConvHelper::usingGeoProjection | ( | ) | const |
Returns whether a transformation from geo to metric coordinates will be performed.
Definition at line 199 of file GeoConvHelper.cpp.
References myProjectionMethod, and NONE.
Referenced by computeFinal(), NBNetBuilder::transformCoordinates(), NWWriter_SUMO::writeLocation(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), and NWWriter_DlrNavteq::writeTrafficSignals().
bool GeoConvHelper::usingInverseGeoProjection | ( | ) | const |
Returns the information whether an inverse transformation will happen.
Definition at line 205 of file GeoConvHelper.cpp.
References myUseInverseProjection.
Referenced by NWWriter_XML::writeEdgesAndConnections(), and NWWriter_XML::writeNodes().
Converts the given coordinate into a cartesian and optionally update myConvBoundary
Definition at line 230 of file GeoConvHelper.cpp.
References Boundary::add(), DHDN, myConvBoundary, myGeoScale, myOrigBoundary, myProjectionMethod, myProjString, toString(), UTM, WRITE_WARNING, Position::x(), and x2cartesian_const().
Referenced by NGNode::buildNBNode(), GUISUMOAbstractView::checkGDALImage(), PCLoaderVisum::load(), PCLoaderArcView::load(), and NBNetBuilder::transformCoordinates().
Converts the given coordinate into a cartesian using the previous initialisation.
!! recheck whether the axes are mirrored
Definition at line 277 of file GeoConvHelper.cpp.
References Position::add(), cartesian2geo(), DEG2RAD, max, myGeoScale, myOffset, myProjectionMethod, myUseInverseProjection, NONE, Position::set(), SIMPLE, SUMOReal, Position::x(), and Position::y().
Referenced by NLHandler::addPOI(), TraCIServerAPI_Simulation::commandPositionConversion(), and x2cartesian().
|
private |
The boundary after conversion (x2cartesian)
Definition at line 199 of file GeoConvHelper.h.
Referenced by getConvBoundary(), moveConvertedBy(), operator=(), setConvBoundary(), and x2cartesian().
|
staticprivate |
coordinate transformation to use for writing the location element and for tracking the original coordinate system
Definition at line 208 of file GeoConvHelper.h.
Referenced by computeFinal(), getFinal(), and init().
|
private |
The scaling to apply to geo-coordinates.
Definition at line 187 of file GeoConvHelper.h.
Referenced by operator=(), x2cartesian(), and x2cartesian_const().
|
staticprivate |
coordinate transformation loaded from a location element
Definition at line 205 of file GeoConvHelper.h.
Referenced by computeFinal(), and setLoaded().
|
staticprivate |
the numer of coordinate transformations loaded from location elements
Definition at line 211 of file GeoConvHelper.h.
Referenced by computeFinal(), resetLoaded(), and setLoaded().
|
private |
The offset to apply.
Definition at line 184 of file GeoConvHelper.h.
Referenced by getOffset(), getOffsetBase(), moveConvertedBy(), operator=(), and x2cartesian_const().
|
private |
The boundary before conversion (x2cartesian)
Definition at line 196 of file GeoConvHelper.h.
Referenced by getOrigBoundary(), operator=(), and x2cartesian().
|
staticprivate |
coordinate transformation to use for input conversion and processing
Definition at line 202 of file GeoConvHelper.h.
Referenced by computeFinal(), getProcessing(), and init().
|
private |
Information whether no projection shall be done.
Definition at line 190 of file GeoConvHelper.h.
Referenced by cartesian2geo(), GeoConvHelper(), operator=(), usingGeoProjection(), x2cartesian(), and x2cartesian_const().
|
private |
A proj options string describing the proj.4-projection to use.
Definition at line 176 of file GeoConvHelper.h.
Referenced by getProjString(), operator=(), and x2cartesian().
|
private |
Information whether inverse projection shall be used.
Definition at line 193 of file GeoConvHelper.h.
Referenced by operator=(), usingInverseGeoProjection(), and x2cartesian_const().