Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SUMOPolygon.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2004-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/****************************************************************************/
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
64 SUMOPolygon(const std::string& id, const std::string& type, const RGBColor& color,
65 const PositionVector& shape, bool geo, bool fill, double lineWidth,
66 double layer = DEFAULT_LAYER,
67 double angle = DEFAULT_ANGLE,
68 const std::string& imgFile = DEFAULT_IMG_FILE,
69 const std::string& name = DEFAULT_NAME,
70 const Parameterised::Map& parameters = DEFAULT_PARAMETERS);
71
74
77
81 const PositionVector& getShape() const;
82
86 const std::vector<PositionVector>& getHoles() const;
87
91 bool getFill() const;
92
96 double getLineWidth() const;
98
101
105 void setFill(bool fill);
106
108 void setLineWidth(double lineWidth);
109
113 virtual void setShape(const PositionVector& shape);
114
118 virtual void setHoles(const std::vector<PositionVector>& holes);
119
121
122 /* @brief polygon definition to the given device
123 * @param[in] geo Whether to write the output in geo-coordinates
124 */
125 void writeXML(OutputDevice& out, bool geo = false) const;
126
129 return myShape;
130 }
131
132protected:
135
137 std::vector<PositionVector> myHoles;
138
140 bool myGEO;
141
143 bool myFill;
144
147};
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A list of positions.
const PositionVector & getShape() const
Returns the shape of the polygon.
virtual void setHoles(const std::vector< PositionVector > &holes)
Sets the holes of the polygon.
PositionVector myShape
The positions of the polygon.
double myLineWidth
The line width for drawing an unfilled polygon.
~SUMOPolygon()
Destructor.
void setFill(bool fill)
Sets whether the polygon shall be filled.
bool myGEO
specify if shape is handled as GEO coordinate (Main used in netedit)
void setLineWidth(double lineWidth)
set line width
double getLineWidth() const
Returns whether the polygon is filled.
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
std::vector< PositionVector > myHoles
The collection of the holes of the polygon, each given by a sequence of coodinates.
PositionVector & getShapeRef()
Return the exterior shape of the polygon.
const std::vector< PositionVector > & getHoles() const
Returns the holers of the polygon.
void writeXML(OutputDevice &out, bool geo=false) const
bool myFill
Information whether the polygon has to be filled.
bool getFill() const
Returns whether the polygon is filled.
A 2D- or 3D-Shape.
Definition Shape.h:38
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:50
static const Parameterised::Map DEFAULT_PARAMETERS
Definition Shape.h:51