/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2004-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file SUMOPolygon.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Jakob Erdmann17/// @author Melanie Knocke18/// @date Jun 200419///20// A 2D- or 3D-polygon21/****************************************************************************/22#pragma once23#include <config.h>2425#include <utils/geom/PositionVector.h>26#include <utils/common/Parameterised.h>27#include "Shape.h"282930// ===========================================================================31// class declarations32// ===========================================================================33class OutputDevice;343536// ===========================================================================37// class definitions38// ===========================================================================39/**40* @class Polygon41* @brief A 2D- or 3D-polygon42*/43class SUMOPolygon : public Shape, public Parameterised {4445public:46/// @brief friend class47friend class PolygonDynamics;4849/** @brief Constructor50* @param[in] id The name of the polygon51* @param[in] type The (abstract) type of the polygon52* @param[in] color The color of the polygon53* @param[in] layer The layer of the polygon54* @param[in] angle The rotation of the polygon55* @param[in] imgFile The raster image of the polygon56* @param[in] shape The shape of the polygon57* @param[in] geo specify if shape was loaded as GEO58* @param[in] fill Whether the polygon shall be filled59* @param[in] lineWidth The line with for drawing an unfilled polygon60* @param[in] name Polygon name61* @param[in] parameters generic parameters62*/63SUMOPolygon(const std::string& id, const std::string& type, const RGBColor& color,64const PositionVector& shape, bool geo, bool fill, double lineWidth,65double layer = DEFAULT_LAYER,66double angle = DEFAULT_ANGLE,67const std::string& imgFile = DEFAULT_IMG_FILE,68const std::string& name = DEFAULT_NAME,69const Parameterised::Map& parameters = DEFAULT_PARAMETERS);7071/// @brief Destructor72~SUMOPolygon();7374/// @name Getter75/// @{7677/** @brief Returns the shape of the polygon78* @return The shape of the polygon79*/80const PositionVector& getShape() const;8182/** @brief Returns the holers of the polygon83* @return The holes of the polygon84*/85const std::vector<PositionVector>& getHoles() const;8687/** @brief Returns whether the polygon is filled88* @return Whether the polygon is filled89*/90bool getFill() const;9192/** @brief Returns whether the polygon is filled93* @return Whether the polygon is filled94*/95double getLineWidth() const;96/// @}9798/// @name Setter99/// @{100101/** @brief Sets whether the polygon shall be filled102* @param[in] fill Whether the polygon shall be filled103*/104void setFill(bool fill);105106/// @brief set line width107void setLineWidth(double lineWidth);108109/** @brief Sets the shape of the polygon110* @param[in] shape The new shape of the polygon111*/112virtual void setShape(const PositionVector& shape);113114/** @brief Sets the holes of the polygon115* @param[in] holes The new holes of the polygon116*/117virtual void setHoles(const std::vector<PositionVector>& holes);118119/// @}120121/* @brief polygon definition to the given device122* @param[in] geo Whether to write the output in geo-coordinates123*/124void writeXML(OutputDevice& out, bool geo = false) const;125126/// @brief Return the exterior shape of the polygon.127PositionVector& getShapeRef() {128return myShape;129}130131protected:132/// @brief The positions of the polygon133PositionVector myShape;134135/// @brief The collection of the holes of the polygon, each given by a sequence of coodinates.136std::vector<PositionVector> myHoles;137138/// @brief specify if shape is handled as GEO coordinate (Main used in netedit)139bool myGEO;140141/// @brief Information whether the polygon has to be filled142bool myFill;143144/// @brief The line width for drawing an unfilled polygon145double myLineWidth;146};147148149