71 FXIMPLEMENT(
GNEConnectorFrame, FXVerticalFrame, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
86 GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"),
92 myLaneDescriptionLabel =
new FXLabel(myGroupBoxDescription,
"", 0,
GUIDesignLabelLeft);
99 myCancelButton =
new FXButton(myGroupBoxModifications,
"Cancel\t\tDiscard connection modifications (Esc)",
102 mySaveButton =
new FXButton(myGroupBoxModifications,
"OK\t\tSave connection modifications (Enter)",
109 mySelectDeadEndsButton =
new FXButton(myGroupBoxOperations,
"Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
112 mySelectDeadStartsButton =
new FXButton(myGroupBoxOperations,
"Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
115 mySelectConflictsButton =
new FXButton(myGroupBoxOperations,
"Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
118 mySelectPassingButton =
new FXButton(myGroupBoxOperations,
"Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
121 myClearSelectedButton =
new FXButton(myGroupBoxOperations,
"Clear Selected\t\tClears all connections of all selected objects",
124 myResetSelectedButton =
new FXButton(myGroupBoxOperations,
"Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
131 myHoldShiftLabel =
new FXLabel(myGroupBoxSelection,
"Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0,
GUIDesignLabelLeft);
132 myHoldControlLabel =
new FXLabel(myGroupBoxSelection,
"Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper nodes)", 0,
GUIDesignLabelLeft);
136 potentialTargetColor =
RGBColor(0, 64, 0, 255);
154 myPossibleTargetLabel =
new FXLabel(myGroupBoxLegend,
"Possible Target", 0,
GUIDesignLabelLeft);
158 myTargetPassLabel =
new FXLabel(myGroupBoxLegend,
"Target (pass)", 0,
GUIDesignLabelLeft);
184 bool changed =
false;
252 std::vector<GUIGlID> selectIDs;
255 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
257 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
258 if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
259 selectIDs.push_back((*it_lane)->getGlID());
271 std::set<GUIGlID> selectIDs;
274 for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
276 const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
277 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
280 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
281 selectIDs.insert(*lid_it);
285 const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
286 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
289 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
290 for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
293 selectIDs.erase(approachedLane->
getGlID());
298 std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
306 std::vector<GUIGlID> selectIDs;
309 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
310 NBEdge* nbe = (*edge_it)->getNBEdge();
312 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
313 for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
316 for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
317 const bool isConflicted = count_if(
318 connections.begin(), connections.end(),
321 selectIDs.push_back((*it_lane)->getGlID());
334 std::vector<GUIGlID> selectIDs;
336 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
339 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
340 for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
341 if (it->mayDefinitelyPass) {
343 selectIDs.push_back(lane->
getGlID());
357 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
370 for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
403 for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
410 throw ProcessError(
"Wrong object type returned from gIDStorage");
435 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
438 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
469 (*it)->setSpecialColor(0);
484 const int toIndex = targetLane->
getIndex();
485 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
486 connections.begin(), connections.end(),
488 const bool isConnected = con_it != connections.end();
490 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.
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
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
select lanes that are connected from concurrent lanes
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
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
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
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
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 (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
void p_abort()
reverts and discards ALL active command groups
select lanes with connections that have the pass attribute set to 'true'
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.
void setSpecialColor(const RGBColor *Color2)
select lanes that have no connection leading to it
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