Eclipse SUMO - Simulation of Urban MObility
GeoConvHelper Class Reference

static methods for processing the coordinates conversion for the current net More...

#include <GeoConvHelper.h>

Collaboration diagram for GeoConvHelper:

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, double scale=1.0, double rot=0.0, bool inverse=false, bool flatten=false)
 Constructor. More...
 
const BoundarygetConvBoundary () 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 BoundarygetOrigBoundary () 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 GeoConvHelpergetFinal ()
 the coordinate transformation for writing the location element and for tracking the original coordinate system More...
 
static GeoConvHelpergetLoaded ()
 the coordinate transformation that was loaded fron an input file More...
 
static int getNumLoaded ()
 
static GeoConvHelpergetProcessing ()
 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, double scale=1.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
}
 projection method More...
 

Private Member Functions

 GeoConvHelper (const GeoConvHelper &)=delete
 invalidated copy constructor. More...
 
GeoConvHelperoperator= (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...
 

Detailed Description

static methods for processing the coordinates conversion for the current net

Definition at line 56 of file GeoConvHelper.h.

Member Enumeration Documentation

◆ ProjectionMethod

projection method

Enumerator
NONE 
SIMPLE 
UTM 
DHDN 
DHDN_UTM 
PROJ 

Definition at line 167 of file GeoConvHelper.h.

Constructor & Destructor Documentation

◆ GeoConvHelper() [1/3]

GeoConvHelper::GeoConvHelper ( OptionsCont oc)

Constructor based on the stored options.

Parameters
[in]ocThe OptionsCont from which to read options

Referenced by computeFinal(), and init().

◆ GeoConvHelper() [2/3]

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::~GeoConvHelper ( )

Destructor.

Definition at line 95 of file GeoConvHelper.cpp.

◆ GeoConvHelper() [3/3]

GeoConvHelper::GeoConvHelper ( const GeoConvHelper )
privatedelete

invalidated copy constructor.

Member Function Documentation

◆ addProjectionOptions()

void GeoConvHelper::addProjectionOptions ( OptionsCont oc)
static

Adds projection options to the given container.

Parameters
[in]ocThe options container to add the options to
Todo:
let the container be retrieved

Definition at line 249 of file GeoConvHelper.cpp.

References OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), OptionsCont::addSynonyme(), and OptionsCont::doRegister().

Referenced by fillOptions(), and GNELoadThread::fillOptions().

◆ cartesian2geo()

◆ computeFinal()

void GeoConvHelper::computeFinal ( bool  lefthand = false)
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(), getNumLoaded(), main(), and GNELoadThread::run().

◆ getConvBoundary()

◆ getFinal()

static const GeoConvHelper& GeoConvHelper::getFinal ( )
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 cartesian2geo(), getConvBoundary(), getOrigBoundary(), moveConvertedBy(), myFinal, resetLoaded(), setLoaded(), usingGeoProjection(), usingInverseGeoProjection(), x2cartesian(), and x2cartesian_const().

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(), GNEPOI::GNEPOI(), GNEPoly::GNEPoly(), 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().

◆ getLoaded()

static GeoConvHelper& GeoConvHelper::getLoaded ( )
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().

◆ getNumLoaded()

static int GeoConvHelper::getNumLoaded ( )
inlinestatic

Definition at line 96 of file GeoConvHelper.h.

References computeFinal(), and myNumLoaded.

Referenced by NBNetBuilder::transformCoordinate().

◆ getOffset()

const Position GeoConvHelper::getOffset ( ) const

Returns the network offset.

Definition at line 496 of file GeoConvHelper.cpp.

References myOffset.

Referenced by computeFinal(), and setConvBoundary().

◆ getOffsetBase()

const Position GeoConvHelper::getOffsetBase ( ) const

Returns the network base.

Definition at line 502 of file GeoConvHelper.cpp.

References myOffset.

Referenced by cartesian2geo(), NBNetBuilder::compute(), setConvBoundary(), writeLocation(), and NWWriter_OpenDrive::writeNetwork().

◆ getOrigBoundary()

const Boundary & GeoConvHelper::getOrigBoundary ( ) const

Returns the original boundary.

Definition at line 484 of file GeoConvHelper.cpp.

References myOrigBoundary.

Referenced by NBNetBuilder::compute(), computeFinal(), getFinal(), and writeLocation().

◆ getProcessing()

static GeoConvHelper& GeoConvHelper::getProcessing ( )
inlinestatic

◆ getProjString()

const std::string & GeoConvHelper::getProjString ( ) const

Returns the original projection definition.

Definition at line 508 of file GeoConvHelper.cpp.

References myProjString.

Referenced by computeFinal(), setConvBoundary(), writeLocation(), and NWWriter_OpenDrive::writeNetwork().

◆ init() [1/2]

bool GeoConvHelper::init ( OptionsCont oc)
static

◆ init() [2/2]

void GeoConvHelper::init ( const std::string &  proj,
const Position offset,
const Boundary orig,
const Boundary conv,
double  scale = 1.0 
)
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.

◆ moveConvertedBy()

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 getFinal(), and NBNetBuilder::moveToOrigin().

◆ operator!=()

bool GeoConvHelper::operator!= ( const GeoConvHelper o) const
inline

Definition at line 161 of file GeoConvHelper.h.

◆ operator=()

GeoConvHelper & GeoConvHelper::operator= ( const GeoConvHelper orig)
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.

◆ operator==()

bool GeoConvHelper::operator== ( const GeoConvHelper o) const

◆ resetLoaded()

void GeoConvHelper::resetLoaded ( )
static

resets loaded location elements

Definition at line 551 of file GeoConvHelper.cpp.

References myNumLoaded.

Referenced by GNEApplicationWindow::closeAllWindows(), and getFinal().

◆ setConvBoundary()

void GeoConvHelper::setConvBoundary ( const Boundary boundary)
inline

sets the converted boundary

Definition at line 143 of file GeoConvHelper.h.

References getOffset(), getOffsetBase(), getProjString(), myConvBoundary, operator==(), and writeLocation().

Referenced by NBNetBuilder::compute().

◆ setLoaded()

void GeoConvHelper::setLoaded ( const GeoConvHelper loaded)
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 getFinal(), NIImporter_SUMO::loadLocation(), and NIImporter_OpenDrive::myCharacters().

◆ usingGeoProjection()

◆ usingInverseGeoProjection()

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 getFinal(), NWWriter_XML::writeEdgesAndConnections(), and NWWriter_XML::writeNodes().

◆ writeLocation()

◆ x2cartesian()

bool GeoConvHelper::x2cartesian ( Position from,
bool  includeInBoundary = true 
)

◆ x2cartesian_const()

Field Documentation

◆ myConvBoundary

Boundary GeoConvHelper::myConvBoundary
private

The boundary after conversion (x2cartesian)

Definition at line 213 of file GeoConvHelper.h.

Referenced by computeFinal(), getConvBoundary(), moveConvertedBy(), operator=(), operator==(), setConvBoundary(), and x2cartesian().

◆ myCos

double GeoConvHelper::myCos
private

Definition at line 198 of file GeoConvHelper.h.

Referenced by operator=(), operator==(), and x2cartesian_const().

◆ myFinal

GeoConvHelper GeoConvHelper::myFinal
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().

◆ myFlatten

bool GeoConvHelper::myFlatten
private

whether to discard z-data

Definition at line 207 of file GeoConvHelper.h.

Referenced by operator=(), operator==(), and x2cartesian_const().

◆ myGeoScale

double GeoConvHelper::myGeoScale
private

The scaling to apply to geo-coordinates.

Definition at line 194 of file GeoConvHelper.h.

Referenced by operator=(), operator==(), x2cartesian(), and x2cartesian_const().

◆ myLoaded

GeoConvHelper GeoConvHelper::myLoaded
staticprivate

coordinate transformation loaded from a location element

Definition at line 219 of file GeoConvHelper.h.

Referenced by computeFinal(), getLoaded(), and setLoaded().

◆ myNumLoaded

int GeoConvHelper::myNumLoaded = 0
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().

◆ myOffset

Position GeoConvHelper::myOffset
private

The offset to apply.

Definition at line 191 of file GeoConvHelper.h.

Referenced by computeFinal(), getOffset(), getOffsetBase(), moveConvertedBy(), operator=(), operator==(), and x2cartesian_const().

◆ myOrigBoundary

Boundary GeoConvHelper::myOrigBoundary
private

The boundary before conversion (x2cartesian)

Definition at line 210 of file GeoConvHelper.h.

Referenced by getOrigBoundary(), operator=(), operator==(), and x2cartesian().

◆ myProcessing

GeoConvHelper GeoConvHelper::myProcessing
staticprivate

coordinate transformation to use for input conversion and processing

Definition at line 216 of file GeoConvHelper.h.

Referenced by computeFinal(), getProcessing(), and init().

◆ myProjectionMethod

ProjectionMethod GeoConvHelper::myProjectionMethod
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().

◆ myProjString

std::string GeoConvHelper::myProjString
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().

◆ mySin

double GeoConvHelper::mySin
private

The rotation to apply to geo-coordinates.

Definition at line 197 of file GeoConvHelper.h.

Referenced by operator=(), operator==(), and x2cartesian_const().

◆ myUseInverseProjection

bool GeoConvHelper::myUseInverseProjection
private

Information whether inverse projection shall be used.

Definition at line 204 of file GeoConvHelper.h.

Referenced by operator=(), operator==(), usingInverseGeoProjection(), and x2cartesian_const().


The documentation for this class was generated from the following files: