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-2026 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 double DEFAULT_HEIGHT;
51 static const std::string DEFAULT_NAME;
54
58 Shape(const std::string& id);
59
69 Shape(const std::string& id, const std::string& type, const RGBColor& color, double layer,
70 double angle, const std::string& imgFile, const std::string& name);
71
73 virtual ~Shape();
74
78 void writeShapeAttributes(OutputDevice& device, const RGBColor& defaultColor, const double defaultLayer) const;
79
82
86 const std::string& getShapeType() const;
87
91 const RGBColor& getShapeColor() const;
92
96 double getShapeLayer() const;
97
101 double getShapeNaviDegree() const;
102
106 const std::string& getShapeImgFile() const;
107
109 const std::string& getShapeName() const;
110
112
115
119 void setShapeType(const std::string& type);
120
124 void setShapeColor(const RGBColor& col);
125
129 void setShapeAlpha(unsigned char alpha);
130
134 void setShapeLayer(const double layer);
135
139 virtual void setShapeNaviDegree(const double angle);
140
144 void setShapeImgFile(const std::string& imgFile);
145
147 void setShapeName(const std::string& name);
148
150
151private:
153 std::string myType = DEFAULT_TYPE;
154
157
160
163
166
168 std::string myName = DEFAULT_NAME;
169};
Base class for objects which have an id.
Definition Named.h:53
Static storage of an output device and its base (abstract) implementation.
std::map< std::string, std::string > Map
parameters map
static const RGBColor BLACK
Definition RGBColor.h:206
A 2D- or 3D-Shape.
Definition Shape.h:38
std::string myImgFile
The img file (include path)
Definition Shape.h:165
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition Shape.cpp:147
static const double DEFAULT_LAYER
Definition Shape.h:43
static const double DEFAULT_HEIGHT
Definition Shape.h:50
static const double DEFAULT_LAYER_POI
Definition Shape.h:45
void setShapeName(const std::string &name)
Sets a new shape name.
Definition Shape.cpp:170
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.cpp:153
void writeShapeAttributes(OutputDevice &device, const RGBColor &defaultColor, const double defaultLayer) const
write shape attributes in a xml file
Definition Shape.cpp:70
static const double DEFAULT_IMG_WIDTH
Definition Shape.h:48
std::string myType
The type of the Shape.
Definition Shape.h:153
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.cpp:99
static const double DEFAULT_LINEWIDTH
Definition Shape.h:44
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.cpp:135
static const double DEFAULT_ANGLE
Definition Shape.h:46
virtual ~Shape()
Destructor.
Definition Shape.cpp:66
static const std::string DEFAULT_NAME
Definition Shape.h:51
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.cpp:159
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.cpp:165
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.cpp:141
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.cpp:111
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.cpp:123
double myLayer
The layer of the Shape.
Definition Shape.h:159
const std::string & getShapeName() const
Returns the name of the Shape.
Definition Shape.cpp:129
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.cpp:105
double myNaviDegreeAngle
The angle of the Shape.
Definition Shape.h:162
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition Shape.cpp:117
static const Parameterised::Map DEFAULT_PARAMETERS
Definition Shape.h:52
std::string myName
shape name
Definition Shape.h:168
RGBColor myColor
The color of the Shape.
Definition Shape.h:156