70 FXIMPLEMENT(
GNEConnectorFrame, FXVerticalFrame, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
85 GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"),
98 myCancelButton =
new FXButton(myGroupBoxModifications,
"Cancel\t\tDiscard connection modifications (Esc)",
101 mySaveButton =
new FXButton(myGroupBoxModifications,
"OK\t\tSave connection modifications (Enter)",
108 mySelectDeadEndsButton =
new FXButton(myGroupBoxOperations,
"Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
111 mySelectDeadStartsButton =
new FXButton(myGroupBoxOperations,
"Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
114 mySelectConflictsButton =
new FXButton(myGroupBoxOperations,
"Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
117 mySelectPassingButton =
new FXButton(myGroupBoxOperations,
"Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
120 myClearSelectedButton =
new FXButton(myGroupBoxOperations,
"Clear Selected\t\tClears all connections of all selected objects",
123 myResetSelectedButton =
new FXButton(myGroupBoxOperations,
"Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
130 myHoldShiftLabel =
new FXLabel(myGroupBoxSelection,
"Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0,
GUIDesignLabelFrameInformation);
131 myHoldControlLabel =
new FXLabel(myGroupBoxSelection,
"Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper nodes)", 0,
GUIDesignLabelFrameInformation);
135 potentialTargetColor =
RGBColor(0, 64, 0, 255);
153 myPossibleTargetLabel =
new FXLabel(myGroupBoxLegend,
"Possible Target", 0,
GUIDesignLabelLeft);
157 myTargetPassLabel =
new FXLabel(myGroupBoxLegend,
"Target (pass)", 0,
GUIDesignLabelLeft);
183 bool changed =
false;
251 std::vector<GUIGlID> selectIDs;
254 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
256 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
257 if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
258 selectIDs.push_back((*it_lane)->getGlID());
270 std::set<GUIGlID> selectIDs;
273 for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
275 const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
276 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
279 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
280 selectIDs.insert(*lid_it);
284 const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
285 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
288 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
289 for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
292 selectIDs.erase(approachedLane->
getGlID());
297 std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
305 std::vector<GUIGlID> selectIDs;
308 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
309 NBEdge* nbe = (*edge_it)->getNBEdge();
311 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
312 for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
315 for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
316 const bool isConflicted = count_if(
317 connections.begin(), connections.end(),
320 selectIDs.push_back((*it_lane)->getGlID());
333 std::vector<GUIGlID> selectIDs;
335 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
338 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
339 for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
340 if (it->mayDefinitelyPass) {
342 selectIDs.push_back(lane->
getGlID());
356 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
369 for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
402 for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
409 throw ProcessError(
"Wrong object type returned from gIDStorage");
434 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
437 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
468 (*it)->setSpecialColor(0);
483 const int toIndex = targetLane->
getIndex();
484 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
485 connections.begin(), connections.end(),
487 const bool isConnected = con_it != connections.end();
489 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
A structure which describes a connection between edges or lanes.
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=GUESSED)
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
GNEJunction * getGNEJunctionSource() const
returns the source-junction
begin/end of the description of a junction
begin/end of the description of a single lane
select lanes that have no connection leading to it
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
long onCmdSelectPass(FXObject *, FXSelector, void *)
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
connectio between two lanes
The representation of a single edge during network building.
std::vector< GNELane * > LaneVector
Definition of the lane's vector.
NBNode * getNBNode() const
Return net build node.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
select lanes with connections that have the pass attribute set to 'true'
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...
void handleIDs(std::vector< GUIGlID > ids, bool selectEdgesEnabled, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
GNEViewParent * getViewParent() const
get the net object
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
int getIndex() const
returns the index of the lane
GUIGlID getGlID() const
Returns the numerical id of the object.
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNet * myViewNet
View Net for changes.
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 (The edges which start at this node)
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)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static const RGBColor GREEN
int myNumChanges
number of changes
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
void initTargets()
init targets
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
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
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
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 *)
void updateDescription() const
update description
static const RGBColor YELLOW
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
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
select lanes that are connected from concurrent lanes
void setSpecialColor(const RGBColor *Color2)
FXLabel * myLaneDescriptionLabel
the label that shows the current editing state
GNENet * getNet() const
get the net object
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.
void setStatusBarText(const std::string &text)
set staturBar text
GNELane * myCurrentLane
the lane of which connections are to be modified
~GNEConnectorFrame()
Destructor.
#define GUIDesignLabelLeft
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.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void cleanup()
clean up when deselecting current lane
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction