54 GNENetElement(from->getNet(),
"from" + from->getMicrosimID() +
"to" + to->getMicrosimID(),
59 mySpecialColor(nullptr),
60 myShapeDeprecated(true) {
101 if (nbCon.
shape.size() != 0) {
113 (
double) 5. * (
double)
getEdgeFrom()->getNBEdge()->getNumLanes(),
123 const double orthoLength = 0.5;
152 return Boundary(junctionParentPosition.
x() - 0.1, junctionParentPosition.
y() - 0.1,
153 junctionParentPosition.
x() + 0.1, junctionParentPosition.
x() + 0.1);
267 mcCustomShape->disable();
284 bool drawConnection =
true;
292 drawConnection =
false;
295 if (drawConnection) {
325 if (spreadSuperposed) {
329 glTranslated(0, 0, 0.1);
424 undoList->
p_begin(
"change tls linkIndex for connection");
430 if (tllogic !=
nullptr) {
434 std::vector<NBNode*> nodes = tlDef->getNodes();
435 for (
NBNode* node : nodes) {
437 undoList->add(
new GNEChange_TLS(junction, tlDef,
false),
true);
438 undoList->add(
new GNEChange_TLS(junction, newDef,
true),
true);
467 return canParse<bool>(value);
469 return canParse<bool>(value);
471 return canParse<double>(value) && (parse<double>(value) >= -1);
473 return canParse<bool>(value);
475 return canParse<double>(value) && (parse<double>(value) >= -1);
479 && canParse<int>(value)
480 && parse<int>(value) >= 0) {
487 return canParse<double>(value) && (parse<double>(value) >= -1);
490 return canParse<PositionVector>(value);
497 return canParse<bool>(value);
511 result += i.first +
"=" + i.second +
"|";
514 if (!result.empty()) {
521 std::vector<std::pair<std::string, std::string> >
523 std::vector<std::pair<std::string, std::string> > result;
526 result.push_back(std::make_pair(i.first, i.second));
537 std::vector<std::string> parsedValues;
540 parsedValues.push_back(stValues.
next());
543 for (
auto i : parsedValues) {
544 std::vector<std::string> parsedParameters;
547 parsedParameters.push_back(stParam.
next());
574 nbCon.
contPos = parse<double>(value);
580 nbCon.
speed = parse<double>(value);
591 if (parse<bool>(value)) {
void updateGeometry()
update pre-computed geometry information
Position getPositionInView() const
Returns position of hierarchical element in view.
SumoXMLTag
Numbers representing SUMO-XML - element names.
A structure which describes a connection between edges or lanes.
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
int toLane
The lane the connections yields in.
double scale
information about a lane's width (temporary, used for a single view)
bool isValid(SumoXMLAttr key, const std::string &value)
PositionVector shape
The shape of the netElement element.
Whether vehicles must keep the junction clear.
whether a given shape is user-defined
GNENet * myNet
the net to inform about updates
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
bool showConnections() const
check if select show connections checkbox is enabled
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.
void append(const PositionVector &v, double sameThreshold=2.0)
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
NBEdge * toEdge
The edge the connections yields in.
GNENet * getNet() const
get Net in which this element is placed
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
A loaded (complete) traffic light logic.
NetworkEditMode
enum for network edit modes
LinkState getLinkState() const
get LinkState
A SUMO-compliant built logic for a traffic light.
Stores the information about how to visualize structures.
connectio between two lanes
double y() const
Returns the y-position.
foe visibility distance of a link
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
double x() const
Returns the x-position.
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
NetElementGeometry myGeometry
netElement geometry
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.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
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...
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
GNELane * myFromLane
incoming lane of this connection
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
double visibility
custom foe visiblity for connection
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool hasNext()
returns the information whether further substrings exist
The link is controlled by a tls which is off, not blinking, may pass.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
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.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
A class that stores a 2D geometrical boundary.
void setSpecialColor(const RGBColor *Color2)
PositionVector customShape
custom shape for connection
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
static OptionsCont & getOptions()
Retrieves the options.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GNELane * getLaneFrom() const
get lane of the incoming lane
double area() const
Returns the area (0 for non-closed)
PositionVector shape
shape of Connection
bool keepClear
whether the junction must be kept clear when using this connection
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
NBEdge * getNBEdge() const
returns the internal NBEdge
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
GUIVisualizationSizeSettings addSize
int getFromLaneIndex() const
get lane index of the incoming lane
int getToLaneIndex() const
get lane index of the outgoing lane
int getIndex() const
returns the index of the lane
std::vector< double > shapeRotations
The rotations of the single shape parts.
RGBColor selectedConnectionColor
connection selection color
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
double speed
custom speed for connection
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static const double connectionsDemandMode
draw connections in demand mode
void updateID()
update internal ID of Connection
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
GNEEdge & getParentEdge()
Returns underlying parent edge.
LinkState myLinkState
Linkstate.
std::string tlID
The id of the traffic light that controls this connection.
int getNumLanes() const
Returns the number of lanes.
int fromLane
The lane the connections starts at.
GNEConnection(GNELane *from, GNELane *to)
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
GNELane * getLaneTo() const
get lane of the outgoing lane
Supermode currentSupermode
the current supermode
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, bool reconstruct=true)
Adds a connection and immediately informs the edges.
friend class GNEChange_Attribute
declare friend class
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
mode for creating new edges
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
const std::string & getID() const
Boundary getBoundary() const
Returns the street's geometry.
GNELane * myToLane
outgoing lane of this connection
NBTrafficLightLogic * getLogic()
Returns the internal logic.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
~GNEConnection()
Destructor.
Boundary & grow(double by)
extends the boundary by the given amount
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
int tlLinkIndex
The index of this connection within the controlling traffic light.
std::vector< double > shapeLengths
The lengths of the single shape parts.
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
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
const PositionVector & getShape() const
retrieve the junction shape
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
A road/street connecting two junctions (netedit-version)
GUIVisualizationDetailSettings detailSettings
detail settings
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
double selectionScale
the current selection scaling in NETEDIT (temporary)
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
double length() const
Returns the length.
PositionVector viaShape
shape of via
NBConnection getNBConnection() const
get NBConnection
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
const std::string & getTagStr() const
get tag assigned to this object in string format
Demanding mode (Routes, Vehicles etc..)
PositionVector myInternalJunctionMarker
waiting position for internal junction
double contPos
custom position for internal junction on this connection
bool uncontrolled
check if Connection is uncontrolled
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
The abstract direction of a link.
std::string getAttribute(SumoXMLAttr key) const
Represents a single node (junction) during network building.
mode for connecting lanes
GUIGlID getGlID() const
Returns the numerical id of the object.
void updateLinkState()
recompute cached myLinkState
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
NetworkEditMode networkEditMode
the current Network edit mode
link: the index of the link within the traffic light
GUIVisualizationColorSettings colorSettings
color settings
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
virtual int getMaxValidIndex()
Returns the maximum index controlled by this traffic light.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const PositionVector & getShape() const
get Position vector calculated in updateGeometry()
bool haveVia
check if Connection have a Via
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Network mode (Edges, junctions, etc..)
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0, int shapeFlag=0) const
Compute a smooth curve between the given geometries.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
void clearGeometry()
reset geometry
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
bool drawBoundaries
enable or disable draw boundaries
NBNode * getToNode() const
Returns the destination node of the edge.
std::string getGenericParametersStr() const
return generic parameters in string format
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const RGBColor * mySpecialColor
optional special color
GNEViewNet * getViewNet() const
get view net
Position getPositionInView() const
Returns position of hierarchical element in view.
void clearParameter()
Clears the parameter map.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
static RGBColor getColor()
gets the gl-color