55 myParentJunction(parentJunction),
56 myCrossingEdges(crossingEdges) {
72 myShape = crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape;
78 int segments = (int)
myShape.size() - 1;
82 for (
int i = 0; i < segments; ++i) {
103 const std::vector<NBEdge*>&
132 glColor3d(0.118, 0.565, 1.000);
133 }
else if (!crossing->valid) {
134 glColor3d(1.0, 0.1, 0.1);
135 }
else if (crossing->priority) {
136 glColor3d(0.9, 0.9, 0.9);
138 glColor3d(0.1, 0.1, 0.1);
141 glTranslated(0, 0, .2);
144 double spacing = 1.0;
145 double halfWidth = crossing->width * 0.5;
149 glTranslated(0, 0, 0.1);
150 for (
int i = 0; i < (int)
myShape.size() - 1; ++i) {
160 glVertex2d(-halfWidth, -t);
161 glVertex2d(-halfWidth, -t - length);
162 glVertex2d(halfWidth, -t - length);
163 glVertex2d(halfWidth, -t);
169 glVertex2d(-halfWidth, 0);
172 glVertex2d(halfWidth, 0);
182 glTranslated(0, 0, -.2);
207 int linkNo = crossing->tlLinkIndex;
208 int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
232 mcCustomShape->disable();
263 return "Temporal Unreferenced";
266 return toString(crossing->customWidth);
268 return crossing->priority ?
"true" :
"false";
272 return toString(crossing->customTLIndex);
274 return toString(crossing->customTLIndex2);
276 return toString(crossing->customShape);
320 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(
myNet, value);
322 for (
auto i : parsedEdges) {
323 nbEdges.push_back(i->getNBEdge());
325 std::sort(nbEdges.begin(), nbEdges.end());
328 std::sort(originalEdges.begin(), originalEdges.end());
339 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1));
341 return canParse<bool>(value);
344 return (crossing->tlID !=
"" && canParse<int>(value)
355 return canParse<bool>(value);
367 if (!crossing->knowsParameter(key)) {
379 if (crossing->knowsParameter(key)) {
391 if (crossing->knowsParameter(oldKey) && !crossing->knowsParameter(newKey)) {
393 crossing->unsetParameter(oldKey);
394 crossing->setParameter(newKey, value);
405 if (crossing->knowsParameter(key)) {
419 for (
auto i : crossing->getParametersMap()) {
420 result += i.first +
"=" + i.second +
"|";
423 if (!result.empty()) {
430 std::vector<std::pair<std::string, std::string> >
433 std::vector<std::pair<std::string, std::string> > result;
435 for (
auto i : crossing->getParametersMap()) {
436 result.push_back(std::make_pair(i.first, i.second));
448 std::vector<std::string> parsedValues;
451 parsedValues.push_back(stValues.
next());
454 for (
auto i : parsedValues) {
455 std::vector<std::string> parsedParameters;
458 parsedParameters.push_back(stParam.
next());
462 crossing->setParameter(parsedParameters.front(), parsedParameters.back());
471 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->
getNBEdge()) != crossing->edges.end()) {
481 for (
auto i : edges) {
501 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(
myNet, value);
503 crossing->edges.clear();
505 for (
auto i : edges) {
506 crossing->edges.push_back(i->getNBEdge());
509 std::sort(crossing->edges.begin(), crossing->edges.end());
518 crossing->customWidth = parse<double>(value);
521 crossing->priority = parse<bool>(value);
524 crossing->customTLIndex = parse<int>(value);
526 crossing->tlLinkIndex = crossing->customTLIndex;
529 crossing->customTLIndex2 = parse<int>(value);
531 crossing->tlLinkIndex2 = crossing->customTLIndex2;
544 if (parse<bool>(value)) {
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge *> edges)
Constructor.
const GNEAttributeCarrier * getACUnderCursor() const
get AttributeCarrier under cursor
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.
bool addGenericParameter(const std::string &key, const std::string &value)
add generic parameter
void unsetParameter(const std::string &key)
Removes a parameter.
bool removeGenericParameter(const std::string &key)
remove generic parameter
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
bool updateGenericParameterValue(const std::string &key, const std::string &newValue)
update value generic parameter
void updateGeometry(bool updateGrid)
Update the boundary of the junction.
GUIVisualizationTextSettings drawLinkTLIndex
GNEJunction * myParentJunction
the parent junction of this crossing
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
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
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
bool updateGenericParameter(const std::string &oldKey, const std::string &newKey)
update generic parameter
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 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
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
crossing between edges for pedestrians
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
~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.
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
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 occurred errors.
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
SumoXMLTag getTag() const
get XML Tag assigned to this object