100 ret.push_back((*i)->getID());
101 (*i)->setNodeCluster(
id);
122 const std::vector<int>& connections,
int nodeCluster,
int edgeid)
132 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
145 const std::vector<int>& connections,
const Boundary& boundary,
146 int nodeCluster,
const std::vector<int>& edges)
153 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
158 assert(find(edges.begin(), edges.end(), c->
getFromEdgeID()) != edges.end()
160 find(edges.begin(), edges.end(), c->
getToEdgeID()) != edges.end());
179 double offset)
const {
201 for (std::vector<int>::iterator j = c->
myEdges.begin(); j != c->
myEdges.end(); j++) {
222 std::vector<NIVissimConnectionCluster*> joinAble;
228 ContType::iterator j = i + 1;
233 if ((*i)->joinable(*j, offset)) {
234 joinAble.push_back(*j);
238 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
239 k != joinAble.end(); k++) {
247 if (joinAble.size() > 0) {
260 ContType::iterator j = i + 1;
264 if ((*i)->joinable(*j, offset)) {
265 joinAble.push_back(*j);
269 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
270 k != joinAble.end(); k++) {
278 if (joinAble.size() > 0) {
294 ContType::iterator j = i + 1;
298 if ((*i)->isWeakDistrictConnRealisation(*j)) {
299 joinAble.push_back(*j);
303 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
304 k != joinAble.end(); k++) {
312 if (joinAble.size() > 0) {
352 std::vector<int> extendedOutgoing1;
353 std::vector<int> extendedIncoming1;
354 std::vector<int> extendedOutgoing2;
355 std::vector<int> extendedIncoming2;
396 bool crosses =
false;
418 if (oe == 0 || ie == 0) {
439 if (pos1 <= 5.0 && pos2 <= 5.0) {
450 if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
462 const std::vector<int>& iv2)
const {
463 std::vector<int> ret(iv1);
464 for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
467 for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
468 if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
469 ret.push_back((*j)->getID());
478 std::vector<int> ret;
482 for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
495 std::vector<int> disturbances;
496 std::vector<int> tls;
497 std::vector<int> nodes;
500 if ((*i)->myConnections.size() > 0) {
501 (*i)->recomputeBoundary();
504 nodes = (*i)->myNodes;
505 if (nodes.size() > 1) {
506 WRITE_WARNING(
"NIVissimConnectionCluster:More than a single node");
509 if (nodes.size() > 0) {
515 nodeid, tlsid, (*i)->myConnections,
516 disturbances, (*i)->myIncomingEdges.size() < 2);
517 assert((*i)->myNodeCluster ==
id || (*i)->myNodeCluster < 0);
518 (*i)->myNodeCluster = id;
526 std::vector<int> connections = (*i)->myConnections;
527 for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
528 if (j != connections.begin()) {
533 into <<
"(" << (*i)->myBoundary <<
")" << std::endl;
535 into <<
"---------------------------" << std::endl;
556 int connid = conn->
getID();
601 std::vector<int>::iterator i;
634 std::vector<int>::const_iterator i;
647 return sum / (double) part;
678 WRITE_WARNING(
"NIVissimConnectionCluster: how to get an edge's position?");
682 std::vector<int>::const_iterator i = find(
myEdges.begin(),
myEdges.end(), edgeid);
690 edgeGeom.front(), edgeGeom.back(), p);
708 std::vector<NIVissimConnection*> edgeIsIncoming;
712 edgeIsIncoming.push_back(c);
716 if (edgeIsIncoming.size() == 0) {
720 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
731 std::vector<NIVissimConnection*> edgeIsIncoming;
735 edgeIsIncoming.push_back(c);
739 if (edgeIsIncoming.size() == 0) {
743 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
745 return *(edgeIsIncoming.begin());
753 std::vector<NIVissimConnection*> edgeIsOutgoing;
757 edgeIsOutgoing.push_back(c);
761 if (edgeIsOutgoing.size() == 0) {
765 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
775 std::vector<NIVissimConnection*> edgeIsOutgoing;
779 edgeIsOutgoing.push_back(c);
783 if (edgeIsOutgoing.size() == 0) {
787 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
789 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 boundary contains 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