Eclipse SUMO - Simulation of Urban MObility
GUITextureSubSys.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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/****************************************************************************/
18// Helper for Gifs loading and usage
19/****************************************************************************/
20#include <config.h>
21
23#include <cassert>
27
28#include "GUITextureSubSys.h"
29
30#include "GNETexture_E3.cpp"
35#include "GNETexture_Lock.cpp"
48#include "GNETexture_Stop.cpp"
54#include "GNETexture_TLS.cpp"
62
63
64// ===========================================================================
65// static member variable definitions
66// ===========================================================================
67
69
70// ===========================================================================
71// member definitions
72// ===========================================================================
73
75 myApp(a) {
76 // Fill map of textures
107}
108
109
111}
112
113
114void
116 assert(myInstance == 0);
118}
119
120
123 // If texture isn't loaded, load it
124 if (myInstance->myTextures.at(which) == 0) {
125 switch (which) {
126 case GUITexture::E3 :
127 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_E3, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
128 break;
130 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_E3Selected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
131 break;
132 case GUITexture::LOCK :
133 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Lock, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
134 break;
136 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_NotMoving, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
137 break;
139 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_NotMovingSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
140 break;
142 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
143 break;
145 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_RerouterSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
146 break;
148 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter_Interval, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
149 break;
151 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter_ClosingReroute, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
152 break;
154 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter_ClosingLaneReroute, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
155 break;
157 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter_RouteProbReroute, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
158 break;
160 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter_DestProbReroute, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
161 break;
163 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Rerouter_ParkingAreaReroute, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
164 break;
166 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_RouteProbe, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
167 break;
169 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_RouteProbeSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
170 break;
171 case GUITexture::TLS :
172 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_TLS, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
173 break;
175 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Vaporizer, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
176 break;
178 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VaporizerSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
179 break;
181 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSign, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
182 break;
184 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSignSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
185 break;
187 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSign_Step, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
188 break;
190 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_LaneBike, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
191 break;
193 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_LaneBus, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
194 break;
196 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_LanePedestrian, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
197 break;
198 case GUITexture::STOP:
199 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_Stop, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
200 break;
202 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_StopSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
203 break;
205 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_StopPerson, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
206 break;
208 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_StopPersonSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
209 break;
211 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_StopContainer, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
212 break;
214 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_StopContainerSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
215 break;
217 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_TractionSubstation, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
218 break;
220 myInstance->myTextures[which] = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_TractionSubstationSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP));
221 break;
222 default:
223 throw ProcessError("Undefined texture");
224 }
225 }
226 // Return GLID associated to the texture
227 return myInstance->myTextures.at(which);
228}
229
230
231void
233 // Reset all textures
235 for (auto& i : myInstance->myTextures) {
236 i.second = 0;
237 }
238}
239
240
241void
243 delete myInstance;
244 myInstance = nullptr;
245}
246
247
248/****************************************************************************/
const unsigned char GNETexture_E3[]
const unsigned char GNETexture_E3Selected[]
const unsigned char GNETexture_LaneBike[]
const unsigned char GNETexture_LaneBus[]
const unsigned char GNETexture_LanePedestrian[]
const unsigned char GNETexture_Lock[]
const unsigned char GNETexture_NotMoving[]
const unsigned char GNETexture_NotMovingSelected[]
const unsigned char GNETexture_Rerouter[]
const unsigned char GNETexture_Rerouter_ClosingLaneReroute[]
const unsigned char GNETexture_Rerouter_ClosingReroute[]
const unsigned char GNETexture_Rerouter_DestProbReroute[]
const unsigned char GNETexture_Rerouter_Interval[]
const unsigned char GNETexture_Rerouter_ParkingAreaReroute[]
const unsigned char GNETexture_Rerouter_RouteProbReroute[]
const unsigned char GNETexture_RerouterSelected[]
const unsigned char GNETexture_RouteProbe[]
const unsigned char GNETexture_RouteProbeSelected[]
const unsigned char GNETexture_Stop[]
const unsigned char GNETexture_StopContainer[]
const unsigned char GNETexture_StopContainerSelected[]
const unsigned char GNETexture_StopPerson[]
const unsigned char GNETexture_StopPersonSelected[]
const unsigned char GNETexture_StopSelected[]
const unsigned char GNETexture_TLS[]
const unsigned char GNETexture_TractionSubstation[]
const unsigned char GNETexture_TractionSubstationSelected[]
const unsigned char GNETexture_Vaporizer[]
const unsigned char GNETexture_VaporizerSelected[]
const unsigned char GNETexture_VariableSpeedSign[]
const unsigned char GNETexture_VariableSpeedSign_Step[]
const unsigned char GNETexture_VariableSpeedSignSelected[]
unsigned int GUIGlID
Definition: GUIGlObject.h:43
GUITexture
An enumeration of gifs used by the gui applications.
Definition: GUITextures.h:31
@ STOPCONTAINER_SELECTED
@ VAPORIZER_SELECTED
@ REROUTER_CLOSINGREROUTE
@ REROUTER_ROUTEPROBREROUTE
@ STOPPERSON_SELECTED
@ VARIABLESPEEDSIGN_STEP
@ ROUTEPROBE_SELECTED
@ TRACTIONSUBSTATION_SELECTED
@ TRACTIONSUBSTATION
@ REROUTER_CLOSINGLANEREROUTE
@ VARIABLESPEEDSIGN_SELECTED
@ REROUTER_DESTPROBREROUTE
@ REROUTER_PARKINGAREAREROUTE
@ NOTMOVING_SELECTED
static void close()
close GUITextureSubSys
static void resetTextures()
Reset textures.
std::map< GUITexture, GUIGlID > myTextures
vector with the Gifs
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
~GUITextureSubSys()
destructor
static GUITextureSubSys * myInstance
instance of GUITextureSubSys
FXApp * myApp
@pointer to Fox App
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
GUITextureSubSys(FXApp *a)
constructor private because is called by the static function init(FXApp* a
static GUIGlID add(FXImage *i)
Adds a texture to use.
static void clearTextures()
clears loaded textures