56 #ifdef CHECK_MEMORY_LEAKS 58 #endif // CHECK_MEMORY_LEAKS 76 FXIMPLEMENT(
GNEConnectorFrame, FXScrollWindow, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
91 GNEFrame(parent, viewNet, "Edit Connections"),
94 myDescription =
new FXLabel(myContentFrame,
"", 0, JUSTIFY_LEFT);
95 new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
100 new FXButton(myContentFrame,
"Cancel\t\tDiscard connection modifications (Esc)", 0,
this,
MID_CANCEL,
101 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
102 0, 0, 0, 0, 4, 4, 3, 3);
104 new FXButton(myContentFrame,
"OK\t\tSave connection modifications (Enter)", 0,
this,
MID_OK,
105 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
106 0, 0, 0, 0, 4, 4, 3, 3);
107 new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
109 new FXButton(myContentFrame,
110 "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
112 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
113 0, 0, 0, 0, 4, 4, 3, 3);
115 new FXButton(myContentFrame,
116 "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
118 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
119 0, 0, 0, 0, 4, 4, 3, 3);
121 new FXButton(myContentFrame,
122 "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
124 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
125 0, 0, 0, 0, 4, 4, 3, 3);
127 new FXButton(myContentFrame,
128 "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
130 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
131 0, 0, 0, 0, 4, 4, 3, 3);
133 new FXButton(myContentFrame,
134 "Clear Selected\t\tClears all connections of all selected objects",
136 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
137 0, 0, 0, 0, 4, 4, 3, 3);
139 new FXButton(myContentFrame,
140 "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
142 ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
143 0, 0, 0, 0, 4, 4, 3, 3);
145 new FXHorizontalSeparator(
this, SEPARATOR_GROOVE | LAYOUT_FILL_X);
147 new FXLabel(myContentFrame,
"Hold <SHIFT> while\nclicking to create\nunyielding conn's.\n", 0, JUSTIFY_LEFT);
148 new FXLabel(myContentFrame,
"Hold <CTRL> while\nclicking to create\nconflicting conn's.\n", 0, JUSTIFY_LEFT);
152 potentialTargetColor =
RGBColor(0, 64, 0, 255);
157 new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
159 new FXLabel(myContentFrame,
"Color Legend:", 0, JUSTIFY_LEFT);
160 l =
new FXLabel(myContentFrame,
"Source", 0, JUSTIFY_LEFT);
162 l =
new FXLabel(myContentFrame,
"Target", 0, JUSTIFY_LEFT);
164 l =
new FXLabel(myContentFrame,
"Possible Target", 0, JUSTIFY_LEFT);
166 l =
new FXLabel(myContentFrame,
"Target (pass)", 0, JUSTIFY_LEFT);
168 l =
new FXLabel(myContentFrame,
"Conflict", 0, JUSTIFY_LEFT);
180 FXScrollWindow::show();
189 FXScrollWindow::hide();
209 bool changed =
false;
278 std::vector<GUIGlID> selectIDs;
281 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
283 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
284 if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
285 selectIDs.push_back((*it_lane)->getGlID());
297 std::set<GUIGlID> selectIDs;
300 for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
302 const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
303 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
306 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
307 selectIDs.insert(*lid_it);
311 const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
312 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
315 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
316 for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
319 selectIDs.erase(approachedLane->
getGlID());
324 std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
332 std::vector<GUIGlID> selectIDs;
335 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
336 NBEdge* nbe = (*edge_it)->getNBEdge();
338 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
339 for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
342 for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
343 const bool isConflicted = count_if(
344 connections.begin(), connections.end(),
347 selectIDs.push_back((*it_lane)->getGlID());
360 std::vector<GUIGlID> selectIDs;
362 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
365 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
366 for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
367 if (it->mayDefinitelyPass) {
369 selectIDs.push_back(lane->
getGlID());
383 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
396 for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
429 for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
436 throw ProcessError(
"Wrong object type returned from gIDStorage");
463 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
466 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
497 (*it)->setSpecialColor(0);
512 const int toIndex = targetLane->
getIndex();
513 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
514 connections.begin(), connections.end(),
516 const bool isConnected = con_it != connections.end();
518 if (con_it->mayDefinitelyPass) {
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
static RGBColor targetColor
color for the to-lane of a connection
const std::set< GUIGlID > & getSelected() const
Returns the list of ids of all selected objects.
A structure which describes a connection between edges or lanes.
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 *)
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)
GNEViewParent * getViewParent() const
get the net object
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 vector.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connectino
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...
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
GNEViewNet * myViewNet
the window to inform when the tls is modfied
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
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...
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
static const std::string MODIFIED
feature has been manually modified (implies approval)
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
static const RGBColor GREEN
int myNumChanges
number of changes
void initTargets()
init targets
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
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.
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
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
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void p_abort()
reverts and discards ALL active command groups
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
A road/street connecting two junctions (netedit-version)
long onCmdOK(FXObject *, FXSelector, void *)
static const RGBColor YELLOW
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
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
const std::vector< Connection > & getConnections() const
Returns the connections.
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
std::vector< NBEdge * > EdgeVector
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)
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
GNENet * getNet() const
get the net object
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
void setStatusBarText(const std::string &text)
set staturBar text
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
GNELane * myCurrentLane
the lane of which connections are to be modified
GNEConnection * retrieveConnection(int fromLane, NBEdge *to, int toLane)
get connection
~GNEConnectorFrame()
Destructor.
NBEdge * getNBEdge()
returns the internal NBEdge
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
NBNode * getNBNode() const
Return net build node.
GUISelectedStorage gSelected
A global holder of selected objects.
void cleanup()
clean up when deselecting current lane
void updateDescription() const
update description
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)