![]() |
Eclipse 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 (const std::string &proj, const Position &offset, const Boundary &orig, const Boundary &conv, double scale=1.0, double rot=0.0, bool inverse=false, bool flatten=false) | |
Constructor. More... | |
GeoConvHelper (OptionsCont &oc) | |
Constructor based on the stored options. 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 original projection definition. More... | |
void | moveConvertedBy (double x, double y) |
Shifts the converted boundary by the given amounts. More... | |
bool | operator!= (const GeoConvHelper &o) const |
bool | operator== (const GeoConvHelper &o) const |
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) |
Converts the given coordinate into a cartesian and optionally update myConvBoundary. More... | |
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 (bool lefthand=false) |
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 & | getLoaded () |
the coordinate transformation that was loaded fron an input file More... | |
static int | getNumLoaded () |
static GeoConvHelper & | getProcessing () |
the coordinate transformation to use for input conversion and processing More... | |
static void | init (const std::string &proj, const Position &offset, const Boundary &orig, const Boundary &conv, double scale=1.0) |
Initialises the processing and the final instance using the given proj.4-definition and complete network parameter. More... | |
static bool | init (OptionsCont &oc) |
Initialises the processing and the final instance using the given options. 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... | |
static void | writeLocation (OutputDevice &into) |
writes the location element More... | |
Private Types | |
enum | ProjectionMethod { NONE, SIMPLE, UTM, DHDN, DHDN_UTM, PROJ } |
projection method More... | |
Private Member Functions | |
GeoConvHelper (const GeoConvHelper &)=delete | |
invalidated copy constructor. More... | |
GeoConvHelper & | operator= (const GeoConvHelper &) |
make assignment operator private More... | |
Private Attributes | |
Boundary | myConvBoundary |
The boundary after conversion (x2cartesian) More... | |
double | myCos |
bool | myFlatten |
whether to discard z-data 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... | |
double | mySin |
The rotation to apply to geo-coordinates. 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 56 of file GeoConvHelper.h.
|
private |
projection method
Enumerator | |
---|---|
NONE | |
SIMPLE | |
UTM | |
DHDN | |
DHDN_UTM | |
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, | ||
double | scale = 1.0 , |
||
double | rot = 0.0 , |
||
bool | inverse = false , |
||
bool | flatten = false |
||
) |
Constructor.
Definition at line 51 of file GeoConvHelper.cpp.
References DHDN, DHDN_UTM, myProjectionMethod, NONE, PROJ, SIMPLE, and UTM.
GeoConvHelper::~GeoConvHelper | ( | ) |
Destructor.
Definition at line 95 of file GeoConvHelper.cpp.
|
privatedelete |
invalidated copy constructor.
|
static |
Adds projection options to the given container.
[in] | oc | The options container to add the options to |
Definition at line 249 of file GeoConvHelper.cpp.
References OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), OptionsCont::addSynonyme(), and OptionsCont::doRegister().
Referenced by fillOptions(), and GNELoadThread::fillOptions().
void GeoConvHelper::cartesian2geo | ( | Position & | cartesian | ) | const |
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Definition at line 294 of file GeoConvHelper.cpp.
References DEG2RAD, getOffsetBase(), myProjectionMethod, NONE, Position::set(), SIMPLE, Position::sub(), Position::x(), and Position::y().
Referenced by TraCIServerAPI_Simulation::commandPositionConversion(), libsumo::Simulation::convert2D(), libsumo::Simulation::convert3D(), libsumo::Simulation::convertGeo(), MSVTypeProbe::execute(), NIImporter_OpenDrive::loadNetwork(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), ROVehicle::saveAsXML(), ROPerson::PersonTrip::saveAsXML(), PCPolyContainer::saveDlrTDP(), GNEPOI::setAttribute(), GNEPoly::setAttribute(), MSDevice_SSM::toGeo(), NBNetBuilder::transformCoordinate(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_DlrNavteq::writeTrafficSignals(), MSFCDExport::writeTransportable(), PointOfInterest::writeXML(), SUMOPolygon::writeXML(), 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 514 of file GeoConvHelper.cpp.
References Boundary::flipY(), GeoConvHelper(), getConvBoundary(), getOffset(), getOrigBoundary(), getProjString(), Position::mul(), myConvBoundary, myFinal, myLoaded, myNumLoaded, myOffset, myProcessing, and usingGeoProjection().
Referenced by NBNetBuilder::compute(), main(), and GNELoadThread::run().
const Boundary & GeoConvHelper::getConvBoundary | ( | ) | const |
Returns the converted boundary.
Definition at line 490 of file GeoConvHelper.cpp.
References myConvBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), libsumo::Helper::convertCartesianToRoadMap(), libsumo::Simulation::getNetBoundary(), main(), NBNetBuilder::moveToOrigin(), writeLocation(), NWWriter_OpenDrive::writeNetwork(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
|
inlinestatic |
the coordinate transformation for writing the location element and for tracking the original coordinate system
Definition at line 106 of file GeoConvHelper.h.
References myFinal.
Referenced by ShapeHandler::addPOI(), ShapeHandler::addPoly(), GUIGlObject::buildPositionCopyEntry(), TraCIServerAPI_Simulation::commandPositionConversion(), GNENet::computeAndUpdate(), libsumo::Simulation::convert2D(), libsumo::Simulation::convert3D(), libsumo::Helper::convertCartesianToRoadMap(), libsumo::Simulation::convertGeo(), libsumo::Simulation::convertRoad(), MSVTypeProbe::execute(), libsumo::Simulation::getDistance2D(), libsumo::Simulation::getNetBoundary(), main(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), GNEPolygonFrame::GEOPOICreator::onCmdCreateGEOPOI(), GNEPolygonFrame::GEOPOICreator::onCmdSetCoordinates(), GNEInspectorFrame::GEOAttributesEditor::onCmdSetGEOAttribute(), GNEAdditionalHandler::parseAndBuildPOI(), GNEAdditionalHandler::parseAndBuildPoly(), RORouteHandler::parseGeoEdges(), GNEInspectorFrame::GEOAttributesEditor::refreshGEOAttributesEditor(), PCPolyContainer::save(), ROVehicle::saveAsXML(), ROPerson::PersonTrip::saveAsXML(), PCPolyContainer::saveDlrTDP(), GNEPOI::setAttribute(), GNEPoly::setAttribute(), NLHandler::setLocation(), GNEInspectorFrame::GEOAttributesEditor::showGEOAttributesEditor(), GNEPolygonFrame::GEOPOICreator::showGEOPOICreatorModul(), MSDevice_SSM::toGeo(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_DlrNavteq::writeTrafficSignals(), MSFCDExport::writeTransportable(), PointOfInterest::writeXML(), and SUMOPolygon::writeXML().
|
inlinestatic |
the coordinate transformation that was loaded fron an input file
Definition at line 92 of file GeoConvHelper.h.
References myLoaded.
Referenced by NBEdgeCont::ignoreFilterMatch(), NIImporter_OpenDrive::loadNetwork(), and NBNetBuilder::transformCoordinate().
|
inlinestatic |
Definition at line 96 of file GeoConvHelper.h.
References myNumLoaded.
Referenced by NBNetBuilder::transformCoordinate().
const Position GeoConvHelper::getOffset | ( | ) | const |
Returns the network offset.
Definition at line 496 of file GeoConvHelper.cpp.
References myOffset.
Referenced by computeFinal().
const Position GeoConvHelper::getOffsetBase | ( | ) | const |
Returns the network base.
Definition at line 502 of file GeoConvHelper.cpp.
References myOffset.
Referenced by cartesian2geo(), NBNetBuilder::compute(), writeLocation(), and NWWriter_OpenDrive::writeNetwork().
const Boundary & GeoConvHelper::getOrigBoundary | ( | ) | const |
Returns the original boundary.
Definition at line 484 of file GeoConvHelper.cpp.
References myOrigBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), and writeLocation().
|
inlinestatic |
the coordinate transformation to use for input conversion and processing
Definition at line 87 of file GeoConvHelper.h.
References myProcessing.
Referenced by ShapeHandler::addPOI(), ShapeHandler::addPoly(), NGNode::buildNBNode(), GUISUMOAbstractView::checkGDALImage(), NBNetBuilder::compute(), PCLoaderOSM::convertNodePosition(), NBEdgeCont::ignoreFilterMatch(), NILoader::load(), PCLoaderVisum::load(), PCLoaderArcView::load(), PCLoaderOSM::loadIfSet(), PCLoaderDlrNavteq::loadPOIFile(), PCLoaderDlrNavteq::loadPolyFile(), and NBNetBuilder::transformCoordinate().
const std::string & GeoConvHelper::getProjString | ( | ) | const |
Returns the original projection definition.
Definition at line 508 of file GeoConvHelper.cpp.
References myProjString.
Referenced by computeFinal(), writeLocation(), and NWWriter_OpenDrive::writeNetwork().
|
static |
Initialises the processing and the final instance using the given proj.4-definition and complete network parameter.
Definition at line 241 of file GeoConvHelper.cpp.
References GeoConvHelper(), myFinal, and myProcessing.
|
static |
Initialises the processing and the final instance using the given options.
Definition at line 201 of file GeoConvHelper.cpp.
References OptionsCont::exists(), GeoConvHelper(), OptionsCont::getBool(), OptionsCont::getFloat(), OptionsCont::getString(), OptionsCont::isDefault(), myFinal, myProcessing, and WRITE_ERROR.
Referenced by main(), PCNetProjectionLoader::myStartElement(), GNELoadThread::run(), RONetHandler::setLocation(), and NLHandler::setLocation().
void GeoConvHelper::moveConvertedBy | ( | double | x, |
double | y | ||
) |
Shifts the converted boundary by the given amounts.
Definition at line 477 of file GeoConvHelper.cpp.
References Position::add(), Boundary::moveby(), myConvBoundary, and myOffset.
Referenced by NBNetBuilder::moveToOrigin().
|
inline |
Definition at line 161 of file GeoConvHelper.h.
|
private |
make assignment operator private
Definition at line 138 of file GeoConvHelper.cpp.
References myConvBoundary, myCos, myFlatten, myGeoScale, myOffset, myOrigBoundary, myProjectionMethod, myProjString, mySin, and myUseInverseProjection.
bool GeoConvHelper::operator== | ( | const GeoConvHelper & | o | ) | const |
Definition at line 122 of file GeoConvHelper.cpp.
References myConvBoundary, myCos, myFlatten, myGeoScale, myOffset, myOrigBoundary, myProjectionMethod, myProjString, mySin, and myUseInverseProjection.
|
static |
resets loaded location elements
Definition at line 551 of file GeoConvHelper.cpp.
References myNumLoaded.
Referenced by GNEApplicationWindow::closeAllWindows().
|
inline |
sets the converted boundary
Definition at line 143 of file GeoConvHelper.h.
References myConvBoundary.
Referenced by NBNetBuilder::compute().
|
static |
sets the coordinate transformation loaded from a location element
Definition at line 540 of file GeoConvHelper.cpp.
References myLoaded, myNumLoaded, toString(), and WRITE_WARNING.
Referenced by NIImporter_SUMO::loadLocation(), and NIImporter_OpenDrive::myCharacters().
bool GeoConvHelper::usingGeoProjection | ( | ) | const |
Returns whether a transformation from geo to metric coordinates will be performed.
Definition at line 282 of file GeoConvHelper.cpp.
References myProjectionMethod, and NONE.
Referenced by ShapeHandler::addPOI(), computeFinal(), MSVTypeProbe::execute(), NBEdgeCont::ignoreFilterMatch(), NIImporter_OpenDrive::loadNetwork(), PCPolyContainer::save(), ROVehicle::saveAsXML(), ROPerson::PersonTrip::saveAsXML(), PCPolyContainer::saveDlrTDP(), NBNetBuilder::transformCoordinate(), writeLocation(), NWWriter_OpenDrive::writeNetwork(), 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 288 of file GeoConvHelper.cpp.
References myUseInverseProjection.
Referenced by NWWriter_XML::writeEdgesAndConnections(), and NWWriter_XML::writeNodes().
|
static |
writes the location element
Definition at line 557 of file GeoConvHelper.cpp.
References OutputDevice::closeTag(), getConvBoundary(), getOffsetBase(), getOrigBoundary(), getProjString(), gPrecisionGeo, OutputDevice::lf(), myFinal, OutputDevice::openTag(), OutputDevice::setPrecision(), SUMO_ATTR_CONV_BOUNDARY, SUMO_ATTR_NET_OFFSET, SUMO_ATTR_ORIG_BOUNDARY, SUMO_ATTR_ORIG_PROJ, SUMO_TAG_LOCATION, usingGeoProjection(), and OutputDevice::writeAttr().
Referenced by PCPolyContainer::save(), NWWriter_SUMO::writeNetwork(), and NWWriter_XML::writeNodes().
bool GeoConvHelper::x2cartesian | ( | Position & | from, |
bool | includeInBoundary = true |
||
) |
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
Definition at line 327 of file GeoConvHelper.cpp.
References Boundary::add(), DHDN, DHDN_UTM, FALLTHROUGH, myConvBoundary, myGeoScale, myOrigBoundary, myProjectionMethod, myProjString, Position::set(), toString(), UTM, WRITE_WARNING, Position::x(), x2cartesian_const(), and Position::y().
Referenced by ShapeHandler::addPOI(), ShapeHandler::addPoly(), NGNode::buildNBNode(), GUISUMOAbstractView::checkGDALImage(), PCLoaderOSM::convertNodePosition(), PCLoaderVisum::load(), PCLoaderArcView::load(), and NBNetBuilder::transformCoordinate().
bool GeoConvHelper::x2cartesian_const | ( | Position & | from | ) | const |
Converts the given coordinate into a cartesian using the previous initialisation.
!! recheck whether the axes are mirrored
Definition at line 418 of file GeoConvHelper.cpp.
References Position::add(), cartesian2geo(), DEG2RAD, myCos, myFlatten, myGeoScale, myOffset, myProjectionMethod, mySin, myUseInverseProjection, NONE, Position::set(), Position::setz(), SIMPLE, toString(), WRITE_WARNING, Position::x(), and Position::y().
Referenced by ShapeHandler::addPOI(), ShapeHandler::addPoly(), TraCIServerAPI_Simulation::commandPositionConversion(), libsumo::Simulation::convertGeo(), libsumo::Simulation::convertRoad(), libsumo::Simulation::getDistance2D(), NBEdgeCont::ignoreFilterMatch(), GNEPolygonFrame::GEOPOICreator::onCmdCreateGEOPOI(), GNEPolygonFrame::GEOPOICreator::onCmdSetCoordinates(), GNEAdditionalHandler::parseAndBuildPoly(), RORouteHandler::parseGeoEdges(), GNEPOI::setAttribute(), GNEPoly::setAttribute(), and x2cartesian().
|
private |
The boundary after conversion (x2cartesian)
Definition at line 213 of file GeoConvHelper.h.
Referenced by computeFinal(), getConvBoundary(), moveConvertedBy(), operator=(), operator==(), setConvBoundary(), and x2cartesian().
|
private |
Definition at line 198 of file GeoConvHelper.h.
Referenced by operator=(), operator==(), and x2cartesian_const().
|
staticprivate |
coordinate transformation to use for writing the location element and for tracking the original coordinate system
Definition at line 222 of file GeoConvHelper.h.
Referenced by computeFinal(), getFinal(), init(), and writeLocation().
|
private |
whether to discard z-data
Definition at line 207 of file GeoConvHelper.h.
Referenced by operator=(), operator==(), and x2cartesian_const().
|
private |
The scaling to apply to geo-coordinates.
Definition at line 194 of file GeoConvHelper.h.
Referenced by operator=(), operator==(), x2cartesian(), and x2cartesian_const().
|
staticprivate |
coordinate transformation loaded from a location element
Definition at line 219 of file GeoConvHelper.h.
Referenced by computeFinal(), getLoaded(), and setLoaded().
|
staticprivate |
the numer of coordinate transformations loaded from location elements
Definition at line 225 of file GeoConvHelper.h.
Referenced by computeFinal(), getNumLoaded(), resetLoaded(), and setLoaded().
|
private |
The offset to apply.
Definition at line 191 of file GeoConvHelper.h.
Referenced by computeFinal(), getOffset(), getOffsetBase(), moveConvertedBy(), operator=(), operator==(), and x2cartesian_const().
|
private |
The boundary before conversion (x2cartesian)
Definition at line 210 of file GeoConvHelper.h.
Referenced by getOrigBoundary(), operator=(), operator==(), and x2cartesian().
|
staticprivate |
coordinate transformation to use for input conversion and processing
Definition at line 216 of file GeoConvHelper.h.
Referenced by computeFinal(), getProcessing(), and init().
|
private |
Information whether no projection shall be done.
Definition at line 201 of file GeoConvHelper.h.
Referenced by cartesian2geo(), GeoConvHelper(), operator=(), operator==(), usingGeoProjection(), x2cartesian(), and x2cartesian_const().
|
private |
A proj options string describing the proj.4-projection to use.
Definition at line 177 of file GeoConvHelper.h.
Referenced by getProjString(), operator=(), operator==(), and x2cartesian().
|
private |
The rotation to apply to geo-coordinates.
Definition at line 197 of file GeoConvHelper.h.
Referenced by operator=(), operator==(), and x2cartesian_const().
|
private |
Information whether inverse projection shall be used.
Definition at line 204 of file GeoConvHelper.h.
Referenced by operator=(), operator==(), usingInverseGeoProjection(), and x2cartesian_const().