Path: blob/main/src/utils/gui/images/GUITexturesHelper.h
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2006-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 GUITexturesHelper.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Jakob Erdmann17/// @date Sept 200618///19// Global storage for textures; manages and draws them20/****************************************************************************/21#pragma once22#include <config.h>2324#include <utils/foxtools/fxheader.h>25#include <utils/gui/globjects/GUIGlObject.h>262728// ===========================================================================29// class definitions30// ===========================================================================31/**32* @class GUITexturesHelper33* @brief Global storage for textures; manages and draws them34*/35class GUITexturesHelper {36public:37/// @brief return maximum number of pixels in x and y direction38static int getMaxTextureSize();3940/// @brief Adds a texture to use41static GUIGlID add(FXImage* i);4243/// @brief Draws a named texture as a box with the given size44static void drawTexturedBox(int which, double size);4546/// @brief Draws a named texture as a rectangle with the given sizes47static void drawTexturedBox(int which, double sizeX1, double sizeY1, double sizeX2, double sizeY2);4849/**@brief return texture id for the given filename (initialize on first use)50* @note return -1 on failure51*/52static int getTextureID(const std::string& filename, const bool mirrorX = false);5354/// @brief clears loaded textures55static void clearTextures();5657/// @brief switch texture drawing on and off58static void allowTextures(const bool val) {59myAllowTextures = val;60}6162/// @brief ask whether texture drawing is enabled63static bool texturesAllowed() {64return myAllowTextures;65}6667private:68/// @brief mapping from image paths to decals (initialization on first use)69static std::map<std::string, int> myTextures;7071/// @brief whether textures are drawn72static bool myAllowTextures;73};747576