55 #ifdef CHECK_MEMORY_LEAKS 57 #endif // CHECK_MEMORY_LEAKS 75 FXIMPLEMENT(
GNEConnectorFrame, FXScrollWindow, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
90 GNEFrame(parent, viewNet, "Edit Connections"),
93 myDescription =
new FXLabel(myContentFrame,
"", 0, JUSTIFY_LEFT);
94 new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
99 new FXButton(myContentFrame,
"Cancel\t\tDiscard connection modifications (Esc)", 0,
this,
MID_CANCEL,
100 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
101 0, 0, 0, 0, 4, 4, 3, 3);
103 new FXButton(myContentFrame,
"OK\t\tSave connection modifications (Enter)", 0,
this,
MID_OK,
104 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
105 0, 0, 0, 0, 4, 4, 3, 3);
106 new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
108 new FXButton(myContentFrame,
109 "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
111 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
112 0, 0, 0, 0, 4, 4, 3, 3);
114 new FXButton(myContentFrame,
115 "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
117 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
118 0, 0, 0, 0, 4, 4, 3, 3);
120 new FXButton(myContentFrame,
121 "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
123 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
124 0, 0, 0, 0, 4, 4, 3, 3);
126 new FXButton(myContentFrame,
127 "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
129 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
130 0, 0, 0, 0, 4, 4, 3, 3);
132 new FXButton(myContentFrame,
133 "Clear Selected\t\tClears all connections of all selected objects",
135 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
136 0, 0, 0, 0, 4, 4, 3, 3);
138 new FXButton(myContentFrame,
139 "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
141 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
142 0, 0, 0, 0, 4, 4, 3, 3);
144 new FXHorizontalSeparator(
this, SEPARATOR_GROOVE | LAYOUT_FILL_X);
146 new FXLabel(myContentFrame,
"Hold <SHIFT> while\nclicking to create\nunyielding conn's.\n", 0, JUSTIFY_LEFT);
147 new FXLabel(myContentFrame,
"Hold <CTRL> while\nclicking to create\nconflicting conn's.\n", 0, JUSTIFY_LEFT);
151 potentialTargetColor =
RGBColor(0, 64, 0, 255);
156 new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
158 new FXLabel(myContentFrame,
"Color Legend:", 0, JUSTIFY_LEFT);
159 l =
new FXLabel(myContentFrame,
"Source", 0, JUSTIFY_LEFT);
161 l =
new FXLabel(myContentFrame,
"Target", 0, JUSTIFY_LEFT);
163 l =
new FXLabel(myContentFrame,
"Possible Target", 0, JUSTIFY_LEFT);
165 l =
new FXLabel(myContentFrame,
"Target (pass)", 0, JUSTIFY_LEFT);
167 l =
new FXLabel(myContentFrame,
"Conflict", 0, JUSTIFY_LEFT);
179 FXScrollWindow::show();
188 FXScrollWindow::hide();
209 bool changed =
false;
219 destEdgeID, lane->
getIndex(), mayDefinitelyPass,
true),
true);
281 std::vector<GUIGlID> selectIDs;
284 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
286 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
287 if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
288 selectIDs.push_back((*it_lane)->getGlID());
300 std::set<GUIGlID> selectIDs;
303 for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
305 const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
306 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
309 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
310 selectIDs.insert(*lid_it);
314 const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
315 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
318 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
319 for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
322 selectIDs.erase(approachedLane->
getGlID());
327 std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
335 std::vector<GUIGlID> selectIDs;
338 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
339 NBEdge* nbe = (*edge_it)->getNBEdge();
341 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
342 for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
345 for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
346 const bool isConflicted = count_if(
347 connections.begin(), connections.end(),
350 selectIDs.push_back((*it_lane)->getGlID());
363 std::vector<GUIGlID> selectIDs;
365 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
368 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
369 for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
370 if (it->mayDefinitelyPass) {
372 selectIDs.push_back(lane->
getGlID());
386 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
399 for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
432 for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
439 throw ProcessError(
"Wrong object type returned from gIDStorage");
466 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
469 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
500 (*it)->setSpecialColor(0);
516 const unsigned int toIndex = targetLane->
getIndex();
517 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
518 connections.begin(), connections.end(),
520 const bool isConnected = con_it != connections.end();
522 if (con_it->mayDefinitelyPass) {
539 const unsigned int toIndex = targetLane->
getIndex();
540 std::vector<NBEdge::Connection>::const_iterator it = find_if(
541 connections.begin(), connections.end(),
543 assert(it != connections.end());
558 const int NUM_POINTS = 5;
560 std::string innerID =
":" + node->
getID();
564 for (EdgeVector::const_iterator it_edg = incoming.begin(); it_edg != incoming.end(); it_edg++) {
565 const std::vector<NBEdge::Connection>& conns = (*it_edg)->getConnections();
566 for (std::vector<NBEdge::Connection>::const_iterator it_con = conns.begin(); it_con != conns.end(); ++it_con) {
568 LinkState state = node->
getLinkState(*it_edg, it_con->toEdge, it_con->fromLane, it_con->toLane, it_con->mayDefinitelyPass, it_con->tlID);
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
static RGBColor targetColor
color for the to-lane of a connection
bool hasConnectionTo(NBEdge *destEdge, unsigned int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
void hideFramesArea()
hide frames area if all GNEFrames are hidden
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
static const NBConnection InvalidConnection
long onCmdSelectPass(FXObject *, FXSelector, void *)
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
The representation of a single edge during network building.
void showFramesArea()
show frames area if at least a GNEFrame is showed
std::vector< GNELane * > LaneVector
Definition of the lane's positions vector.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
NBNode * getNBNode() const
Return net build node.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
A NBNetBuilder extended by visualisation and editing capabilities.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
GNEViewParent * getViewParent() const
get the net object
unsigned int getIndex() const
returns the index of the lane
A RT-tree for efficient storing of SUMO's GL-objects.
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
GUIGlID getGlID() const
Returns the numerical id of the object.
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNet * myViewNet
the window to inform when the tls is modfied
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
static RGBColor potentialTargetColor
color for potential to-lane targets (currently unconnected)
void handleLaneClick(GNELane *lane, bool mayDefinitelyPass, bool allowConflict, bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
const std::string & getID() const
Returns the id.
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
static const std::string MODIFIED
feature has been manually modified (implies approval)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static const RGBColor GREEN
const std::set< GUIGlID > & getSelected() const
Returns the list of ids of all selected objects.
void initTargets()
init targets
GNEEdge & getParentEdge()
Returns underlying parent edge.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
static RGBColor sourceColor
color for the from-lane of a connection
static const RGBColor MAGENTA
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void p_abort()
reverts and discards ALL active command groups
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
A road/street connecting two junctions (netedit-version)
long onCmdOK(FXObject *, FXSelector, void *)
void updateDescription() const
update description
static const RGBColor YELLOW
NBNode * getToNode() const
Returns the destination node of the edge.
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints) const
Compute the shape for an internal lane.
static RGBColor conflictColor
color for a to-lane that cannot be used because another connection conflicts
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
static const RGBColor CYAN
unsigned int getTLLLinkNumber(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
std::vector< NBEdge * > EdgeVector
void buildIinternalLanes(NBNode *node)
builds internal lanes for the given node
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXLabel * myDescription
the label that shows the current editing state
void setSpecialColor(const RGBColor *Color2)
GNEJunction * getDest() const
returns the destination-junction
GNENet * getNet() const
get the net object
void handleIDs(std::vector< GUIGlID > ids, bool selectEdges, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
LaneStatus
the status of a target lane
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Represents a single node (junction) during network building.
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the Corresponding-button.
unsigned int myNumChanges
number of changes
void setStatusBarText(const std::string &text)
set staturBar text
GNELane * myCurrentLane
the lane of which connections are to be modified
~GNEConnectorFrame()
Destructor.
NBEdge * getNBEdge()
returns the internal NBEdge
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
void cleanup()
clean up when deselecting current lane
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT