97 myConnectorFrameParent(connectorFrameParent) {
100 myCancelButton =
new FXButton(
this,
"Cancel\t\tDiscard connection modifications (Esc)",
103 mySaveButton =
new FXButton(
this,
"OK\t\tSave connection modifications (Enter)",
147 mySelectDeadEndsButton =
new FXButton(
this,
"Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
150 mySelectDeadStartsButton =
new FXButton(
this,
"Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
153 mySelectConflictsButton =
new FXButton(
this,
"Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
156 mySelectPassingButton =
new FXButton(
this,
"Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
159 myClearSelectedButton =
new FXButton(
this,
"Clear Selected\t\tClears all connections of all selected objects",
162 myResetSelectedButton =
new FXButton(
this,
"Reset Selected\t\tRecomputes connections at all selected junctions",
172 std::vector<GNEAttributeCarrier*> deadEnds;
175 for (
auto i : edges) {
176 for (
auto j : i->getLanes()) {
177 if (i->getNBEdge()->getConnectionsFromLane(j->getIndex()).size() == 0) {
178 deadEnds.push_back(j);
189 std::vector<GNEAttributeCarrier*> deadStarts;
192 for (
auto i : junctions) {
194 for (
auto j : i->getNBNode()->getOutgoingEdges()) {
197 deadStarts.push_back(k);
201 for (
auto j : i->getNBNode()->getIncomingEdges()) {
215 std::vector<GNEAttributeCarrier*> conflicts;
218 for (
auto i : edges) {
219 const EdgeVector destinations = i->getNBEdge()->getConnectedEdges();
220 for (
auto j : destinations) {
223 const bool isConflicted = count_if(i->getNBEdge()->getConnections().begin(), i->getNBEdge()->getConnections().end(),
226 conflicts.push_back(k);
239 std::vector<GNEAttributeCarrier*> pass;
241 for (
auto i : edges) {
242 for (
auto j : i->getNBEdge()->getConnections()) {
243 if (j.mayDefinitelyPass) {
244 pass.push_back(i->getLanes()[j.fromLane]);
259 for (
auto i : junctions) {
265 for (
auto i : edges) {
266 for (
auto j : i->getLanes()) {
272 for (
auto i : lanes) {
285 for (
auto i : junctions) {
314 myPotentialTargetColor(
RGBColor(0, 64, 0, 255)),
315 myTargetPassColor(
RGBColor::MAGENTA),
377 GNEFrame(horizontalFrameParent, viewNet,
"Edit Connections"),
440 bool changed =
false;
479 }
else if ((fromPermissions & toPermissions) == 0) {
503 for (
auto it_lane : edge->
getLanes()) {
532 it->setSpecialColor(0);
535 myPotentialTargets.clear();
549 const int toIndex = targetLane->
getIndex();
550 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
551 connections.begin(), connections.end(),
553 const bool isConnected = con_it != connections.end();
555 if (con_it->mayDefinitelyPass) {
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
A structure which describes a connection between edges or lanes.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
FXLabel * myTargetPassLabel
target pass label
select lanes that have no connection leading to it
const KeyPressed & getKeyPressed() const
get Key Pressed modul
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
begin/end of the description of a junction
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
const RGBColor & getSourceColor() const
get color for the from-lane of a connection
void handleIDs(const std::vector< GNEAttributeCarrier *> &ACs, ModificationMode::SetOperation setop=ModificationMode::SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
static const NBConnection InvalidConnection
FXButton * myClearSelectedButton
"Clear Selected"
connectio between two lanes
RGBColor myConflictColor
color for a to-lane that cannot be used because another connection conflicts
GNEViewParent * getViewParent() const
get the net object
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
The representation of a single edge during network building.
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
FXButton * mySelectPassingButton
"Select Edges which may always pass"
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
FXLabel * myHoldControlLabel
hold control label
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...
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
FXButton * myResetSelectedButton
"Reset Selected"
GNEViewNet * getViewNet() const
get view net
void handleLaneClick(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
FXButton * myCancelButton
"Cancel" button
RGBColor myPotentialTargetColor
color for potential to-lane targets (currently unconnected)
FXLabel * myCurrentLaneLabel
Label for current Lane.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
GNEViewNet * myViewNet
View Net for changes.
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
FXLabel * myConflictLabel
conflict label
select lanes with connections that have the pass attribute set to 'true'
RGBColor myTargetColor
color for the to-lane of a connection
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
int myNumChanges
number of changes
void initTargets()
init targets
RGBColor mySourceColor
color for the from-lane of a connection
~ConnectionModifications()
destructor
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
GNEEdge & getParentEdge()
Returns underlying parent edge.
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
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.
FXLabel * myPossibleTargetLabel
possible target label
void removeConnections(GNELane *lane)
remove connections
~ConnectionOperations()
destructor
FXLabel * mySourceLabel
source label
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
FXLabel * myTargetLabel
target label
const RGBColor & getTargetPassColor() const
get color for the to-lane of a connection with pass attribute
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
C++ TraCI client API implementation.
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
~ConnectionLegend()
destructor
FXButton * mySelectConflictsButton
"Select Conflicts" button
bool controlKeyPressed() const
check if CONTROL key was pressed during click
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
const RGBColor & getPotentialTargetColor() const
get color for potential to-lane targets (currently unconnected)
FXLabel * myHoldShiftLabel
Selection Hint.
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
const RGBColor & getTargetColor() const
get color for the to-lane of a connection
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
const std::string getID() const
function to support debugging
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
GNEJunction * getGNEJunctionSource() const
returns the source-junction
void p_abort()
reverts and discards ALL active command groups
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
const RGBColor & getConflictColor() const
get color for a to-lane that cannot be used because another connection conflicts
ConnectionOperations()
FOX needs this.
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
A road/street connecting two junctions (netedit-version)
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
ConnectionModifications()
FOX needs this.
select lanes that are connected from concurrent lanes
void buildConnection(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::vector< GNELane * > & getLanes()
returns a reference to the lane vector
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
const std::vector< Connection > & getConnections() const
Returns the connections.
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
void setSpecialColor(const RGBColor *Color2)
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
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.
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
void setStatusBarText(const std::string &text)
set staturBar text
~GNEConnectorFrame()
Destructor.
#define GUIDesignLabelLeft
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
NBEdge * getNBEdge()
returns the internal NBEdge
~ConnectionSelection()
destructor
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
NBNode * getNBNode() const
Return net build node.
FXButton * mySaveButton
"OK" button
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void cleanup()
clean up when deselecting current lane
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
CurrentLane * myCurrentLane
CurrentLane modul.