 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
59 const std::string& name,
60 const std::vector<int>& districts,
const std::vector<double>& percentages,
61 int edgeid,
double position,
62 const std::vector<std::pair<int, int> >& assignedVehicles)
63 : myID(id), myName(name), myDistricts(districts),
64 myEdgeID(edgeid), myPosition(position),
65 myAssignedVehicles(assignedVehicles) {
67 std::vector<double>::const_iterator j = percentages.begin();
82 const std::vector<int>& districts,
const std::vector<double>& percentages,
83 int edgeid,
double position,
84 const std::vector<std::pair<int, int> >& assignedVehicles) {
87 edgeid, position, assignedVehicles);
98 DictType::iterator i =
myDict.find(
id);
109 DictType::iterator i =
myDict.find(
id);
119 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
121 const std::vector<int>& districts = c->
myDistricts;
122 for (std::vector<int>::const_iterator j = districts.begin(); j != districts.end(); j++) {
133 const std::vector<int>& connections = (*k).second;
134 for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
155 const std::vector<int>& connections = (*k).second;
157 std::string dsid = toString<int>((*k).first);
162 for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
167 if (connections.size() == 1) {
168 distCenter.
add(10, 10);
172 std::string
id =
"District" + district->
getID();
175 if (!nc.
insert(districtNode)) {
191 const std::vector<int>& connections = (*k).second;
194 dc.
retrieve(toString<int>((*k).first));
196 assert(district != 0 && districtNode != 0);
198 for (std::vector<int>::const_iterator l = connections.begin(); l != connections.end(); l++) {
206 WRITE_WARNING(
"Could not build district '" + toString<int>((*k).first) +
"' - edge '" + toString<int>(c->
myEdgeID) +
"' is missing.");
209 std::string
id =
"ParkingPlace" + toString<int>(*l);
211 if (parkingPlace ==
nullptr) {
213 if (pos < e->getLength() - pos) {
228 id =
"VissimFromParkingplace" + toString<int>((*k).first) +
"-" + toString<int>(c->
myID);
230 new NBEdge(
id, districtNode, parkingPlace,
238 if (!district->
addSource(source, percNormed)) {
245 id =
"VissimToParkingplace" + toString<int>((*k).first) +
"-" + toString<int>(c->
myID);
247 new NBEdge(
id, parkingPlace, districtNode,
248 "Connection", (
double) 100 / (
double) 3.6, 2, -1,
250 if (!ec.
insert(destination)) {
255 if (!district->
addSink(destination, percNormed2)) {
339 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
340 if ((*i).second->myEdgeID == edgeid) {
350 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
362 return (
double) 200 / (double) 3.6;
365 std::vector<std::pair<int, int> >::const_iterator i;
375 std::string
id = toString<int>(distNo);
377 if (dist ==
nullptr) {
378 WRITE_WARNING(
"The referenced speed distribution '" +
id +
"' is not known.");
383 double speed = dist->
getMax();
384 if (speed < 0 || speed > 1000) {
double getPosition() const
Returns the position of the connection at the edge.
std::vector< std::pair< int, int > > myAssignedVehicles
The vehicles using this connection.
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
#define WRITE_WARNING(msg)
static bool dictionary(const std::string &type, const std::string &id, Distribution *d)
Adds a distribution of the given type and name to the container.
Storage for edges, including some functionality operating on multiple edges.
A temporary storage for edges imported from Vissim.
double getRealSpeed(int distNo) const
int myID
The id of the connections.
static DictType myDict
District connection dictionary.
const Position & getPosition() const
Returns the position of this district's center.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
static void dict_BuildDistrictConnections()
static bool dictionary(int id, const std::string &name, const std::vector< int > &districts, const std::vector< double > &percentages, int edgeid, double position, const std::vector< std::pair< int, int > > &assignedVehicles)
Inserts the connection into the dictionary after building it.
static OptionsCont & getOptions()
Retrieves the options.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
virtual double getMax() const =0
Returns the maximum value of this distribution.
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
void checkDistrictConnectionExistanceAt(double pos)
static std::map< int, std::vector< int > > myDistrictsConnections
Map from ditricts to connections.
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
A container for districts.
Container for nodes during the netbuilding process.
The representation of a single edge during network building.
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, double zuschlag1, double zuschlag2, double length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
int myEdgeID
The id of the connected edge.
NBNode * getToNode() const
Returns the destination node of the edge.
void invalidateIncomingConnections()
invalidate incoming connections
static void clearDict()
Clears the dictionary.
std::map< int, NIVissimDistrictConnection * > DictType
Definition of a dictionary of district connections.
NBEdge * retrievePossiblySplit(const std::string &id, bool downstream) const
Tries to retrieve an edge, even if it is splitted.
A point in 2D or 3D with translation and scaling methods.
void invalidateOutgoingConnections()
invalidate outgoing connections
static NIVissimDistrictConnection * dict_findForEdge(int edgeid)
Returns the connection to a district placed at the given node Yep, there onyl should be one,...
static void dict_CheckEdgeEnds()
NIVissimDistrictConnection(int id, const std::string &name, const std::vector< int > &districts, const std::vector< double > &percentages, int edgeid, double position, const std::vector< std::pair< int, int > > &assignedVehicles)
Contructor.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Position geomPosition() const
Returns the position The position yields from the edge geometry and the place the connection is plaed...
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Position getGeomPosition(double pos) const
std::vector< int > myDistricts
The connected districts.
DistrictPercentages myPercentages
A map how many vehicles (key, amount) should leave to a district (key)
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
static const double UNSPECIFIED_WIDTH
unspecified lane width
bool addSink(NBEdge *const sink, double weight)
Adds a sink.
void add(const Position &pos)
Adds the given position to this one.
void setCenter(const Position &pos)
Sets the center coordinates.
Represents a single node (junction) during network building.
double getMeanSpeed() const
double myPosition
The position on the edge.
~NIVissimDistrictConnection()
bool addSource(NBEdge *const source, double weight)
Adds a source.
const std::string & getID() const
Returns the id.
A class representing a single district.
NBNode * getFromNode() const
Returns the origin node of the edge.