 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
44 myParentJunction(parentJunction),
45 myCrossingEdges(crossingEdges) {
66 myGeometry.
shape = crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape;
87 const std::vector<NBEdge*>&
117 }
else if (!crossing->valid) {
119 }
else if (crossing->priority) {
125 glTranslated(0, 0, .2);
128 double spacing = 1.0;
129 double halfWidth = crossing->width * 0.5;
133 glTranslated(0, 0, 0.1);
144 glVertex2d(-halfWidth, -t);
145 glVertex2d(-halfWidth, -t - length);
146 glVertex2d(halfWidth, -t - length);
147 glVertex2d(halfWidth, -t);
153 glVertex2d(-halfWidth, 0);
156 glVertex2d(halfWidth, 0);
165 glTranslated(0, 0, -.2);
190 int linkNo = crossing->tlLinkIndex;
191 int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
215 mcCustomShape->disable();
223 throw ProcessError(
"Crossings doesn't have a boundary");
236 return "Temporal Unreferenced";
239 return toString(crossing->customWidth);
241 return crossing->priority ?
"true" :
"false";
245 return toString(crossing->customTLIndex);
247 return toString(crossing->customTLIndex2);
249 return toString(crossing->customShape);
293 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(
myNet, value);
295 for (
auto i : parsedEdges) {
296 nbEdges.push_back(i->getNBEdge());
298 std::sort(nbEdges.begin(), nbEdges.end());
301 std::sort(originalEdges.begin(), originalEdges.end());
312 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1));
314 return canParse<bool>(value);
317 return (crossing->tlID !=
"" && canParse<int>(value)
324 return canParse<PositionVector>(value);
327 return canParse<bool>(value);
341 for (
auto i : crossing->getParametersMap()) {
342 result += i.first +
"=" + i.second +
"|";
345 if (!result.empty()) {
352 std::vector<std::pair<std::string, std::string> >
355 std::vector<std::pair<std::string, std::string> > result;
357 for (
auto i : crossing->getParametersMap()) {
358 result.push_back(std::make_pair(i.first, i.second));
370 std::vector<std::string> parsedValues;
373 parsedValues.push_back(stValues.
next());
376 for (
auto i : parsedValues) {
377 std::vector<std::string> parsedParameters;
380 parsedParameters.push_back(stParam.
next());
384 crossing->setParameter(parsedParameters.front(), parsedParameters.back());
393 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->
getNBEdge()) != crossing->edges.end()) {
403 for (
auto i : edges) {
423 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(
myNet, value);
425 crossing->edges.clear();
427 for (
auto i : edges) {
428 crossing->edges.push_back(i->getNBEdge());
431 std::sort(crossing->edges.begin(), crossing->edges.end());
440 crossing->customWidth = parse<double>(value);
443 crossing->priority = parse<bool>(value);
446 crossing->customTLIndex = parse<int>(value);
448 crossing->tlLinkIndex = crossing->customTLIndex;
451 crossing->customTLIndex2 = parse<int>(value);
453 crossing->tlLinkIndex2 = crossing->customTLIndex2;
457 crossing->customShape = parse<PositionVector>(value);
461 if (parse<bool>(value)) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNEJunction * myParentJunction
the parent junction of this crossing
~GNECrossing()
Destructor.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool hasNext()
returns the information whether further substrings exist
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
whether a given shape is user-defined
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static const RGBColor crossing
color for crossings
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
mode for creating new edges
std::string getAttribute(SumoXMLAttr key) const
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
SumoXMLTag
Numbers representing SUMO-XML - element names.
static const RGBColor crossingPriority
color for priority crossing
PositionVector shape
The shape of the netElement element.
void updateGeometry()
update pre-computed geometry information
A road/street connecting two junctions (netedit-version)
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
friend class GNEChange_Attribute
declare friend class
Position getPositionInView() const
Returns position of hierarchical element in view.
NBNode * getNBNode() const
Return net build node.
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::vector< double > shapeRotations
The rotations of the single shape parts.
NetElementGeometry myGeometry
netElement geometry
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::string getGenericParametersStr() const
return generic parameters in string format
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
NBEdge * getNBEdge() const
returns the internal NBEdge
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
link: the index of the opposite direction link of a pedestrian crossing
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.
double scale
information about a lane's width (temporary, used for a single view)
A point in 2D or 3D with translation and scaling methods.
mode for connecting lanes
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
GUIVisualizationTextSettings drawLinkTLIndex
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
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
void clearGeometry()
reset geometry
NetworkEditMode
@brie enum for network edit modes
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
static const RGBColor crossingInvalid
color for invalid crossing
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
GNEViewNet * getViewNet() const
get view net
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIVisualizationColorSettings colorSettings
color settings
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const PositionVector & getShape() const
retrieve the junction shape
GNEJunction * getParentJunction() const
get parent Junction
crossing between edges for pedestrians
link: the index of the link within the traffic light
PositionVector reverse() const
reverse position vector
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 setGenericParametersStr(const std::string &value)
set generic parameters in string format
bool isValid(SumoXMLAttr key, const std::string &value)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge * > edges)
Constructor.
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,...
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
GNENet * myNet
the net to inform about updates
void clearParameter()
Clears the parameter map.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
void updateGeometry()
update pre-computed geometry information
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
RGBColor selectedCrossingColor
crossings selection color
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const std::string & getTagStr() const
get tag assigned to this object in string format
Stores the information about how to visualize structures.
A definition of a pedestrian crossing.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
NetworkEditMode networkEditMode
the current Network edit mode
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, double size, RGBColor color)
draw text and the end of shape
std::vector< double > shapeLengths
The lengths of the single shape parts.
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects