SUMO - Simulation of Urban MObility
GUIGlObject.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Base class for all objects that may be displayed within the openGL-gui
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef GUIGlObject_h
24 #define GUIGlObject_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <set>
38 #include "GUIGlObjectTypes.h"
39 #include <utils/geom/Boundary.h>
40 #include <utils/common/StdDefs.h>
43 #include <utils/common/RGBColor.h>
44 
45 
46 // ===========================================================================
47 // definitions
48 // ===========================================================================
49 
50 typedef unsigned int GUIGlID;
51 
52 // ===========================================================================
53 // class declarations
54 // ===========================================================================
55 
56 class GUIGlObjectStorage;
58 class GUIMainWindow;
63 #ifdef HAVE_OSG
64 namespace osg {
65 class Node;
66 }
67 #endif
68 
69 // ===========================================================================
70 // class definitions
71 // ===========================================================================
72 
73 class GUIGlObject {
74 public:
77 
86  GUIGlObject(GUIGlObjectType type, const std::string& microsimID);
87 
96  GUIGlObject(const std::string& prefix, GUIGlObjectType type, const std::string& microsimID);
97 
99  virtual ~GUIGlObject();
100 
105  const std::string& getFullName() const;
106 
109  virtual const std::string& getParentName() const;
110 
113  GUIGlID getGlID() const;
115 
118 
124  virtual GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0;
125 
132  virtual GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0;
133 
140  virtual GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
141 
143  virtual const std::string& getMicrosimID() const;
144 
147  virtual void setMicrosimID(const std::string& newID);
148 
151  GUIGlObjectType getType() const;
152 
154  virtual Boundary getCenteringBoundary() const = 0;
155 
158  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
160 
165  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
166 
167 #ifdef HAVE_OSG
168  osg::Node* getNode() const;
170 
172  void setNode(osg::Node* node);
173 #endif
174 
179  void addParameterTable(GUIParameterTableWindow* w);
180 
183  void removeParameterTable(GUIParameterTableWindow* w);
185 
187  void drawName(const Position& pos, const SUMOReal scale, const GUIVisualizationTextSettings& settings, const SUMOReal angle = 0) const;
188 
189 protected:
192 
196  void buildPopupHeader(GUIGLObjectPopupMenu* ret, GUIMainWindow& app, bool addSeparator = true);
197 
202  void buildCenterPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
203 
208  void buildNameCopyPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
209 
214  void buildSelectionPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
215 
220  void buildShowParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
221 
226  void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
227 
233  void buildPositionCopyEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
234 
239  void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
241 
242 protected:
244  void setPrefix(const std::string& prefix);
245 
246 private:
249 
252 
254  std::string myMicrosimID;
255 
257  std::string myPrefix;
258 
260  std::string myFullName;
261 
263  std::set<GUIParameterTableWindow*> myParamWindows;
264 
266  std::string createFullName() const;
267 
268 #ifdef HAVE_OSG
269  osg::Node* myOSGNode;
271 #endif
272 
274  // static StringBijection<SumoXMLLinkStateValue> LinkStates;
275 
277  static StringBijection<GUIGlObjectType>::Entry GUIGlObjectTypeNamesInitializer[];
278 
279 private:
281  GUIGlObject(const GUIGlObject&);
282 
284  GUIGlObject& operator=(const GUIGlObject&);
285 };
286 #endif
287 
288 /****************************************************************************/
289 
GUIGlObjectType
GUIGlID myGlID
The numerical id of the object.
Definition: GUIGlObject.h:248
Stores the information about how to visualize structures.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
std::string myMicrosimID
ID of GL object.
Definition: GUIGlObject.h:254
A storage for of displayed objects via their numerical id.
const GUIGlObjectType myGLObjectType
The type of the object.
Definition: GUIGlObject.h:251
unsigned int GUIGlID
Definition: GUIGlObject.h:50
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
Definition: GUIGlObject.h:76
The popup menu of a globject.
std::string myPrefix
prefix of GL Object
Definition: GUIGlObject.h:257
std::string myFullName
full name of GL Object
Definition: GUIGlObject.h:260
#define SUMOReal
Definition: config.h:214
std::set< GUIParameterTableWindow * > myParamWindows
Parameter table windows which refer to this object.
Definition: GUIGlObject.h:263
A window containing a gl-object&#39;s parameter.