SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUITexturesHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Global storage for textures; manages and draws them
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef GUITexturesHelper_h
22 #define GUITexturesHelper_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <fx.h>
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
46 public:
48  static int getMaxTextureSize();
49 
51  static GUIGlID add(FXImage* i);
52 
54  static void drawTexturedBox(unsigned int which, SUMOReal size);
55 
57  static void drawTexturedBox(unsigned int which,
58  SUMOReal sizeX1, SUMOReal sizeY1, SUMOReal sizeX2, SUMOReal sizeY2);
59 
61  // @note return -1 on failure
62  static int getTextureID(const std::string& filename);
63 
65  static void clearTextures();
66 
68  static void allowTextures(const bool val) {
69  myAllowTextures = val;
70  }
71 
73  static bool texturesAllowed() {
74  return myAllowTextures;
75  }
76 
77 private:
79  static std::map<std::string, int> myTextures;
80 
82  static bool myAllowTextures;
83 
84 };
85 
86 
87 #endif
88 
89 /****************************************************************************/
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()
clears loaded textures
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 bool myAllowTextures
whether textures are drawn
unsigned int GUIGlID
Definition: GUIGlObject.h:48
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
#define SUMOReal
Definition: config.h:215
Global storage for textures; manages and draws them.
static void allowTextures(const bool val)
don't draw any textures
static int getTextureID(const std::string &filename)
return texture id for the given filename (initialize on first use)