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
57 Shape(const std::string& id);
58
68 Shape(const std::string& id, const std::string& type, const RGBColor& color, double layer,
69 double angle, const std::string& imgFile, const std::string& name);
70
72 virtual ~Shape();
73
77 void writeShapeAttributes(OutputDevice& device, const RGBColor& defaultColor, const double defaultLayer) const;
78
81
85 const std::string& getShapeType() const;
86
90 const RGBColor& getShapeColor() const;
91
95 double getShapeLayer() const;
96
100 double getShapeNaviDegree() const;
101
105 const std::string& getShapeImgFile() const;
106
108 const std::string& getShapeName() const;
109
111
114
118 void setShapeType(const std::string& type);
119
123 void setShapeColor(const RGBColor& col);
124
128 void setShapeAlpha(unsigned char alpha);
129
133 void setShapeLayer(const double layer);
134
138 virtual void setShapeNaviDegree(const double angle);
139
143 void setShapeImgFile(const std::string& imgFile);
144
146 void setShapeName(const std::string& name);
147
149
150private:
152 std::string myType;
153
156
158 double myLayer;
159
162
164 std::string myImgFile;
165
167 std::string myName;
168};
Base class for objects which have an id.
Definition Named.h:54
Static storage of an output device and its base (abstract) implementation.
std::map< std::string, std::string > Map
parameters map
A 2D- or 3D-Shape.
Definition Shape.h:38
std::string myImgFile
The img file (include path)
Definition Shape.h:164
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition Shape.cpp:151
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.cpp:174
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.cpp:157
void writeShapeAttributes(OutputDevice &device, const RGBColor &defaultColor, const double defaultLayer) const
write shape attributes in a xml file
Definition Shape.cpp:74
static const double DEFAULT_IMG_WIDTH
Definition Shape.h:48
std::string myType
The type of the Shape.
Definition Shape.h:152
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:103
static const double DEFAULT_LINEWIDTH
Definition Shape.h:44
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.cpp:139
static const double DEFAULT_ANGLE
Definition Shape.h:46
virtual ~Shape()
Destructor.
Definition Shape.cpp:70
static const std::string DEFAULT_NAME
Definition Shape.h:50
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.cpp:163
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.cpp:169
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:145
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.cpp:115
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.cpp:127
double myLayer
The layer of the Shape.
Definition Shape.h:158
const std::string & getShapeName() const
Returns the name of the Shape.
Definition Shape.cpp:133
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.cpp:109
double myNaviDegreeAngle
The angle of the Shape.
Definition Shape.h:161
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition Shape.cpp:121
static const Parameterised::Map DEFAULT_PARAMETERS
Definition Shape.h:51
std::string myName
shape name
Definition Shape.h:167
RGBColor myColor
The color of the Shape.
Definition Shape.h:155