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)",
134 if (!i->isDemandElementValid()) {
135 FXMessageBox::warning(getApp(), MBOX_OK,
136 "Error saving connection operations",
"%s",
137 (
"Connection edition cannot be saved because route '" + i->getID() +
"' is broken.").c_str());
162 mySelectDeadEndsButton =
new FXButton(
this,
"Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
165 mySelectDeadStartsButton =
new FXButton(
this,
"Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
168 mySelectConflictsButton =
new FXButton(
this,
"Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
171 mySelectPassingButton =
new FXButton(
this,
"Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
174 myClearSelectedButton =
new FXButton(
this,
"Clear Selected\t\tClears all connections of all selected objects",
177 myResetSelectedButton =
new FXButton(
this,
"Reset Selected\t\tRecomputes connections at all selected junctions",
187 std::vector<GNEAttributeCarrier*> deadEnds;
190 for (
auto i : edges) {
191 for (
auto j : i->getLanes()) {
192 if (i->getNBEdge()->getConnectionsFromLane(j->getIndex()).size() == 0) {
193 deadEnds.push_back(j);
204 std::vector<GNEAttributeCarrier*> deadStarts;
207 for (
auto i : junctions) {
209 for (
auto j : i->getNBNode()->getOutgoingEdges()) {
212 deadStarts.push_back(k);
216 for (
auto j : i->getNBNode()->getIncomingEdges()) {
230 std::vector<GNEAttributeCarrier*> conflicts;
233 for (
auto i : edges) {
234 const EdgeVector destinations = i->getNBEdge()->getConnectedEdges();
235 for (
auto j : destinations) {
238 const bool isConflicted = count_if(i->getNBEdge()->getConnections().begin(), i->getNBEdge()->getConnections().end(),
241 conflicts.push_back(k);
254 std::vector<GNEAttributeCarrier*> pass;
256 for (
auto i : edges) {
257 for (
auto j : i->getNBEdge()->getConnections()) {
258 if (j.mayDefinitelyPass) {
259 pass.push_back(i->getLanes()[j.fromLane]);
274 for (
auto i : junctions) {
280 for (
auto i : edges) {
281 for (
auto j : i->getLanes()) {
287 for (
auto i : lanes) {
300 for (
auto i : junctions) {
329 myPotentialTargetColor(
RGBColor(0, 64, 0, 255)),
330 myTargetPassColor(
RGBColor::MAGENTA),
392 GNEFrame(horizontalFrameParent, viewNet,
"Edit Connections"),
455 bool changed =
false;
494 }
else if ((fromPermissions & toPermissions) == 0) {
518 for (
auto it_lane : edge->
getLanes()) {
547 it->setSpecialColor(0);
550 myPotentialTargets.clear();
564 const int toIndex = targetLane->
getIndex();
565 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
566 connections.begin(), connections.end(),
568 const bool isConnected = con_it != connections.end();
570 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
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
begin/end of the description of a junction
void update() const
Mark the entire GNEViewNet to be repainted later.
bool controlKeyPressed() const
check if CONTROL key was pressed during click
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
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)
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
FXButton * myResetSelectedButton
"Reset Selected"
GNEViewNet * getViewNet() const
get view net
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)
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
GNEViewNet * myViewNet
View Net.
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
NBEdge * getNBEdge() const
returns the internal NBEdge
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
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.
#define GUIDesignCheckButton
checkButton placed in left position
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.
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
~ConnectionLegend()
destructor
class used to group all variables related with objects under cursor after a click over view ...
FXButton * mySelectConflictsButton
"Select Conflicts" button
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
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_NMODE_SELECT
const GNEViewNetHelper::KeyPressed & getKeyPressed() const
get Key Pressed modul
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
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
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)
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
ConnectionModifications()
FOX needs this.
select lanes that are connected from concurrent lanes
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
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...
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
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.
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
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
~ConnectionSelection()
destructor
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.