58 #ifdef CHECK_MEMORY_LEAKS 60 #endif // CHECK_MEMORY_LEAKS 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++) {
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.");
500 if (fromNode == toNode) {
506 avgSpeed / (
SUMOReal) 3.6, myNoLanes, -1,
518 if (tmpClusters.size() > 0) {
520 for (ConnectionClusters::iterator j = tmpClusters.begin(); cont && j != tmpClusters.end(); ++j) {
522 std::string nextID = buildEdge->
getID() +
"[1]";
523 cont = ec.
splitAt(dc, buildEdge, (*j)->getNBNode());
533 std::string
id = toString<int>(distNo);
536 WRITE_WARNING(
"The referenced speed distribution '" +
id +
"' is not known.");
541 if (speed < 0 || speed > 1000) {
542 WRITE_WARNING(
"What about distribution '" + toString<int>(distNo) +
"' ");
585 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++) {
915 if (g1.back().distanceTo(g2.back()) > 10) {
959 std::vector<int>::iterator i;
976 const std::vector<NIVissimEdge*>&
987 std::ostringstream str;
988 str <<
"The following lanes have no explicit speed information:\n ";
SUMOReal getFromPosition() 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
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 bool dictionary(int id, NIVissimConnection *o)
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
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.
int myNoLanes
The number of lanes the edge has.
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.
void setSpeed(int lane, int speedDist)
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 type of the edge.
int myEdgeID
The id 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.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
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)
int myEdgeID
The id of the edge.
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