41 {}, {}, {}, {}, {}, {}, {}, {}),
42 myParentJunction(
nullptr),
43 myTemplateNBCrossing(
new NBNode::Crossing(
nullptr, {}, 0,
false, 0, 0, {})) {
50 {}, {}, {}, {}, {}, {}, {}, {}),
51 myParentJunction(parentJunction),
52 myCrossingEdges(crossingEdges),
53 myTemplateNBCrossing(
nullptr) {
55 updateCenteringBoundary(
false);
69 return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
108 if (shape.size() > 2) {
114 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
116 shape.erase(shape.begin() + index);
133 const std::vector<NBEdge*>&
158 drawCrossing =
false;
162 drawCrossing =
false;
166 drawCrossing =
false;
170 drawCrossing =
false;
179 const double length = 0.5 * selectionScale;
180 const double spacing = 1.0 * selectionScale;
181 const double halfWidth = NBCrossing->width * 0.5 * selectionScale;
189 }
else if (!NBCrossing->valid) {
191 }
else if (NBCrossing->priority) {
216 glTranslated(0, 0, 0.1);
226 glVertex2d(-halfWidth, -t);
227 glVertex2d(-halfWidth, -t - length);
228 glVertex2d(halfWidth, -t - length);
229 glVertex2d(halfWidth, -t);
266 selectionScale,
true,
true);
271 selectionScale,
true,
true);
316 mcCustomShape->disable();
333 if (crossing->customShape.size() > 0) {
334 myBoundary = crossing->customShape.getBoxBoundary();
336 }
else if (crossing->shape.size() > 0) {
337 myBoundary = crossing->shape.getBoxBoundary();
358 return "Temporal Unreferenced";
361 return toString(crossing->customWidth);
363 return crossing->priority ?
"true" :
"false";
367 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
369 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
371 return toString(crossing->customShape);
375 return crossing->getParametersStr();
436 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(
myNet, value);
438 for (
auto i : parsedEdges) {
439 nbEdges.push_back(i->getNBEdge());
441 std::sort(nbEdges.begin(), nbEdges.end());
444 std::sort(originalEdges.begin(), originalEdges.end());
455 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1));
457 return canParse<bool>(value);
463 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
468 return canParse<PositionVector>(value);
471 return canParse<bool>(value);
480 const std::map<std::string, std::string>&
489 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->
getNBEdge()) != crossing->edges.end()) {
499 for (
auto i : edges) {
519 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(
myNet, value);
521 crossing->edges.clear();
523 for (
auto i : edges) {
524 crossing->edges.push_back(i->getNBEdge());
527 std::sort(crossing->edges.begin(), crossing->edges.end());
536 crossing->customWidth = parse<double>(value);
543 crossing->priority = parse<bool>(value);
546 crossing->customTLIndex = parse<int>(value);
548 crossing->tlLinkIndex = crossing->customTLIndex;
551 crossing->customTLIndex2 = parse<int>(value);
553 crossing->tlLinkIndex2 = crossing->customTLIndex2;
557 crossing->customShape = parse<PositionVector>(value);
565 if (parse<bool>(value)) {
572 crossing->setParametersStr(value);
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ 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 pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
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.
static void popName()
pop Name
static void pushMatrix()
push matrix
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)
GNECrossing(GNENet *net)
default constructor
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
GNEJunction * myParentJunction
the parent junction of this crossing
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEJunction * getParentJunction() const
get parent Junction
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
const PositionVector & getCrossingShape() const
~GNECrossing()
Destructor.
bool isAttributeComputed(SumoXMLAttr key) const
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
A road/street connecting two junctions (netedit-version)
NBEdge * getNBEdge() const
returns the internal NBEdge
void updateGeometry()
update pre-computed geometry information (including crossings)
NBNode * getNBNode() const
Return net build node.
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
calculate move shape operation
PositionVector shapeToUpdate
shape to update (edited in moveElement)
A NBNetBuilder extended by visualisation and editing capabilities.
GNEPathManager * getPathManager()
get path manager
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 invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
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)
update entire geometry
static void drawMovingHint(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
const std::vector< T > & getSchemes() const
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
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 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)
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, 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.
int indexOfClosest(const Position &p, bool twoD=false) const
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
PositionVector reverse() const
reverse position vector
static const RGBColor BLACK
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
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, 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 crossingGeometryPointRadius
moving crossing geometry point radius
bool show(const GUIGlObject *o) const
whether to show the text