62 #ifdef CHECK_MEMORY_LEAKS 64 #endif // CHECK_MEMORY_LEAKS 72 myOrigPos(nbn.getPosition()),
73 myAmCreateEdgeSource(false),
74 myLogicStatus(loaded ? LOADED : GUESSED),
75 myAmResponsible(false),
76 myHasValidLogic(loaded),
77 myAmTLSSelected(false) {
92 const double EXTENT = 2;
113 for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
133 FXMenuCommand* mcCustomShape =
new FXMenuCommand(ret,
"Set custom shape", 0, &parent,
MID_GNE_NODE_SHAPE);
134 FXMenuCommand* mcReplace =
new FXMenuCommand(ret,
"Replace by geometry node", 0, &parent,
MID_GNE_NODE_REPLACE);
138 mcCustomShape->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
145 mcReplace->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
148 (
dynamic_cast<GNEViewNet&
>(parent)).markPopupPosition();
184 glGetFloatv(GL_CURRENT_COLOR, color);
190 if (exaggeration > 1) {
205 glGetFloatv(GL_CURRENT_COLOR, color);
209 glTranslated(pos.
x(), pos.
y(),
getType() + 0.05);
219 glGetFloatv(GL_CURRENT_COLOR, color);
223 glTranslated(pos.
x(), pos.
y(),
getType() - 0.05);
232 glTranslated(pos.
x(), pos.
y(),
getType() + 0.1);
320 const std::vector<GNEEdge*>&
326 const std::vector<GNEEdge*>&
332 const std::vector<GNEEdge*>&
337 const std::vector<GNECrossing*>&
365 for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
392 std::set<GNEJunction*> affectedJunctions;
393 std::set<GNEEdge*> affectedEdges;
395 for (std::vector<GNEEdge*>::const_iterator i =
myGNEEdges.begin(); i !=
myGNEEdges.end(); i++) {
397 affectedJunctions.insert((*i)->getGNEJunctionSource());
398 affectedJunctions.insert((*i)->getGNEJunctionDestiny());
400 for (std::vector<GNEEdge*>::const_iterator j = (*i)->getGNEJunctionSource()->getGNEEdges().begin(); j != (*i)->getGNEJunctionSource()->getGNEEdges().end(); j++) {
401 affectedEdges.insert(*j);
404 for (std::vector<GNEEdge*>::const_iterator j = (*i)->getGNEJunctionDestiny()->getGNEEdges().begin(); j != (*i)->getGNEJunctionDestiny()->getGNEEdges().end(); j++) {
405 affectedEdges.insert(*j);
409 for (std::set<GNEJunction*>::iterator i = affectedJunctions.begin(); i != affectedJunctions.end(); i++) {
411 if ((*i)->getNBNode()->hasCustomShape() ==
false) {
413 (*i)->getNBNode()->sortEdges(
false);
414 (*i)->getNBNode()->computeNodeShape(-1);
417 (*i)->updateGeometry();
420 for (std::set<GNEEdge*>::iterator i = affectedEdges.begin(); i != affectedEdges.end(); i++) {
422 (*i)->getNBEdge()->computeEdgeShape();
424 (*i)->updateGeometry();
448 assert(undoList != 0);
452 for (EdgeVector::iterator it = incoming.begin(); it != incoming.end(); it++) {
457 std::vector<NBEdge::Connection> connections = srcNBE->
getConnections();
459 for (std::vector<NBEdge::Connection>::reverse_iterator con_it = connections.rbegin(); con_it != connections.rend(); con_it++) {
460 bool hasTurn = con_it->toEdge == turnEdge;
481 for (EdgeVector::iterator it = incoming.begin(); it != incoming.end(); it++) {
494 for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
498 std::string newID = tlDef->
getID();
503 replacementDef = repl;
509 undoList->add(
new GNEChange_TLS(
this, replacementDef,
true,
false, newID),
true);
511 const std::vector<NBNode*> coNodes = tlDef->
getNodes();
512 for (std::vector<NBNode*>::const_iterator it_node = coNodes.begin(); it_node != coNodes.end(); it_node++) {
514 undoList->add(
new GNEChange_TLS(sharing, tlDef,
false),
true);
515 undoList->add(
new GNEChange_TLS(sharing, replacementDef,
true,
false, newID),
true);
527 for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
528 EdgeSet edgeSet((*it).edges.begin(), (*it).edges.end());
529 if (edgeSet.count(edge->
getNBEdge()) == 1) {
547 if ((*it)->unreferenced()) {
609 }
else if (
getNBNode()->isTLControlled()) {
613 for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
626 for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
630 const std::map<std::string, NBTrafficLightDefinition*>& programs = tlCont.
getPrograms(value);
631 if (programs.size() > 0) {
633 for (std::map<std::string, NBTrafficLightDefinition*>::const_iterator it = programs.begin(); it != programs.end(); it++) {
635 if (dynamic_cast<NBOwnTLDef*>(oldTLS) != 0) {
639 const std::vector<NBNode*> nodes = oldTLS->
getNodes();
640 for (std::vector<NBNode*>::const_iterator it_node = nodes.begin(); it_node != nodes.end(); ++it_node) {
642 undoList->add(
new GNEChange_TLS(oldJunction, oldTLS,
false),
true);
644 undoList->add(
new GNEChange_TLS(
this, 0,
true,
false, value),
true);
647 for (std::vector<NBNode*>::const_iterator it_node = nodes.begin(); it_node != nodes.end(); ++it_node) {
649 undoList->add(
new GNEChange_TLS(oldJunction, newTLS,
true),
true);
655 undoList->add(
new GNEChange_TLS(
this, 0,
true,
false, value),
true);
686 return canParse<SUMOReal>(value);
693 return value ==
"true" || value ==
"false";
733 (*i)->clearGNEConnections();
749 for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
842 tlCont.
insert(tlDef, forceInsert);
850 if (tlDef->
getNodes().size() == 1) {
GUIVisualizationSizeSettings junctionSize
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
bool myAmResponsible
whether we are responsible for deleting myNBNode
GUIVisualizationTextSettings junctionName
void removeConnection(const NBConnection &conn, bool reconstruct=true)
removes the given connection from the traffic light if recontruct=true, reconstructs the logic and in...
bool myHasValidLogic
whether this junctions logic is valid
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
std::string myLogicStatus
modification status of the junction logic (all connections across this junction)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool getKeepClear() const
Returns the keepClear flag.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
SUMOReal getHeight() const
Returns the height of the boundary (y-axis)
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
static StringBijection< SumoXMLNodeType > NodeTypes
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Whether vehicles must keep the junction clear.
GNENet * myNet
the net to inform about updates
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
SUMOReal getWidth() const
Returns the width of the boudary (x-axis)
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
begin/end of the description of a junction
SUMOReal getRadius() const
Returns the turning radius of this node.
PositionVector myPoly
the (outer) shape of the junction
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
void markAsCreateEdgeSource()
marks as first junction in createEdge-mode
bool hasString(const std::string &str) const
A loaded (complete) traffic light logic.
bool myAmCreateEdgeSource
whether this junction is the first junction for a newly creatededge
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static const NBConnection InvalidConnection
A container for traffic light definitions and built programs.
std::vector< GNEEdge * > myGNEIncomingEdges
vector with the incomings GNEEdges vinculated with this junction
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
bool isValid(SumoXMLAttr key, const std::string &value)
TrafficLightType getType() const
get the algorithm type (static etc..)
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
friend class GNEChange_TLS
Declare friend class.
Stores the information about how to visualize structures.
const std::string & getProgramID() const
Returns the ProgramID.
The representation of a single edge during network building.
NBNode * getNBNode() const
Return net build node.
const std::vector< Crossing > & getCrossings() const
return this junctions pedestrian crossings
The base class for traffic light logic definitions.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
link,node: the traffic light id responsible for this link
void scaleRelative(SUMOReal factor)
enlarges/shrinks the polygon by a factor based at the centroid
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
A NBNetBuilder extended by visualisation and editing capabilities.
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
int editMode
the current NETEDIT mode (temporary)
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...
bool hasCustomShape() const
return whether the shape was set by the user
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void selectTLS(bool selected)
notify the junction of being selected in tls-mode. (used to control drawing)
bool checkIsRemovable() const
check if node is removable
bool myAmTLSSelected
whether this junction is selected in tls-mode
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
void setCustomShape(const PositionVector &shape)
set the junction shape
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
void registerMove(GNEUndoList *undoList)
registers completed movement with the undoList
void updateShapesAndGeometries()
update shapes of all elements associated to the junction
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
removes a traffic light
SUMOReal x() const
Returns the x-position.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A class that stores a 2D geometrical boundary.
Position myOrigPos
restore point for undo
SUMOReal scale
information about a lane's width (temporary, used for a single view)
void setColor(const GUIVisualizationSettings &s, bool bubble) const
sets junction color depending on circumstances
whether a feature has been loaded,guessed,modified or approved
SUMOTime getOffset()
Returns the offset.
void renameJunction(GNEJunction *junction, const std::string &newID)
updates the map and reserves new id
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
const std::string & getID() const
Returns the id.
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
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.
void invalidateIncomingConnections()
invalidate incoming connections
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
const Position & getPosition() const
The turning radius at an intersection in m.
std::set< NBEdge * > EdgeSet
container for unique edges
SUMOReal selectionScale
the current selection scaling in NETEDIT (temporary)
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
void buildCrossingsAndWalkingAreas(bool discardInvalid=true)
build crossings, and walkingareas. Also removes invalid loaded crossings if wished ...
void setRadius(SUMOReal radius)
set the turning radius
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
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.
A point in 2D or 3D with translation and scaling methods.
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
bool isLogicValid()
whether this junction has a valid logic
SUMOReal getColorValue(const GUIVisualizationSettings &s, bool bubble) const
determines color value
friend class GNEChange_Attribute
declare friend class
SumoXMLNodeType getType() const
Returns the type of this node.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
turn junction into geometry node
void removeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
SUMOReal myMaxSize
The maximum size (in either x-, or y-dimension) for determining whether to draw or not...
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
void dropGNECrossings()
drop crossings
const T getColor(const SUMOReal value) const
NBTrafficLightLogic * getLogic()
Returns the internal logic.
node: the type of traffic light
edge: the shape in xml-definition
GUIColorer junctionColorer
The junction colorer.
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
std::vector< GNEEdge * > myGNEEdges
vector with the GNEEdges vinculated with this junction
void unMarkAsCreateEdgeSource()
removes mark as first junction in createEdge-mode
void setProgramID(const std::string &programID)
Sets the programID.
const std::string getID() const
function to support debugging
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
const PositionVector & getShape() const
retrieve the junction shape
NBNode & myNBNode
A reference to the represented junction.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
void setKeepClear(bool keepClear)
set the keepClear flag
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
static void computeTurnDirectionsForNode(NBNode *node, bool warn)
Computes turnaround destinations for all incoming edges of the given nodes (if any) ...
begin/end of the description of an edge
A road/street connecting two junctions (netedit-version)
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
bool hasCommandGroup() const
Check if undoList has command group.
virtual ~GNEJunction()
Destructor.
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
void updateGeometry()
Update the boundary of the junction.
void add(SUMOReal x, SUMOReal y, SUMOReal z=0)
Makes the boundary include the given coordinate.
Boundary getBoundary() const
Returns the boundary of the junction.
Boundary myBoundary
The represented junction's boundary.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
std::vector< GNECrossing * > myGNECrossings
the built crossing objects
SUMOReal y() const
Returns the y-position.
void rebuildGNECrossings()
rebuilds crossing objects for this junction
void move(Position pos)
reposition the node at pos and informs the edges
void updateJunctionPosition(GNEJunction *junction, const Position &origPos)
update edge geometry after junction move
std::vector< GNEEdge * > myGNEOutgoingEdges
vector with the outgoings GNEEdges vinculated with this junction
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
Represents a single node (junction) during network building.
T get(const std::string &str) const
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNEJunction(NBNode &nbn, GNENet *net, bool loaded=false)
Constructor.
SumoXMLTag getTag() const
get XML Tag assigned to this object
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
static const std::string GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
bool drawJunctionShape
whether the shape of the junction should be drawn
static const RGBColor selectionColor
color of selection
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
mode for connecting lanes
mode for creating new edges
std::string getAttribute(SumoXMLAttr key) const
void setPosition(Position pos)
reposition the NBNnode and nothing else
NBEdge * getNBEdge()
returns the internal NBEdge
SUMOReal area() const
Returns the area (0 for non-closed)
A traffic light logics which must be computed (only nodes/edges are given)
bool showJunctionAsBubbles() const
return true if junction must be showed as bubbles
void closePolygon()
ensures that the last position equals the first
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
void moveby(SUMOReal x, SUMOReal y, SUMOReal z=0)
Moves the boundary by the given amount.
A window containing a gl-object's parameter.
NBEdge * getTurnDestination(bool possibleDestination=false) const
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
GNEViewNet * getViewNet() const
get view net
static void drawTexturedBox(int which, SUMOReal size)
Draws a named texture as a box with the given size.
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occured errors.
void requireRecompute()
inform the net about the need for recomputation
void addTrafficLight(NBTrafficLightDefinition *tlDef, bool forceInsert)
adds a traffic light
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
NBNetBuilder * getNetBuilder() const
get net builder