Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
Shape.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2012-2025 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 <map>
26#include <utils/common/Named.h>
29
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
38class Shape : public Named {
39public:
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 double DEFAULT_IMG_WIDTH;
49 static const double DEFAULT_IMG_HEIGHT;
50 static const std::string DEFAULT_NAME;
53
63 Shape(const std::string& id, const std::string& type, const RGBColor& color, double layer,
64 double angle, const std::string& imgFile, const std::string& name);
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
108 inline const std::string getShapeName() const {
109 return myName;
110 }
111
113
114
117
121 inline void setShapeType(const std::string& type) {
122 myType = type;
123 }
124
128 inline void setShapeColor(const RGBColor& col) {
129 myColor = col;
130 }
131
135 inline void setShapeAlpha(unsigned char alpha) {
136 myColor.setAlpha(alpha);
137 }
138
142 inline void setShapeLayer(const double layer) {
143 myLayer = layer;
144 }
145
149 virtual void setShapeNaviDegree(const double angle) {
150 myNaviDegreeAngle = angle;
151 }
152
156 inline void setShapeImgFile(const std::string& imgFile) {
157 myImgFile = imgFile;
158 }
159
161 inline void setShapeName(const std::string& name) {
162 myName = name;
163 }
164
166
167private:
169 std::string myType;
170
173
175 double myLayer;
176
179
181 std::string myImgFile;
182
184 std::string myName;
185};
Base class for objects which have an id.
Definition Named.h:54
std::map< std::string, std::string > Map
parameters map
void setAlpha(unsigned char alpha)
Sets a new alpha value.
Definition RGBColor.cpp:108
A 2D- or 3D-Shape.
Definition Shape.h:38
const std::string getShapeName() const
Returns the name of the Shape.
Definition Shape.h:108
std::string myImgFile
The img file (include path)
Definition Shape.h:181
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition Shape.h:135
static const double DEFAULT_LAYER
Definition Shape.h:43
static const double DEFAULT_LAYER_POI
Definition Shape.h:45
void setShapeName(const std::string &name)
Sets a new shape name.
Definition Shape.h:161
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.h:142
static const double DEFAULT_IMG_WIDTH
Definition Shape.h:48
std::string myType
The type of the Shape.
Definition Shape.h:169
static const std::string DEFAULT_IMG_FILE
Definition Shape.h:47
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.h:75
static const double DEFAULT_LINEWIDTH
Definition Shape.h:44
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.h:121
static const double DEFAULT_ANGLE
Definition Shape.h:46
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.h:149
virtual ~Shape()
Destructor.
Definition Shape.cpp:56
static const std::string DEFAULT_NAME
Definition Shape.h:50
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.h:156
static const double DEFAULT_IMG_HEIGHT
Definition Shape.h:49
static const std::string DEFAULT_TYPE
Definition Shape.h:42
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition Shape.h:128
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.h:89
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.h:103
double myLayer
The layer of the Shape.
Definition Shape.h:175
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.h:82
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:96
static const Parameterised::Map DEFAULT_PARAMETERS
Definition Shape.h:51
std::string myName
shape name
Definition Shape.h:184
RGBColor myColor
The color of the Shape.
Definition Shape.h:172