 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
85 myCurrentLaneLabel->setText(
"No lane selected");
87 myCurrentLaneLabel->setText((std::string(
"Current Lane: ") + laneID).c_str());
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)",
116 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
117 myConnectorFrameParent->getViewNet()->getUndoList()->p_abort();
118 if (myConnectorFrameParent->myNumChanges) {
119 myConnectorFrameParent->getViewNet()->setStatusBarText(
"Changes reverted");
121 myConnectorFrameParent->cleanup();
122 myConnectorFrameParent->getViewNet()->update();
130 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
132 if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
133 for (
const auto& i : myConnectorFrameParent->myCurrentEditedLane->getParentEdge().getDemandElementChildren()) {
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());
143 myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
144 if (myConnectorFrameParent->myNumChanges) {
145 myConnectorFrameParent->getViewNet()->setStatusBarText(
"Changes accepted");
147 myConnectorFrameParent->cleanup();
148 myConnectorFrameParent->getViewNet()->update();
159 myConnectorFrameParent(connectorFrameParent) {
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;
189 const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
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;
206 const std::vector<GNEJunction*> junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions();
207 for (
auto i : junctions) {
209 for (
auto j : i->getNBNode()->getOutgoingEdges()) {
212 deadStarts.push_back(k);
216 for (
auto j : i->getNBNode()->getIncomingEdges()) {
219 deadStarts.push_back(myConnectorFrameParent->getViewNet()->getNet()->retrieveEdge(k.toEdge->getID())->getLanes()[k.toLane]);
230 std::vector<GNEAttributeCarrier*> conflicts;
232 const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
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;
255 const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
256 for (
auto i : edges) {
257 for (
auto j : i->getNBEdge()->getConnections()) {
258 if (j.mayDefinitelyPass) {
259 pass.push_back(i->getLanes()[j.fromLane]);
270 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
271 myConnectorFrameParent->getViewNet()->getUndoList()->p_begin(
"clear connections from selected lanes, edges and " +
toString(
SUMO_TAG_JUNCTION) +
"s");
273 auto junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions(
true);
274 for (
auto i : junctions) {
275 i->setLogicValid(
false, myConnectorFrameParent->getViewNet()->getUndoList());
279 auto edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges(
true);
280 for (
auto i : edges) {
281 for (
auto j : i->getLanes()) {
282 myConnectorFrameParent->removeConnections(j);
286 auto lanes = myConnectorFrameParent->getViewNet()->getNet()->retrieveLanes(
true);
287 for (
auto i : lanes) {
288 myConnectorFrameParent->removeConnections(dynamic_cast<GNELane*>(i));
290 myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
297 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
298 myConnectorFrameParent->getViewNet()->getUndoList()->p_begin(
"reset connections from selected lanes");
299 auto junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions(
true);
300 for (
auto i : junctions) {
301 i->setLogicValid(
false, myConnectorFrameParent->getViewNet()->getUndoList());
303 myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
329 myPotentialTargetColor(
RGBColor(0, 64, 0, 255)),
330 myTargetPassColor(
RGBColor::MAGENTA),
360 return mySourceColor;
366 return myTargetColor;
372 return myPotentialTargetColor;
378 return myTargetPassColor;
384 return myConflictColor;
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);
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) {
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
const static NBConnection InvalidConnection
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
RGBColor myTargetColor
color for the to-lane of a connection
FXButton * mySelectConflictsButton
"Select Conflicts" button
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
~GNEConnectorFrame()
Destructor.
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
select lanes that have no connection leading to it
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
FXLabel * myPossibleTargetLabel
possible target label
const std::string getID() const
function to support debugging
void removeConnections(GNELane *lane)
remove connections
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
~ConnectionOperations()
destructor
ConnectionOperations()
FOX needs this.
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
ConnectionModifications()
FOX needs this.
~ConnectionSelection()
destructor
bool controlKeyPressed() const
check if CONTROL key was pressed during click
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const RGBColor & getPotentialTargetColor() const
get color for potential to-lane targets (currently unconnected)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
void setStatusBarText(const std::string &text)
set staturBar text
~ConnectionLegend()
destructor
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
const RGBColor & getTargetColor() const
get color for the to-lane of a connection
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
The representation of a single edge during network building.
CurrentLane * myCurrentLane
CurrentLane modul.
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
int getIndex() const
returns the index of the lane
A road/street connecting two junctions (netedit-version)
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
GNENet * getNet() const
get the net object
NBNode * getNBNode() const
Return net build node.
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
select lanes that are connected from concurrent lanes
const RGBColor & getSourceColor() const
get color for the from-lane of a connection
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
FXButton * myResetSelectedButton
"Reset Selected"
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
void initTargets()
init targets
NBEdge * getNBEdge() const
returns the internal NBEdge
class used to group all variables related with objects under cursor after a click over view
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
FXButton * mySaveButton
"OK" button
int myNumChanges
number of changes
FXLabel * myTargetPassLabel
target pass label
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
FXButton * myCancelButton
"Cancel" button
GNEEdge & getParentEdge()
Returns underlying parent edge.
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
LaneStatus
the status of a target lane
#define GUIDesignLabelLeft
const GNEViewNetHelper::KeyPressed & getKeyPressed() const
get Key Pressed modul
FXLabel * myHoldControlLabel
hold control label
#define GUIDesignCheckButton
checkButton placed in left position
GNEViewNet * myViewNet
View Net.
GNEUndoList * getUndoList() const
get the undoList object
void cleanup()
clean up when deselecting current lane
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
const RGBColor & getTargetPassColor() const
get color for the to-lane of a connection with pass attribute
RGBColor myPotentialTargetColor
color for potential to-lane targets (currently unconnected)
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
GNEJunction * getGNEJunctionSource() const
returns the source-junction
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
FXLabel * myTargetLabel
target label
select lanes with connections that have the pass attribute set to 'true'
GNENet * getNet() const
get Net in which this element is placed
FXLabel * myHoldShiftLabel
Selection Hint.
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
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...
connectio between two lanes
FXButton * myClearSelectedButton
"Clear Selected"
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
FXButton * mySelectPassingButton
"Select Edges which may always pass"
~ConnectionModifications()
destructor
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
C++ TraCI client API implementation.
const RGBColor & getConflictColor() const
get color for a to-lane that cannot be used because another connection conflicts
RGBColor myConflictColor
color for a to-lane that cannot be used because another connection conflicts
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Represents a single node (junction) during network building.
RGBColor mySourceColor
color for the from-lane of a connection
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
A structure which describes a connection between edges or lanes.
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...
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
FXLabel * mySourceLabel
source label
FXLabel * myConflictLabel
conflict label
const std::vector< Connection > & getConnections() const
Returns the connections.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
begin/end of the description of a junction