91 ret.push_back((*i)->getID());
92 (*i)->setNodeCluster(
id);
113 const std::vector<int>& connections,
int nodeCluster,
int edgeid)
123 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
136 const std::vector<int>& connections,
const Boundary& boundary,
137 int nodeCluster,
const std::vector<int>& edges)
138 : myConnections(connections), myBoundary(boundary),
139 myNodeCluster(nodeCluster), myEdges(edges) {
144 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
149 assert(find(edges.begin(), edges.end(), c->
getFromEdgeID()) != edges.end()
151 std::find(edges.begin(), edges.end(), c->
getToEdgeID()) != edges.end());
170 double offset)
const {
192 for (std::vector<int>::iterator j = c->
myEdges.begin(); j != c->
myEdges.end(); j++) {
213 std::vector<NIVissimConnectionCluster*> joinAble;
219 ContType::iterator j = i + 1;
224 if ((*i)->joinable(*j, offset)) {
225 joinAble.push_back(*j);
229 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
230 k != joinAble.end(); k++) {
238 if (joinAble.size() > 0) {
251 ContType::iterator j = i + 1;
255 if ((*i)->joinable(*j, offset)) {
256 joinAble.push_back(*j);
260 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
261 k != joinAble.end(); k++) {
269 if (joinAble.size() > 0) {
285 ContType::iterator j = i + 1;
289 if ((*i)->isWeakDistrictConnRealisation(*j)) {
290 joinAble.push_back(*j);
294 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
295 k != joinAble.end(); k++) {
303 if (joinAble.size() > 0) {
343 std::vector<int> extendedOutgoing1;
344 std::vector<int> extendedIncoming1;
345 std::vector<int> extendedOutgoing2;
346 std::vector<int> extendedIncoming2;
387 bool crosses =
false;
408 if (oe ==
nullptr || ie ==
nullptr) {
429 if (pos1 <= 5.0 && pos2 <= 5.0) {
440 if (pos1 >= g.
length() - 5.0 && pos2 >= g.
length() - 5.0) {
452 const std::vector<int>& iv2)
const {
453 std::vector<int> ret(iv1);
454 for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
457 for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
458 if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
459 ret.push_back((*j)->getID());
468 std::vector<int> ret;
472 for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
485 std::vector<int> disturbances;
486 std::vector<int> tls;
487 std::vector<int> nodes;
490 if ((*i)->myConnections.size() > 0) {
491 (*i)->recomputeBoundary();
494 nodes = (*i)->myNodes;
495 if (nodes.size() > 1) {
496 WRITE_WARNING(
TL(
"NIVissimConnectionCluster: More than a single node"));
499 if (nodes.size() > 0) {
505 nodeid, tlsid, (*i)->myConnections,
506 disturbances, (*i)->myIncomingEdges.size() < 2);
507 assert((*i)->myNodeCluster ==
id || (*i)->myNodeCluster < 0);
508 (*i)->myNodeCluster = id;
516 std::vector<int> connections = (*i)->myConnections;
517 for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
518 if (j != connections.begin()) {
523 into <<
"(" << (*i)->myBoundary <<
")" << std::endl;
525 into <<
"---------------------------" << std::endl;
540 int connid = conn->
getID();
585 std::vector<int>::iterator i;
618 std::vector<int>::const_iterator i;
631 return sum / (double) part;
640 if (node !=
nullptr) {
662 WRITE_WARNING(
TL(
"NIVissimConnectionCluster: how to get an edge's position?"));
666 std::vector<int>::const_iterator i = std::find(
myEdges.begin(),
myEdges.end(), edgeid);
674 edgeGeom.front(), edgeGeom.back(), p);
692 std::vector<NIVissimConnection*> edgeIsIncoming;
696 edgeIsIncoming.push_back(c);
700 if (edgeIsIncoming.size() == 0) {
704 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
715 std::vector<NIVissimConnection*> edgeIsIncoming;
719 edgeIsIncoming.push_back(c);
723 if (edgeIsIncoming.size() == 0) {
727 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
729 return *(edgeIsIncoming.begin());
737 std::vector<NIVissimConnection*> edgeIsOutgoing;
741 edgeIsOutgoing.push_back(c);
745 if (edgeIsOutgoing.size() == 0) {
749 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
759 std::vector<NIVissimConnection*> edgeIsOutgoing;
763 edgeIsOutgoing.push_back(c);
767 if (edgeIsOutgoing.size() == 0) {
771 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
773 return *(edgeIsOutgoing.begin());
#define WRITE_WARNING(msg)
A class that stores a 2D geometrical boundary.
Position getCenter() const
Returns the center of the boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
double xmin() const
Returns minimum x-coordinate.
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
bool around(const Position &p, double offset=0) const
Returns whether the boundary contains the given coordinate.
double xmax() const
Returns maximum x-coordinate.
static Position crossPoint(const Boundary &b, const PositionVector &v)
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
Represents a single node (junction) during network building.
const PositionVector & getGeometry() const
const std::vector< int > & getDisturbances() const
const Boundary & getBoundary() const
bool overlapsWith(const NodeSubCluster &c, double offset=0)
void add(NIVissimConnection *c)
NodeSubCluster(NIVissimConnection *c)
std::vector< int > getConnectionIDs() const
ConnectionCont myConnections
bool around(const Position &p, double offset=0) const
NIVissimConnection * getIncomingContinuation(NIVissimEdge *e) const
std::vector< int > myOutgoingEdges
bool liesOnSameEdgesEnd(NIVissimConnectionCluster *cc2)
Boundary myBoundary
The boundary of the cluster.
static int getNextFreeNodeID()
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const
std::vector< int > myConnections
List of connection-ids which participate within this cluster.
void removeConnections(const NodeSubCluster &c)
std::vector< int > extendByToTreatAsSame(const std::vector< int > &iv1, const std::vector< int > &iv2) const
std::vector< int > myEdges
bool isWeakDistrictConnRealisation(NIVissimConnectionCluster *c2)
static void joinBySameEdges(double offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap.
std::vector< int > getDisturbanceParticipators()
bool joinable(NIVissimConnectionCluster *c2, double offset)
static void _debugOut(std::ostream &into)
bool overlapsWith(NIVissimConnectionCluster *c, double offset=0) const
Returns the information whether the given cluster overlaps the current.
std::vector< NIVissimConnectionCluster * > ContType
NIVissimConnection * getOutgoingContinuation(NIVissimEdge *e) const
NBNode * getNBNode() const
~NIVissimConnectionCluster()
Destructor.
static void buildNodeClusters()
bool hasNodeCluster() const
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
int myNodeCluster
The node the cluster is assigned to.
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
static ContType myClusters
double getPositionForEdge(int edgeid) const
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
double getFromPosition() const
const Boundary & getBoundingBox() const
int getFromEdgeID() const
static bool dictionary(int id, NIVissimConnection *o)
Position getToGeomPosition() const
double getToPosition() const
Position getFromGeomPosition() const
int getDisturbanceID() const
static bool dictionary(const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by)
static std::vector< int > getWithin(const AbstractPoly &poly)
A temporary storage for edges imported from Vissim.
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
void addToConnectionCluster(NIVissimConnectionCluster *c)
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
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.
static bool dictionary(int id, NIVissimNodeCluster *o)
static bool dictionary(int id, NIVissimNodeDef *o)
virtual double getEdgePosition(int edgeid) const =0
A point in 2D or 3D with translation and scaling methods.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
double length() const
Returns the length.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
static void removeDouble(std::vector< T > &v)