LCOV - code coverage report
Current view: top level - src/libsumo - Polygon.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 1 0
Test Date: 2025-11-13 15:38:19 Functions: - 0 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2017-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              : /****************************************************************************/
      14              : /// @file    Polygon.h
      15              : /// @author  Gregor Laemmel
      16              : /// @date    15.03.2017
      17              : ///
      18              : // C++ TraCI client API implementation
      19              : /****************************************************************************/
      20              : #pragma once
      21              : #include <string>
      22              : #include <vector>
      23              : #include <libsumo/TraCIDefs.h>
      24              : #include <libsumo/TraCIConstants.h>
      25              : 
      26              : 
      27              : // ===========================================================================
      28              : // class declarations
      29              : // ===========================================================================
      30              : #ifndef LIBTRACI
      31              : class NamedRTree;
      32              : class PositionVector;
      33              : class SUMOPolygon;
      34              : class SUMOTrafficObject;
      35              : #endif
      36              : 
      37              : 
      38              : // ===========================================================================
      39              : // class definitions
      40              : // ===========================================================================
      41              : namespace LIBSUMO_NAMESPACE {
      42              : class Polygon {
      43              : public:
      44              :     static std::string getType(const std::string& polygonID);
      45              :     static libsumo::TraCIPositionVector getShape(const std::string& polygonID);
      46              :     static libsumo::TraCIColor getColor(const std::string& polygonID);
      47              :     static bool getFilled(const std::string& polygonID);
      48              :     static double getLineWidth(const std::string& polygonID);
      49              : 
      50              :     LIBSUMO_ID_PARAMETER_API
      51            0 :     LIBSUMO_SUBSCRIPTION_API
      52              : 
      53              :     static void setType(const std::string& polygonID, const std::string& polygonType);
      54              :     static void setShape(const std::string& polygonID, const libsumo::TraCIPositionVector& shape);
      55              :     static void setColor(const std::string& polygonID, const libsumo::TraCIColor& color);
      56              :     static void add(const std::string& polygonID, const libsumo::TraCIPositionVector& shape, const libsumo::TraCIColor& color, bool fill = false, const std::string& polygonType = "", int layer = 0, double lineWidth = 1);
      57              : 
      58              :     static void addDynamics(const std::string& polygonID, const std::string& trackedObjectID = "", const std::vector<double>& timeSpan = std::vector<double>(), const std::vector<double>& alphaSpan = std::vector<double>(), bool looped = false, bool rotate = true);
      59              :     static void remove(const std::string& polygonID, int layer = 0);
      60              : 
      61              :     static void setFilled(std::string polygonID, bool filled);
      62              :     static void setLineWidth(std::string polygonID, double lineWidth);
      63              : 
      64              : #ifndef LIBTRACI
      65              : #ifndef SWIG
      66              :     // currently only used as a Helper function by POI and Vehicle, not part of the public API (and the clients)
      67              :     static void addHighlightPolygon(const std::string& objectID, const int type, const std::string& polygonID, const libsumo::TraCIPositionVector& shape, const libsumo::TraCIColor& color, bool fill, const std::string& polygonType, int layer, double lineWidth);
      68              : 
      69              :     /** @brief Returns a tree filled with polygon instances
      70              :      * @return The rtree of polygons
      71              :      */
      72              :     static NamedRTree* getTree();
      73              :     static void cleanup();
      74              : 
      75              :     /** @brief Saves the shape of the requested object in the given container
      76              :     *  @param id The id of the poi to retrieve
      77              :     *  @param shape The container to fill
      78              :     */
      79              :     static void storeShape(const std::string& id, PositionVector& shape);
      80              : 
      81              :     static std::shared_ptr<VariableWrapper> makeWrapper();
      82              : 
      83              :     static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
      84              : 
      85              :     /// Checks if a polygon of the given name exists already in the simulation
      86              :     static bool exists(std::string polyID);
      87              : 
      88              : private:
      89              :     static SUMOPolygon* getPolygon(const std::string& id);
      90              :     /// @brief Obtain a traffic object with the given id if one exists
      91              :     /// @return Searches the domains Vehicle and Person for the given id (priorizes vehicles)
      92              :     static SUMOTrafficObject* getTrafficObject(const std::string& id);
      93              : 
      94              : 
      95              : private:
      96              :     static SubscriptionResults mySubscriptionResults;
      97              :     static ContextSubscriptionResults myContextSubscriptionResults;
      98              :     static NamedRTree* myTree;
      99              : #endif
     100              : #endif
     101              : 
     102              :     /// @brief invalidated standard constructor
     103              :     Polygon() = delete;
     104              : };
     105              : 
     106              : 
     107              : }
        

Generated by: LCOV version 2.0-1