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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A 2D- or 3D-Shape
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <string>
25 #include <utils/common/Named.h>
26 #include <utils/common/RGBColor.h>
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
36 class Shape : public Named {
37 public:
40  static const std::string DEFAULT_TYPE;
41  static const double DEFAULT_LAYER;
42  static const double DEFAULT_LINEWIDTH;
43  static const double DEFAULT_LAYER_POI;
44  static const double DEFAULT_ANGLE;
45  static const std::string DEFAULT_IMG_FILE;
46  static const bool DEFAULT_RELATIVEPATH;
47  static const double DEFAULT_IMG_WIDTH;
48  static const double DEFAULT_IMG_HEIGHT;
50 
60  Shape(const std::string& id, const std::string& type,
61  const RGBColor& color, double layer,
62  double angle, const std::string& imgFile, bool relativePath);
63 
65  virtual ~Shape();
66 
69 
73  inline const std::string& getShapeType() const {
74  return myType;
75  }
76 
80  inline const RGBColor& getShapeColor() const {
81  return myColor;
82  }
83 
87  inline double getShapeLayer() const {
88  return myLayer;
89  }
90 
94  inline double getShapeNaviDegree() const {
95  return myNaviDegreeAngle;
96  }
97 
101  inline const std::string& getShapeImgFile() const {
102  return myImgFile;
103  }
104 
108  inline bool getShapeRelativePath() const {
109  return myRelativePath;
110  }
112 
113 
116 
120  inline void setShapeType(const std::string& type) {
121  myType = type;
122  }
123 
127  inline void setShapeColor(const RGBColor& col) {
128  myColor = col;
129  }
130 
134  inline void setShapeAlpha(unsigned char alpha) {
135  myColor.setAlpha(alpha);
136  }
137 
141  inline void setShapeLayer(const double layer) {
142  myLayer = layer;
143  }
144 
148  virtual void setShapeNaviDegree(const double angle) {
149  myNaviDegreeAngle = angle;
150  }
151 
155  inline void setShapeImgFile(const std::string& imgFile) {
156  myImgFile = imgFile;
157  }
158 
162  inline void setShapeRelativePath(bool relativePath) {
163  myRelativePath = relativePath;
164  }
166 
167 private:
169  std::string myType;
170 
173 
175  double myLayer;
176 
179 
181  std::string myImgFile;
182 
185 };
Base class for objects which have an id.
Definition: Named.h:53
void setAlpha(unsigned char alpha)
Sets a new alpha value.
Definition: RGBColor.h:88
A 2D- or 3D-Shape.
Definition: Shape.h:36
std::string myImgFile
The img file (include path)
Definition: Shape.h:181
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:46
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:80
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition: Shape.h:134
static const double DEFAULT_LAYER
Definition: Shape.h:41
static const double DEFAULT_LAYER_POI
Definition: Shape.h:43
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:101
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:42
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:141
static const double DEFAULT_IMG_WIDTH
Definition: Shape.h:47
bool myRelativePath
Enable or disable save imgFile as relative path.
Definition: Shape.h:184
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:108
std::string myType
The type of the Shape.
Definition: Shape.h:169
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:45
static const double DEFAULT_LINEWIDTH
Definition: Shape.h:42
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:120
static const double DEFAULT_ANGLE
Definition: Shape.h:44
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:162
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:148
virtual ~Shape()
Destructor.
Definition: Shape.cpp:55
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:155
static const double DEFAULT_IMG_HEIGHT
Definition: Shape.h:48
static const std::string DEFAULT_TYPE
Definition: Shape.h:40
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:127
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:87
double myLayer
The layer of the Shape.
Definition: Shape.h:175
double myNaviDegreeAngle
The angle of the Shape.
Definition: Shape.h:178
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:94
RGBColor myColor
The color of the Shape.
Definition: Shape.h:172
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:73