SUMO - Simulation of Urban MObility
GUITexturesHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Global storage for textures; manages and draws them
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GUITexturesHelper_h
23 #define GUITexturesHelper_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <fx.h>
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
47 public:
49  static int getMaxTextureSize();
50 
52  static GUIGlID add(FXImage* i);
53 
55  static void drawTexturedBox(unsigned int which, SUMOReal size);
56 
58  static void drawTexturedBox(unsigned int which,
59  SUMOReal sizeX1, SUMOReal sizeY1, SUMOReal sizeX2, SUMOReal sizeY2);
60 
62  // @note return -1 on failure
63  static int getTextureID(const std::string& filename, const bool mirrorX = false);
64 
66  static void clearTextures();
67 
69  static void allowTextures(const bool val) {
70  myAllowTextures = val;
71  }
72 
74  static bool texturesAllowed() {
75  return myAllowTextures;
76  }
77 
78 private:
80  static std::map<std::string, int> myTextures;
81 
83  static bool myAllowTextures;
84 
85 };
86 
87 
88 #endif
89 
90 /****************************************************************************/
static GUIGlID add(FXImage *i)
Adds a texture to use.
static std::map< std::string, int > myTextures
mapping from image paths to decals (initialization on first use)
static bool texturesAllowed()
ask whether texture drawing is enabled
static void clearTextures()
clears loaded textures
static void drawTexturedBox(unsigned int which, SUMOReal size)
Draws a named texture as a box with the given size.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static bool myAllowTextures
whether textures are drawn
unsigned int GUIGlID
Definition: GUIGlObject.h:49
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
#define SUMOReal
Definition: config.h:213
Global storage for textures; manages and draws them.
static void allowTextures(const bool val)
switch texture drawing on and off