39 myTemplateNBCrossing(new
NBNode::Crossing(nullptr, {}, 0,
false, 0, 0, {})) {
46 myCrossingEdges(crossingEdges),
47 myTemplateNBCrossing(nullptr) {
49 setParent<GNEJunction*>(junction);
86 return TL(
"Crossing's edges don't support pedestrians");
93 return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
181 if (editedNetworkElement) {
182 return editedNetworkElement ==
this;
193const std::vector<NBEdge*>&
218 const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
224 drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
235 if (editedNetworkElement && (editedNetworkElement ==
this)) {
300 mcCustomShape->disable();
329 return "Temporal Unreferenced";
332 return toString(crossing->customWidth);
334 return crossing->priority ?
"true" :
"false";
338 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
340 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
343 return toString(crossing->customShape);
422 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(
myNet, value);
424 for (
const auto& edge : parsedEdges) {
425 nbEdges.push_back(edge->getNBEdge());
427 std::sort(nbEdges.begin(), nbEdges.end());
430 std::sort(originalEdges.begin(), originalEdges.end());
441 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1));
443 return canParse<bool>(value);
449 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
451 && (*
getParentJunctions().front()->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
455 return canParse<PositionVector>(value);
465 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->
getNBEdge()) != crossing->edges.end()) {
475 for (
auto i : edges) {
507 const NBNode::Crossing* crossing,
const double width,
const double exaggeration)
const {
530 glTranslated(0, 0, 0.2);
552 }
else if (!crossing->
valid) {
567 const double length = 0.5 * exaggeration;
568 const double spacing = 1.0 * exaggeration;
572 glTranslated(0, 0, 0.1);
582 glVertex2d(-width, -t);
583 glVertex2d(-width, -t - length);
584 glVertex2d(width, -t - length);
585 glVertex2d(width, -t);
598 const double width,
const double exaggeration)
const {
612 width, exaggeration,
true,
true, 0,
nullptr,
getParentJunctions().front(), addToSelectedObjects);
626 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(
myNet, value);
628 crossing->edges.clear();
630 for (
auto i : edges) {
631 crossing->edges.push_back(i->getNBEdge());
634 std::sort(crossing->edges.begin(), crossing->edges.end());
643 crossing->customWidth = parse<double>(value);
646 crossing->priority = parse<bool>(value);
649 crossing->customTLIndex = parse<int>(value);
651 crossing->tlLinkIndex = crossing->customTLIndex;
654 crossing->customTLIndex2 = parse<int>(value);
656 crossing->tlLinkIndex2 = crossing->customTLIndex2;
661 crossing->customShape = parse<PositionVector>(value);
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CROSSING_EDIT_SHAPE
edit crossing shape
GUIViewObjectsHandler gViewObjectsHandler
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_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
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 popMatrix()
pop matrix
static void pushMatrix()
push matrix
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getCommonAttributeDouble(SumoXMLAttr key) const
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
Position getCommonAttributePosition(SumoXMLAttr key) const
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
void drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
Boundary getContourBoundary() const
get contour boundary
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
bool checkDrawCrossing(const GUIVisualizationSettings &s) const
check if draw crossing
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
std::string getAttribute(SumoXMLAttr key) const override
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNEMoveElementCrossing * myMoveElementCrossing
move element crossing
bool isNetworkElementValid() const
check if current network element is valid to be written into XML
void deleteGLObject()
delete element
GNECrossing(GNENet *net)
default constructor
void updateGLObject()
update GLObject (geometry, ID, etc.)
void drawCrossing(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const NBNode::Crossing *crossing, const double width, const double exaggeration) const
draw crossing
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
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
Position getAttributePosition(SumoXMLAttr key) const override
bool checkDrawFromContour() const override
check if draw from contour (green)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool isValid(SumoXMLAttr key, const std::string &value) override
Parameterised * getParameters() override
get parameters associated with this crossing
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this crossing
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
bool checkDrawSelectContour() const override
check if draw select contour (blue)
bool checkDrawMoveContour() const override
check if draw move contour (red)
std::string getNetworkElementProblem() const
return a string with the current network element problem
const PositionVector & getCrossingShape() const
get Crossing shape
void updateGeometry() override
update pre-computed geometry information
~GNECrossing()
Destructor.
void calculateCrossingContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const double exaggeration) const
calculate contour
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool checkDrawOverContour() const override
check if draw over contour (orange)
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
RGBColor getCrossingColor(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
get crossing color
bool checkDrawToContour() const override
check if draw from contour (magenta)
void drawCrossingDetailed(const double width, const double exaggeration) const
draw crossing with hight detail
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
double getAttributeDouble(SumoXMLAttr key) const override
NBEdge * getNBEdge() const
returns the internal NBEdge
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
A NBNetBuilder extended by visualisation and editing capabilities.
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
GNEPathManager * getDemandPathManager()
get demand path manager
GNEViewNet * getViewNet() const
get view net
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
GUIGLObjectPopupMenu * getShapeEditedPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, const PositionVector &shape)
get shape edited popup menu
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool editingElevation)
draw geometry points
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
const std::vector< T > & getSchemes() const
GUIGLObjectPopupMenu * getPopup() const
ge the current popup-menu
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
Stores the information about how to visualize structures.
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationTextSettings cwaEdgeName
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
Setting bundles for optional drawing names with size and color.
GUIVisualizationTextSettings drawLinkTLIndex
bool drawCrossingsAndWalkingareas
whether crossings 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)
PositionVector customShape
optional customShape for this crossing
PositionVector shape
The crossing's shape.
bool priority
whether the pedestrians have priority
bool valid
whether this crossing is valid (and can be written to the net.xml). This is needed for netedit becaus...
Represents a single node (junction) during network building.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
PositionVector reverse() const
reverse position vector
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
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
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
RGBColor selectedCrossingColor
crossings selection color
static const RGBColor crossingPriorityColor
color for priority crossing
static const RGBColor crossingInvalidColor
color for invalid crossing
static const RGBColor crossingColor
color for crossings
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double crossingGeometryPointRadius
moving crossing geometry point radius
bool show(const GUIGlObject *o) const
whether to show the text