39 GNENetworkElement(parentJunction->getNet(), parentJunction->getNBNode()->getCrossing(crossingEdges)->id,
41 {}, {}, {}, {}, {}, {}, {}, {}),
42 myParentJunction(parentJunction),
43 myCrossingEdges(crossingEdges) {
45 updateCenteringBoundary(
false);
56 return (crossing->customShape.size() > 0) ? crossing->
customShape : crossing->shape;
100 if (positionAtOffset.
distanceSquaredTo2D(shapeToMove[index]) > (snap_radius * snap_radius)) {
104 return new GNEMoveOperation(
this, originalShape, {index}, shapeToMove, {newIndex});
119 if (shape.size() > 2) {
125 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
127 shape.erase(shape.begin() + index);
144 const std::vector<NBEdge*>&
162 drawCrossing =
false;
166 drawCrossing =
false;
170 drawCrossing =
false;
174 drawCrossing =
false;
183 const double length = 0.5 * selectionScale;
184 const double spacing = 1.0 * selectionScale;
185 const double halfWidth = NBCrossing->width * 0.5 * selectionScale;
193 }
else if (!NBCrossing->valid) {
195 }
else if (NBCrossing->priority) {
220 glTranslated(0, 0, 0.1);
230 glVertex2d(-halfWidth, -t);
231 glVertex2d(-halfWidth, -t - length);
232 glVertex2d(halfWidth, -t - length);
233 glVertex2d(halfWidth, -t);
311 mcCustomShape->disable();
322 if (crossing->customShape.size() > 0) {
323 myBoundary = crossing->customShape.getBoxBoundary();
325 }
else if (crossing->shape.size() > 0) {
326 myBoundary = crossing->shape.getBoxBoundary();
347 return "Temporal Unreferenced";
350 return toString(crossing->customWidth);
352 return crossing->priority ?
"true" :
"false";
356 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
358 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
360 return toString(crossing->customShape);
364 return crossing->getParametersStr();
419 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(
myNet, value);
421 for (
auto i : parsedEdges) {
422 nbEdges.push_back(i->getNBEdge());
424 std::sort(nbEdges.begin(), nbEdges.end());
427 std::sort(originalEdges.begin(), originalEdges.end());
438 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1));
440 return canParse<bool>(value);
446 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
451 return canParse<PositionVector>(value);
454 return canParse<bool>(value);
463 const std::map<std::string, std::string>&
472 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->
getNBEdge()) != crossing->edges.end()) {
482 for (
auto i : edges) {
502 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(
myNet, value);
504 crossing->edges.clear();
506 for (
auto i : edges) {
507 crossing->edges.push_back(i->getNBEdge());
510 std::sort(crossing->edges.begin(), crossing->edges.end());
519 crossing->customWidth = parse<double>(value);
524 crossing->priority = parse<bool>(value);
527 crossing->customTLIndex = parse<int>(value);
529 crossing->tlLinkIndex = crossing->customTLIndex;
532 crossing->customTLIndex2 = parse<int>(value);
534 crossing->tlLinkIndex2 = crossing->customTLIndex2;
538 crossing->customShape = parse<PositionVector>(value);
544 if (parse<bool>(value)) {
551 crossing->setParametersStr(value);
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CROSSING_EDIT_SHAPE
edit junction shape
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Boundary & grow(double by)
extends the boundary by the given amount
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, const GUIVisualizationTextSettings &settings, const double scale)
draw text and the end of shape
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.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
std::string getAttribute(SumoXMLAttr key) const
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void updateGeometry()
update pre-computed geometry information
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Position getPositionInView() const
Returns position of hierarchical element in view.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
draw TLS Link Number
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
GNEJunction * myParentJunction
the parent junction of this crossing
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEJunction * getParentJunction() const
get parent Junction
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge * > edges)
Constructor.
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
GNEGeometry::Geometry myCrossingGeometry
crossing geometry
const PositionVector & getCrossingShape() const
~GNECrossing()
Destructor.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
A road/street connecting two junctions (netedit-version)
NBEdge * getNBEdge() const
returns the internal NBEdge
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void updateGeometry()
update pre-computed geometry information (including crossings)
NBNode * getNBNode() const
Return net build node.
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNEViewNet * getViewNet() const
get view net
bool myShapeEdited
flag to check if element shape is being edited
bool isShapeEdited() const
check if shape is being edited
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Boundary myBoundary
object boundary
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
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...
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlID getGlID() const
Returns the numerical id of the object.
const std::vector< T > & getSchemes() const
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool drawDottedContour() const
check if dotted contour can be drawn
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings drawLinkTLIndex
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
double selectorFrameScale
the current selection scaling in NETEDIT (set in SelectorFrame)
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
A definition of a pedestrian crossing.
int tlLinkIndex
the traffic light index of this crossing (if controlled)
std::string tlID
The id of the traffic light that controls this connection.
PositionVector customShape
optional customShape for this crossing
PositionVector shape
The crossing's shape.
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
static const Position INVALID
used to indicate that a position is valid
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
int indexOfClosest(const Position &p) const
index of the closest position to p
PositionVector reverse() const
reverse position vector
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
static void drawGeometryPoints(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration)
draw geometry points
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration)
draw dotted contour for the given shape (used by additionals)
static void drawMovingHint(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static const RGBColor crossingInvalid
color for invalid crossing
static const RGBColor crossing
color for crossings
RGBColor selectedCrossingColor
crossings selection color
static const RGBColor editShape
color for edited shapes (Junctions, crossings and connections)
static const RGBColor crossingPriority
color for priority crossing
static const double crossingGeometryPointRadius
moving crossing geometry point radius