68 myCurrentLaneLabel =
new FXLabel(getCollapsableFrame(),
"No lane selected", 0,
GUIDesignLabelLeft);
78 myCurrentLaneLabel->setText(
TL(
"No lane selected"));
80 myCurrentLaneLabel->setText((std::string(
"Current Lane: ") + laneID).c_str());
90 myConnectorFrameParent(connectorFrameParent) {
109 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
110 myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
111 if (myConnectorFrameParent->myNumChanges) {
112 myConnectorFrameParent->getViewNet()->setStatusBarText(
"Changes reverted");
114 myConnectorFrameParent->cleanup();
115 myConnectorFrameParent->getViewNet()->updateViewNet();
123 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
125 if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
126 for (
const auto& i : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
128 FXMessageBox::warning(getApp(), MBOX_OK,
129 "Error saving connection operations",
"%s",
130 (
"Connection edition cannot be saved because route '" + i->getID() +
"' is broken.").c_str());
136 myConnectorFrameParent->getViewNet()->getUndoList()->end();
137 if (myConnectorFrameParent->myNumChanges) {
138 myConnectorFrameParent->getViewNet()->setStatusBarText(
"Changes accepted");
140 myConnectorFrameParent->cleanup();
141 myConnectorFrameParent->getViewNet()->updateViewNet();
152 myConnectorFrameParent(connectorFrameParent) {
181 std::vector<GNEAttributeCarrier*> deadEnds;
183 for (
const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
184 for (
const auto& lane : edge.second->getLanes()) {
185 if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
186 deadEnds.push_back(lane);
198 std::set<GNEAttributeCarrier*> deadStarts;
201 for (
const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
203 for (
const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
204 for (
const auto& lane : outgoingEdge->getLanes()) {
205 deadStarts.insert(lane);
209 for (
const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
210 for (
const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
215 std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
223 std::vector<GNEAttributeCarrier*> conflicts;
225 for (
const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
226 const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
227 for (
const auto& destination : destinations) {
229 for (
const auto& lane : dest->
getLanes()) {
230 const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
233 conflicts.push_back(lane);
246 std::vector<GNEAttributeCarrier*> pass;
247 for (
const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
248 for (
const auto& connection : edge.second->getNBEdge()->getConnections()) {
249 if (connection.mayDefinitelyPass) {
250 pass.push_back(edge.second->getLanes()[connection.fromLane]);
261 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
264 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
265 for (
const auto& junction : selectedJunctions) {
266 junction->setLogicValid(
false, myConnectorFrameParent->getViewNet()->getUndoList());
270 const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
271 for (
const auto& edge : selectedEdges) {
272 for (
const auto& lane : edge->getLanes()) {
273 myConnectorFrameParent->removeConnections(lane);
277 const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
278 for (
const auto& lane : selectedLanes) {
279 myConnectorFrameParent->removeConnections(lane);
281 myConnectorFrameParent->getViewNet()->getUndoList()->end();
288 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
289 myConnectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::CONNECTION,
"reset connections from selected lanes");
290 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
291 for (
const auto& junction : selectedJunctions) {
292 junction->setLogicValid(
false, myConnectorFrameParent->getViewNet()->getUndoList());
294 myConnectorFrameParent->getViewNet()->getUndoList()->end();
295 if (selectedJunctions.size() > 0) {
296 auto viewNet = myConnectorFrameParent->getViewNet();
297 viewNet->getNet()->requireRecompute();
298 viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
354 GNEFrame(viewParent, viewNet,
"Edit Connections"),
382 for (
const auto& lane : objectsUnderCursor.
getLanes()) {
427 bool changed =
false;
449 if (mayDefinitelyPass) {
472 }
else if ((fromPermissions & toPermissions) == 0) {
496 for (
const auto& lane : edge->
getLanes()) {
525 it->setSpecialColor(0);
542 const int toIndex = targetLane->
getIndex();
543 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
544 connections.begin(), connections.end(),
546 const bool isConnected = con_it != connections.end();
548 if (con_it->mayDefinitelyPass) {
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CANCEL
Cancel-button pressed.
@ MID_CHOOSEN_CLEAR
Clear set.
@ MID_OK
Ok-button pressed.
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
@ MID_CHOOSEN_RESET
Reset set.
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
#define GUIDesignLabelLeft
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_CONNECTION
connectio between two lanes
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string getID() const
get ID (all Attribute Carriers have one)
GNENet * getNet() const
get pointer to net
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
~ConnectionModifications()
destructor
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXButton * mySaveButton
"OK" button
FXButton * myCancelButton
"Cancel" button
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
~ConnectionOperations()
destructor
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
FXButton * mySelectConflictsButton
"Select Conflicts" button
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
FXButton * myClearSelectedButton
"Clear Selected"
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
FXButton * myResetSelectedButton
"Reset Selected"
FXButton * mySelectPassingButton
"Select Edges which may always pass"
~ConnectionSelection()
destructor
FXLabel * myHoldShiftLabel
Selection Hint.
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
FXLabel * myHoldControlLabel
hold control label
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Legend(GNEConnectorFrame *connectorFrameParent)
constructor
int myNumChanges
number of changes
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
void cleanup()
clean up when deselecting current lane
void initTargets()
init targets
GNEConnectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
GNEConnectorFrame::ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
GNEConnectorFrame::Legend * myLegend
Legend modul.
void buildConnection(GNELane *lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
~GNEConnectorFrame()
Destructor.
void removeConnections(GNELane *lane)
remove connections
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, const GNELane *targetLane) const
return the status of toLane
GNEConnectorFrame::ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
LaneStatus
the status of a target lane
GNEConnectorFrame::ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
CurrentLane * myCurrentLane
CurrentLane modul.
A road/street connecting two junctions (netedit-version)
NBEdge * getNBEdge() const
returns the internal NBEdge
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
FOX need this.
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
NBNode * getNBNode() const
Return net build node.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
int getIndex() const
returns the index of the lane
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
GNEEdge * getParentEdge() const
get parent edge
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
A NBNetBuilder extended by visualisation and editing capabilities.
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEViewNet * getViewNet() const
get view net
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used to group all variables related with objects under cursor after a click over view
const std::vector< GNELane * > & getLanes() const
get lanes
GNELane * getLaneFrontNonLocked() const
get front lane or a pointer to nullptr checking if is locked
GNENet * getNet() const
get the net object
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set statusBar text
A single child window which contains a view of the simulation area.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
static const NBConnection InvalidConnection
The representation of a single edge during network building.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Represents a single node (junction) during network building.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
static const RGBColor WHITE
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
A structure which describes a connection between edges or lanes.
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
int tlLinkIndex
The index of this connection within the controlling traffic light.