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 /****************************************************************************/
16 // A 2D- or 3D-Shape
17 /****************************************************************************/
18 #ifndef Shape_h
19 #define Shape_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <utils/common/Named.h>
29 #include <utils/common/RGBColor.h>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
39 class Shape : public Named {
40 public:
43  static const std::string DEFAULT_TYPE;
44  static const double DEFAULT_LAYER;
45  static const double DEFAULT_LINEWIDTH;
46  static const double DEFAULT_LAYER_POI;
47  static const double DEFAULT_ANGLE;
48  static const std::string DEFAULT_IMG_FILE;
49  static const bool DEFAULT_RELATIVEPATH;
50  static const double DEFAULT_IMG_WIDTH;
51  static const double DEFAULT_IMG_HEIGHT;
53 
63  Shape(const std::string& id, const std::string& type,
64  const RGBColor& color, double layer,
65  double angle, const std::string& imgFile, bool relativePath);
66 
68  virtual ~Shape();
69 
72 
76  inline const std::string& getShapeType() const {
77  return myType;
78  }
79 
83  inline const RGBColor& getShapeColor() const {
84  return myColor;
85  }
86 
90  inline double getShapeLayer() const {
91  return myLayer;
92  }
93 
97  inline double getShapeNaviDegree() const {
98  return myNaviDegreeAngle;
99  }
100 
104  inline const std::string& getShapeImgFile() const {
105  return myImgFile;
106  }
107 
111  inline bool getShapeRelativePath() const {
112  return myRelativePath;
113  }
115 
116 
119 
123  inline void setShapeType(const std::string& type) {
124  myType = type;
125  }
126 
130  inline void setShapeColor(const RGBColor& col) {
131  myColor = col;
132  }
133 
137  inline void setShapeAlpha(unsigned char alpha) {
138  myColor.setAlpha(alpha);
139  }
140 
144  inline void setShapeLayer(const double layer) {
145  myLayer = layer;
146  }
147 
151  inline void setShapeNaviDegree(const double angle) {
152  myNaviDegreeAngle = angle;
153  }
154 
158  inline void setShapeImgFile(const std::string& imgFile) {
159  myImgFile = imgFile;
160  }
161 
165  inline void setShapeRelativePath(bool relativePath) {
166  myRelativePath = relativePath;
167  }
169 
170 private:
172  std::string myType;
173 
176 
178  double myLayer;
179 
182 
184  std::string myImgFile;
185 
188 };
189 
190 
191 #endif
192 
193 /****************************************************************************/
194 
Shape::setShapeType
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:123
RGBColor::setAlpha
void setAlpha(unsigned char alpha)
Sets a new alpha value.
Definition: RGBColor.h:98
Named
Base class for objects which have an id.
Definition: Named.h:57
Shape::getShapeNaviDegree
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:97
Shape::myNaviDegreeAngle
double myNaviDegreeAngle
The angle of the Shape.
Definition: Shape.h:181
Shape::DEFAULT_LAYER
static const double DEFAULT_LAYER
Definition: Shape.h:44
Shape::myType
std::string myType
The type of the Shape.
Definition: Shape.h:172
Shape::setShapeImgFile
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:158
Shape::getShapeImgFile
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:104
Shape::setShapeAlpha
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition: Shape.h:137
Shape::getShapeColor
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:83
RGBColor.h
Shape::setShapeRelativePath
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:165
Shape::DEFAULT_IMG_HEIGHT
static const double DEFAULT_IMG_HEIGHT
Definition: Shape.h:51
Shape::~Shape
virtual ~Shape()
Destructor.
Definition: Shape.cpp:57
Shape::DEFAULT_RELATIVEPATH
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:49
RGBColor
Definition: RGBColor.h:40
Shape::DEFAULT_LINEWIDTH
static const double DEFAULT_LINEWIDTH
Definition: Shape.h:45
Shape::getShapeLayer
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
Named.h
Shape::DEFAULT_TYPE
static const std::string DEFAULT_TYPE
Definition: Shape.h:43
Shape::getShapeType
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:76
Shape::myImgFile
std::string myImgFile
The img file (include path)
Definition: Shape.h:184
Shape
A 2D- or 3D-Shape.
Definition: Shape.h:39
Shape::getShapeRelativePath
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:111
Shape::myRelativePath
bool myRelativePath
Enable or disable save imgFile as relative path.
Definition: Shape.h:187
Shape::setShapeLayer
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:144
Shape::DEFAULT_ANGLE
static const double DEFAULT_ANGLE
Definition: Shape.h:47
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:44
config.h
Shape::setShapeNaviDegree
void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:151
Shape::DEFAULT_IMG_FILE
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:48
Shape::DEFAULT_LAYER_POI
static const double DEFAULT_LAYER_POI
Definition: Shape.h:46
Shape::setShapeColor
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:130
Shape::myLayer
double myLayer
The layer of the Shape.
Definition: Shape.h:178
Shape::myColor
RGBColor myColor
The color of the Shape.
Definition: Shape.h:175
Shape::DEFAULT_IMG_WIDTH
static const double DEFAULT_IMG_WIDTH
Definition: Shape.h:50