76 myCurrentLaneLabel =
new FXLabel(getCollapsableFrame(),
TL(
"No lane selected"), 0,
GUIDesignLabel(JUSTIFY_LEFT));
86 myCurrentLaneLabel->setText(
TL(
"No lane selected"));
88 myCurrentLaneLabel->setText((std::string(
TL(
"Current Lane: ")) + laneID).c_str());
98 myConnectorFrameParent(connectorFrameParent) {
117 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
118 myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
119 if (myConnectorFrameParent->myNumChanges) {
120 myConnectorFrameParent->getViewNet()->setStatusBarText(
TL(
"Changes reverted"));
122 myConnectorFrameParent->cleanup();
123 myConnectorFrameParent->getViewNet()->updateViewNet();
131 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
133 if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
134 for (
const auto& demandElement : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
138 TL(
"Error saving connection operations"),
139 TLF(
"Connection edition cannot be saved because route '%s' is broken.", demandElement->getID()));
145 myConnectorFrameParent->getViewNet()->getUndoList()->end();
146 if (myConnectorFrameParent->myNumChanges) {
147 myConnectorFrameParent->getViewNet()->setStatusBarText(
TL(
"Changes accepted"));
149 myConnectorFrameParent->cleanup();
151 myConnectorFrameParent->getViewNet()->getNet()->requireRecompute();
162 myConnectorFrameParent(connectorFrameParent) {
191 std::vector<GNEAttributeCarrier*> deadEnds;
193 for (
const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
194 for (
const auto& lane : edge.second->getChildLanes()) {
195 if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
196 deadEnds.push_back(lane);
201 myConnectorFrameParent->getViewNet()->updateViewNet();
209 std::set<GNEAttributeCarrier*> deadStarts;
212 for (
const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
214 for (
const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
215 for (
const auto& lane : outgoingEdge->getChildLanes()) {
216 deadStarts.insert(lane);
220 for (
const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
221 for (
const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
226 std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
228 myConnectorFrameParent->getViewNet()->updateViewNet();
235 std::vector<GNEAttributeCarrier*> conflicts;
237 for (
const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
238 const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
239 for (
const auto& destination : destinations) {
242 const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
245 conflicts.push_back(lane);
252 myConnectorFrameParent->getViewNet()->updateViewNet();
259 std::vector<GNEAttributeCarrier*> pass;
260 for (
const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
261 for (
const auto& connection : edge.second->getNBEdge()->getConnections()) {
262 if (connection.mayDefinitelyPass) {
263 pass.push_back(edge.second->getChildLanes()[connection.fromLane]);
268 myConnectorFrameParent->getViewNet()->updateViewNet();
275 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
276 myConnectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::CONNECTION,
TL(
"clear connections from selected lanes, edges and junctions"));
279 for (
const auto& junction : selectedJunctions) {
280 junction->setLogicValid(
false, myConnectorFrameParent->getViewNet()->getUndoList());
284 const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
285 for (
const auto& edge : selectedEdges) {
286 for (
const auto& lane : edge->getChildLanes()) {
287 myConnectorFrameParent->removeConnections(lane);
291 const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
292 for (
const auto& lane : selectedLanes) {
293 myConnectorFrameParent->removeConnections(lane);
295 myConnectorFrameParent->getViewNet()->getUndoList()->end();
296 myConnectorFrameParent->getViewNet()->updateViewNet();
303 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
304 myConnectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::CONNECTION,
TL(
"reset connections from selected lanes"));
305 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
306 for (
const auto& junction : selectedJunctions) {
307 junction->setLogicValid(
false, myConnectorFrameParent->getViewNet()->getUndoList());
309 myConnectorFrameParent->getViewNet()->getUndoList()->end();
310 if (selectedJunctions.size() > 0) {
311 auto viewNet = myConnectorFrameParent->getViewNet();
312 viewNet->getNet()->requireRecompute();
313 viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
315 myConnectorFrameParent->getViewNet()->updateViewNet();
325 myConnectorFrameParent(connectorFrameParent) {
345 if (myConnectorFrameParent->getViewNet()->getNetworkViewOptions().menuCheckShowConnections->amChecked()) {
346 myToggleVisibleInInspectMode->setCheck(TRUE, FALSE);
348 myToggleVisibleInInspectMode->setCheck(FALSE, FALSE);
355 return myToggleVisibleInInspectMode->getCheck() == TRUE;
361 return myToggleHideOtherSources->getCheck() == TRUE;
367 return myToggleInspectConnectionsCheckbutton->getCheck() == TRUE;
372 return myConnectorFrameParent->getViewNet()->onCmdToggleShowConnections(obj, sel, ptr);
378 myConnectorFrameParent->getViewNet()->updateViewNet();
385 myConnectorFrameParent->getViewNet()->updateViewNet();
440 GNEFrame(viewParent, viewNet,
TL(
"Edit Connections")),
475 for (
const auto& lane : viewObjects.
getLanes()) {
477 if (lane->getParentEdge()->isMarkedForDrawingFront()) {
532 bool changed =
false;
554 if (mayDefinitelyPass) {
577 }
else if ((fromPermissions & toPermissions) == 0) {
633 it->setSpecialColor(0);
650 const int toIndex = targetLane->
getIndex();
651 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
652 connections.begin(), connections.end(),
654 const bool isConnected = con_it != connections.end();
656 if (con_it->mayDefinitelyPass) {
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
@ MID_GNE_CONNECTORFRAME_VISIBLEININSPECTMODE
toogle inspect connections
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CANCEL
Cancel-button pressed.
@ MID_CHOOSEN_CLEAR
Clear set.
@ MID_OK
Ok-button pressed.
@ MID_GNE_CONNECTORFRAME_HIDEOTHERSOURCES
toogle show only from source connections
@ MID_GNE_CONNECTORFRAME_INSPECTCONNECTIONS
toogle inspect connections
@ 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 GUIDesignLabel(justify)
#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
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_PEDESTRIAN
pedestrian
const std::string getID() const override
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
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
void updateShowConnections()
update show connections
ConnectionVisualization(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdToggleInspectConnections(FXObject *, FXSelector, void *)
Called when the user toggles the inspect connections checkbox.
bool inspectConnections() const
check if inspect connections
long onCmdToggleHideOtherSources(FXObject *, FXSelector, void *)
Called when the user toggles the show only from checkbox.
FXCheckButton * myToggleInspectConnectionsCheckbutton
"Inspect connections" check button
bool showConnections() const
check if show connections
FXCheckButton * myToggleVisibleInInspectMode
"Visible in inspet mode" check button
FXCheckButton * myToggleHideOtherSources
"Hide other sources" check button
long onCmdToggleVisibleInInspectMode(FXObject *obj, FXSelector sel, void *ptr)
Called when the user toggles the show always connection checkbox.
bool showOnlyFromConnections() const
check if show only from connections
~ConnectionVisualization()
destructor
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Legend(GNEConnectorFrame *connectorFrameParent)
constructor
int myNumChanges
number of changes
GNELane * getCurrentEditedLane() const
get the lane of which connections are to be modified
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.
ConnectionVisualization * getConnectionVisualization()
get pointer to ConnectionVisualization module
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications module
GNEConnectorFrame::Legend * myLegend
Legend module.
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...
~GNEConnectorFrame()
Destructor.
void removeConnections(GNELane *lane)
remove connections
GNEConnectorFrame::ConnectionVisualization * myConnectionVisualization
ConnectionVisualization module.
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 module.
void handleLaneClick(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
either sets the current lane or toggles the connection of the
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
LaneStatus
the status of a target lane
GNEConnectorFrame::ConnectionSelection * myConnectionSelection
ConnectionSelection module.
CurrentLane * myCurrentLane
CurrentLane module.
NBEdge * getNBEdge() const
returns the internal NBEdge
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.
virtual void show()
show Frame
GNEGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
NBNode * getNBNode() const
Return net build node.
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
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
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 (used for simplify code)
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
GNELane * getLaneFrontNonLocked() const
get front lane or a pointer to nullptr checking if is locked
const std::vector< GNELane * > & getLanes() const
get lanes
GNENet * getNet() const
get the net object
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 FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
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.
A list item which allows for custom coloring.
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, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
bool hasConnectionTo(const 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.