62 #ifdef CHECK_MEMORY_LEAKS 64 #endif // CHECK_MEMORY_LEAKS 80 myOrigPos(nbn.getPosition()),
81 myAmCreateEdgeSource(false),
83 myLogicStatus(loaded ? LOADED : GUESSED),
84 myAmResponsible(false),
85 myHasValidLogic(loaded),
86 myAmTLSSelected(false) {
102 const double EXTENT = 2;
117 if ((*it)->unreferenced()) {
124 for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
145 FXMenuCommand* mcCustomShape =
new FXMenuCommand(ret,
"Set custom shape", 0, &parent,
MID_GNE_NODE_SHAPE);
146 FXMenuCommand* mcReplace =
new FXMenuCommand(ret,
"Replace by geometry node", 0, &parent,
MID_GNE_NODE_REPLACE);
150 mcCustomShape->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
157 mcReplace->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
160 (
dynamic_cast<GNEViewNet&
>(parent)).markPopupPosition();
198 if (selectionScale > 1) {
212 glTranslated(pos.
x(), pos.
y(),
getType() - 0.05);
220 FXImage* i =
new FXGIFImage(
myNet->
getApp(),
tlslogo, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
227 glTranslated(pos.
x(), pos.
y(),
getType() + 0.1);
253 for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
286 assert(undoList != 0);
292 for (EdgeVector::iterator it = incoming.begin(); it != incoming.end(); it++) {
296 std::vector<NBEdge::Connection> connections = srcNBE->
getConnections();
298 for (std::vector<NBEdge::Connection>::reverse_iterator con_it = connections.rbegin(); con_it != connections.rend(); con_it++) {
299 bool hasTurn = con_it->toEdge == turnEdge;
301 srcEdge, con_it->fromLane, con_it->toEdge->
getID(),
302 con_it->toLane, con_it->mayDefinitelyPass,
false),
true);
323 for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
327 std::string newID = tlDef->
getID();
332 replacementDef = repl;
337 undoList->add(
new GNEChange_TLS(
this, replacementDef,
true,
false, newID),
true);
339 const std::vector<NBNode*> coNodes = tlDef->
getNodes();
340 for (std::vector<NBNode*>::const_iterator it_node = coNodes.begin(); it_node != coNodes.end(); it_node++) {
342 undoList->add(
new GNEChange_TLS(sharing, tlDef,
false),
true);
343 undoList->add(
new GNEChange_TLS(sharing, replacementDef,
true,
false, newID),
true);
355 for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
356 EdgeSet edgeSet((*it).edges.begin(), (*it).edges.end());
357 if (edgeSet.count(edge->
getNBEdge()) == 1) {
406 undoList->
p_begin(
"change junction type");
412 }
else if (
getNBNode()->isTLControlled()) {
416 for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
447 value,
"user-supplied position", 0, ok,
true);
452 return canParse<SUMOReal>(value);
455 return value ==
"true" || value ==
"false";
581 tlCont.
insert(tlDef, forceInsert);
597 EdgeSet edgeSet2((*it).edges.begin(), (*it).edges.end());
598 if (edgeSet == edgeSet2) {
599 (*it).width = crossing.
width;
bool myAmResponsible
whether we are responsible for deleting myNBNode
void rebuildCrossings(bool deleteOnly)
rebuilds crossing objects for this junction
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
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
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.
static StringBijection< SumoXMLNodeType > NodeTypes
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
std::vector< Crossing > myCrossings
Vector of crossings.
SUMOReal width
This lane's width.
Whether vehicles must keep the junction clear.
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
SUMOReal getWidth() const
Returns the width of the boudary.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
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
bool hasString(const std::string &str) const
A loaded (complete) traffic light logic.
bool myAmCreateEdgeSource
static GUIGlID add(FXImage *i)
Adds a texture to use.
static const NBConnection InvalidConnection
A container for traffic light definitions and built programs.
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
Stores the information about how to visualize structures.
static int TLSDecalGlID
gl-id of the tls-decal (drawn in tls-mode)
The representation of a single edge during network building.
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.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void scaleRelative(SUMOReal factor)
enlarges/shrinks the polygon by a factor based at the centroid
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
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)
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.
static bool TLSDecalInitialized
whether the tls-decal has been initialized
bool checkIsRemovable() const
bool myAmTLSSelected
whether this junction is selected in tls-mode
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 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
bool priority
whether the pedestrians have priority
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.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
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
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
const Position & getPosition() const
Returns the position of this node.
The turning radius at an intersection in m.
std::set< NBEdge * > EdgeSet
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.
static void drawTexturedBox(unsigned int which, SUMOReal size)
Draws a named texture as a box with the given size.
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 updateCrossingAttributes(NBNode::Crossing crossing)
modify the specified crossing (using friend privileges)
void setRadius(SUMOReal radius)
set the turning radius
A point in 2D or 3D with translation and scaling methods.
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
SUMOReal getColorValue(const GUIVisualizationSettings &s, bool bubble) const
determines color value
const unsigned char tlslogo[]
friend class GNEChange_Attribute
SumoXMLNodeType getType() const
Returns the type of this 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.
const T getColor(const SUMOReal value) const
NBNode * getNBNode()
returns the internal NBNode
NBTrafficLightLogic * getLogic()
Returns the internal logic.
GUIColorer junctionColorer
The junction colorer.
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
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
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) ...
NBEdge * getNBEdge()
returns the internal NBEdge
A road/street connecting two junctions (netedit-version)
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
bool hasCommandGroup() const
virtual ~GNEJunction()
Destructor.
Boundary myBoundary
The represented junction's boundary.
std::vector< NBEdge * > EdgeVector
SUMOReal y() const
Returns the y-position.
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
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
EdgeVector edges
The edges being crossed.
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.
A definition of a pedestrian crossing.
GNEJunction(NBNode &nbn, GNENet *net, bool loaded=false)
Constructor.
GUIVisualizationSettings * getVisualisationSettings() const
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
std::vector< GNECrossing * > myCrossings
the built crossing objects
bool drawJunctionShape
whether the shape of the junction should be drawn
static const RGBColor selectionColor
void moveby(SUMOReal x, SUMOReal y)
Moves the boundary by the given amount.
std::string getAttribute(SumoXMLAttr key) const
void setPosition(Position pos)
reposition the NBNnode and nothing else
SUMOReal area() const
Returns the area (0 for non-closed)
A traffic light logics which must be computed (only nodes/edges are given)
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.
A window containing a gl-object's parameter.
NBEdge * getTurnDestination(bool possibleDestination=false) const
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 updateBoundary()
Update the boundary of the junction.
void addTrafficLight(NBTrafficLightDefinition *tlDef, bool forceInsert)
adds a traffic light
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.