SUMO - Simulation of Urban MObility
Polygon.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-2016 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 class OutputDevice;
41 
42 // we need to put this into a namespace to avoid clashing with wingdi.h::Polygon function
43 namespace SUMO {
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 class Polygon : public Shape, public Parameterised {
53 public:
64  Polygon(const std::string& id, const std::string& type,
65  const RGBColor& color, const PositionVector& shape, bool fill,
66  SUMOReal layer = DEFAULT_LAYER,
67  SUMOReal angle = DEFAULT_ANGLE,
68  const std::string& imgFile = DEFAULT_IMG_FILE);
69 
70 
72  virtual ~Polygon();
73 
74 
75 
78 
82  inline const PositionVector& getShape() const {
83  return myShape;
84  }
85 
86 
90  inline bool getFill() const {
91  return myFill;
92  }
94 
95 
96 
99 
103  inline void setFill(bool fill) {
104  myFill = fill;
105  }
106 
107 
111  inline virtual void setShape(const PositionVector& shape) {
112  myShape = shape;
113  }
115 
116  /* @brief polygon definition to the given device
117  * @param[in] geo Whether to write the output in geo-coordinates
118  */
119  void writeXML(OutputDevice& out, bool geo = false);
120 
121 protected:
124 
126  bool myFill;
127 
128 };
129 
130 }
131 
132 #endif
133 
134 /****************************************************************************/
135 
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:152
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: Polygon.h:82
void writeXML(OutputDevice &out, bool geo=false)
Definition: Polygon.cpp:60
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: Polygon.h:111
Polygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool fill, SUMOReal layer=DEFAULT_LAYER, SUMOReal angle=DEFAULT_ANGLE, const std::string &imgFile=DEFAULT_IMG_FILE)
Constructor.
Definition: Polygon.cpp:47
A 2D- or 3D-polygon.
Definition: Polygon.h:52
static const SUMOReal DEFAULT_ANGLE
Definition: Shape.h:151
A list of positions.
A 2D- or 3D-Shape.
Definition: Shape.h:46
An upper class for objects with additional parameters.
Definition: Parameterised.h:47
static const SUMOReal DEFAULT_LAYER
Definition: Shape.h:150
bool myFill
Information whether the polygon has to be filled.
Definition: Polygon.h:126
Definition: Polygon.h:43
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:213
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: Polygon.h:103
PositionVector myShape
The positions of the polygon.
Definition: Polygon.h:123
bool getFill() const
Returns whether the polygon is filled.
Definition: Polygon.h:90
virtual ~Polygon()
Destructor.
Definition: Polygon.cpp:56