Eclipse SUMO - Simulation of Urban MObility
SUMOPolygon.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-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 /****************************************************************************/
17 // A 2D- or 3D-polygon
18 /****************************************************************************/
19 #ifndef Polygon_h
20 #define Polygon_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
30 #include "Shape.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OutputDevice;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
46 class SUMOPolygon : public Shape, public Parameterised {
47  friend class PolygonDynamics;
48 public:
62  SUMOPolygon(const std::string& id, const std::string& type,
63  const RGBColor& color, const PositionVector& shape,
64  bool geo, bool fill, double lineWidth,
65  double layer = DEFAULT_LAYER,
66  double angle = DEFAULT_ANGLE,
67  const std::string& imgFile = DEFAULT_IMG_FILE,
68  bool relativePath = DEFAULT_RELATIVEPATH);
69 
70 
72  virtual ~SUMOPolygon();
73 
74 
77 
81  inline const PositionVector& getShape() const {
82  return myShape;
83  }
84 
85 
89  inline bool getFill() const {
90  return myFill;
91  }
92 
96  inline double getLineWidth() const {
97  return myLineWidth;
98  }
100 
101 
104 
108  inline void setFill(bool fill) {
109  myFill = fill;
110  }
111 
112  inline void setLineWidth(double lineWidth) {
113  myLineWidth = lineWidth;
114  }
115 
116 
120  inline virtual void setShape(const PositionVector& shape) {
121  myShape = shape;
122  }
124 
125  /* @brief polygon definition to the given device
126  * @param[in] geo Whether to write the output in geo-coordinates
127  */
128  void writeXML(OutputDevice& out, bool geo = false);
129 
130 protected:
133 
135  bool myGEO;
136 
138  bool myFill;
139 
141  double myLineWidth;
142 };
143 
144 
145 #endif
146 
147 /****************************************************************************/
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
SUMOPolygon::writeXML
void writeXML(OutputDevice &out, bool geo=false)
Definition: SUMOPolygon.cpp:49
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
SUMOPolygon::setShape
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: SUMOPolygon.h:120
Shape::DEFAULT_LAYER
static const double DEFAULT_LAYER
Definition: Shape.h:43
SUMOPolygon::myShape
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:132
PositionVector
A list of positions.
Definition: PositionVector.h:45
SUMOPolygon::myLineWidth
double myLineWidth
The line width for drawing an unfilled polygon.
Definition: SUMOPolygon.h:141
Shape::DEFAULT_RELATIVEPATH
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:48
RGBColor
Definition: RGBColor.h:39
Shape.h
SUMOPolygon::myGEO
bool myGEO
specify if shape is handled as GEO coordinate (Main used in netedit)
Definition: SUMOPolygon.h:135
Parameterised.h
Shape
A 2D- or 3D-Shape.
Definition: Shape.h:38
SUMOPolygon::getShape
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.h:81
SUMOPolygon::setFill
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: SUMOPolygon.h:108
SUMOPolygon
Definition: SUMOPolygon.h:46
SUMOPolygon::setLineWidth
void setLineWidth(double lineWidth)
Definition: SUMOPolygon.h:112
PolygonDynamics
Definition: PolygonDynamics.h:29
Shape::DEFAULT_ANGLE
static const double DEFAULT_ANGLE
Definition: Shape.h:46
config.h
SUMOPolygon::myFill
bool myFill
Information whether the polygon has to be filled.
Definition: SUMOPolygon.h:138
SUMOPolygon::getFill
bool getFill() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.h:89
Shape::DEFAULT_IMG_FILE
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
PositionVector.h
SUMOPolygon::~SUMOPolygon
virtual ~SUMOPolygon()
Destructor.
Definition: SUMOPolygon.cpp:45
SUMOPolygon::SUMOPolygon
SUMOPolygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool geo, bool fill, double lineWidth, double layer=DEFAULT_LAYER, double angle=DEFAULT_ANGLE, const std::string &imgFile=DEFAULT_IMG_FILE, bool relativePath=DEFAULT_RELATIVEPATH)
Constructor.
Definition: SUMOPolygon.cpp:34
SUMOPolygon::getLineWidth
double getLineWidth() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.h:96