59 #ifdef CHECK_MEMORY_LEAKS 61 #endif // CHECK_MEMORY_LEAKS 79 FXIMPLEMENT(
GNEConnectorFrame, FXVerticalFrame, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
94 GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"),
100 myLaneDescriptionLabel =
new FXLabel(myGroupBoxDescription,
"", 0,
GUIDesignLabelLeft);
107 myCancelButton =
new FXButton(myGroupBoxModifications,
"Cancel\t\tDiscard connection modifications (Esc)",
110 mySaveButton =
new FXButton(myGroupBoxModifications,
"OK\t\tSave connection modifications (Enter)",
117 mySelectDeadEndsButton =
new FXButton(myGroupBoxOperations,
"Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
120 mySelectDeadStartsButton =
new FXButton(myGroupBoxOperations,
"Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
123 mySelectConflictsButton =
new FXButton(myGroupBoxOperations,
"Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
126 mySelectPassingButton =
new FXButton(myGroupBoxOperations,
"Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
129 myClearSelectedButton =
new FXButton(myGroupBoxOperations,
"Clear Selected\t\tClears all connections of all selected objects",
132 myResetSelectedButton =
new FXButton(myGroupBoxOperations,
"Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
139 myHoldShiftLabel =
new FXLabel(myGroupBoxSelection,
"Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0,
GUIDesignLabelLeft);
140 myHoldControlLabel =
new FXLabel(myGroupBoxSelection,
"Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper nodes)", 0,
GUIDesignLabelLeft);
144 potentialTargetColor =
RGBColor(0, 64, 0, 255);
162 myPossibleTargetLabel =
new FXLabel(myGroupBoxLegend,
"Possible Target", 0,
GUIDesignLabelLeft);
166 myTargetPassLabel =
new FXLabel(myGroupBoxLegend,
"Target (pass)", 0,
GUIDesignLabelLeft);
191 bool changed =
false;
259 std::vector<GUIGlID> selectIDs;
262 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
264 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
265 if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
266 selectIDs.push_back((*it_lane)->getGlID());
278 std::set<GUIGlID> selectIDs;
281 for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
283 const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
284 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
287 for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
288 selectIDs.insert(*lid_it);
292 const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
293 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
296 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
297 for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
300 selectIDs.erase(approachedLane->
getGlID());
305 std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
313 std::vector<GUIGlID> selectIDs;
316 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
317 NBEdge* nbe = (*edge_it)->getNBEdge();
319 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
320 for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
323 for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
324 const bool isConflicted = count_if(
325 connections.begin(), connections.end(),
328 selectIDs.push_back((*it_lane)->getGlID());
341 std::vector<GUIGlID> selectIDs;
343 for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
346 const std::vector<NBEdge::Connection>& connections = nbe->
getConnections();
347 for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
348 if (it->mayDefinitelyPass) {
350 selectIDs.push_back(lane->
getGlID());
364 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
377 for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
410 for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
417 throw ProcessError(
"Wrong object type returned from gIDStorage");
442 for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
445 for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
476 (*it)->setSpecialColor(0);
491 const int toIndex = targetLane->
getIndex();
492 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
493 connections.begin(), connections.end(),
495 const bool isConnected = con_it != connections.end();
497 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
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
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
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)
connectio between two lanes
The representation of a single edge during network building.
std::vector< GNELane * > LaneVector
Definition of the lane's vector.
NBNode * getNBNode() const
Return net build node.
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...
select lanes that are connected from concurrent lanes
GNEViewParent * getViewParent() const
get the net object
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
int getIndex() const
returns the index of the lane
GUIGlID getGlID() const
Returns the numerical id of the object.
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNet * myViewNet
the window to inform when the tls is modfied
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
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)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static const RGBColor GREEN
int myNumChanges
number of changes
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
void initTargets()
init targets
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
select lanes that have no connection leading to it
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
static RGBColor sourceColor
color for the from-lane of a connection
static const RGBColor MAGENTA
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
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 *)
void updateDescription() const
update description
static const RGBColor YELLOW
static RGBColor conflictColor
color for a to-lane that cannot be used because another connection conflicts
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
static const RGBColor CYAN
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
select lanes with connections that have the pass attribute set to 'true'
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
GNENet * getNet() const
get the net object
void handleIDs(std::vector< GUIGlID > ids, bool selectEdges, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
LaneStatus
the status of a target lane
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.
void setStatusBarText(const std::string &text)
set staturBar text
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
NBEdge * getNBEdge()
returns the internal NBEdge
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void cleanup()
clean up when deselecting current lane
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction