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-2019 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 /****************************************************************************/
16 // The GUI-version of a polygon
17 /****************************************************************************/
18 #ifndef GUIPolygon_h
19 #define GUIPolygon_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 /*
38  * @class GUIPolygon
39  * @brief The GUI-version of a polygon
40  */
42 public:
56  GUIPolygon(const std::string& id, const std::string& type,
57  const RGBColor& color, const PositionVector& shape, bool geo, bool fill, double lineWidth,
58  double layer = 0, double angle = 0, const std::string& imgFile = "", bool relativePath = false);
59 
61  ~GUIPolygon();
62 
63 
65 
66 
75  GUISUMOAbstractView& parent);
76 
77 
86  GUISUMOAbstractView& parent);
87 
88 
95 
96 
101  virtual void drawGL(const GUIVisualizationSettings& s) const;
103 
104 
106  virtual void setShape(const PositionVector& shape);
107 
111  virtual void setShapeNaviDegree(const double angle) {
113  if (angle != 0.) {
114  setShape(myShape);
115  }
116  }
117 
118 protected:
120  void setColor(const GUIVisualizationSettings& s, bool disableSelectionColor) const;
121 
123  bool checkDraw(const GUIVisualizationSettings& s) const;
124 
126  void drawInnerPolygon(const GUIVisualizationSettings& s, bool disableSelectionColor) const;
127 
128 private:
130  mutable FXMutex myLock;
131 
133  mutable GLuint myDisplayList;
134 
137 
139  void storeTesselation(double lineWidth) const;
140 
141  // @brief perform the tesselation / drawing
142  void performTesselation(double lineWidth) const;
143 
144 };
145 
146 
147 #endif
148 
149 /****************************************************************************/
150 
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUIVisualizationSettings.h
GUIGlObject_AbstractAdd
Definition: GUIGlObject_AbstractAdd.h:39
SUMOPolygon::myShape
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:132
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIPolygon::setColor
void setColor(const GUIVisualizationSettings &s, bool disableSelectionColor) const
set color
Definition: GUIPolygon.cpp:239
GUIPolygon::drawInnerPolygon
void drawInnerPolygon(const GUIVisualizationSettings &s, bool disableSelectionColor) const
draw inner Polygon (before pushName() )
Definition: GUIPolygon.cpp:278
RGBColor
Definition: RGBColor.h:39
GUIPolygon::myRotatedShape
PositionVector * myRotatedShape
shape rotated on the centroid, if rotation is needed, nullptr otherwise
Definition: GUIPolygon.h:136
GUIPolygon::~GUIPolygon
~GUIPolygon()
Destructor.
Definition: GUIPolygon.cpp:103
GUIPolygon::setShape
virtual void setShape(const PositionVector &shape)
set a new shape and update the tesselation
Definition: GUIPolygon.cpp:168
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GUIPolygon::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPolygon.cpp:110
GUIPolygon::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPolygon.cpp:127
GUIGlObject_AbstractAdd.h
GUIPolygon::performTesselation
void performTesselation(double lineWidth) const
Definition: GUIPolygon.cpp:189
GLIncludes.h
SUMOPolygon
Definition: SUMOPolygon.h:46
GUIPolygon::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPolygon.cpp:140
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIPolygon::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPolygon.cpp:150
GUIPolygon::GUIPolygon
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::setShapeNaviDegree
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: GUIPolygon.h:111
config.h
Shape::setShapeNaviDegree
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:150
GUIPolygon::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the shape.
Definition: GUIPolygon.h:130
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SUMOPolygon.h
GUIPolygon::myDisplayList
GLuint myDisplayList
id of the display list for the cached tesselation
Definition: GUIPolygon.h:133
GUIPolygon::checkDraw
bool checkDraw(const GUIVisualizationSettings &s) const
check if Polygon can be drawn
Definition: GUIPolygon.cpp:256
GUIPolygon
Definition: GUIPolygon.h:41
GUIPolygon::storeTesselation
void storeTesselation(double lineWidth) const
store the drawing commands in a display list
Definition: GUIPolygon.cpp:224