71 FXIMPLEMENT(
GNEConnectorFrame, FXVerticalFrame, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
86 GNEFrame(horizontalFrameParent, viewNet,
"Edit Connections"),
183 bool changed =
false;
251 std::vector<GUIGlID> selectIDs;
254 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
256 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
257 if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
258 selectIDs.push_back((*it_lane)->getGlID());
270 std::set<GUIGlID> selectIDs;
273 for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
275 const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
276 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
279 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
280 selectIDs.insert(*lid_it);
284 const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
285 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
288 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
289 for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
292 selectIDs.erase(approachedLane->
getGlID());
297 std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
305 std::vector<GUIGlID> selectIDs;
308 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
309 NBEdge* nbe = (*edge_it)->getNBEdge();
311 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
312 for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
315 for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
316 const bool isConflicted = count_if(
317 connections.begin(), connections.end(),
320 selectIDs.push_back((*it_lane)->getGlID());
333 std::vector<GUIGlID> selectIDs;
335 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
338 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
339 for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
340 if (it->mayDefinitelyPass) {
342 selectIDs.push_back(lane->
getGlID());
356 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
369 for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
402 for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
409 throw ProcessError(
"Wrong object type returned from gIDStorage");
434 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
437 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
468 (*it)->setSpecialColor(0);
483 const int toIndex = targetLane->
getIndex();
484 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
485 connections.begin(), connections.end(),
487 const bool isConnected = con_it != connections.end();
489 if (con_it->mayDefinitelyPass) {
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
static RGBColor targetColor
color for the to-lane of a connection
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
A structure which describes a connection between edges or lanes.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
begin/end of the description of a junction
begin/end of the description of a single lane
FXButton * mySelectPassingButton
"Select Edges which may always pass"
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
FXLabel * myHoldShiftLabel
Selection Hint.
long onCmdSelectPass(FXObject *, FXSelector, void *)
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
FXLabel * myHoldControlLabel
hold control label
connectio between two lanes
GNEViewParent * getViewParent() const
get the net object
The representation of a single edge during network building.
std::vector< GNELane * > LaneVector
Definition of the lane's vector.
FXGroupBox * myGroupBoxSelection
groupbox for selection hints
FXGroupBox * myGroupBoxModifications
GroupBox for Buttons.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
A NBNetBuilder extended by visualisation and editing capabilities.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
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...
void handleIDs(std::vector< GUIGlID > ids, bool selectEdgesEnabled, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
FXGroupBox * myGroupBoxLegend
group box for legend
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
FXGroupBox * myGroupBoxDescription
Groupbox for description.
FXLabel * myConflictLabel
conflict label
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
GNEViewNet * myViewNet
the window to inform when the tls is modfied
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
select lanes with connections that have the pass attribute set to 'true'
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
static RGBColor potentialTargetColor
color for potential to-lane targets (currently unconnected)
void handleLaneClick(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 onCmdSelectConflicts(FXObject *, FXSelector, void *)
static const std::string MODIFIED
feature has been manually modified (implies approval)
GNEUndoList * getUndoList() const
get the undoList object
int getIndex() const
returns the index of the lane
static const RGBColor GREEN
int myNumChanges
number of changes
FXGroupBox * myGroupBoxOperations
groupbox for operations
void initTargets()
init targets
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GNEConnectorFrame()
FOX needs this.
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.
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.
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
FXButton * myResetSelectedButton
"Reset Selected"
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
select lanes that have no connection leading to it
static RGBColor sourceColor
color for the from-lane of a connection
FXLabel * myTargetLabel
target label
static const RGBColor MAGENTA
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
FXLabel * myPossibleTargetLabel
possible target label
FXButton * mySelectConflictsButton
"Select Conflicts" button
void p_abort()
reverts and discards ALL active command groups
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
A road/street connecting two junctions (netedit-version)
long onCmdOK(FXObject *, FXSelector, void *)
static const RGBColor YELLOW
static RGBColor conflictColor
color for a to-lane that cannot be used because another connection conflicts
FXButton * mySaveButton
"OK" button
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
static const RGBColor CYAN
FXButton * myCancelButton
"Cancel" button
select lanes that are connected from concurrent lanes
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.
FXLabel * mySourceLabel
source label
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
void setSpecialColor(const RGBColor *Color2)
FXLabel * myLaneDescriptionLabel
the label that shows the current editing state
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.
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the Corresponding-button.
GUIGlID getGlID() const
Returns the numerical id of the object.
void setStatusBarText(const std::string &text)
set staturBar text
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
GNELane * myCurrentLane
the lane of which connections are to be modified
GNEConnection * retrieveConnection(int fromLane, NBEdge *to, int toLane)
get connection
~GNEConnectorFrame()
Destructor.
#define GUIDesignLabelLeft
FXLabel * myTargetPassLabel
target pass label
NBEdge * getNBEdge()
returns the internal NBEdge
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
FXButton * myClearSelectedButton
"Clear Selected"
NBNode * getNBNode() const
Return net build node.
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void cleanup()
clean up when deselecting current lane
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
void updateDescription() const
update description
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)