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-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 /****************************************************************************/
18 // A 2D- or 3D-polygon
19 /****************************************************************************/
20 #ifndef Polygon_h
21 #define Polygon_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
31 #include "Shape.h"
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
47 class SUMOPolygon : public Shape, public Parameterised {
48 public:
61  SUMOPolygon(const std::string& id, const std::string& type,
62  const RGBColor& color, const PositionVector& shape,
63  bool geo, bool fill,
64  double layer = DEFAULT_LAYER,
65  double angle = DEFAULT_ANGLE,
66  const std::string& imgFile = DEFAULT_IMG_FILE,
67  bool relativePath = DEFAULT_RELATIVEPATH);
68 
69 
71  virtual ~SUMOPolygon();
72 
73 
76 
80  inline const PositionVector& getShape() const {
81  return myShape;
82  }
83 
84 
88  inline bool getFill() const {
89  return myFill;
90  }
92 
93 
96 
100  inline void setFill(bool fill) {
101  myFill = fill;
102  }
103 
104 
108  inline virtual void setShape(const PositionVector& shape) {
109  myShape = shape;
110  }
112 
113  /* @brief polygon definition to the given device
114  * @param[in] geo Whether to write the output in geo-coordinates
115  */
116  void writeXML(OutputDevice& out, bool geo = false);
117 
118 protected:
121 
123  bool myGEO;
124 
126  bool myFill;
127 };
128 
129 
130 #endif
131 
132 /****************************************************************************/
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:120
bool myGEO
specify if shape is handled as GEO coordinate (Main used in netedit)
Definition: SUMOPolygon.h:123
bool myFill
Information whether the polygon has to be filled.
Definition: SUMOPolygon.h:126
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
SUMOPolygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool geo, bool fill, double layer=DEFAULT_LAYER, double angle=DEFAULT_ANGLE, const std::string &imgFile=DEFAULT_IMG_FILE, bool relativePath=DEFAULT_RELATIVEPATH)
Constructor.
Definition: SUMOPolygon.cpp:35
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.h:80
virtual ~SUMOPolygon()
Destructor.
Definition: SUMOPolygon.cpp:45
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: SUMOPolygon.h:108
A list of positions.
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:48
A 2D- or 3D-Shape.
Definition: Shape.h:39
An upper class for objects with additional parameters.
Definition: Parameterised.h:44
bool getFill() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.h:88
void writeXML(OutputDevice &out, bool geo=false)
Definition: SUMOPolygon.cpp:49
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: SUMOPolygon.h:100
static const double DEFAULT_ANGLE
Definition: Shape.h:46
static const double DEFAULT_LAYER
Definition: Shape.h:44