Eclipse SUMO - Simulation of Urban MObility
Shape.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 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 /****************************************************************************/
15 // A 2D- or 3D-Shape
16 /****************************************************************************/
17 #ifndef Shape_h
18 #define Shape_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <utils/common/Named.h>
28 #include <utils/common/RGBColor.h>
29 
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
38 class Shape : public Named {
39 public:
42  static const std::string DEFAULT_TYPE;
43  static const double DEFAULT_LAYER;
44  static const double DEFAULT_LINEWIDTH;
45  static const double DEFAULT_LAYER_POI;
46  static const double DEFAULT_ANGLE;
47  static const std::string DEFAULT_IMG_FILE;
48  static const bool DEFAULT_RELATIVEPATH;
49  static const double DEFAULT_IMG_WIDTH;
50  static const double DEFAULT_IMG_HEIGHT;
52 
62  Shape(const std::string& id, const std::string& type,
63  const RGBColor& color, double layer,
64  double angle, const std::string& imgFile, bool relativePath);
65 
67  virtual ~Shape();
68 
71 
75  inline const std::string& getShapeType() const {
76  return myType;
77  }
78 
82  inline const RGBColor& getShapeColor() const {
83  return myColor;
84  }
85 
89  inline double getShapeLayer() const {
90  return myLayer;
91  }
92 
96  inline double getShapeNaviDegree() const {
97  return myNaviDegreeAngle;
98  }
99 
103  inline const std::string& getShapeImgFile() const {
104  return myImgFile;
105  }
106 
110  inline bool getShapeRelativePath() const {
111  return myRelativePath;
112  }
114 
115 
118 
122  inline void setShapeType(const std::string& type) {
123  myType = type;
124  }
125 
129  inline void setShapeColor(const RGBColor& col) {
130  myColor = col;
131  }
132 
136  inline void setShapeAlpha(unsigned char alpha) {
137  myColor.setAlpha(alpha);
138  }
139 
143  inline void setShapeLayer(const double layer) {
144  myLayer = layer;
145  }
146 
150  virtual void setShapeNaviDegree(const double angle) {
151  myNaviDegreeAngle = angle;
152  }
153 
157  inline void setShapeImgFile(const std::string& imgFile) {
158  myImgFile = imgFile;
159  }
160 
164  inline void setShapeRelativePath(bool relativePath) {
165  myRelativePath = relativePath;
166  }
168 
169 private:
171  std::string myType;
172 
175 
177  double myLayer;
178 
181 
183  std::string myImgFile;
184 
187 };
188 
189 
190 #endif
191 
192 /****************************************************************************/
193 
Shape::setShapeType
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:122
RGBColor::setAlpha
void setAlpha(unsigned char alpha)
Sets a new alpha value.
Definition: RGBColor.h:97
Named
Base class for objects which have an id.
Definition: Named.h:56
Shape::getShapeNaviDegree
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:96
Shape::myNaviDegreeAngle
double myNaviDegreeAngle
The angle of the Shape.
Definition: Shape.h:180
Shape::DEFAULT_LAYER
static const double DEFAULT_LAYER
Definition: Shape.h:43
Shape::myType
std::string myType
The type of the Shape.
Definition: Shape.h:171
Shape::setShapeImgFile
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:157
Shape::getShapeImgFile
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:103
Shape::setShapeAlpha
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition: Shape.h:136
Shape::getShapeColor
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:82
RGBColor.h
Shape::setShapeRelativePath
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:164
Shape::DEFAULT_IMG_HEIGHT
static const double DEFAULT_IMG_HEIGHT
Definition: Shape.h:50
Shape::~Shape
virtual ~Shape()
Destructor.
Definition: Shape.cpp:56
Shape::DEFAULT_RELATIVEPATH
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:48
RGBColor
Definition: RGBColor.h:39
Shape::DEFAULT_LINEWIDTH
static const double DEFAULT_LINEWIDTH
Definition: Shape.h:44
Shape::getShapeLayer
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:89
Named.h
Shape::DEFAULT_TYPE
static const std::string DEFAULT_TYPE
Definition: Shape.h:42
Shape::getShapeType
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:75
Shape::myImgFile
std::string myImgFile
The img file (include path)
Definition: Shape.h:183
Shape
A 2D- or 3D-Shape.
Definition: Shape.h:38
Shape::getShapeRelativePath
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:110
Shape::myRelativePath
bool myRelativePath
Enable or disable save imgFile as relative path.
Definition: Shape.h:186
Shape::setShapeLayer
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:143
Shape::DEFAULT_ANGLE
static const double DEFAULT_ANGLE
Definition: Shape.h:46
Shape::Shape
Shape(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath)
Constructor.
Definition: Shape.cpp:43
config.h
Shape::setShapeNaviDegree
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:150
Shape::DEFAULT_IMG_FILE
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
Shape::DEFAULT_LAYER_POI
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
Shape::setShapeColor
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:129
Shape::myLayer
double myLayer
The layer of the Shape.
Definition: Shape.h:177
Shape::myColor
RGBColor myColor
The color of the Shape.
Definition: Shape.h:174
Shape::DEFAULT_IMG_WIDTH
static const double DEFAULT_IMG_WIDTH
Definition: Shape.h:49