Eclipse 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-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 /****************************************************************************/
20 // The GUI-version of a polygon
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 /*
36  * @class GUIPolygon
37  * @brief The GUI-version of a polygon
38  */
40 
41 public:
55  GUIPolygon(const std::string& id, const std::string& type, const RGBColor& color, const PositionVector& shape,
56  bool geo, bool fill, double lineWidth, double layer = 0, double angle = 0, const std::string& imgFile = "",
57  bool relativePath = false, const std::string& name = DEFAULT_NAME);
58 
60  ~GUIPolygon();
61 
63 
64 
73  GUISUMOAbstractView& parent);
74 
83  GUISUMOAbstractView& parent);
84 
86  double getExaggeration(const GUIVisualizationSettings& s) const;
87 
94 
99  virtual void drawGL(const GUIVisualizationSettings& s) const;
101 
103  virtual void setShape(const PositionVector& shape);
104 
108  virtual void setShapeNaviDegree(const double angle) {
110  if (angle != 0.) {
111  setShape(myShape);
112  }
113  }
114 
116  static void setColor(const GUIVisualizationSettings& s, const SUMOPolygon* polygon, const GUIGlObject* o, bool disableSelectionColor, int alphaOverride);
117 
119  static bool checkDraw(const GUIVisualizationSettings& s, const SUMOPolygon* polygon, const GUIGlObject* o);
120 
122  static void drawInnerPolygon(const GUIVisualizationSettings& s, const SUMOPolygon* polygon, const GUIGlObject* o,
123  const PositionVector shape, const bool drawFill, double layer, bool disableSelectionColor, int alphaOverride = -1);
124 
125 private:
127  mutable FXMutex myLock;
128 
130  mutable GLuint myDisplayList;
131 
134 
136  void storeTesselation(const bool fill, const PositionVector& shape, double lineWidth) const;
137 
138  // @brief perform the tesselation / drawing
139  static void performTesselation(const bool fill, const PositionVector& shape, const double lineWidth);
140 
141 };
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
The popup menu of a globject.
A window containing a gl-object's parameter.
virtual void setShape(const PositionVector &shape)
set a new shape and update the tesselation
Definition: GUIPolygon.cpp:182
static bool checkDraw(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o)
check if Polygon can be drawn
Definition: GUIPolygon.cpp:280
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPolygon.cpp:115
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: GUIPolygon.h:108
static void drawInnerPolygon(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o, const PositionVector shape, const bool drawFill, double layer, bool disableSelectionColor, int alphaOverride=-1)
draw inner Polygon (before pushName() )
Definition: GUIPolygon.cpp:302
void storeTesselation(const bool fill, const PositionVector &shape, double lineWidth) const
store the drawing commands in a display list
Definition: GUIPolygon.cpp:243
PositionVector * myRotatedShape
shape rotated on the centroid, if rotation is needed, nullptr otherwise
Definition: GUIPolygon.h:133
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, const std::string &name=DEFAULT_NAME)
Constructor.
Definition: GUIPolygon.cpp:95
GLuint myDisplayList
id of the display list for the cached tesselation
Definition: GUIPolygon.h:130
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPolygon.cpp:131
~GUIPolygon()
Destructor.
Definition: GUIPolygon.cpp:109
static void performTesselation(const bool fill, const PositionVector &shape, const double lineWidth)
Definition: GUIPolygon.cpp:203
FXMutex myLock
The mutex used to avoid concurrent updates of the shape.
Definition: GUIPolygon.h:127
static void setColor(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o, bool disableSelectionColor, int alphaOverride)
set color
Definition: GUIPolygon.cpp:258
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPolygon.cpp:150
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GUIPolygon.cpp:144
virtual void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPolygon.cpp:160
Stores the information about how to visualize structures.
A list of positions.
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:121
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:156
static const std::string DEFAULT_NAME
Definition: Shape.h:50