58 #ifdef CHECK_MEMORY_LEAKS
60 #endif // CHECK_MEMORY_LEAKS
100 : myEdgeID(edgeid) {}
109 if (pos2 < 0 || pos1 < 0) {
113 assert(pos1 >= 0 && pos2 >= 0);
121 const std::string& type,
int noLanes,
129 assert(noLanes >= 0);
133 for (
int i = 0; i < noLanes; i++) {
149 const std::string& type,
int noLanes,
154 zuschlag2, length, geom, clv);
166 DictType::iterator i =
myDict.find(
id);
178 DictType::iterator i =
myDict.find(
id);
188 const SUMOReal MAX_CLUSTER_DISTANCE = 10;
191 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
192 int edgeid = (*i).first;
197 if (connectors.size() == 0) {
203 std::vector<int> currentCluster;
204 std::vector<int>::iterator j = connectors.begin();
215 if (j == connectors.end()) {
218 currentCluster.push_back(*j);
225 if (n_outgoing == outgoing && fabs(n_position - position) < MAX_CLUSTER_DISTANCE) {
227 currentCluster.push_back(*(j + 1));
232 currentCluster.clear();
233 currentCluster.push_back(*(j + 1));
235 outgoing = n_outgoing;
236 position = n_position;
239 }
while (j != connectors.end());
241 if (currentCluster.size() > 0) {
252 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
261 DictType::iterator i;
270 for (
int j = 0; j < 3; j++) {
309 for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
327 for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
340 if (forLanes.size() == 0) {
342 forLanes.push_back((
int) i);
347 for (std::vector<int>::const_iterator i = forLanes.begin(); i < forLanes.end(); i++) {
369 for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
392 for (
unsigned int i = 0; i <
myNoLanes; i++) {
398 for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
411 std::vector<NIVissimConnection*>
413 std::vector<NIVissimConnection*> ret;
417 if (find(lanes.begin(), lanes.end(), lane) != lanes.end()) {
432 std::pair<NIVissimConnectionCluster*, NBNode*> fromInf, toInf;
433 NBNode* fromNode, *toNode;
434 fromNode = toNode = 0;
438 if (tmpClusters.size() != 0) {
444 fromNode = fromInf.second;
448 toNode = toInf.second;
449 if (fromInf.first != 0 && toNode != 0 && fromInf.first->around(toNode->
getPosition())) {
456 if (fromNode == toNode) {
457 std::pair<NBNode*, NBNode*> tmp =
resolveSameNode(nc, sameNodesOffset, fromNode, toNode);
458 if (fromNode != tmp.first) {
461 if (toNode != tmp.second) {
464 fromNode = tmp.first;
474 if (!nc.
insert(fromNode)) {
475 throw ProcessError(
"Could not insert node '" + fromNode->
getID() +
"' to nodes container.");
483 throw ProcessError(
"Could not insert node '" + toNode->
getID() +
"' to nodes container.");
501 if (fromNode == toNode) {
519 if (tmpClusters.size() > 0) {
521 for (ConnectionClusters::iterator j = tmpClusters.begin(); cont && j != tmpClusters.end(); ++j) {
523 std::string nextID = buildEdge->
getID() +
"[1]";
524 cont = ec.
splitAt(dc, buildEdge, (*j)->getNBNode());
534 std::string
id = toString<int>(distNo);
537 WRITE_WARNING(
"The referenced speed distribution '" +
id +
"' is not known.");
542 if (speed < 0 || speed > 1000) {
543 WRITE_WARNING(
"What about distribution '" + toString<int>(distNo) +
"' ");
586 std::pair<NIVissimConnectionCluster*, NBNode*>
589 assert(clusters.size() >= 1);
593 if (c->
around(beg, MAX_DISTANCE)) {
594 clusters.erase(clusters.begin());
595 return std::pair<NIVissimConnectionCluster*, NBNode*>
621 std::pair<NIVissimConnectionCluster*, NBNode*>
624 if (clusters.size() > 0) {
626 assert(clusters.size() >= 1);
629 if (c->around(end, MAX_DISTANCE)) {
630 clusters.erase(clusters.end() - 1);
631 return std::pair<NIVissimConnectionCluster*, NBNode*>(c, c->getNBNode());
668 std::pair<NBNode*, NBNode*>
672 std::string nid =
"ParkingPlace" + toString<int>(d->
getID());
682 return std::pair<NBNode*, NBNode*>(newNode, toNode);
689 return std::pair<NBNode*, NBNode*>(fromNode, newNode);
695 std::pair<NBNode*, NBNode*>
707 std::string nid =
"ParkingPlace" + toString<int>(d->
getID());
716 return std::pair<NBNode*, NBNode*>(node, prevTo);
720 std::string nid =
"ParkingPlace" + toString<int>(d->
getID());
729 return std::pair<NBNode*, NBNode*>(prevFrom, node);
742 toString<int>(
myID) +
"-End",
748 return std::pair<NBNode*, NBNode*>(node, end);
754 toString<int>(
myID) +
"-Begin",
758 std::cout <<
"nope, NIVissimDisturbance" << std::endl;
761 return std::pair<NBNode*, NBNode*>(beg, node);
766 return std::pair<NBNode*, NBNode*>(node, node);
771 return std::pair<NBNode*, NBNode*>(prevFrom, prevTo);
803 ConnectionClusters::iterator i =
818 ConnectionClusters::iterator i =
827 ConnectionClusters::iterator i =
878 for (DictType::iterator i1 =
myDict.begin(); i1 !=
myDict.end(); i1++) {
883 DictType::iterator i2 = i1;
885 for (; i2 !=
myDict.end(); i2++) {
906 Line l1 =
Line(g1.front(), g1.back());
907 Line l2 =
Line(g2.front(), g2.back());
962 std::vector<int>::iterator i;
979 const std::vector<NIVissimEdge*>&
990 std::ostringstream str;
991 str <<
"The following lanes have no explicit speed information:\n ";
SUMOReal getFromPosition() const
SUMOReal atan2DegreeAngle() const
const Position & p2() const
static int myMaxID
The current maximum id; needed for further id assignment.
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
const std::vector< int > & getToLanes() const
bool insert(const std::string &id, const Position &position, NBDistrict *district)
Inserts a node into the map.
std::vector< SUMOReal > myLaneSpeeds
Position getBegin2D() const
NBNode * getNBNode() const
int operator()(int c1id, int c2id) const
comparing operation
~NIVissimEdge()
Destructor.
Position geomPosition() const
Returns the position The position yields from the edge geometry and the place the connection is plaed...
std::string myName
The name of the edge.
static void dict_checkEdges2Join()
std::map< int, NIVissimEdge * > DictType
Definition of the dictionary type.
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
std::vector< int > myPatchedSpeeds
std::pair< NBNode *, NBNode * > remapOneOfNodes(NBNodeCont &nc, NIVissimDistrictConnection *d, NBNode *fromNode, NBNode *toNode)
static void reportUnsetSpeeds()
Writes edges with unset speeds to the warnings message log instance.
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
std::vector< NIVissimConnection * > getOutgoingConnected(int lane) const
std::vector< NIVissimClosedLaneDef * > NIVissimClosedLanesVector
The representation of a single edge during network building.
static bool dictionary(const std::string &type, const std::string &id, Distribution *d)
ConnectionClusters myConnectionClusters
List of connection clusters along this edge.
A container for districts.
void checkDistrictConnectionExistanceAt(SUMOReal pos)
void addToConnectionCluster(NIVissimConnectionCluster *c)
void setNodeCluster(int nodeid)
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
void buildNBEdge(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, SUMOReal sameNodesOffset)
Builds the NBEdge from this VissimEdge.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
void setSpeed(size_t lane, int speedDist)
std::pair< NBNode *, NBNode * > resolveSameNode(NBNodeCont &nc, SUMOReal offset, NBNode *prevFrom, NBNode *prevTo)
Tries to resolve the problem that the same node has been returned as origin and destination node...
static NIVissimDistrictConnection * dict_findForEdge(int edgeid)
Returns the connection to a district placed at the given node Yep, there onyl should be one...
const PositionVector & getGeometry() const
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
A temporary storage for edges imported from Vissim.
int getID() const
Returns the id of the connection.
const std::string & getID() const
Returns the id.
const Position & getPosition() const
Returns the position of this node.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::vector< SUMOReal > myDistrictConnections
void addIncomingConnection(int id)
Adds a connection where this edge is the destination.
bool myAmWithinJunction
Information whether this edge was not build due to being within a junction.
SUMOReal getToPosition() const
static void dict_propagateSpeeds()
A point in 2D or 3D with translation and scaling methods.
NIVissimEdge * getBestOutgoing() const
std::vector< int > myIncomingConnections
List of connections incoming to this edge.
static void removeDouble(std::vector< T > &v)
std::string myType
The tape of the edge.
Storage for edges, including some functionality operating on multiple edges.
connection_cluster_position_sorter(int edgeid)
constructor
connection_position_sorter(int edgeid)
constructor
void checkUnconnectedLaneSpeeds()
void addOutgoingConnection(int id)
Adds a connection where this edge is the source.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
NIVissimConnection * getConnectionTo(NIVissimEdge *e)
SUMOReal getPosition() const
Returns the position of the connection at the edge.
bool around(const Position &p, SUMOReal offset=0) const
std::pair< NIVissimConnectionCluster *, NBNode * > getToNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the destination node.
SUMOReal length() const
Returns the length.
SUMOReal getRealSpeed(int distNo)
static void buildConnectionClusters()
Clusters connections of each edge.
std::vector< NIVissimEdge * > myToTreatAsSame
bool addToTreatAsSame(NIVissimEdge *e)
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
const std::vector< int > & getFromLanes() const
Position getEnd2D() const
Returns the end position of the edge.
SUMOReal myZuschlag1
Additional load values for this edge.
SUMOReal getMeanSpeed() const
NIVissimEdge(int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Constructor.
static bool dictionary(int id, const std::string &name, const NIVissimExtendedEdgePoint &from_def, const NIVissimExtendedEdgePoint &to_def, const PositionVector &geom, Direction direction, SUMOReal dxnothalt, SUMOReal dxeinordnen, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal seglength, const std::vector< int > &assignedVehicles, const NIVissimClosedLanesVector &clv)
unsigned int myNoLanes
The number of lanes the edge has.
static std::vector< std::string > myLanesWithMissingSpeeds
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
NIVissimClosedLanesVector myClosedLanes
List of lanes closed on this edge.
std::vector< NIVissimConnectionCluster * > ConnectionClusters
The definition for a container for connection clusters.
Represents a single node (junction) during network building.
SUMOReal getLength() const
Returns the length of the node.
NIVissimEdge * getBestIncoming() const
SUMOReal getPositionForEdge(int edgeid) const
void propagateSpeed(SUMOReal speed, std::vector< int > forLanes)
static DictType myDict
The dictionary.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Container for nodes during the netbuilding process.
void mergedInto(NIVissimConnectionCluster *old, NIVissimConnectionCluster *act)
bool erase(NBNode *node)
Removes the given node, deleting it.
std::vector< int > myOutgoingConnections
List of connections outgoing from this edge.
static void dict_buildNBEdges(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, SUMOReal offset)
Builds NBEdges from the VissimEdges within the dictionary.
std::pair< NIVissimConnectionCluster *, NBNode * > getFromNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the origin node.
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
int operator()(NIVissimConnectionCluster *cc1, NIVissimConnectionCluster *cc2) const
comparing operation
int getFromEdgeID() const