![]() |
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 (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 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... | |
static void | writeLocation (OutputDevice &into) |
writes the location element More... | |
Private Types | |
enum | ProjectionMethod { NONE, SIMPLE, UTM, DHDN, DHDN_UTM, 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 60 of file GeoConvHelper.h.
|
private |
Enumerator | |
---|---|
NONE | |
SIMPLE | |
UTM | |
DHDN | |
DHDN_UTM | |
PROJ |
Definition at line 176 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 60 of file GeoConvHelper.cpp.
References DHDN, DHDN_UTM, myProjectionMethod, NONE, PROJ, SIMPLE, and UTM.
GeoConvHelper::~GeoConvHelper | ( | ) |
Destructor.
Definition at line 97 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 198 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 241 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(), getFinal(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), NBNetBuilder::transformCoordinates(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_DlrNavteq::writeTrafficSignals(), MSFCDExport::writeTransportable(), PointOfInterest::writeXML(), SUMO::Polygon::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 415 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(), getLoaded(), main(), and GNELoadThread::run().
const Boundary & GeoConvHelper::getConvBoundary | ( | ) | const |
Returns the converted boundary.
Definition at line 391 of file GeoConvHelper.cpp.
References myConvBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), getFinal(), main(), NBNetBuilder::moveToOrigin(), TraCIServerAPI_Simulation::processGet(), writeLocation(), and NWWriter_OpenDrive::writeNetwork().
|
inlinestatic |
the coordinate transformation for writing the location element and for tracking the original coordinate system
Definition at line 117 of file GeoConvHelper.h.
References cartesian2geo(), getConvBoundary(), getOrigBoundary(), moveConvertedBy(), myFinal, resetLoaded(), setLoaded(), SUMOReal, usingGeoProjection(), usingInverseGeoProjection(), x2cartesian(), and x2cartesian_const().
Referenced by ShapeHandler::addPOI(), ShapeHandler::addPoly(), GUIGlObject::buildPositionCopyEntry(), TraCIServerAPI_Simulation::commandPositionConversion(), MSVTypeProbe::execute(), main(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), TraCIServerAPI_Simulation::processGet(), PCPolyContainer::save(), NLHandler::setLocation(), GUISUMOAbstractView::updatePositionInformation(), MSFCDExport::write(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_DlrNavteq::writeTrafficSignals(), MSFCDExport::writeTransportable(), PointOfInterest::writeXML(), and SUMO::Polygon::writeXML().
|
inlinestatic |
the coordinate transformation that was loaded fron an input file
Definition at line 104 of file GeoConvHelper.h.
References computeFinal(), and myLoaded.
Referenced by NBEdgeCont::ignoreFilterMatch().
const Position GeoConvHelper::getOffset | ( | ) | const |
Returns the network offset.
Definition at line 397 of file GeoConvHelper.cpp.
References myOffset.
Referenced by computeFinal(), and setConvBoundary().
const Position GeoConvHelper::getOffsetBase | ( | ) | const |
Returns the network base.
Definition at line 403 of file GeoConvHelper.cpp.
References myOffset.
Referenced by cartesian2geo(), NBNetBuilder::compute(), setConvBoundary(), and writeLocation().
const Boundary & GeoConvHelper::getOrigBoundary | ( | ) | const |
Returns the original boundary.
Definition at line 385 of file GeoConvHelper.cpp.
References myOrigBoundary.
Referenced by NBNetBuilder::compute(), computeFinal(), getFinal(), and writeLocation().
|
inlinestatic |
the coordinate transformation to use for input conversion and processing
Definition at line 98 of file GeoConvHelper.h.
References myProcessing.
Referenced by NGNode::buildNBNode(), GUISUMOAbstractView::checkGDALImage(), NBNetBuilder::compute(), NBEdgeCont::ignoreFilterMatch(), 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 409 of file GeoConvHelper.cpp.
References myProjString.
Referenced by computeFinal(), setConvBoundary(), and writeLocation().
|
static |
Initialises the processing and the final instance using the given options.
Definition at line 149 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 main(), PCNetProjectionLoader::myStartElement(), GNELoadThread::run(), and NLHandler::setLocation().
|
static |
Initialises the processing and the final instance using the given proj.4-definition and complete network parameter.
Definition at line 187 of file GeoConvHelper.cpp.
References GeoConvHelper(), myFinal, and myProcessing.
Shifts the converted boundary by the given amounts.
Definition at line 378 of file GeoConvHelper.cpp.
References Position::add(), Boundary::moveby(), myConvBoundary, and myOffset.
Referenced by getFinal(), and NBNetBuilder::moveToOrigin().
|
private |
assignment operator.
Definition at line 113 of file GeoConvHelper.cpp.
References myConvBoundary, myGeoScale, myOffset, myOrigBoundary, myProjectionMethod, myProjString, and myUseInverseProjection.
|
static |
resets loaded location elements
Definition at line 447 of file GeoConvHelper.cpp.
References myNumLoaded.
Referenced by GNEApplicationWindow::closeAllWindows(), and getFinal().
|
inline |
sets the converted boundary
Definition at line 159 of file GeoConvHelper.h.
References getOffset(), getOffsetBase(), getProjString(), myConvBoundary, and writeLocation().
Referenced by NBNetBuilder::compute().
|
static |
sets the coordinate transformation loaded from a location element
Definition at line 436 of file GeoConvHelper.cpp.
References myLoaded, myNumLoaded, toString(), and WRITE_WARNING.
Referenced by getFinal(), and NIImporter_SUMO::loadLocation().
bool GeoConvHelper::usingGeoProjection | ( | ) | const |
Returns whether a transformation from geo to metric coordinates will be performed.
Definition at line 229 of file GeoConvHelper.cpp.
References myProjectionMethod, and NONE.
Referenced by computeFinal(), MSVTypeProbe::execute(), getFinal(), NBEdgeCont::ignoreFilterMatch(), PCPolyContainer::save(), NBNetBuilder::transformCoordinates(), 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 235 of file GeoConvHelper.cpp.
References myUseInverseProjection.
Referenced by getFinal(), NWWriter_XML::writeEdgesAndConnections(), and NWWriter_XML::writeNodes().
|
static |
writes the location element
Definition at line 453 of file GeoConvHelper.cpp.
References OutputDevice::closeTag(), GEO_OUTPUT_ACCURACY, getConvBoundary(), getOffsetBase(), getOrigBoundary(), getProjString(), 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(), GNEPOI::saveToFile(), setConvBoundary(), 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 260 of file GeoConvHelper.cpp.
References Boundary::add(), DHDN, DHDN_UTM, myConvBoundary, myGeoScale, myOrigBoundary, myProjectionMethod, myProjString, Position::set(), SUMOReal, toString(), UTM, WRITE_WARNING, Position::x(), x2cartesian_const(), and Position::y().
Referenced by NGNode::buildNBNode(), GUISUMOAbstractView::checkGDALImage(), getFinal(), PCLoaderVisum::load(), PCLoaderArcView::load(), and NBNetBuilder::transformCoordinates().
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 329 of file GeoConvHelper.cpp.
References Position::add(), cartesian2geo(), DEG2RAD, max, myGeoScale, myOffset, myProjectionMethod, myUseInverseProjection, NONE, Position::set(), SIMPLE, SUMOReal, toString(), WRITE_WARNING, Position::x(), and Position::y().
Referenced by ShapeHandler::addPOI(), ShapeHandler::addPoly(), TraCIServerAPI_Simulation::commandPositionConversion(), getFinal(), NBEdgeCont::ignoreFilterMatch(), and x2cartesian().
|
private |
The boundary after conversion (x2cartesian)
Definition at line 215 of file GeoConvHelper.h.
Referenced by computeFinal(), 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 224 of file GeoConvHelper.h.
Referenced by computeFinal(), getFinal(), init(), and writeLocation().
|
private |
The scaling to apply to geo-coordinates.
Definition at line 203 of file GeoConvHelper.h.
Referenced by operator=(), x2cartesian(), and x2cartesian_const().
|
staticprivate |
coordinate transformation loaded from a location element
Definition at line 221 of file GeoConvHelper.h.
Referenced by computeFinal(), getLoaded(), and setLoaded().
|
staticprivate |
the numer of coordinate transformations loaded from location elements
Definition at line 227 of file GeoConvHelper.h.
Referenced by computeFinal(), resetLoaded(), and setLoaded().
|
private |
The offset to apply.
Definition at line 200 of file GeoConvHelper.h.
Referenced by computeFinal(), getOffset(), getOffsetBase(), moveConvertedBy(), operator=(), and x2cartesian_const().
|
private |
The boundary before conversion (x2cartesian)
Definition at line 212 of file GeoConvHelper.h.
Referenced by getOrigBoundary(), operator=(), and x2cartesian().
|
staticprivate |
coordinate transformation to use for input conversion and processing
Definition at line 218 of file GeoConvHelper.h.
Referenced by computeFinal(), getProcessing(), and init().
|
private |
Information whether no projection shall be done.
Definition at line 206 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 186 of file GeoConvHelper.h.
Referenced by getProjString(), operator=(), and x2cartesian().
|
private |
Information whether inverse projection shall be used.
Definition at line 209 of file GeoConvHelper.h.
Referenced by operator=(), usingInverseGeoProjection(), and x2cartesian_const().