SUMO - Simulation of Urban MObility
GUIGlObject.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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Base class for all objects that may be displayed within the openGL-gui
19 /****************************************************************************/
20 #ifndef GUIGlObject_h
21 #define GUIGlObject_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <set>
31 #include "GUIGlObjectTypes.h"
32 #include <utils/geom/Boundary.h>
33 #include <utils/common/StdDefs.h>
36 #include <utils/common/RGBColor.h>
37 
38 
39 // ===========================================================================
40 // definitions
41 // ===========================================================================
42 
43 typedef unsigned int GUIGlID;
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 
49 class GUIGlObjectStorage;
51 class GUIMainWindow;
56 #ifdef HAVE_OSG
57 namespace osg {
58 class Node;
59 }
60 #endif
61 
62 // ===========================================================================
63 // class definitions
64 // ===========================================================================
65 
66 class GUIGlObject {
67 public:
70  static const GUIGlID INVALID_ID;
71 
81  GUIGlObject(GUIGlObjectType type, const std::string& microsimID);
82 
84  virtual ~GUIGlObject();
85 
90  const std::string& getFullName() const;
91 
94  virtual std::string getParentName() const;
95 
98  GUIGlID getGlID() const;
100 
103 
109  virtual GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0;
110 
117  virtual GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0;
118 
125  virtual GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
126 
128  virtual const std::string& getMicrosimID() const;
129 
132  virtual void setMicrosimID(const std::string& newID);
133 
136  GUIGlObjectType getType() const;
137 
139  virtual Boundary getCenteringBoundary() const = 0;
140 
143  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
145 
150  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
151 
152 #ifdef HAVE_OSG
153  osg::Node* getNode() const;
155 
157  void setNode(osg::Node* node);
158 #endif
159 
164  void addParameterTable(GUIParameterTableWindow* w);
165 
168  void removeParameterTable(GUIParameterTableWindow* w);
170 
172  void drawName(const Position& pos, const double scale, const GUIVisualizationTextSettings& settings, const double angle = 0) const;
173 
174 protected:
177 
181  void buildPopupHeader(GUIGLObjectPopupMenu* ret, GUIMainWindow& app, bool addSeparator = true);
182 
187  void buildCenterPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
188 
193  void buildNameCopyPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
194 
199  void buildSelectionPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
200 
205  void buildShowParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
206 
211  void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
212 
218  void buildPositionCopyEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
219 
224  void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
226 
227 protected:
229  void buildShapePopupOptions(GUIMainWindow& app, GUIGLObjectPopupMenu* ret, const std::string& type);
230 
232  void buildAdditionalsPopupOptions(GUIMainWindow& app, GUIGLObjectPopupMenu* ret, const std::string& type);
233 
234 private:
237 
240 
242  std::string myMicrosimID;
243 
245  std::string myFullName;
246 
248  std::set<GUIParameterTableWindow*> myParamWindows;
249 
251  std::string createFullName() const;
252 
253 #ifdef HAVE_OSG
254  osg::Node* myOSGNode;
256 #endif
257 
259  // static StringBijection<SumoXMLLinkStateValue> LinkStates;
260 
262  static StringBijection<GUIGlObjectType>::Entry GUIGlObjectTypeNamesInitializer[];
263 
264 private:
266  GUIGlObject(const GUIGlObject&) = delete;
267 
269  GUIGlObject& operator=(const GUIGlObject&) = delete;
270 };
271 #endif
272 
273 /****************************************************************************/
274 
GUIGlObjectType
GUIGlID myGlID
The numerical id of the object.
Definition: GUIGlObject.h:236
Stores the information about how to visualize structures.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
std::string myMicrosimID
ID of GL object.
Definition: GUIGlObject.h:242
A storage for of displayed objects via their numerical id.
const GUIGlObjectType myGLObjectType
The type of the object.
Definition: GUIGlObject.h:239
unsigned int GUIGlID
Definition: GUIGlObject.h:43
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
Definition: GUIGlObject.h:69
static const GUIGlID INVALID_ID
Definition: GUIGlObject.h:70
The popup menu of a globject.
std::string myFullName
full name of GL Object
Definition: GUIGlObject.h:245
std::set< GUIParameterTableWindow * > myParamWindows
Parameter table windows which refer to this object.
Definition: GUIGlObject.h:248
A window containing a gl-object&#39;s parameter.