SUMO - Simulation of Urban MObility
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.
 GeoConvHelper (OptionsCont &oc)
 Constructor based on the stored options.
 GeoConvHelper (const std::string &proj, const Position &offset, const Boundary &orig, const Boundary &conv, int shift=0, bool inverse=false, bool baseFound=false)
 Constructor.
const BoundarygetConvBoundary () const
 Returns the converted boundary.
const Position getOffset () const
 Returns the network offset.
const Position getOffsetBase () const
 Returns the network base.
const BoundarygetOrigBoundary () const
 Returns the original boundary.
const std::string & getProjString () const
 Returns the network offset.
void moveConvertedBy (SUMOReal x, SUMOReal y)
 Shifts the converted boundary by the given amounts.
bool usingGeoProjection () const
 Returns whether a transformation from geo to metric coordinates will be performed.
bool usingInverseGeoProjection () const
 Returns the information whether an inverse transformation will happen.
bool x2cartesian (Position &from, bool includeInBoundary=true)
bool x2cartesian_const (Position &from) const
 Converts the given coordinate into a cartesian using the previous initialisation.
 ~GeoConvHelper ()
 Destructor.

Static Public Member Functions

static void addProjectionOptions (OptionsCont &oc)
 Adds projection options to the given container.
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
static const GeoConvHelpergetFinal ()
 the coordinate transformation for writing the location element and for tracking the original coordinate system
static GeoConvHelpergetProcessing ()
 the coordinate transformation to use for input conversion and processing
static bool init (OptionsCont &oc)
 Initialises the processing and the final instance using the given options.
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.
static void resetLoaded ()
 resets loaded location elements
static void setLoaded (const GeoConvHelper &loaded)
 sets the coordinate transformation loaded from a location element

Private Types

enum  ProjectionMethod {
  NONE, SIMPLE, UTM, DHDN,
  PROJ
}

Private Member Functions

 GeoConvHelper (const GeoConvHelper &)
 invalidated copy constructor.
GeoConvHelperoperator= (const GeoConvHelper &)
 assignment operator.

Private Attributes

bool myBaseFound
 Information whether the first node conversion was done.
double myBaseX
 The initial x/y-coordinates for a very simple geocoordinates conversion.
double myBaseY
Boundary myConvBoundary
 The boundary after conversion (x2cartesian)
double myGeoScale
 The scaling to apply to geo-coordinates.
Position myOffset
 The offset to apply.
Boundary myOrigBoundary
 The boundary before conversion (x2cartesian)
ProjectionMethod myProjectionMethod
 Information whether no projection shall be done.
std::string myProjString
 A proj options string describing the proj.4-projection to use.
bool myUseInverseProjection
 Information whether inverse projection shall be used.

Static Private Attributes

static GeoConvHelper myFinal
 coordinate transformation to use for writing the location element and for tracking the original coordinate system
static GeoConvHelper myLoaded
 coordinate transformation loaded from a location element
static int myNumLoaded = 0
 the numer of coordinate transformations loaded from location elements
static GeoConvHelper myProcessing
 coordinate transformation to use for input conversion and processing

Detailed Description

static methods for processing the coordinates conversion for the current net

Definition at line 58 of file GeoConvHelper.h.


Member Enumeration Documentation

Enumerator:
NONE 
SIMPLE 
UTM 
DHDN 
PROJ 

Definition at line 160 of file GeoConvHelper.h.


Constructor & Destructor Documentation

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,
bool  baseFound = false 
)

Constructor.

Definition at line 58 of file GeoConvHelper.cpp.

References DHDN, myProjectionMethod, NONE, PROJ, SIMPLE, and UTM.

Destructor.

Definition at line 94 of file GeoConvHelper.cpp.

invalidated copy constructor.


Member Function Documentation

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

References GeoConvHelper(), getConvBoundary(), getOffset(), getOrigBoundary(), getProjString(), myFinal, myLoaded, myNumLoaded, myProcessing, and usingGeoProjection().

Referenced by NBNetBuilder::compute().

Returns the converted boundary.

Definition at line 350 of file GeoConvHelper.cpp.

