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-sim.org/
13 // Copyright (C) 2004-2014 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 // we need to put this into a namespace to avoid clashing with wingdi.h::Polygon function
41 namespace SUMO {
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 class Polygon : public Shape, public Parameterised {
51 public:
62  Polygon(const std::string& id, const std::string& type,
63  const RGBColor& color, const PositionVector& shape, bool fill,
64  SUMOReal layer = DEFAULT_LAYER,
65  SUMOReal angle = DEFAULT_ANGLE,
66  const std::string& imgFile = DEFAULT_IMG_FILE);
67 
68 
70  virtual ~Polygon();
71 
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 
94 
97 
101  inline void setFill(bool fill) {
102  myFill = fill;
103  }
104 
105 
109  inline virtual void setShape(const PositionVector& shape) {
110  myShape = shape;
111  }
113 
114 
115 protected:
118 
120  bool myFill;
121 
122 };
123 
124 }
125 
126 #endif
127 
128 /****************************************************************************/
129 
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:80
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: Polygon.h:109
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:44
A 2D- or 3D-polygon.
Definition: Polygon.h:50
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:120
Definition: Polygon.h:41
#define SUMOReal
Definition: config.h:215
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: Polygon.h:101
PositionVector myShape
The positions of the polygon.
Definition: Polygon.h:117
bool getFill() const
Returns whether the polygon is filled.
Definition: Polygon.h:88
virtual ~Polygon()
Destructor.
Definition: Polygon.cpp:53