44 myParentJunction(parentJunction),
45 myCrossingEdges(crossingEdges) {
57 myShape = crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape;
63 int segments = (int)
myShape.size() - 1;
67 for (
int i = 0; i < segments; ++i) {
84 const std::vector<NBEdge*>&
113 glColor3d(0.118, 0.565, 1.000);
114 }
else if (!crossing->valid) {
115 glColor3d(1.0, 0.1, 0.1);
116 }
else if (crossing->priority) {
117 glColor3d(0.9, 0.9, 0.9);
119 glColor3d(0.1, 0.1, 0.1);
122 glTranslated(0, 0, .2);
125 double spacing = 1.0;
126 double halfWidth = crossing->width * 0.5;
130 glTranslated(0, 0, 0.1);
131 for (
int i = 0; i < (int)
myShape.size() - 1; ++i) {
141 glVertex2d(-halfWidth, -t);
142 glVertex2d(-halfWidth, -t - length);
143 glVertex2d(halfWidth, -t - length);
144 glVertex2d(halfWidth, -t);
150 glVertex2d(-halfWidth, 0);
153 glVertex2d(halfWidth, 0);
163 glTranslated(0, 0, -.2);
188 int linkNo = crossing->tlLinkIndex;
189 int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
213 mcCustomShape->disable();
244 return "Temporal Unreferenced";
247 return toString(crossing->customWidth);
249 return crossing->priority ?
"true" :
"false";
253 return toString(crossing->customTLIndex);
255 return toString(crossing->customTLIndex2);
257 return toString(crossing->customShape);
301 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(
myNet, value);
303 for (
auto i : parsedEdges) {
304 nbEdges.push_back(i->getNBEdge());
306 std::sort(nbEdges.begin(), nbEdges.end());
309 std::sort(originalEdges.begin(), originalEdges.end());
320 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1));
322 return canParse<bool>(value);
325 return (crossing->tlID !=
"" && canParse<int>(value)
332 return canParse<PositionVector>(value);
335 return canParse<bool>(value);
349 for (
auto i : crossing->getParametersMap()) {
350 result += i.first +
"=" + i.second +
"|";
353 if (!result.empty()) {
360 std::vector<std::pair<std::string, std::string> >
363 std::vector<std::pair<std::string, std::string> > result;
365 for (
auto i : crossing->getParametersMap()) {
366 result.push_back(std::make_pair(i.first, i.second));
378 std::vector<std::string> parsedValues;
381 parsedValues.push_back(stValues.
next());
384 for (
auto i : parsedValues) {
385 std::vector<std::string> parsedParameters;
388 parsedParameters.push_back(stParam.
next());
392 crossing->setParameter(parsedParameters.front(), parsedParameters.back());
401 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->
getNBEdge()) != crossing->edges.end()) {
411 for (
auto i : edges) {
431 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(
myNet, value);
433 crossing->edges.clear();
435 for (
auto i : edges) {
436 crossing->edges.push_back(i->getNBEdge());
439 std::sort(crossing->edges.begin(), crossing->edges.end());
448 crossing->customWidth = parse<double>(value);
451 crossing->priority = parse<bool>(value);
454 crossing->customTLIndex = parse<int>(value);
456 crossing->tlLinkIndex = crossing->customTLIndex;
459 crossing->customTLIndex2 = parse<int>(value);
461 crossing->tlLinkIndex2 = crossing->customTLIndex2;
467 crossing->customShape = parse<PositionVector>(value);
473 if (parse<bool>(value)) {
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge *> edges)
Constructor.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Position getPositionInView() const
Return current position.
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
double scale
information about a lane's width (temporary, used for a single view)
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
whether a given shape is user-defined
GNENet * myNet
the net to inform about updates
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, double size, RGBColor color)
draw text and the end of shape
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Stores the information about how to visualize structures.
double y() const
Returns the y-position.
double x() const
Returns the x-position.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
int editMode
the current NETEDIT mode (temporary)
PositionVector reverse() const
reverse position vector
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
std::string getGenericParametersStr() const
return generic parameters in string format
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.
A class that stores a 2D geometrical boundary.
link: the index of the opposite direction link of a pedestrian crossing
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void updateGeometry(bool updateGrid)
update pre-computed geometry information
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::vector< double > myShapeRotations
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges) ...
A point in 2D or 3D with translation and scaling methods.
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
friend class GNEChange_Attribute
declare friend class
void updateGeometry(bool updateGrid)
Update the boundary of the junction.
GUIVisualizationTextSettings drawLinkTLIndex
GNEJunction * myParentJunction
the parent junction of this crossing
Boundary & grow(double by)
extends the boundary by the given amount
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
EditMode getCurrentEditMode() const
get the current edit mode
const PositionVector & getShape() const
retrieve the junction shape
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
A road/street connecting two junctions (netedit-version)
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
static void drawShapeDottedContour(const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
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) ...
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const std::string & getTagStr() const
get tag assigned to this object in string format
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
crossing between edges for pedestrians
~GNECrossing()
Destructor.
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
GUIGlID getGlID() const
Returns the numerical id of the object.
A definition of a pedestrian crossing.
PositionVector myShape
crossingShape
link: the index of the link within the traffic light
bool isValid(SumoXMLAttr key, const std::string &value)
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
std::vector< double > myShapeLengths
The lengths of the shape parts.
mode for connecting lanes
mode for creating new edges
NBEdge * getNBEdge()
returns the internal NBEdge
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
NBNode * getNBNode() const
Return net build node.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
std::string getAttribute(SumoXMLAttr key) const
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEViewNet * getViewNet() const
get view net
void clearParameter()
Clears the parameter map.
GNEJunction * getParentJunction() const
get parent Junction