SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeoConvHelper Class Reference

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 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 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 GeoConvHelpergetFinal ()
 the coordinate transformation for writing the location element and for tracking the original coordinate system More...
 
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, 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...
 
GeoConvHelperoperator= (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...
 

Detailed Description

static methods for processing the coordinates conversion for the current net

Definition at line 59 of file GeoConvHelper.h.

Member Enumeration Documentation

Enumerator
NONE 
SIMPLE 
UTM 
DHDN 
PROJ 

Definition at line 167 of file GeoConvHelper.h.

Constructor & Destructor Documentation

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::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.

GeoConvHelper::GeoConvHelper ( const GeoConvHelper )
private

invalidated copy constructor.

Member Function Documentation

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 171 of file GeoConvHelper.cpp.

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

Referenced by fillOptions().

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

static GeoConvHelper& GeoConvHelper::getProcessing ( )
inlinestatic

the coordinate transformation to use for input conversion and processing

Note
instance is modified during use: boundary may adapt to new coordinates

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().

bool GeoConvHelper::init ( OptionsCont oc)
static
void GeoConvHelper::init ( const std::string &  proj,
const Position offset,
const Boundary orig,
const Boundary conv,
int  shift = 0 
)
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.

void GeoConvHelper::moveConvertedBy ( SUMOReal  x,
SUMOReal  y 
)

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().

GeoConvHelper & GeoConvHelper::operator= ( const GeoConvHelper orig)
private

assignment operator.

Definition at line 102 of file GeoConvHelper.cpp.

References myConvBoundary, myGeoScale, myOffset, myOrigBoundary, myProjectionMethod, myProjString, and myUseInverseProjection.

void GeoConvHelper::resetLoaded ( )
static

resets loaded location elements

Definition at line 386 of file GeoConvHelper.cpp.

References myNumLoaded.

void GeoConvHelper::setConvBoundary ( const Boundary boundary)
inline

sets the converted boundary

Definition at line 153 of file GeoConvHelper.h.

References myConvBoundary.

Referenced by NBNetBuilder::moveToOrigin().

void GeoConvHelper::setLoaded ( const GeoConvHelper loaded)
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().

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

Converts the given coordinate into a cartesian and optionally update myConvBoundary

Note
: initializes UTM / DHDN projection on first use (select zone)

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().

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 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().

Field Documentation

Boundary GeoConvHelper::myConvBoundary
private

The boundary after conversion (x2cartesian)

Definition at line 199 of file GeoConvHelper.h.

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

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

double GeoConvHelper::myGeoScale
private

The scaling to apply to geo-coordinates.

Definition at line 187 of file GeoConvHelper.h.

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

GeoConvHelper GeoConvHelper::myLoaded
staticprivate

coordinate transformation loaded from a location element

Definition at line 205 of file GeoConvHelper.h.

Referenced by computeFinal(), and setLoaded().

int GeoConvHelper::myNumLoaded = 0
staticprivate

the numer of coordinate transformations loaded from location elements

Definition at line 211 of file GeoConvHelper.h.

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

Position GeoConvHelper::myOffset
private

The offset to apply.

Definition at line 184 of file GeoConvHelper.h.

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

Boundary GeoConvHelper::myOrigBoundary
private

The boundary before conversion (x2cartesian)

Definition at line 196 of file GeoConvHelper.h.

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

GeoConvHelper GeoConvHelper::myProcessing
staticprivate

coordinate transformation to use for input conversion and processing

Definition at line 202 of file GeoConvHelper.h.

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

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

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

bool GeoConvHelper::myUseInverseProjection
private

Information whether inverse projection shall be used.

Definition at line 193 of file GeoConvHelper.h.

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


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