50 #ifdef CHECK_MEMORY_LEAKS 52 #endif // CHECK_MEMORY_LEAKS 101 std::vector<int> ret;
104 ret.push_back((*i)->getID());
105 (*i)->setNodeCluster(
id);
126 const std::vector<int>& connections,
int nodeCluster,
int edgeid)
136 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
149 const std::vector<int>& connections,
const Boundary& boundary,
150 int nodeCluster,
const std::vector<int>& edges)
157 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
162 assert(find(edges.begin(), edges.end(), c->
getFromEdgeID()) != edges.end()
164 find(edges.begin(), edges.end(), c->
getToEdgeID()) != edges.end());
205 for (std::vector<int>::iterator j = c->
myEdges.begin(); j != c->
myEdges.end(); j++) {
226 std::vector<NIVissimConnectionCluster*> joinAble;
232 ContType::iterator j = i + 1;
237 if ((*i)->joinable(*j, offset)) {
238 joinAble.push_back(*j);
242 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
243 k != joinAble.end(); k++) {
251 if (joinAble.size() > 0) {
264 ContType::iterator j = i + 1;
268 if ((*i)->joinable(*j, offset)) {
269 joinAble.push_back(*j);
273 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
274 k != joinAble.end(); k++) {
282 if (joinAble.size() > 0) {
298 ContType::iterator j = i + 1;
302 if ((*i)->isWeakDistrictConnRealisation(*j)) {
303 joinAble.push_back(*j);
307 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
308 k != joinAble.end(); k++) {
316 if (joinAble.size() > 0) {
356 std::vector<int> extendedOutgoing1;
357 std::vector<int> extendedIncoming1;
358 std::vector<int> extendedOutgoing2;
359 std::vector<int> extendedIncoming2;
400 bool crosses =
false;
422 if (oe == 0 || ie == 0) {
443 if (pos1 <= 5.0 && pos2 <= 5.0) {
454 if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
466 const std::vector<int>& iv2)
const {
467 std::vector<int> ret(iv1);
468 for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
471 for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
472 if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
473 ret.push_back((*j)->getID());
482 std::vector<int> ret;
486 for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
499 std::vector<int> disturbances;
500 std::vector<int> tls;
501 std::vector<int> nodes;
504 if ((*i)->myConnections.size() > 0) {
505 (*i)->recomputeBoundary();
508 nodes = (*i)->myNodes;
509 if (nodes.size() > 1) {
510 WRITE_WARNING(
"NIVissimConnectionCluster:More than a single node");
513 if (nodes.size() > 0) {
519 nodeid, tlsid, (*i)->myConnections,
520 disturbances, (*i)->myIncomingEdges.size() < 2);
521 assert((*i)->myNodeCluster ==
id || (*i)->myNodeCluster < 0);
522 (*i)->myNodeCluster = id;
530 std::vector<int> connections = (*i)->myConnections;
531 for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
532 if (j != connections.begin()) {
537 into <<
"(" << (*i)->myBoundary <<
")" << std::endl;
539 into <<
"---------------------------" << std::endl;
560 int connid = conn->
getID();
605 std::vector<int>::iterator i;
638 std::vector<int>::const_iterator i;
682 WRITE_WARNING(
"NIVissimConnectionCluster: how to get an edge's position?");
686 std::vector<int>::const_iterator i = find(
myEdges.begin(),
myEdges.end(), edgeid);
694 edgeGeom.front(), edgeGeom.back(), p);
712 std::vector<NIVissimConnection*> edgeIsIncoming;
716 edgeIsIncoming.push_back(c);
720 if (edgeIsIncoming.size() == 0) {
724 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
735 std::vector<NIVissimConnection*> edgeIsIncoming;
739 edgeIsIncoming.push_back(c);
743 if (edgeIsIncoming.size() == 0) {
747 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
749 return *(edgeIsIncoming.begin());
757 std::vector<NIVissimConnection*> edgeIsOutgoing;
761 edgeIsOutgoing.push_back(c);
765 if (edgeIsOutgoing.size() == 0) {
769 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
779 std::vector<NIVissimConnection*> edgeIsOutgoing;
783 edgeIsOutgoing.push_back(c);
787 if (edgeIsOutgoing.size() == 0) {
791 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
793 return *(edgeIsOutgoing.begin());
SUMOReal getFromPosition() const
bool joinable(NIVissimConnectionCluster *c2, SUMOReal offset)
std::vector< NIVissimConnectionCluster * > ContType
NodeSubCluster(NIVissimConnection *c)
int myNodeCluster
The node the cluster is assigned to.
NBNode * getNBNode() const
int getDisturbanceID() const
Position getCenter() const
Returns the center of the boundary.
std::vector< int > myConnections
List of connection-ids which participate within this cluster.
bool around(const Position &p, SUMOReal offset=0) const
Returns whether the boundary contains the given coordinate.
static void joinBySameEdges(SUMOReal offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap...
static std::vector< int > getWithin(const AbstractPoly &poly)
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
SUMOReal xmin() const
Returns minimum x-coordinate.
NIVissimConnection * getOutgoingContinuation(NIVissimEdge *e) const
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
static bool dictionary(const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by)
bool overlapsWith(NIVissimConnectionCluster *c, SUMOReal offset=0) const
Returns the information whether the given cluster overlaps the current.
void addToConnectionCluster(NIVissimConnectionCluster *c)
static bool dictionary(int id, NIVissimNodeCluster *o)
std::vector< int > myOutgoingEdges
static bool dictionary(int id, NIVissimConnection *o)
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
static Position crossPoint(const Boundary &b, const PositionVector &v)
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
SUMOReal xmax() const
Returns maximum x-coordinate.
const PositionVector & getGeometry() const
A class that stores a 2D geometrical boundary.
bool overlapsWith(const NodeSubCluster &c, SUMOReal offset=0)
Position getToGeomPosition() const
std::vector< int > getDisturbanceParticipators()
#define WRITE_WARNING(msg)
A temporary storage for edges imported from Vissim.
static ContType myClusters
bool overlapsWith(const AbstractPoly &poly, SUMOReal offset=0) const
Returns whether the boundary overlaps with the given polygon.
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
~NIVissimConnectionCluster()
Destructor.
SUMOReal getToPosition() const
A point in 2D or 3D with translation and scaling methods.
static void _debugOut(std::ostream &into)
NIVissimConnection * getIncomingContinuation(NIVissimEdge *e) const
static void buildNodeClusters()
std::vector< int > myEdges
std::vector< int > extendByToTreatAsSame(const std::vector< int > &iv1, const std::vector< int > &iv2) const
static void removeDouble(std::vector< T > &v)
virtual SUMOReal getEdgePosition(int edgeid) const =0
static bool dictionary(int id, NIVissimNodeDef *o)
const Boundary & getBoundingBox() const
std::vector< int > getConnectionIDs() const
bool around(const Position &p, SUMOReal offset=0) const
void add(NIVissimConnection *c)
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
void removeConnections(const NodeSubCluster &c)
static int getNextFreeNodeID()
ConnectionCont myConnections
bool hasNodeCluster() const
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
const Boundary & getBoundary() const
static SUMOReal nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
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.
Boundary myBoundary
The boundary of the cluster.
Represents a single node (junction) during network building.
SUMOReal getPositionForEdge(int edgeid) const
const std::vector< int > & getDisturbances() const
bool liesOnSameEdgesEnd(NIVissimConnectionCluster *cc2)
bool isWeakDistrictConnRealisation(NIVissimConnectionCluster *c2)
NIVissimConnectionCluster(const std::vector< int > &connections, int nodeCluster, int edgeid)
Constructor Build the boundary; The boundary includes both incoming and outgoing nodes.
std::vector< int > myIncomingEdges
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getFromGeomPosition() const
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
int getFromEdgeID() const