SUMO - Simulation of Urban MObility
NBDistrict Class Reference

A class representing a single district. More...

#include <NBDistrict.h>

Inheritance diagram for NBDistrict:
Named

Public Member Functions

void addShape (const PositionVector &p)
 Sets the shape of this district.
bool addSink (NBEdge *const sink, SUMOReal weight)
 Adds a sink.
bool addSource (NBEdge *const source, SUMOReal weight)
 Adds a source.
const std::string & getID () const
 Returns the id.
const PositiongetPosition () const
 Returns the position of this district's center.
const PositionVectorgetShape () const
 Returns the shape.
const std::vector< NBEdge * > & getSinkEdges () const
 Returns the sinks.
const std::vector< SUMOReal > & getSinkWeights () const
 Returns the weights of the sinks.
const std::vector< NBEdge * > & getSourceEdges () const
 Returns the sources.
const std::vector< SUMOReal > & getSourceWeights () const
 Returns the weights of the sources.
 NBDistrict (const std::string &id, const Position &pos)
 Constructor with id, and position.
 NBDistrict (const std::string &id)
 Constructor without position.
void removeFromSinksAndSources (NBEdge *const e)
 Removes the given edge from the lists of sources and sinks.
void replaceIncoming (const EdgeVector &which, NBEdge *const by)
 Replaces incoming edges from the vector (sinks) by the given edge.
void replaceOutgoing (const EdgeVector &which, NBEdge *const by)
 Replaces outgoing edges from the vector (source) by the given edge.
void setCenter (const Position &pos)
 Sets the center coordinates.
void setID (const std::string &newID)
 resets the id
 ~NBDistrict ()
 Destructor.
Applying offset
void reshiftPosition (SUMOReal xoff, SUMOReal yoff)
 Applies an offset to the district.

Protected Attributes

std::string myID
 The name of the object.

Private Types

typedef std::vector< SUMORealWeightsCont
 Definition of a vector of connection weights.

Private Member Functions

 NBDistrict (const NBDistrict &s)
NBDistrictoperator= (const NBDistrict &s)

Private Attributes

Position myPosition
 The position of the district.
PositionVector myShape
 The shape of the dsitrict.
EdgeVector mySinks
 The sinks (connection from network to district)
WeightsCont mySinkWeights
 The weights of the sinks.
EdgeVector mySources
 The sources (connection from district to network)
WeightsCont mySourceWeights
 The weights of the sources.

Detailed Description

A class representing a single district.

A "district" is an area within the network which may be referenced by O/D-matrices. It stems from importing VISUM-networks. Work with VISUM- -networks also made it necessary that a district knows the edges at which new vehicles shall approach the simulated network (sources) and those to use when leaving the network (sinks). These connections to the network are weighted.

Later work on VISUM required also parsing the shape of a district. This information is used by some external tools only, it is even not shown within the GUI.

Todo:
Recheck whether this can be somehow joined with ODDistrict

Definition at line 72 of file NBDistrict.h.


Member Typedef Documentation

typedef std::vector<SUMOReal> NBDistrict::WeightsCont [private]

Definition of a vector of connection weights.

Definition at line 244 of file NBDistrict.h.


Constructor & Destructor Documentation

NBDistrict::NBDistrict ( const std::string &  id,
const Position pos 
)

Constructor with id, and position.

Parameters:
[in]idThe id of the district
[in]posThe position of the district

Definition at line 53 of file NBDistrict.cpp.

NBDistrict::NBDistrict ( const std::string &  id)

Constructor without position.

The position must be computed later

Parameters:
[in]idThe id of the district

Definition at line 58 of file NBDistrict.cpp.

Destructor.

Definition at line 62 of file NBDistrict.cpp.

NBDistrict::NBDistrict ( const NBDistrict s) [private]

invalid copy constructor


Member Function Documentation

void NBDistrict::addShape ( const PositionVector p)

Sets the shape of this district.

