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, bool baseFound=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... | |
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) |
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 | |
bool | myBaseFound |
Information whether the first node conversion was done. More... | |
double | myBaseX |
The initial x/y-coordinates for a very simple geocoordinates conversion. More... | |
double | myBaseY |
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 58 of file GeoConvHelper.h.
|
private |
Enumerator | |
---|---|
NONE | |
SIMPLE | |
UTM | |
DHDN | |
PROJ |
Definition at line 160 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 , |
||
bool | baseFound = false |
||
) |
Constructor.
Definition at line 57 of file GeoConvHelper.cpp.
References DHDN, myProjectionMethod, NONE, PROJ, SIMPLE, and UTM.
GeoConvHelper::~GeoConvHelper | ( | ) |
Destructor.
Definition at line 93 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 178 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 218 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(), NILoader::transformCoordinates(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), 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 373 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 349 of file GeoConvHelper.cpp.
References myConvBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), 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 109 of file GeoConvHelper.h.
References myFinal.
Referenced by GUIGlObject::buildPositionCopyEntry(), TraCIServerAPI_Simulation::commandPositionConversion(), MSVTypeProbe::execute(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), TraCIServerAPI_Simulation::processGet(), NLHandler::setLocation(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeLocation(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
const Position GeoConvHelper::getOffset | ( | ) | const |
Returns the network offset.
Definition at line 355 of file GeoConvHelper.cpp.
References myOffset.
Referenced by computeFinal().
const Position GeoConvHelper::getOffsetBase | ( | ) | const |
Returns the network base.
Definition at line 361 of file GeoConvHelper.cpp.
References myBaseX, myBaseY, myOffset, Position::x(), and Position::y().
Referenced by cartesian2geo(), NBNetBuilder::compute(), and NWWriter_SUMO::writeLocation().
const Boundary & GeoConvHelper::getOrigBoundary | ( | ) | const |
Returns the original boundary.
Definition at line 343 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 95 of file GeoConvHelper.h.
References myProcessing.
Referenced by NGNode::buildNBNode(), NBNetBuilder::compute(), NILoader::load(), PCLoaderVisum::load(), PCLoaderArcView::load(), PCLoaderOSM::loadIfSet(), PCLoaderDlrNavteq::loadPOIFile(), PCLoaderDlrNavteq::loadPolyFile(), PCLoaderXML::myStartElement(), and NILoader::transformCoordinates().
const std::string & GeoConvHelper::getProjString | ( | ) | const |
Returns the network offset.
Definition at line 367 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 128 of file GeoConvHelper.cpp.
References OptionsCont::exists(), GeoConvHelper(), OptionsCont::getBool(), OptionsCont::getFloat(), OptionsCont::getInt(), OptionsCont::getString(), OptionsCont::isDefault(), myFinal, myProcessing, and WRITE_ERROR.
Referenced by NILoader::load(), main(), and NLHandler::setLocation().
|
static |
Initialises the processing and the final instance using the given proj.4-definition and complete network parameter.
Definition at line 168 of file GeoConvHelper.cpp.
References GeoConvHelper(), myFinal, and myProcessing.
Shifts the converted boundary by the given amounts.
Definition at line 336 of file GeoConvHelper.cpp.
References Position::add(), Boundary::moveby(), myConvBoundary, and myOffset.
Referenced by NBNetBuilder::compute().
|
private |
assignment operator.
Definition at line 103 of file GeoConvHelper.cpp.
References myBaseFound, myBaseX, myBaseY, myConvBoundary, myGeoScale, myOffset, myOrigBoundary, myProjectionMethod, myProjString, and myUseInverseProjection.
|
static |
resets loaded location elements
Definition at line 401 of file GeoConvHelper.cpp.
References myNumLoaded.
|
static |
sets the coordinate transformation loaded from a location element
Definition at line 390 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 206 of file GeoConvHelper.cpp.
References myProjectionMethod, and NONE.
Referenced by computeFinal(), NILoader::transformCoordinates(), NWWriter_SUMO::writeLocation(), NWWriter_XML::writeNodes(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
bool GeoConvHelper::usingInverseGeoProjection | ( | ) | const |
Returns the information whether an inverse transformation will happen.
Definition at line 212 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 237 of file GeoConvHelper.cpp.
References Boundary::add(), DHDN, myBaseFound, myBaseX, myBaseY, myConvBoundary, myGeoScale, myOrigBoundary, myProjectionMethod, myProjString, Position::set(), SIMPLE, toString(), UTM, WRITE_WARNING, Position::x(), x2cartesian_const(), and Position::y().
Referenced by NGNode::buildNBNode(), PCLoaderVisum::load(), PCLoaderArcView::load(), and NILoader::transformCoordinates().
Converts the given coordinate into a cartesian using the previous initialisation.
!! recheck whether the axes are mirrored
Definition at line 292 of file GeoConvHelper.cpp.
References Position::add(), cartesian2geo(), myBaseX, myBaseY, myGeoScale, myOffset, myProjectionMethod, myUseInverseProjection, NONE, PI, Position::set(), SIMPLE, SUMOReal, Position::x(), and Position::y().
Referenced by TraCIServerAPI_Simulation::commandPositionConversion(), and x2cartesian().
|
private |
Information whether the first node conversion was done.
Definition at line 189 of file GeoConvHelper.h.
Referenced by operator=(), and x2cartesian().
|
private |
The initial x/y-coordinates for a very simple geocoordinates conversion.
Definition at line 192 of file GeoConvHelper.h.
Referenced by getOffsetBase(), operator=(), x2cartesian(), and x2cartesian_const().
|
private |
Definition at line 192 of file GeoConvHelper.h.
Referenced by getOffsetBase(), operator=(), x2cartesian(), and x2cartesian_const().
|
private |
The boundary after conversion (x2cartesian)
Definition at line 198 of file GeoConvHelper.h.
Referenced by getConvBoundary(), moveConvertedBy(), operator=(), and x2cartesian().
|
staticprivate |
coordinate transformation to use for writing the location element and for tracking the original coordinate system
Definition at line 207 of file GeoConvHelper.h.
Referenced by computeFinal(), getFinal(), and init().
|
private |
The scaling to apply to geo-coordinates.
Definition at line 180 of file GeoConvHelper.h.
Referenced by operator=(), x2cartesian(), and x2cartesian_const().
|
staticprivate |
coordinate transformation loaded from a location element
Definition at line 204 of file GeoConvHelper.h.
Referenced by computeFinal(), and setLoaded().
|
staticprivate |
the numer of coordinate transformations loaded from location elements
Definition at line 210 of file GeoConvHelper.h.
Referenced by computeFinal(), resetLoaded(), and setLoaded().
|
private |
The offset to apply.
Definition at line 177 of file GeoConvHelper.h.
Referenced by getOffset(), getOffsetBase(), moveConvertedBy(), operator=(), and x2cartesian_const().
|
private |
The boundary before conversion (x2cartesian)
Definition at line 195 of file GeoConvHelper.h.
Referenced by getOrigBoundary(), operator=(), and x2cartesian().
|
staticprivate |
coordinate transformation to use for input conversion and processing
Definition at line 201 of file GeoConvHelper.h.
Referenced by computeFinal(), getProcessing(), and init().
|
private |
Information whether no projection shall be done.
Definition at line 183 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 169 of file GeoConvHelper.h.
Referenced by getProjString(), operator=(), and x2cartesian().
|
private |
Information whether inverse projection shall be used.
Definition at line 186 of file GeoConvHelper.h.
Referenced by operator=(), usingInverseGeoProjection(), and x2cartesian_const().