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-2020 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,
56  const RGBColor& color, const PositionVector& shape, bool geo, bool fill, double lineWidth,
57  double layer = 0, double angle = 0, const std::string& imgFile = "", bool relativePath = false);
58 
60  ~GUIPolygon();
61 
62 
64 
65 
74  GUISUMOAbstractView& parent);
75 
76 
85  GUISUMOAbstractView& parent);
86 
87 
94 
95 
100  virtual void drawGL(const GUIVisualizationSettings& s) const;
102 
103 
105  virtual void setShape(const PositionVector& shape);
106 
110  virtual void setShapeNaviDegree(const double angle) {
112  if (angle != 0.) {
113  setShape(myShape);
114  }
115  }
116 
118  static void setColor(const GUIVisualizationSettings& s, const SUMOPolygon* polygon, const GUIGlObject* o, bool disableSelectionColor);
119 
121  static bool checkDraw(const GUIVisualizationSettings& s, const SUMOPolygon* polygon, const GUIGlObject* o);
122 
124  static void drawInnerPolygon(const GUIVisualizationSettings& s, const SUMOPolygon* polygon, const GUIGlObject* o, const PositionVector shape, double layer, bool disableSelectionColor);
125 
126 private:
128  mutable FXMutex myLock;
129 
131  mutable GLuint myDisplayList;
132 
135 
137  void storeTesselation(const bool fill, const PositionVector& shape, double lineWidth) const;
138 
139  // @brief perform the tesselation / drawing
140  static void performTesselation(const bool fill, const PositionVector& shape, const double lineWidth);
141 
142 };
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:171
static bool checkDraw(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o)
check if Polygon can be drawn
Definition: GUIPolygon.cpp:257
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPolygon.cpp:111
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: GUIPolygon.h:110
void storeTesselation(const bool fill, const PositionVector &shape, double lineWidth) const
store the drawing commands in a display list
Definition: GUIPolygon.cpp:225
static void setColor(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o, bool disableSelectionColor)
set color
Definition: GUIPolygon.cpp:240
PositionVector * myRotatedShape
shape rotated on the centroid, if rotation is needed, nullptr otherwise
Definition: GUIPolygon.h:134
GLuint myDisplayList
id of the display list for the cached tesselation
Definition: GUIPolygon.h:131
static void drawInnerPolygon(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o, const PositionVector shape, double layer, bool disableSelectionColor)
draw inner Polygon (before pushName() )
Definition: GUIPolygon.cpp:279
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPolygon.cpp:127
~GUIPolygon()
Destructor.
Definition: GUIPolygon.cpp:105
static void performTesselation(const bool fill, const PositionVector &shape, const double lineWidth)
Definition: GUIPolygon.cpp:192
FXMutex myLock
The mutex used to avoid concurrent updates of the shape.
Definition: GUIPolygon.h:128
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPolygon.cpp:139
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:91
virtual void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPolygon.cpp:149
Stores the information about how to visualize structures.
A list of positions.
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:133
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:148