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  static const GUIGlID INVALID_ID;
78 
87  GUIGlObject(GUIGlObjectType type, const std::string& microsimID);
88 
97  GUIGlObject(const std::string& prefix, GUIGlObjectType type, const std::string& microsimID);
98 
100  virtual ~GUIGlObject();
101 
106  const std::string& getFullName() const;
107 
110  virtual const std::string& getParentName() const;
111 
114  GUIGlID getGlID() const;
116 
119 
125  virtual GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0;
126 
133  virtual GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0;
134 
141  virtual GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
142 
144  virtual const std::string& getMicrosimID() const;
145 
148  virtual void setMicrosimID(const std::string& newID);
149 
152  GUIGlObjectType getType() const;
153 
155  virtual Boundary getCenteringBoundary() const = 0;
156 
159  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
161 
166  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
167 
168 #ifdef HAVE_OSG
169  osg::Node* getNode() const;
171 
173  void setNode(osg::Node* node);
174 #endif
175 
180  void addParameterTable(GUIParameterTableWindow* w);
181 
184  void removeParameterTable(GUIParameterTableWindow* w);
186 
188  void drawName(const Position& pos, const SUMOReal scale, const GUIVisualizationTextSettings& settings, const SUMOReal angle = 0) const;
189 
190 protected:
193 
197  void buildPopupHeader(GUIGLObjectPopupMenu* ret, GUIMainWindow& app, bool addSeparator = true);
198 
203  void buildCenterPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
204 
209  void buildNameCopyPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
210 
215  void buildSelectionPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
216 
221  void buildShowParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
222 
227  void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
228 
234  void buildPositionCopyEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
235 
240  void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true);
242 
243 protected:
245  void setPrefix(const std::string& prefix);
246 
247 private:
250 
253 
255  std::string myMicrosimID;
256 
258  std::string myPrefix;
259 
261  std::string myFullName;
262 
264  std::set<GUIParameterTableWindow*> myParamWindows;
265 
267  std::string createFullName() const;
268 
269 #ifdef HAVE_OSG
270  osg::Node* myOSGNode;
272 #endif
273 
275  // static StringBijection<SumoXMLLinkStateValue> LinkStates;
276 
278  static StringBijection<GUIGlObjectType>::Entry GUIGlObjectTypeNamesInitializer[];
279 
280 private:
282  GUIGlObject(const GUIGlObject&);
283 
285  GUIGlObject& operator=(const GUIGlObject&);
286 };
287 #endif
288 
289 /****************************************************************************/
290 
GUIGlObjectType
GUIGlID myGlID
The numerical id of the object.
Definition: GUIGlObject.h:249
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:255
A storage for of displayed objects via their numerical id.
const GUIGlObjectType myGLObjectType
The type of the object.
Definition: GUIGlObject.h:252
unsigned int GUIGlID
Definition: GUIGlObject.h:50
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
Definition: GUIGlObject.h:76
static const GUIGlID INVALID_ID
Definition: GUIGlObject.h:77
The popup menu of a globject.
std::string myPrefix
prefix of GL Object
Definition: GUIGlObject.h:258
std::string myFullName
full name of GL Object
Definition: GUIGlObject.h:261
#define SUMOReal
Definition: config.h:213
std::set< GUIParameterTableWindow * > myParamWindows
Parameter table windows which refer to this object.
Definition: GUIGlObject.h:264
A window containing a gl-object&#39;s parameter.