Eclipse SUMO - Simulation of Urban MObility
SUMOPolygon.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2004-2022 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/****************************************************************************/
21// A 2D- or 3D-polygon
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
28#include "Shape.h"
29
30
31// ===========================================================================
32// class declarations
33// ===========================================================================
34class OutputDevice;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
44class SUMOPolygon : public Shape, public Parameterised {
45
46public:
48 friend class PolygonDynamics;
49
65 SUMOPolygon(const std::string& id, const std::string& type, const RGBColor& color,
66 const PositionVector& shape, bool geo, bool fill, double lineWidth,
67 double layer = DEFAULT_LAYER,
68 double angle = DEFAULT_ANGLE,
69 const std::string& imgFile = DEFAULT_IMG_FILE,
70 bool relativePath = DEFAULT_RELATIVEPATH,
71 const std::string& name = DEFAULT_NAME,
72 const Parameterised::Map& parameters = DEFAULT_PARAMETERS);
73
76
79
83 const PositionVector& getShape() const;
84
88 bool getFill() const;
89
93 double getLineWidth() const;
95
98
102 void setFill(bool fill);
103
105 void setLineWidth(double lineWidth);
106
110 virtual void setShape(const PositionVector& shape);
111
113
114 /* @brief polygon definition to the given device
115 * @param[in] geo Whether to write the output in geo-coordinates
116 */
117 void writeXML(OutputDevice& out, bool geo = false) const;
118
119protected:
122
124 bool myGEO;
125
127 bool myFill;
128
131};
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A list of positions.
const PositionVector & getShape() const
Returns whether the shape of the polygon.
Definition: SUMOPolygon.cpp:52
SUMOPolygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool geo, bool fill, double lineWidth, double layer=DEFAULT_LAYER, double angle=DEFAULT_ANGLE, const std::string &imgFile=DEFAULT_IMG_FILE, bool relativePath=DEFAULT_RELATIVEPATH, const std::string &name=DEFAULT_NAME, const Parameterised::Map &parameters=DEFAULT_PARAMETERS)
Constructor.
Definition: SUMOPolygon.cpp:35
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:121
double myLineWidth
The line width for drawing an unfilled polygon.
Definition: SUMOPolygon.h:130
~SUMOPolygon()
Destructor.
Definition: SUMOPolygon.cpp:48
void setFill(bool fill)
Sets whether the polygon shall be filled.
Definition: SUMOPolygon.cpp:70
bool myGEO
specify if shape is handled as GEO coordinate (Main used in netedit)
Definition: SUMOPolygon.h:124
void setLineWidth(double lineWidth)
set line width
Definition: SUMOPolygon.cpp:76
double getLineWidth() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.cpp:64
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Definition: SUMOPolygon.cpp:82
void writeXML(OutputDevice &out, bool geo=false) const
Definition: SUMOPolygon.cpp:88
bool myFill
Information whether the polygon has to be filled.
Definition: SUMOPolygon.h:127
bool getFill() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.cpp:58
A 2D- or 3D-Shape.
Definition: Shape.h:38
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:48
static const double DEFAULT_LAYER
Definition: Shape.h:43
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
static const double DEFAULT_ANGLE
Definition: Shape.h:46
static const std::string DEFAULT_NAME
Definition: Shape.h:51
static const Parameterised::Map DEFAULT_PARAMETERS
Definition: Shape.h:52