 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
53 GNENetElement(from->getNet(),
"from" + from->getMicrosimID() +
"to" + to->getMicrosimID(),
58 mySpecialColor(nullptr),
59 myShapeDeprecated(true) {
107 }
else if (
getEdgeFrom()->getNBEdge()->getToNode()->getShape().area() > 4) {
108 if (nbCon.
shape.size() != 0) {
120 (
double) 5. * (
double)
getEdgeFrom()->getNBEdge()->getNumLanes(),
130 const double orthoLength = 0.5;
157 return Boundary(junctionParentPosition.
x() - 0.1, junctionParentPosition.
y() - 0.1,
158 junctionParentPosition.
x() + 0.1, junctionParentPosition.
x() + 0.1);
265 mcCustomShape->disable();
283 bool drawConnection =
true;
291 drawConnection =
false;
294 if (drawConnection) {
324 if (spreadSuperposed) {
328 glTranslated(0, 0, 0.1);
473 undoList->
p_begin(
"change tls linkIndex for connection");
479 if (tllogic !=
nullptr) {
484 for (
NBNode* node : tlDef->getNodes()) {
486 undoList->add(
new GNEChange_TLS(junction, tlDef,
false),
true);
487 undoList->add(
new GNEChange_TLS(junction, newDef,
true),
true);
506 return canParse<bool>(value);
508 return canParse<bool>(value);
510 return canParse<double>(value) && (parse<double>(value) >= -1);
512 return canParse<bool>(value);
514 return canParse<double>(value) && (parse<double>(value) >= -1);
520 canParse<int>(value) &&
521 (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
532 return canParse<double>(value) && (parse<double>(value) >= -1);
535 return canParse<PositionVector>(value);
542 return canParse<bool>(value);
565 if (
getEdgeFrom()->getNBEdge()->getToNode()->isTLControlled()) {
569 if (tllogic !=
nullptr) {
599 nbCon.
contPos = parse<double>(value);
605 nbCon.
speed = parse<double>(value);
610 if (successorAllows != customPermissions) {
618 if (successorDisallows != customPermissions) {
632 if (parse<bool>(value)) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string tlID
The id of the traffic light that controls this connection.
bool isValid(SumoXMLAttr key, const std::string &value)
@ GLO_CONNECTION
a connection
Position getPositionInView() const
Returns position of hierarchical element in view.
const RGBColor * mySpecialColor
optional special color
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
NBEdge * toEdge
The edge the connections yields in.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
static RGBColor getColor()
gets the gl-color
NBTrafficLightLogic * compute(OptionsCont &oc)
Computes the traffic light logic.
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
std::string edgeParam
key for coloring by edge parameter
void updateGeometry()
update pre-computed geometry information
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
bool haveVia
check if Connection have a Via
const std::string getID() const
function to support debugging
virtual int getMaxValidIndex()
Returns the maximum index controlled by this traffic light.
void updateGeometryShape(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
@ LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
bool uncontrolled
check if Connection is uncontrolled
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GNEEdge * getParentEdge() const
Returns underlying parent edge.
bool drawBoundaries
enable or disable draw boundaries
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
SVCPermissions permissions
List of vehicle types that are allowed on this connection.
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
double contPos
custom position for internal junction on this connection
LinkState getLinkState() const
get LinkState
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
GNELane * myFromLane
incoming lane of this connection
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
@ SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
double length() const
Returns the length.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
NBTrafficLightLogic * getLogic()
Returns the internal logic.
@ GNE_NMODE_CREATE_EDGE
mode for creating new edges
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
@ GNE_NMODE_TLS
mode for editing tls
int tlLinkIndex
The index of this connection within the controlling traffic light.
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
RGBColor selectedConnectionColor
connection selection color
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, int linkIndex2, bool reconstruct=true)
Adds a connection and immediately informs the edges.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
@ SUMO_ATTR_DIR
The abstract direction of a link.
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
int fromLane
The lane the connections starts at.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
int getIndex() const
returns the index of the lane
double speed
custom speed for connection
A road/street connecting two junctions (netedit-version)
friend class GNEChange_Attribute
declare friend class
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
int toLane
The lane the connections yields in.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void setSpecialColor(const RGBColor *Color2)
void updateID()
update internal ID of Connection
NBNode * getToNode() const
Returns the destination node of the edge.
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
PositionVector viaShape
shape of via
GUIVisualizationDetailSettings detailSettings
detail settings
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
const PositionVector & getShape() const
The shape of the additional element.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
GNEConnection(GNELane *from, GNELane *to)
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
NBEdge * getNBEdge() const
returns the internal NBEdge
const PositionVector & getConnectionShape() const
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
PositionVector shape
shape of Connection
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
A class that stores a 2D geometrical boundary.
Boundary getBoundary() const
Returns the street's geometry.
int getNumLanes() const
Returns the number of lanes.
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
double scale
information about a lane's width (temporary, used for a single view)
@ GNE_SUPERMODE_NETWORK
Network mode (Edges, junctions, etc..)
int tlLinkIndex2
The index of the internal junction within the controlling traffic light (optional)
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Supermode currentSupermode
the current supermode
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
GNELane * myToLane
outgoing lane of this connection
A point in 2D or 3D with translation and scaling methods.
LinkState myLinkState
Linkstate.
@ GNE_NMODE_CONNECT
mode for connecting lanes
double x() const
Returns the x-position.
~GNEConnection()
Destructor.
double selectionScale
the current selection scaling in NETEDIT (temporary)
void append(const PositionVector &v, double sameThreshold=2.0)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
bool showConnections() const
check if select show connections checkbox is enabled
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
@ MID_GNE_CONNECTION_EDIT_SHAPE
edit junction shape
bool isAttributeEnabled(SumoXMLAttr key) const
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
NetworkEditMode
@brie enum for network edit modes
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
GNEViewNet * getViewNet() const
get view net
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
GUIVisualizationColorSettings colorSettings
color settings
void setParametersStr(const std::string ¶msString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
NBConnection getNBConnection() const
get NBConnection
@ SUMO_ATTR_STATE
The state of a link.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double y() const
Returns the y-position.
PositionVector myInternalJunctionMarker
waiting position for internal junction
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
GNENet * getNet() const
get Net in which this element is placed
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
bool keepClear
whether the junction must be kept clear when using this connection
std::string getAttribute(SumoXMLAttr key) const
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
@ SUMO_TAG_CONNECTION
connectio between two lanes
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
PositionVector customShape
custom shape for connection
GNENet * myNet
the net to inform about updates
void updateLinkState()
recompute cached myLinkState
GUIVisualizationSizeSettings addSize
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
@ GNE_ATTR_SELECTED
element is selected
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Boundary & grow(double by)
extends the boundary by the given amount
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
A SUMO-compliant built logic for a traffic light.
const std::string & getTagStr() const
get tag assigned to this object in string format
Represents a single node (junction) during network building.
static const double connectionsDemandMode
draw connections in demand mode
Stores the information about how to visualize structures.
A structure which describes a connection between edges or lanes.
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...
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
double visibility
custom foe visiblity for connection
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
NetworkEditMode networkEditMode
the current Network edit mode
Position getPositionInView() const
Returns position of hierarchical element in view.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GUIVisualizationTextSettings edgeValue
GNEGeometry::Geometry myConnectionGeometry
connection geometry
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
The base class for traffic light logic definitions.
const std::string & getID() const
A loaded (complete) traffic light logic.