Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEAdditional.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A abstract class for representation of additional elements
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
30
31// ===========================================================================
32// class declarations
33// ===========================================================================
34
37
38// ===========================================================================
39// class definitions
40// ===========================================================================
41
43
44public:
46 friend class GNEAdditionalListed;
48
54
62 GNEAdditional(const std::string& id, GNENet* net, SumoXMLTag tag, FileBucket* fileBucket, const std::string& name);
63
69 GNEAdditional(GNEAdditional* additionalParent, SumoXMLTag tag, const std::string& name);
70
73
76
79
81 GUIGlObject* getGUIGlObject() override;
82
84 const GUIGlObject* getGUIGlObject() const override;
85
87
89 FileBucket* getFileBucket() const override;
90
92 virtual const std::string getOptionalName() const override;
93
96
98 void setSpecialColor(const RGBColor* color);
99
102
105
109 virtual void writeAdditional(OutputDevice& device) const = 0;
110
112 virtual bool isAdditionalValid() const = 0;
113
115 virtual std::string getAdditionalProblem() const = 0;
116
118 virtual void fixAdditionalProblem() = 0;
119
121
124
129 virtual void openAdditionalDialog(FXWindow* restoringFocusWindow);
130
132 virtual Position getPositionInView() const = 0;
133
135 double getExaggeration(const GUIVisualizationSettings& s) const override;
136
138 Boundary getCenteringBoundary() const override;
139
141 virtual void updateCenteringBoundary(const bool updateGrid) = 0;
142
144 virtual void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) = 0;
145
147
150
152 bool checkDrawFromContour() const override;
153
155 bool checkDrawToContour() const override;
156
158 bool checkDrawRelatedContour() const override;
159
161 bool checkDrawOverContour() const override;
162
164 bool checkDrawDeleteContour() const override;
165
167 bool checkDrawDeleteContourSmall() const override;
168
170 bool checkDrawSelectContour() const override;
171
173
176
185
194
196 const std::string& getOptionalAdditionalName() const;
197
199 bool isGLObjectLocked() const override;
200
202 void markAsFrontElement() override;
203
205 void deleteGLObject() override;
206
208 void selectGLObject() override;
209
211 void updateGLObject() override;
212
214
217
219 virtual void computePathElement() override;
220
222 bool isPathElementSelected() const override;
223
229 virtual void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
230
236 virtual void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
237
239 GNELane* getFirstPathLane() const override;
240
242 GNELane* getLastPathLane() const override;
243
245
247 void drawParentChildLines(const GUIVisualizationSettings& s, const RGBColor& color, const bool onlySymbols = false) const;
248
251 const double rot, const RGBColor& baseColor, const bool ignoreShift = false) const;
252
255 const double rot, const RGBColor& baseColor, const bool ignoreShift = false) const;
256
259 const double rot, const RGBColor& baseColor, const bool ignoreShift = false) const;
260
263 const double rot, const RGBColor& baseColor, const bool ignoreShift = false) const;
264
266 static bool areLaneConsecutives(const std::vector<GNELane*>& lanes);
267
269 static bool areLaneConnected(const std::vector<GNELane*>& lanes);
270
271protected:
274
277
280
282 std::string myAdditionalName;
283
285 const RGBColor* mySpecialColor = nullptr;
286
288 void writeAdditionalAttributes(OutputDevice& device) const;
289
292
294 bool isValidAdditionalID(const std::string& value) const;
295
297 bool isValidAdditionalID(const std::vector<SumoXMLTag>& tags, const std::string& value) const;
298
300 bool isValidDetectorID(const std::string& value) const;
301
303 bool isValidDetectorID(const std::vector<SumoXMLTag>& tags, const std::string& value) const;
304
306 void setAdditionalID(const std::string& newID);
307
309
311 void drawAdditionalID(const GUIVisualizationSettings& s) const;
312
314 void drawAdditionalName(const GUIVisualizationSettings& s) const;
315
317 void replaceAdditionalParentEdges(const std::string& value);
318
320 void replaceAdditionalParentLanes(const std::string& value);
321
323 void replaceAdditionalChildEdges(const std::string& value);
324
326 void replaceAdditionalChildLanes(const std::string& value);
327
329 void replaceAdditionalParent(SumoXMLTag tag, const std::string& value, const int parentIndex);
330
332 void replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex);
333
335 void shiftLaneIndex();
336
338 void calculatePerpendicularLine(const double endLaneposition);
339
342
345
347 static std::string getJuPedSimType(SumoXMLTag tag);
348
351
353 static bool getJuPedSimFill(SumoXMLTag tag);
354
356 static double getJuPedSimLayer(SumoXMLTag tag);
357
359
362
365 const double layer, const double exaggeration, const bool filledShape) const;
366
368
369private:
373 virtual bool checkChildAdditionalRestriction() const;
374
377 const Position& pos, const double rot, const RGBColor& baseColor,
378 const double fromAngle, const double toAngle, const bool ignoreShift) const;
379
381 GNEAdditional(const GNEAdditional&) = delete;
382
385};
SumoXMLTag
Numbers representing SUMO-XML - element names.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
virtual void updateCenteringBoundary(const bool updateGrid)=0
update centering boundary (implies change in RTREE)
bool isPathElementSelected() const override
check if path element is selected
void markAsFrontElement() override
mark element as front element
virtual const std::string getOptionalName() const override
Returns the name of the object (default "")
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
virtual void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
virtual void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
GNEAdditional & operator=(const GNEAdditional &)=delete
Invalidated assignment operator.
void deleteGLObject() override
delete element
virtual void writeAdditional(OutputDevice &device) const =0
write additional element into a xml file
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
static bool areLaneConnected(const std::vector< GNELane * > &lanes)
check if the given lanes are connected
bool checkDrawFromContour() const override
check if draw from contour (green)
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
virtual bool isAdditionalValid() const =0
check if current additional is valid to be written into XML (by default true, can be reimplemented in...
void updateGLObject() override
update GLObject (geometry, ID, etc.)
virtual std::string getAdditionalProblem() const =0
return a string with the current additional problem (by default empty, can be reimplemented in childr...
static std::string getJuPedSimType(SumoXMLTag tag)
get JuPedSim type
void replaceAdditionalChildLanes(const std::string &value)
replace additional child lanes
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
bool checkDrawOverContour() const override
check if draw over contour (orange)
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
bool isValidDetectorID(const std::string &value) const
check if a new detector ID is valid
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
void drawUpGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw up geometry point
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
GNEHierarchicalElement * getHierarchicalElement() override
methods to retrieve the elements linked to this additional
void shiftLaneIndex()
shift lane index
GNELane * getFirstPathLane() const override
get first path lane
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
void calculatePerpendicularLine(const double endLaneposition)
calculate perpendicular line between lane parents
bool isGLObjectLocked() const override
check if element is locked
GNEAdditional(const GNEAdditional &)=delete
Invalidated copy constructor.
std::string myAdditionalName
name of additional
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
void resetAdditionalContour()
reset additional contour
bool checkDrawSelectContour() const override
check if draw select contour (blue)
void drawDemandElementChildren(const GUIVisualizationSettings &s) const
draw demand element children
static double getJuPedSimLayer(SumoXMLTag tag)
get JuPedSim color
bool checkDrawToContour() const override
check if draw from contour (magenta)
void setSpecialColor(const RGBColor *color)
set special color
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
virtual void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)=0
split geometry
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
void drawSemiCircleGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const double fromAngle, const double toAngle, const bool ignoreShift) const
draw geometry point
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
void replaceAdditionalChildEdges(const std::string &value)
replace additional child edges
virtual void openAdditionalDialog(FXWindow *restoringFocusWindow)
open Additional Dialog
GNELane * getLastPathLane() const override
get last path lane
void calculateContourPolygons(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer, const double exaggeration, const bool filledShape) const
calculate contour for polygons
void selectGLObject() override
select element
FileBucket * getFileBucket() const override
get reference to fileBucket in which save this AC
void drawDownGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw down geometry point
static RGBColor getJuPedSimColor(SumoXMLTag tag)
get JuPedSim color
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
static bool getJuPedSimFill(SumoXMLTag tag)
get JuPedSim fill
~GNEAdditional()
Destructor.
const std::string & getOptionalAdditionalName() const
Returns the additional name.
virtual void computePathElement() override
compute pathElement
GUIGlObject * getGUIGlObject() override
get GUIGlObject associated with this additional
virtual Position getPositionInView() const =0
Returns position of additional in view.
virtual void fixAdditionalProblem()=0
fix additional problem (by default throw an exception, has to be reimplemented in children)
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37