99 ret.push_back((*i)->getID());
100 (*i)->setNodeCluster(
id);
121 const std::vector<int>& connections,
int nodeCluster,
int edgeid)
131 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
144 const std::vector<int>& connections,
const Boundary& boundary,
145 int nodeCluster,
const std::vector<int>& edges)
152 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
157 assert(find(edges.begin(), edges.end(), c->
getFromEdgeID()) != edges.end()
159 find(edges.begin(), edges.end(), c->
getToEdgeID()) != edges.end());
178 double offset)
const {
200 for (std::vector<int>::iterator j = c->
myEdges.begin(); j != c->
myEdges.end(); j++) {
221 std::vector<NIVissimConnectionCluster*> joinAble;
227 ContType::iterator j = i + 1;
232 if ((*i)->joinable(*j, offset)) {
233 joinAble.push_back(*j);
237 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
238 k != joinAble.end(); k++) {
246 if (joinAble.size() > 0) {
259 ContType::iterator j = i + 1;
263 if ((*i)->joinable(*j, offset)) {
264 joinAble.push_back(*j);
268 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
269 k != joinAble.end(); k++) {
277 if (joinAble.size() > 0) {
293 ContType::iterator j = i + 1;
297 if ((*i)->isWeakDistrictConnRealisation(*j)) {
298 joinAble.push_back(*j);
302 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
303 k != joinAble.end(); k++) {
311 if (joinAble.size() > 0) {
351 std::vector<int> extendedOutgoing1;
352 std::vector<int> extendedIncoming1;
353 std::vector<int> extendedOutgoing2;
354 std::vector<int> extendedIncoming2;
395 bool crosses =
false;
417 if (oe == 0 || ie == 0) {
438 if (pos1 <= 5.0 && pos2 <= 5.0) {
449 if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
461 const std::vector<int>& iv2)
const {
462 std::vector<int> ret(iv1);
463 for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
466 for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
467 if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
468 ret.push_back((*j)->getID());
477 std::vector<int> ret;
481 for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
494 std::vector<int> disturbances;
495 std::vector<int> tls;
496 std::vector<int> nodes;
499 if ((*i)->myConnections.size() > 0) {
500 (*i)->recomputeBoundary();
503 nodes = (*i)->myNodes;
504 if (nodes.size() > 1) {
505 WRITE_WARNING(
"NIVissimConnectionCluster:More than a single node");
508 if (nodes.size() > 0) {
514 nodeid, tlsid, (*i)->myConnections,
515 disturbances, (*i)->myIncomingEdges.size() < 2);
516 assert((*i)->myNodeCluster ==
id || (*i)->myNodeCluster < 0);
517 (*i)->myNodeCluster = id;
525 std::vector<int> connections = (*i)->myConnections;
526 for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
527 if (j != connections.begin()) {
532 into <<
"(" << (*i)->myBoundary <<
")" << std::endl;
534 into <<
"---------------------------" << std::endl;
555 int connid = conn->
getID();
600 std::vector<int>::iterator i;
633 std::vector<int>::const_iterator i;
646 return sum / (double) part;
677 WRITE_WARNING(
"NIVissimConnectionCluster: how to get an edge's position?");
681 std::vector<int>::const_iterator i = find(
myEdges.begin(),
myEdges.end(), edgeid);
689 edgeGeom.front(), edgeGeom.back(), p);
707 std::vector<NIVissimConnection*> edgeIsIncoming;
711 edgeIsIncoming.push_back(c);
715 if (edgeIsIncoming.size() == 0) {
719 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
730 std::vector<NIVissimConnection*> edgeIsIncoming;
734 edgeIsIncoming.push_back(c);
738 if (edgeIsIncoming.size() == 0) {
742 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
744 return *(edgeIsIncoming.begin());
752 std::vector<NIVissimConnection*> edgeIsOutgoing;
756 edgeIsOutgoing.push_back(c);
760 if (edgeIsOutgoing.size() == 0) {
764 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
774 std::vector<NIVissimConnection*> edgeIsOutgoing;
778 edgeIsOutgoing.push_back(c);
782 if (edgeIsOutgoing.size() == 0) {
786 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
788 return *(edgeIsOutgoing.begin());
double xmax() const
Returns maximum x-coordinate.
static void joinBySameEdges(double offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap...
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.
static std::vector< int > getWithin(const AbstractPoly &poly)
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
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)
void addToConnectionCluster(NIVissimConnectionCluster *c)
static bool dictionary(int id, NIVissimNodeCluster *o)
std::vector< int > myOutgoingEdges
double getPositionForEdge(int edgeid) const
static bool dictionary(int id, NIVissimConnection *o)
static Position crossPoint(const Boundary &b, const PositionVector &v)
const PositionVector & getGeometry() const
A class that stores a 2D geometrical boundary.
Position getToGeomPosition() const
std::vector< int > getDisturbanceParticipators()
#define WRITE_WARNING(msg)
A temporary storage for edges imported from Vissim.
bool joinable(NIVissimConnectionCluster *c2, double offset)
bool around(const Position &p, double offset=0) const
static ContType myClusters
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
~NIVissimConnectionCluster()
Destructor.
A point in 2D or 3D with translation and scaling methods.
static void _debugOut(std::ostream &into)
NIVissimConnection * getIncomingContinuation(NIVissimEdge *e) const
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
static void buildNodeClusters()
std::vector< int > myEdges
bool overlapsWith(NIVissimConnectionCluster *c, double offset=0) const
Returns the information whether the given cluster overlaps the current.
std::vector< int > extendByToTreatAsSame(const std::vector< int > &iv1, const std::vector< int > &iv2) const
static void removeDouble(std::vector< T > &v)
double getFromPosition() const
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.
const Boundary & getBoundingBox() const
std::vector< int > getConnectionIDs() const
void add(NIVissimConnection *c)
bool around(const Position &p, double offset=0) const
Returns whether the boundary contains the given coordinate.
void removeConnections(const NodeSubCluster &c)
static int getNextFreeNodeID()
ConnectionCont myConnections
bool hasNodeCluster() const
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
double xmin() const
Returns minimum x-coordinate.
const Boundary & getBoundary() const
virtual double getEdgePosition(int edgeid) const =0
Boundary myBoundary
The boundary of the cluster.
Represents a single node (junction) during network building.
bool overlapsWith(const NodeSubCluster &c, double offset=0)
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.
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
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getFromGeomPosition() const
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
double getToPosition() const
int getFromEdgeID() const