93 ret.push_back((*i)->getID());
94 (*i)->setNodeCluster(
id);
115 const std::vector<int>& connections,
int nodeCluster,
int edgeid)
125 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
138 const std::vector<int>& connections,
const Boundary& boundary,
139 int nodeCluster,
const std::vector<int>& edges)
146 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
151 assert(find(edges.begin(), edges.end(), c->
getFromEdgeID()) != edges.end()
153 find(edges.begin(), edges.end(), c->
getToEdgeID()) != edges.end());
172 double offset)
const {
194 for (std::vector<int>::iterator j = c->
myEdges.begin(); j != c->
myEdges.end(); j++) {
215 std::vector<NIVissimConnectionCluster*> joinAble;
221 ContType::iterator j = i + 1;
226 if ((*i)->joinable(*j, offset)) {
227 joinAble.push_back(*j);
231 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
232 k != joinAble.end(); k++) {
240 if (joinAble.size() > 0) {
253 ContType::iterator j = i + 1;
257 if ((*i)->joinable(*j, offset)) {
258 joinAble.push_back(*j);
262 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
263 k != joinAble.end(); k++) {
271 if (joinAble.size() > 0) {
287 ContType::iterator j = i + 1;
291 if ((*i)->isWeakDistrictConnRealisation(*j)) {
292 joinAble.push_back(*j);
296 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
297 k != joinAble.end(); k++) {
305 if (joinAble.size() > 0) {
345 std::vector<int> extendedOutgoing1;
346 std::vector<int> extendedIncoming1;
347 std::vector<int> extendedOutgoing2;
348 std::vector<int> extendedIncoming2;
389 bool crosses =
false;
411 if (oe ==
nullptr || ie ==
nullptr) {
432 if (pos1 <= 5.0 && pos2 <= 5.0) {
443 if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
455 const std::vector<int>& iv2)
const {
456 std::vector<int> ret(iv1);
457 for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
460 for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
461 if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
462 ret.push_back((*j)->getID());
471 std::vector<int> ret;
475 for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
488 std::vector<int> disturbances;
489 std::vector<int> tls;
490 std::vector<int> nodes;
493 if ((*i)->myConnections.size() > 0) {
494 (*i)->recomputeBoundary();
497 nodes = (*i)->myNodes;
498 if (nodes.size() > 1) {
499 WRITE_WARNING(
"NIVissimConnectionCluster:More than a single node");
502 if (nodes.size() > 0) {
508 nodeid, tlsid, (*i)->myConnections,
509 disturbances, (*i)->myIncomingEdges.size() < 2);
510 assert((*i)->myNodeCluster ==
id || (*i)->myNodeCluster < 0);
511 (*i)->myNodeCluster = id;
519 std::vector<int> connections = (*i)->myConnections;
520 for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
521 if (j != connections.begin()) {
526 into <<
"(" << (*i)->myBoundary <<
")" << std::endl;
528 into <<
"---------------------------" << std::endl;
549 int connid = conn->
getID();
594 std::vector<int>::iterator i;
627 std::vector<int>::const_iterator i;
640 return sum / (double) part;
649 if (node !=
nullptr) {
671 WRITE_WARNING(
"NIVissimConnectionCluster: how to get an edge's position?");
675 std::vector<int>::const_iterator i = find(
myEdges.begin(),
myEdges.end(), edgeid);
683 edgeGeom.front(), edgeGeom.back(), p);
701 std::vector<NIVissimConnection*> edgeIsIncoming;
705 edgeIsIncoming.push_back(c);
709 if (edgeIsIncoming.size() == 0) {
713 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
724 std::vector<NIVissimConnection*> edgeIsIncoming;
728 edgeIsIncoming.push_back(c);
732 if (edgeIsIncoming.size() == 0) {
736 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
738 return *(edgeIsIncoming.begin());
746 std::vector<NIVissimConnection*> edgeIsOutgoing;
750 edgeIsOutgoing.push_back(c);
754 if (edgeIsOutgoing.size() == 0) {
758 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
768 std::vector<NIVissimConnection*> edgeIsOutgoing;
772 edgeIsOutgoing.push_back(c);
776 if (edgeIsOutgoing.size() == 0) {
780 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
782 return *(edgeIsOutgoing.begin());
static void joinBySameEdges(double offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap...
double xmax() const
Returns maximum x-coordinate.
const std::vector< int > & getDisturbances() const
std::vector< NIVissimConnectionCluster * > ContType
NodeSubCluster(NIVissimConnection *c)
int myNodeCluster
The node the cluster is assigned to.
std::vector< int > myConnections
List of connection-ids which participate within this cluster.
NIVissimConnection * getIncomingContinuation(NIVissimEdge *e) const
static std::vector< int > getWithin(const AbstractPoly &poly)
NBNode * getNBNode() const
static bool dictionary(const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by)
const PositionVector & getGeometry() const
void addToConnectionCluster(NIVissimConnectionCluster *c)
static bool dictionary(int id, NIVissimNodeCluster *o)
NIVissimConnection * getOutgoingContinuation(NIVissimEdge *e) const
std::vector< int > myOutgoingEdges
static bool dictionary(int id, NIVissimConnection *o)
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
static Position crossPoint(const Boundary &b, const PositionVector &v)
const Boundary & getBoundary() const
A class that stores a 2D geometrical boundary.
std::vector< int > getDisturbanceParticipators()
#define WRITE_WARNING(msg)
double getPositionForEdge(int edgeid) const
A temporary storage for edges imported from Vissim.
bool joinable(NIVissimConnectionCluster *c2, double offset)
static ContType myClusters
int getFromEdgeID() const
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
int getDisturbanceID() const
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
~NIVissimConnectionCluster()
Destructor.
bool hasNodeCluster() const
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
A point in 2D or 3D with translation and scaling methods.
static void _debugOut(std::ostream &into)
static void buildNodeClusters()
std::vector< int > myEdges
const Boundary & getBoundingBox() const
static void removeDouble(std::vector< T > &v)
bool around(const Position &p, double offset=0) const
double xmin() const
Returns minimum x-coordinate.
static bool dictionary(int id, NIVissimNodeDef *o)
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.
double getToPosition() const
void add(NIVissimConnection *c)
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const
Position getToGeomPosition() const
void removeConnections(const NodeSubCluster &c)
static int getNextFreeNodeID()
ConnectionCont myConnections
std::vector< int > getConnectionIDs() const
std::vector< int > extendByToTreatAsSame(const std::vector< int > &iv1, const std::vector< int > &iv2) const
virtual double getEdgePosition(int edgeid) const =0
bool around(const Position &p, double offset=0) const
Returns whether the AbstractPoly the given coordinate.
Boundary myBoundary
The boundary of the cluster.
Represents a single node (junction) during network building.
Position getCenter() const
Returns the center of the boundary.
Position getFromGeomPosition() const
bool overlapsWith(const NodeSubCluster &c, double offset=0)
bool overlapsWith(NIVissimConnectionCluster *c, double offset=0) const
Returns the information whether the given cluster overlaps the current.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
const std::vector< NIVissimEdge * > & getToTreatAsSame() 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.
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
std::vector< int > myIncomingEdges
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
double getFromPosition() const