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)
 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 Boundary & getConvBoundary () const
 Returns the converted boundary.
const Position getOffset () const
 Returns the network offset.
const Position getOffsetBase () const
 Returns the network base.
const Boundary & getOrigBoundary () 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)
 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 GeoConvHelper & getDefaultInstance ()
 the coordinate transformation to use for input conversion
static const GeoConvHelper & getOutputInstance ()
 the coordinate transformation for writing the location element
static bool init (OptionsCont &oc)
 Initialises the default and the output instance using the given options.
static void init (const std::string &proj, const Position &offset, const Boundary &orig, const Boundary &conv)
 Initialises the default and the output instance using the given proj.4-definition and complete network parameter.
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.
GeoConvHelper & operator= (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 myDefault
 coordinate transformation to use for input conversion
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 myOutput
 coordinate transformation to use for writing location element

Detailed Description

static methods for processing the coordinates conversion for the current net

Definition at line 55 of file GeoConvHelper.h.


Member Enumeration Documentation

Enumerator:
NONE 
SIMPLE 
UTM 
DHDN 
PROJ 

Definition at line 139 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 getOutputInstance(), 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 55 of file GeoConvHelper.cpp.

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

GeoConvHelper::~GeoConvHelper ( )

Destructor.

Definition at line 91 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 199 of file GeoConvHelper.cpp.

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

Referenced by fillOptions().

void GeoConvHelper::cartesian2geo ( Position &  cartesian)
const Boundary & GeoConvHelper::getConvBoundary ( ) const

Returns the converted boundary.

Definition at line 338 of file GeoConvHelper.cpp.

References myConvBoundary.

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

const Position GeoConvHelper::getOffset ( ) const

Returns the network offset.

Definition at line 344 of file GeoConvHelper.cpp.

References myOffset.

Referenced by getOutputInstance().

const Position GeoConvHelper::getOffsetBase ( ) const

Returns the network base.

Definition at line 350 of file GeoConvHelper.cpp.

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

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

const Boundary & GeoConvHelper::getOrigBoundary ( ) const

Returns the original boundary.

Definition at line 332 of file GeoConvHelper.cpp.

References myOrigBoundary.

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

const GeoConvHelper & GeoConvHelper::getOutputInstance ( ) [static]
const std::string & GeoConvHelper::getProjString ( ) const

Returns the network offset.

Definition at line 356 of file GeoConvHelper.cpp.

References myProjString.

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

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

Initialises the default and the output instance using the given options.

Definition at line 123 of file GeoConvHelper.cpp.

References OptionsCont::exists(), GeoConvHelper(), OptionsCont::getBool(), OptionsCont::getFloat(), OptionsCont::getInt(), OptionsCont::getString(), OptionsCont::isDefault(), myDefault, 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 default and the output instance using the given proj.4-definition and complete network parameter.

Definition at line 162 of file GeoConvHelper.cpp.

References GeoConvHelper(), and myDefault.

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

Shifts the converted boundary by the given amounts.

Definition at line 325 of file GeoConvHelper.cpp.

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

Referenced by NBNetBuilder::compute().

GeoConvHelper & GeoConvHelper::operator= ( const GeoConvHelper &  orig) [private]
static void GeoConvHelper::setLoaded ( const GeoConvHelper &  loaded) [inline, static]

sets the coordinate transformation loaded from a location element

Definition at line 103 of file GeoConvHelper.h.

References myLoaded, and myNumLoaded.

Referenced by NIImporter_SUMO::setLocation().

bool GeoConvHelper::usingGeoProjection ( ) const

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

Definition at line 227 of file GeoConvHelper.cpp.

References myProjectionMethod, and NONE.

Referenced by getOutputInstance(), NILoader::transformCoordinates(), and NWWriter_SUMO::writeLocation().

bool GeoConvHelper::usingInverseGeoProjection ( ) const

Returns the information whether an inverse transformation will happen.

Definition at line 233 of file GeoConvHelper.cpp.

References myUseInverseProjection.

Referenced by NWWriter_XML::writeEdgesAndConnections(), and NWWriter_XML::writeNodes().

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

Field Documentation

Information whether the first node conversion was done.

Definition at line 168 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 171 of file GeoConvHelper.h.

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

double GeoConvHelper::myBaseY [private]

Definition at line 171 of file GeoConvHelper.h.

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

The boundary after conversion (x2cartesian)

Definition at line 177 of file GeoConvHelper.h.

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

coordinate transformation to use for input conversion

Definition at line 185 of file GeoConvHelper.h.

Referenced by getDefaultInstance(), getOutputInstance(), and init().

double GeoConvHelper::myGeoScale [private]

The scaling to apply to geo-coordinates.

Definition at line 159 of file GeoConvHelper.h.

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

coordinate transformation loaded from a location element

Definition at line 188 of file GeoConvHelper.h.

Referenced by getOutputInstance(), and setLoaded().

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

the numer of coordinate transformations loaded from location elements

Definition at line 194 of file GeoConvHelper.h.

Referenced by getOutputInstance(), and setLoaded().

The offset to apply.

Definition at line 156 of file GeoConvHelper.h.

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

The boundary before conversion (x2cartesian)

Definition at line 174 of file GeoConvHelper.h.

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

coordinate transformation to use for writing location element

Definition at line 191 of file GeoConvHelper.h.

Referenced by getOutputInstance().

Information whether no projection shall be done.

Definition at line 162 of file GeoConvHelper.h.

Referenced by cartesian2geo(), GeoConvHelper(), operator=(), usingGeoProjection(), and x2cartesian().

std::string GeoConvHelper::myProjString [private]

A proj options string describing the proj.4-projection to use.

Definition at line 148 of file GeoConvHelper.h.

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

Information whether inverse projection shall be used.

Definition at line 165 of file GeoConvHelper.h.

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


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