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 declarations
33// ===========================================================================
34class OutputDevice;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
44class Shape : public Named {
45public:
48 static const std::string DEFAULT_TYPE;
49 static const double DEFAULT_LAYER;
50 static const double DEFAULT_LINEWIDTH;
51 static const double DEFAULT_LAYER_POI;
52 static const double DEFAULT_ANGLE;
53 static const std::string DEFAULT_IMG_FILE;
54 static const double DEFAULT_IMG_WIDTH;
55 static const double DEFAULT_IMG_HEIGHT;
56 static const double DEFAULT_HEIGHT;
57 static const std::string DEFAULT_NAME;
60
64 Shape(const std::string& id);
65
75 Shape(const std::string& id, const std::string& type, const RGBColor& color, double layer,
76 double angle, const std::string& imgFile, const std::string& name);
77
79 virtual ~Shape();
80
84 void writeShapeAttributes(OutputDevice& device, const RGBColor& defaultColor, const double defaultLayer) const;
85
88
92 const std::string& getShapeType() const;
93
97 const RGBColor& getShapeColor() const;
98
102 double getShapeLayer() const;
103
107 double getShapeNaviDegree() const;
108
112 const std::string& getShapeImgFile() const;
113
115 const std::string& getShapeName() const;
116
118
121
125 void setShapeType(const std::string& type);
126
130 void setShapeColor(const RGBColor& col);
131
135 void setShapeAlpha(unsigned char alpha);
136
140 void setShapeLayer(const double layer);
141
145 virtual void setShapeNaviDegree(const double angle);
146
150 void setShapeImgFile(const std::string& imgFile);
151
153 void setShapeName(const std::string& name);
154
156
157private:
159 std::string myType = DEFAULT_TYPE;
160
163
166
169
172
174 std::string myName = DEFAULT_NAME;
175};
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:212
A 2D- or 3D-Shape.
Definition Shape.h:44
std::string myImgFile
The img file (include path)
Definition Shape.h:171
void setShapeAlpha(unsigned char alpha)
Sets a new alpha value.
Definition Shape.cpp:147
static const double DEFAULT_LAYER
Definition Shape.h:49
static const double DEFAULT_HEIGHT
Definition Shape.h:56
static const double DEFAULT_LAYER_POI
Definition Shape.h:51
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:54
std::string myType
The type of the Shape.
Definition Shape.h:159
static const std::string DEFAULT_IMG_FILE
Definition Shape.h:53
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.cpp:99
static const double DEFAULT_LINEWIDTH
Definition Shape.h:50
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.cpp:135
static const double DEFAULT_ANGLE
Definition Shape.h:52
virtual ~Shape()
Destructor.
Definition Shape.cpp:66
static const std::string DEFAULT_NAME
Definition Shape.h:57
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:55
static const std::string DEFAULT_TYPE
Definition Shape.h:48
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:165
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:168
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:58
std::string myName
shape name
Definition Shape.h:174
RGBColor myColor
The color of the Shape.
Definition Shape.h:162