Parameters:
[in]pThe new shape

Definition at line 188 of file NBDistrict.cpp.

References myShape.

bool NBDistrict::addSink ( NBEdge *const  sink,
SUMOReal  weight 
)

Adds a sink.

It is checked whether the edge has already been added as a sink. false is returned in this case. Otherwise, the sink is pushed into the list of sink and the weight into the list of sink weights. both lists stay sorted this way. true is returned.

Parameters:
[in]sinkAn edge that shall be used as sink
[in]weightThe weight of the sink
Returns:
Whether the sink could be added (was not added before)
Todo:
Consider using only one list for sinks/weights

Definition at line 87 of file NBDistrict.cpp.

References Named::getID(), mySinks, and mySinkWeights.

Referenced by NBDistrictCont::addSink(), and NIVissimDistrictConnection::dict_BuildDistricts().

bool NBDistrict::addSource ( NBEdge *const  source,
SUMOReal  weight 
)

Adds a source.

It is checked whether the edge has already been added as a source. false is returned in this case. Otherwise, the source is pushed into the list of sources and the weight into the list of source weights. both lists stay sorted this way. true is returned.

Parameters:
[in]sourceAn edge that shall be used as source
[in]weightThe weight of the source
Returns:
Whether the source could be added (was not added before)
Todo:
Consider using only one list for sources/weights

Definition at line 74 of file NBDistrict.cpp.

References Named::getID(), mySources, and mySourceWeights.

Referenced by NBDistrictCont::addSource(), and NIVissimDistrictConnection::dict_BuildDistricts().

const std::string& Named::getID ( ) const [inline, inherited]

Returns the id.

Returns:
The stored id

Reimplemented in MS_E2_ZS_CollectorOverLanes.

Definition at line 61 of file Named.h.

References Named::myID.

