LCOV - code coverage report
Current view: top level - src/utils/gui/images - GUITexturesHelper.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 50.0 % 2 1
Test Date: 2024-10-17 15:44:51 Functions: - 0 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2006-2024 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    GUITexturesHelper.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @author  Jakob Erdmann
      18              : /// @date    Sept 2006
      19              : ///
      20              : // Global storage for textures; manages and draws them
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <utils/foxtools/fxheader.h>
      26              : #include <utils/gui/globjects/GUIGlObject.h>
      27              : 
      28              : 
      29              : // ===========================================================================
      30              : // class definitions
      31              : // ===========================================================================
      32              : /**
      33              :  * @class GUITexturesHelper
      34              :  * @brief Global storage for textures; manages and draws them
      35              :  */
      36              : class GUITexturesHelper {
      37              : public:
      38              :     /// @brief return maximum number of pixels in x and y direction
      39              :     static int getMaxTextureSize();
      40              : 
      41              :     /// @brief Adds a texture to use
      42              :     static GUIGlID add(FXImage* i);
      43              : 
      44              :     /// @brief Draws a named texture as a box with the given size
      45              :     static void drawTexturedBox(int which, double size);
      46              : 
      47              :     /// @brief Draws a named texture as a rectangle with the given sizes
      48              :     static void drawTexturedBox(int which, double sizeX1, double sizeY1, double sizeX2, double sizeY2);
      49              : 
      50              :     /**@brief return texture id for the given filename (initialize on first use)
      51              :      * @note return -1 on failure
      52              :      */
      53              :     static int getTextureID(const std::string& filename, const bool mirrorX = false);
      54              : 
      55              :     /// @brief clears loaded textures
      56              :     static void clearTextures();
      57              : 
      58              :     /// @brief switch texture drawing on and off
      59              :     static void allowTextures(const bool val) {
      60         7471 :         myAllowTextures = val;
      61              :     }
      62              : 
      63              :     /// @brief ask whether texture drawing is enabled
      64              :     static bool texturesAllowed() {
      65            0 :         return myAllowTextures;
      66              :     }
      67              : 
      68              : private:
      69              :     /// @brief mapping from image paths to decals (initialization on first use)
      70              :     static std::map<std::string, int> myTextures;
      71              : 
      72              :     /// @brief whether textures are drawn
      73              :     static bool myAllowTextures;
      74              : };
        

Generated by: LCOV version 2.0-1