SUMO - Simulation of Urban MObility
SUMOPolygon.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A 2D- or 3D-polygon
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef Polygon_h
24 #define Polygon_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
38 #include "Shape.h"
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
54 class SUMOPolygon : public Shape, public Parameterised {
55 public:
66  SUMOPolygon(const std::string& id, const std::string& type,
67  const RGBColor& color, const PositionVector& shape, bool fill,
68  double layer = DEFAULT_LAYER,
69  double angle = DEFAULT_ANGLE,
70  const std::string& imgFile = DEFAULT_IMG_FILE);
71 
72 
74  virtual ~SUMOPolygon();
75 
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 
98 
101 
105  inline void setFill(bool fill) {
106  myFill = fill;
107  }
108 
109 
113  inline virtual void setShape(const PositionVector& shape) {
114  myShape = shape;
115  }
117 
118  /* @brief polygon definition to the given device
119  * @param[in] geo Whether to write the output in geo-coordinates
120  */
121  void writeXML(OutputDevice& out, bool geo = false);
122 
123 protected:
126 
128  bool myFill;
129 
130 };
131 
132 
133 #endif
134 
135 /****************************************************************************/
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:125
bool myFill
Information whether the polygon has to be filled.
Definition: SUMOPolygon.h:128
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:152
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.h:84
virtual ~SUMOPolygon()
Destructor.
Definition: SUMOPolygon.cpp:51
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: SUMOPolygon.h:113
A list of positions.
SUMOPolygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool fill, double layer=DEFAULT_LAYER, double angle=DEFAULT_ANGLE, const std::string &imgFile=DEFAULT_IMG_FILE)
Constructor.
Definition: SUMOPolygon.cpp:42
A 2D- or 3D-Shape.
Definition: Shape.h:46
bool getFill() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.h:92
An upper class for objects with additional parameters.
Definition: Parameterised.h:51
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:71
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: SUMOPolygon.h:105
static const double DEFAULT_ANGLE
Definition: Shape.h:151
static const double DEFAULT_LAYER
Definition: Shape.h:150