Eclipse SUMO - Simulation of Urban MObility
GNEInternalLane.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 class for visualizing Inner Lanes (used when editing traffic lights)
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include "GNENetworkElement.h"
23 
24 // ===========================================================================
25 // class declarations
26 // ===========================================================================
28 class GNETLSEditorFrame;
29 class PositionVector;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
40 class GNEInternalLane : public GNENetworkElement, public FXDelegator {
42  FXDECLARE(GNEInternalLane)
43 
44 public:
52  GNEInternalLane(GNETLSEditorFrame* editor, const GNEJunction* junctionParent, const std::string& id, const PositionVector& shape, int tlIndex, LinkState state = LINKSTATE_DEADEND);
53 
56 
60  void updateGeometry();
61 
65 
70 
72  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
74 
77 
85 
94 
96  double getExaggeration(const GUIVisualizationSettings& s) const;
97 
99  void updateCenteringBoundary(const bool updateGrid);
100 
105  void drawGL(const GUIVisualizationSettings& s) const;
107 
109  void setLinkState(LinkState state);
110 
112  LinkState getLinkState() const;
113 
115  long onDefault(FXObject*, FXSelector, void*);
116 
118  int getTLIndex() const;
119 
122 
124  static RGBColor colorForLinksState(FXuint state);
125 
128  /* @brief method for getting the Attribute of an XML key
129  * @param[in] key The attribute key
130  * @return string with the value associated to key
131  */
132  std::string getAttribute(SumoXMLAttr key) const;
133 
134  /* @brief method for setting the attribute and letting the object perform additional changes
135  * @param[in] key The attribute key
136  * @param[in] value The new value
137  * @param[in] undoList The undoList on which to register changes
138  */
139  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
140 
141  /* @brief method for checking if the key and their conrrespond attribute are valids
142  * @param[in] key The attribute key
143  * @param[in] value The value asociated to key key
144  * @return true if the value is valid, false in other case
145  */
146  bool isValid(SumoXMLAttr key, const std::string& value);
147 
148  /* @brief method for check if the value for certain attribute is set
149  * @param[in] key The attribute key
150  */
151  bool isAttributeEnabled(SumoXMLAttr key) const;
152 
153  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
154  * @param[in] key The attribute key
155  */
156  bool isAttributeComputed(SumoXMLAttr key) const;
157 
159 
161  const std::map<std::string, std::string>& getACParametersMap() const;
162 
163 protected:
165  GNEInternalLane();
166 
167 private:
170 
173 
175  FXuint myState;
176  FXDataTarget myStateTarget;
177 
180 
182  FXDataTarget stateTarget;
183 
186 
189 
192 
195 
196 private:
198  void setAttribute(SumoXMLAttr key, const std::string& value);
199 
201  void setMoveShape(const GNEMoveResult& moveResult);
202 
204  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
205 
208 
211 };
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_DEADEND
This is a dead end link.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
GNEInternalLane()
FOX needs this.
GNEInternalLane & operator=(const GNEInternalLane &)=delete
Invalidated assignment operator.
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
LinkState myOrigState
the original state of the link (used for tracking modification)
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void updateGeometry()
update pre-computed geometry information
std::string getAttribute(SumoXMLAttr key) const
const GNEJunction * myJunctionParent
pointer to junction parent
FXuint myState
the state of the link (used for visualization)
LinkState getLinkState() const
whether link state has been modfied
FXDataTarget myStateTarget
int myTlIndex
the tl-index of this lane
GUIGLObjectPopupMenu * myPopup
the created popup
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Position getPositionInView() const
Returns position of hierarchical element in view.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
GNEMoveOperation * getMoveOperation()
get move operation
static StringBijection< FXuint >::Entry linkStateNamesValues[]
linkstates names values
FXDataTarget stateTarget
data target for selection state
bool isAttributeComputed(SumoXMLAttr key) const
GUIGeometry myInternalLaneGeometry
internal lane geometry
bool isValid(SumoXMLAttr key, const std::string &value)
static const StringBijection< FXuint > LinkStateNames
long names for link states
int getTLIndex() const
get Traffic Light index
GNEInternalLane(const GNEInternalLane &)=delete
Invalidated copy constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
~GNEInternalLane()
Destructor.
void setLinkState(LinkState state)
set the linkState (controls drawing color)
GNETLSEditorFrame * myEditor
the editor to inform about changes
bool isAttributeEnabled(SumoXMLAttr key) const
move operation
move result
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.