SUMO - Simulation of Urban MObility
GUIPolygon.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 /****************************************************************************/
17 // The GUI-version of a polygon
18 /****************************************************************************/
19 #ifndef GUIPolygon_h
20 #define GUIPolygon_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
39 /*
40  * @class GUIPolygon
41  * @brief The GUI-version of a polygon
42  */
44 public:
58  GUIPolygon(const std::string& id, const std::string& type,
59  const RGBColor& color, const PositionVector& shape, bool geo, bool fill, double lineWidth,
60  double layer = 0, double angle = 0, const std::string& imgFile = "", bool relativePath = false);
61 
63  ~GUIPolygon();
64 
65 
67 
68 
77  GUISUMOAbstractView& parent);
78 
79 
88  GUISUMOAbstractView& parent);
89 
90 
97 
98 
103  virtual void drawGL(const GUIVisualizationSettings& s) const;
105 
106 
108  virtual void setShape(const PositionVector& shape);
109 
110 protected:
112  void setColor(const GUIVisualizationSettings& s) const;
113 
115  bool checkDraw(const GUIVisualizationSettings& s) const;
116 
118  void drawInnerPolygon(const GUIVisualizationSettings& s) const;
119 
120 private:
122  mutable MFXMutex myLock;
123 
125  mutable GLuint myDisplayList;
126 
128  void storeTesselation(double lineWidth) const;
129 
130  // @brief perform the tesselation / drawing
131  void performTesselation(double lineWidth) const;
132 
133 };
134 
135 
136 #endif
137 
138 /****************************************************************************/
139 
void setColor(const GUIVisualizationSettings &s) const
set color
Definition: GUIPolygon.cpp:219
void performTesselation(double lineWidth) const
Definition: GUIPolygon.cpp:170
void storeTesselation(double lineWidth) const
store the drawing commands in a display list
Definition: GUIPolygon.cpp:204
Stores the information about how to visualize structures.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GLuint myDisplayList
id of the display list for the cached tesselation
Definition: GUIPolygon.h:125
A list of positions.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPolygon.cpp:122
bool checkDraw(const GUIVisualizationSettings &s) const
check if Polygon can be drawn
Definition: GUIPolygon.cpp:236
virtual void setShape(const PositionVector &shape)
set a new shape and update the tesselation
Definition: GUIPolygon.cpp:162
void drawInnerPolygon(const GUIVisualizationSettings &s) const
draw inner Polygon (before pushName() )
Definition: GUIPolygon.cpp:258
virtual void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPolygon.cpp:144
GUIPolygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool geo, bool fill, double lineWidth, double layer=0, double angle=0, const std::string &imgFile="", bool relativePath=false)
Constructor.
Definition: GUIPolygon.cpp:89
~GUIPolygon()
Destructor.
Definition: GUIPolygon.cpp:100
The popup menu of a globject.
MFXMutex myLock
The mutex used to avoid concurrent updates of the shape.
Definition: GUIPolygon.h:122
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPolygon.cpp:135
A window containing a gl-object&#39;s parameter.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPolygon.cpp:105