Referenced by MSDetectorControl::add(), ShapeContainer::add(), RORouteDef_Alternatives::addAlternative(), MSNet::addBusStop(), NBLoadedSUMOTLDef::addConnection(), NLHandler::addConnection(), NIImporter_OpenDrive::addE2EConnectionsSecure(), RONet::addNode(), NIImporter_SUMO::addPhase(), RONet::addRouteDef(), addSink(), addSource(), MSRouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NIVissimDisturbance::addToNode(), MSVehicle::addTraciStop(), NIVisumTL::build(), MS_E2_ZS_CollectorOverLanes::buildCollector(), NIImporter_VISUM::buildDistrictNode(), NIVissimConnection::buildEdgeConnections(), NBEdge::buildInnerEdges(), NIVissimEdge::buildNBEdge(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), ODDistrictHandler::closeDistrict(), NBTrafficLightDefinition::collectEdges(), NBOwnTLDef::collectLinks(), NBTrafficLightDefinition::compute(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShapes(), NBNode::computeLogic(), NBNode::computeNodeShape(), NBTrafficLightLogicCont::computeSingleLogic(), NBTurningDirectionsComputer::computeTurnDirectionsForNode(), NBEdge::connections_sorter(), MSLane::detectCollisions(), NIVissimDistrictConnection::dict_BuildDistricts(), MSE3Collector::enter(), Command_SaveTLSSwitches::execute(), MSVTypeProbe::execute(), NBNodeCont::extract(), NBTrafficLightLogicCont::extract(), NBEdgeCont::extract(), MSNet::getBusStopID(), NIImporter_VISUM::getNamedEdgeContinuating(), NLTriggerBuilder::getPosition(), NBNode::getPossiblySplittedIncoming(), NBNode::getPossiblySplittedOutgoing(), NIImporter_VISUM::getReversedContinuating(), NBEdgeCont::ignoreFilterMatch(), MSActuatedTrafficLightLogic::init(), MSAgentbasedTrafficLightLogic::init(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NBDistrictCont::insert(), NBTrafficLightLogicCont::insert(), NBNodeCont::insert(), NBEdgeCont::insert(), NBEdgeCont::joinSameNodeConnectingEdges(), MSE3Collector::leave(), NIImporter_OpenDrive::loadNetwork(), MSLane::moveCritical(), MSVehicle::MSVehicle(), RORDLoader_SUMOBase::myCharacters(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), NIXMLTrafficLightsHandler::myEndElement(), NIXMLEdgesHandler::myEndElement(), NIImporter_SUMO::myEndElement(), NIXMLConnectionsHandler::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSTriggeredRerouter::myStartElement(), NBConnection::NBConnection(), NBRequest::NBRequest(), MSDevice_Tripinfo::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), Named::ComparatorIdLess::operator()(), NBTurningDirectionsComputer::combination_by_angle_sorter::operator()(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), NBNetBuilder::by_id_sorter::operator()(), NBContHelper::same_connection_edge_sorter::operator()(), NBNode::nodes_by_id_sorter::operator()(), NIImporter_VISUM::parse_EdgePolys(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_LanesConnections(), NIImporter_VISUM::parse_Turns(), NIImporter_VISUM::parse_TurnsToSignalGroups(), NIXMLConnectionsHandler::parseDeprecatedLaneDefinition(), NIXMLConnectionsHandler::parseLaneBound(), NBLoadedTLDef::SignalGroup::patchTYellow(), RORouteDef_Complete::preComputeCurrentRoute(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), NWWriter_SUMO::prohibitionConnection(), NBLoadedTLDef::SignalGroup::remapIncoming(), NBLoadedTLDef::SignalGroup::remapOutgoing(), NBLoadedSUMOTLDef::removeConnection(), NBNode::removeSelfLoops(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBNodeCont::rename(), NBEdgeCont::rename(), NBConnection::replaceFrom(), MSBaseVehicle::replaceRouteEdges(), NBConnection::replaceTo(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), NBNodeCont::setAsTLControlled(), NBEdge::setControllingTLInformation(), MSLane::setCritical(), NIXMLEdgesHandler::setNodes(), NBOwnTLDef::setTLControllingInformation(), NBLoadedSUMOTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), RORDLoader_SUMOBase::startRoute(), NBEdge::startShapeAt(), NIXMLConnectionsHandler::validateLaneInfo(), MSInstantInductLoop::write(), NWWriter_SUMO::writeConnection(), NWWriter_SUMO::writeDistrict(), NWWriter_SUMO::writeEdge(), MSMeanData::writeEdge(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeInternalConnections(), NWWriter_SUMO::writeJunction(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), MSInductLoop::writeTypedXMLOutput(), MSRouteProbe::writeXMLOutput(), and MSE2Collector::writeXMLOutput().

const Position& NBDistrict::getPosition ( ) const [inline]

Returns the position of this district's center.

Returns:
The position of this district's center
Todo:
Recheck when this information is set/needed

Definition at line 130 of file NBDistrict.h.

References myPosition.

Referenced by NIImporter_VISUM::buildDistrictNode().

const PositionVector& NBDistrict::getShape ( ) const [inline]

Returns the shape.

Returns:
The district's shape

Definition at line 222 of file NBDistrict.h.

References myShape.

Referenced by NWWriter_SUMO::writeDistrict().

const std::vector<NBEdge*>& NBDistrict::getSinkEdges ( ) const [inline]

Returns the sinks.

Returns:
The sink edges

Definition at line 214 of file NBDistrict.h.

References mySinks.

Referenced by NWWriter_SUMO::writeDistrict().

const std::vector<SUMOReal>& NBDistrict::getSinkWeights ( ) const [inline]

Returns the weights of the sinks.

Returns:
The sink weights

Definition at line 206 of file NBDistrict.h.

References mySinkWeights.

Referenced by NWWriter_SUMO::writeDistrict().

const std::vector<NBEdge*>& NBDistrict::getSourceEdges ( ) const [inline]

Returns the sources.

Returns:
The source edges

Definition at line 198 of file NBDistrict.h.

References mySources.

Referenced by NWWriter_SUMO::writeDistrict().

const std::vector<SUMOReal>& NBDistrict::getSourceWeights ( ) const [inline]

Returns the weights of the sources.

Returns:
The source weights

Definition at line 190 of file NBDistrict.h.

References mySourceWeights.

Referenced by NWWriter_SUMO::writeDistrict().

NBDistrict& NBDistrict::operator= ( const NBDistrict s) [private]

invalid assignment operator

Removes the given edge from the lists of sources and sinks.

The according weights are removed, too.

Parameters:
[in]eThe edge to remove from sinks/sources

Definition at line 170 of file NBDistrict.cpp.

References mySinks, mySinkWeights, mySources, and mySourceWeights.

void NBDistrict::replaceIncoming ( const EdgeVector which,
NBEdge *const  by 
)

Replaces incoming edges from the vector (sinks) by the given edge.

When an edge is split/joined/removed/etc., it may get necessary to replace prior edges by new ones. This method replaces all occurences of the edges from "which" within incoming edges (sinks) by the given edge.

The new sink edge's weight is the sum of the weights of the replaced edges.

Parameters:
[in]whichList of edges to replace
[in]byThe replacement

Definition at line 106 of file NBDistrict.cpp.

References mySinks, mySinkWeights, and SUMOReal.

Referenced by NBNode::replaceIncoming().

void NBDistrict::replaceOutgoing ( const EdgeVector which,
NBEdge *const  by 
)

Replaces outgoing edges from the vector (source) by the given edge.

When an edge is split/joined/removed/etc., it may get necessary to replace prior edges by new ones. This method replaces all occurences of the edges from "which" within outgoing edges (sources) by the given edge.

The new source edge's weight is the sum of the weights of the replaced edges.

Parameters:
[in]whichList of edges to replace
[in]byThe replacement

Definition at line 138 of file NBDistrict.cpp.

References mySources, mySourceWeights, and SUMOReal.

Referenced by NBNode::replaceOutgoing().

void NBDistrict::reshiftPosition ( SUMOReal  xoff,
SUMOReal  yoff 
)

Applies an offset to the district.

Parameters:
[in]xoffThe x-offset to apply
[in]yoffThe y-offset to apply

Definition at line 67 of file NBDistrict.cpp.

References myPosition, myShape, Position::reshiftRotate(), and PositionVector::reshiftRotate().

void NBDistrict::setCenter ( const Position pos)

Sets the center coordinates.

Parameters:
[in]posThe new center to assign
Todo:
Recheck when this information is set/needed

Definition at line 100 of file NBDistrict.cpp.

References myPosition.

void Named::setID ( const std::string &  newID) [inline, inherited]

resets the id

Definition at line 67 of file Named.h.

References Named::myID.

Referenced by NBNodeCont::rename(), and NBEdgeCont::rename().


Field Documentation

The position of the district.

Definition at line 259 of file NBDistrict.h.

Referenced by getPosition(), reshiftPosition(), and setCenter().

The shape of the dsitrict.

Definition at line 262 of file NBDistrict.h.

Referenced by addShape(), getShape(), and reshiftPosition().

The sinks (connection from network to district)

Definition at line 253 of file NBDistrict.h.

Referenced by addSink(), getSinkEdges(), removeFromSinksAndSources(), and replaceIncoming().

The weights of the sinks.

Definition at line 256 of file NBDistrict.h.

Referenced by addSink(), getSinkWeights(), removeFromSinksAndSources(), and replaceIncoming().

The sources (connection from district to network)

Definition at line 247 of file NBDistrict.h.

Referenced by addSource(), getSourceEdges(), removeFromSinksAndSources(), and replaceOutgoing().

The weights of the sources.

Definition at line 250 of file NBDistrict.h.

Referenced by addSource(), getSourceWeights(), removeFromSinksAndSources(), and replaceOutgoing().


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