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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // A 2D- or 3D-polygon
21 /****************************************************************************/
22 #ifndef Polygon_h
23 #define Polygon_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
37 #include "Shape.h"
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 class SUMOPolygon : public Shape, public Parameterised {
54 public:
66  SUMOPolygon(const std::string& id, const std::string& type,
67  const RGBColor& color, const PositionVector& shape,
68  bool geo, bool fill,
69  double layer = DEFAULT_LAYER,
70  double angle = DEFAULT_ANGLE,
71  const std::string& imgFile = DEFAULT_IMG_FILE);
72 
73 
75  virtual ~SUMOPolygon();
76 
77 
80 
84  inline const PositionVector& getShape() const {
85  return myShape;
86  }
87 
88 
92  inline bool getFill() const {
93  return myFill;
94  }
96 
97 
100 
104  inline void setFill(bool fill) {
105  myFill = fill;
106  }
107 
108 
112  inline virtual void setShape(const PositionVector& shape) {
113  myShape = shape;
114  }
116 
117  /* @brief polygon definition to the given device
118  * @param[in] geo Whether to write the output in geo-coordinates
119  */
120  void writeXML(OutputDevice& out, bool geo = false);
121 
122 protected:
125 
127  bool myGEO;
128 
130  bool myFill;
131 };
132 
133 
134 #endif
135 
136 /****************************************************************************/
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:124
bool myGEO
specify if shape is handled as GEO coordinate (Main used in netedit)
Definition: SUMOPolygon.h:127
bool myFill
Information whether the polygon has to be filled.
Definition: SUMOPolygon.h:130
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:151
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.h:84
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)
Constructor.
Definition: SUMOPolygon.cpp:41
virtual ~SUMOPolygon()
Destructor.
Definition: SUMOPolygon.cpp:51
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: SUMOPolygon.h:112
A list of positions.
A 2D- or 3D-Shape.
Definition: Shape.h:45
An upper class for objects with additional parameters.
Definition: Parameterised.h:50
bool getFill() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.h:92
void writeXML(OutputDevice &out, bool geo=false)
Definition: SUMOPolygon.cpp:55
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: SUMOPolygon.h:104
static const double DEFAULT_ANGLE
Definition: Shape.h:150
static const double DEFAULT_LAYER
Definition: Shape.h:149