References myConvBoundary.

Referenced by NBNetBuilder::compute(), computeFinal(), TraCIServerAPI_Simulation::processGet(), and NWWriter_SUMO::writeLocation().

Returns the network offset.

Definition at line 356 of file GeoConvHelper.cpp.

References myOffset.

Referenced by computeFinal().

Returns the network base.

Definition at line 362 of file GeoConvHelper.cpp.

References myBaseX, myBaseY, myOffset, Position::x(), and Position::y().

Referenced by cartesian2geo(), NBNetBuilder::compute(), and NWWriter_SUMO::writeLocation().

Returns the original boundary.

Definition at line 344 of file GeoConvHelper.cpp.

References myOrigBoundary.

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

static GeoConvHelper& GeoConvHelper::getProcessing ( ) [inline, static]

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 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::myCharacters(), PCLoaderXML::myStartElement(), and NILoader::transformCoordinates().

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

Returns the network offset.

Definition at line 368 of file GeoConvHelper.cpp.

References myProjString.

Referenced by computeFinal(), and NWWriter_SUMO::writeLocation().

bool GeoConvHelper::init ( OptionsCont oc) [static]

Initialises the processing and the final instance using the given options.

Definition at line 129 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().

void GeoConvHelper::init ( const std::string &  proj,
const Position offset,
const Boundary orig,
const Boundary conv 
) [static]

Initialises the processing and the final instance using the given proj.4-definition and complete network parameter.

Definition at line 169 of file GeoConvHelper.cpp.

References GeoConvHelper(), myFinal, and myProcessing.

Shifts the converted boundary by the given amounts.

Definition at line 337 of file GeoConvHelper.cpp.

References Position::add(), Boundary::moveby(), myConvBoundary, and myOffset.

Referenced by NBNetBuilder::compute().

GeoConvHelper & GeoConvHelper::operator= ( const GeoConvHelper orig) [private]
void GeoConvHelper::resetLoaded ( ) [static]

resets loaded location elements

Definition at line 402 of file GeoConvHelper.cpp.

References myNumLoaded.

void GeoConvHelper::setLoaded ( const GeoConvHelper loaded) [static]

sets the coordinate transformation loaded from a location element

Definition at line 391 of file GeoConvHelper.cpp.

References myLoaded, myNumLoaded, toString(), and WRITE_WARNING.

Referenced by NIImporter_SUMO::loadLocation().

Returns whether a transformation from geo to metric coordinates will be performed.

Definition at line 207 of file GeoConvHelper.cpp.

References myProjectionMethod, and NONE.

Referenced by computeFinal(), NILoader::transformCoordinates(), NWWriter_SUMO::writeLocation(), and NWWriter_XML::writeNodes().

Returns the information whether an inverse transformation will happen.

Definition at line 213 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 238 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 293 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().


Field Documentation

Information whether the first node conversion was done.

Definition at line 189 of file GeoConvHelper.h.

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

double GeoConvHelper::myBaseX [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().

double GeoConvHelper::myBaseY [private]

Definition at line 192 of file GeoConvHelper.h.

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

The boundary after conversion (x2cartesian)

Definition at line 198 of file GeoConvHelper.h.

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

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

double GeoConvHelper::myGeoScale [private]

The scaling to apply to geo-coordinates.

Definition at line 180 of file GeoConvHelper.h.

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

coordinate transformation loaded from a location element

Definition at line 204 of file GeoConvHelper.h.

Referenced by computeFinal(), and setLoaded().

int GeoConvHelper::myNumLoaded = 0 [static, private]

the numer of coordinate transformations loaded from location elements

Definition at line 210 of file GeoConvHelper.h.

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

The offset to apply.

Definition at line 177 of file GeoConvHelper.h.

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

The boundary before conversion (x2cartesian)

Definition at line 195 of file GeoConvHelper.h.

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

coordinate transformation to use for input conversion and processing

Definition at line 201 of file GeoConvHelper.h.

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

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

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

Information whether inverse projection shall be used.

Definition at line 186 of file GeoConvHelper.h.

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


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines