SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIDialog_ViewSettings.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The dialog to change the view (gui) settings.
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 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 GUIDialog_ViewSettings_h
23 #define GUIDialog_ViewSettings_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>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MFXMutex;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
57  // is a FOX-object with an own mapping
58  FXDECLARE(GUIDialog_ViewSettings)
59 public:
60 
61  class NamePanel {
62  public:
63  NamePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
64  const std::string& title,
65  const GUIVisualizationTextSettings& settings);
66 
68  void update(const GUIVisualizationTextSettings& settings);
69 
70  FXCheckButton* myCheck;
71  FXRealSpinDial* mySizeDial;
72  FXColorWell* myColorWell;
73  };
74 
75  class SizePanel {
76  public:
77  SizePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
78  const GUIVisualizationSizeSettings& settings);
79 
81  void update(const GUIVisualizationSizeSettings& settings);
82 
83  FXRealSpinDial* myMinSizeDial;
84  FXRealSpinDial* myExaggerateDial;
85  FXCheckButton* myCheck;
86  };
87 
97  GUIVisualizationSettings* settings,
98  std::vector<GUISUMOAbstractView::Decal>* decals,
99  MFXMutex* decalsLock);
100 
101 
104 
105 
109  void setCurrent(GUIVisualizationSettings* settings);
110 
111 
112 
115 
117  long onCmdOk(FXObject*, FXSelector, void*);
118 
120  long onCmdCancel(FXObject*, FXSelector, void*);
121 
123  long onCmdColorChange(FXObject*, FXSelector, void*);
124 
126  long onCmdEditTable(FXObject*, FXSelector, void* data);
127 
129  long onCmdNameChange(FXObject*, FXSelector, void*);
130 
132  long onCmdSaveSetting(FXObject*, FXSelector, void* data);
134  long onUpdSaveSetting(FXObject*, FXSelector, void* data);
135 
137  long onCmdDeleteSetting(FXObject*, FXSelector, void* data);
139  long onUpdDeleteSetting(FXObject*, FXSelector, void* data);
140 
142  long onCmdExportSetting(FXObject*, FXSelector, void* data);
144  long onUpdExportSetting(FXObject*, FXSelector, void* data);
145 
147  long onCmdImportSetting(FXObject*, FXSelector, void* data);
149  long onUpdImportSetting(FXObject*, FXSelector, void* data);
150 
152  long onCmdLoadDecals(FXObject*, FXSelector, void* data);
154  long onCmdSaveDecals(FXObject*, FXSelector, void* data);
156 
157 
158 
162  std::string getCurrentScheme() const;
163 
164 
168  void setCurrentScheme(const std::string&);
169 
170 
171 private:
172  bool updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
173  std::vector<FXColorWell*>::const_iterator colEnd,
174  std::vector<FXRealSpinDial*>::const_iterator threshIt,
175  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
176  std::vector<FXButton*>::const_iterator buttonIt,
177  GUIColorScheme& scheme);
178 
179  bool updateScaleRanges(FXObject* sender, std::vector<FXRealSpinDial*>::const_iterator colIt,
180  std::vector<FXRealSpinDial*>::const_iterator colEnd,
181  std::vector<FXRealSpinDial*>::const_iterator threshIt,
182  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
183  std::vector<FXButton*>::const_iterator buttonIt,
184  GUIScaleScheme& scheme);
185 
188  FXMatrix* rebuildColorMatrix(FXVerticalFrame* frame,
189  std::vector<FXColorWell*>& colors,
190  std::vector<FXRealSpinDial*>& thresholds,
191  std::vector<FXButton*>& buttons,
192  FXCheckButton* interpolation,
193  GUIColorScheme& scheme);
194 
197  FXMatrix* rebuildScaleMatrix(FXVerticalFrame* frame,
198  std::vector<FXRealSpinDial*>& scales,
199  std::vector<FXRealSpinDial*>& thresholds,
200  std::vector<FXButton*>& buttons,
201  FXCheckButton* interpolation,
202  GUIScaleScheme& scheme);
203 
204 
208  void rebuildColorMatrices(bool doCreate = false);
209 
210 
212  void rebuildList();
213 
214 
218  void loadSettings(const std::string& file);
219 
220 
224  void saveDecals(OutputDevice& dev) const;
225 
226 
230  void loadDecals(const std::string& file);
231 
233  void saveWindowSize();
234 
235 private:
238 
241 
244 
246  std::vector<GUISUMOAbstractView::Decal>* myDecals;
247 
250 
253  FXComboBox* mySchemeName;
254  FXCheckButton* myShowGrid;
256 
257  FXColorWell* myBackgroundColor;
258  FXVerticalFrame* myDecalsFrame;
260 
262  FXComboBox* myLaneEdgeColorMode;
263  FXVerticalFrame* myLaneColorSettingFrame;
264  std::vector<FXColorWell*> myLaneColors;
265  std::vector<FXRealSpinDial*> myLaneThresholds;
266  std::vector<FXButton*> myLaneButtons;
267  FXCheckButton* myLaneColorInterpolation;
268 
270  FXComboBox* myLaneEdgeScaleMode;
271  FXVerticalFrame* myLaneScaleSettingFrame;
272  std::vector<FXRealSpinDial*> myLaneScales;
273  std::vector<FXRealSpinDial*> myLaneScaleThresholds;
274  std::vector<FXButton*> myLaneScaleButtons;
275  FXCheckButton* myLaneScaleInterpolation;
276 
279  FXRealSpinDial* myLaneWidthUpscaleDialer;
280 
282  FXVerticalFrame* myVehicleColorSettingFrame;
283  std::vector<FXColorWell*> myVehicleColors;
284  std::vector<FXRealSpinDial*> myVehicleThresholds;
285  std::vector<FXButton*> myVehicleButtons;
287  FXCheckButton* myShowBlinker, *myShowMinGap, *myShowBTRange; /* *myShowLaneChangePreference,*/
288 
290  FXVerticalFrame* myPersonColorSettingFrame;
291  std::vector<FXColorWell*> myPersonColors;
292  std::vector<FXRealSpinDial*> myPersonThresholds;
293  std::vector<FXButton*> myPersonButtons;
295 
298  std::vector<FXColorWell*> myContainerColors;
299  std::vector<FXRealSpinDial*> myContainerThresholds;
300  std::vector<FXButton*> myContainerButtons;
303 
304  FXComboBox* myJunctionColorMode;
305  FXVerticalFrame* myJunctionColorSettingFrame;
306  std::vector<FXColorWell*> myJunctionColors;
307  std::vector<FXRealSpinDial*> myJunctionThresholds;
308  std::vector<FXButton*> myJunctionButtons;
311 
312  FXCheckButton* myShowLane2Lane;
313  FXCheckButton* myDrawJunctionShape;
314  FXCheckButton* myAntialiase;
315  FXCheckButton* myDither;
316  FXCheckButton* myShowSizeLegend;
317 
322 
324 
325 
326  // load/save-menu
329 
330 
331 protected:
334 
335 
336 private:
339 
342 
343 
344 };
345 
346 
347 #endif
348 
349 /****************************************************************************/
350 
void rebuildColorMatrices(bool doCreate=false)
Rebuilds color changing dialogs after choosing another coloring scheme.
FXVerticalFrame * myVehicleColorSettingFrame
long onUpdSaveSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to save the settings into the registry.
FXCheckButton * myLaneColorInterpolation
FXCheckButton * myJunctionColorInterpolation
FXVerticalFrame * myLaneScaleSettingFrame
FXRealSpinDial * myContainerUpscaleDialer
std::vector< FXButton * > myLaneButtons
Stores the information about how to visualize structures.
The dialog to change the view (gui) settings.
SizePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const GUIVisualizationSizeSettings &settings)
std::vector< FXRealSpinDial * > myLaneScaleThresholds
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent's decals.
void loadDecals(const std::string &file)
Loads decals from a file.
std::vector< FXButton * > myPersonButtons
FXMatrix * rebuildScaleMatrix(FXVerticalFrame *frame, std::vector< FXRealSpinDial * > &scales, std::vector< FXRealSpinDial * > &thresholds, std::vector< FXButton * > &buttons, FXCheckButton *interpolation, GUIScaleScheme &scheme)
Rebuilds manipulators for the current scaling scheme.
std::vector< FXColorWell * > myJunctionColors
void loadSettings(const std::string &file)
Loads a scheme from a file.
long onCmdSaveDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be saved to a file.
long onCmdSaveSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be saved into the registry.
long onCmdExportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be exported into a file.
long onCmdEditTable(FXObject *, FXSelector, void *data)
Called if the decals-table was changed.
FXVerticalFrame * myContainerColorSettingFrame
std::vector< FXRealSpinDial * > myPersonThresholds
long onCmdNameChange(FXObject *, FXSelector, void *)
Called if the name of the scheme was changed.
std::vector< FXButton * > myContainerButtons
FXCheckButton * myVehicleColorInterpolation
GUIDialog_ViewSettings()
Default constructor (needed by FOX)
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
void rebuildList()
Rebuilds the decals table.
void update(const GUIVisualizationSizeSettings &settings)
GUIVisualizationSettings * mySettings
The current settings.
FXMatrix * rebuildColorMatrix(FXVerticalFrame *frame, std::vector< FXColorWell * > &colors, std::vector< FXRealSpinDial * > &thresholds, std::vector< FXButton * > &buttons, FXCheckButton *interpolation, GUIColorScheme &scheme)
Rebuilds manipulators for the current coloring scheme.
std::vector< FXRealSpinDial * > myLaneScales
std::vector< FXColorWell * > myVehicleColors
FXRealSpinDial * myLaneWidthUpscaleDialer
void saveWindowSize()
save window position and size to the registry
FXVerticalFrame * myLaneColorSettingFrame
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
long onUpdDeleteSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to delete settings.
FXVerticalFrame * myJunctionColorSettingFrame
FXCheckButton * myLaneScaleInterpolation
std::vector< FXColorWell * > myPersonColors
FXRealSpinDial * myGridYSizeDialer
long onCmdCancel(FXObject *, FXSelector, void *)
Called if the Cancel-button was pressed.
std::vector< FXButton * > myLaneScaleButtons
void saveDecals(OutputDevice &dev) const
Writes the currently used decals into a file.
long onCmdOk(FXObject *, FXSelector, void *)
Called if the OK-button was pressed.
bool updateScaleRanges(FXObject *sender, std::vector< FXRealSpinDial * >::const_iterator colIt, std::vector< FXRealSpinDial * >::const_iterator colEnd, std::vector< FXRealSpinDial * >::const_iterator threshIt, std::vector< FXRealSpinDial * >::const_iterator threshEnd, std::vector< FXButton * >::const_iterator buttonIt, GUIScaleScheme &scheme)
MFXAddEditTypedTable * myDecalsTable
GUIDialog_ViewSettings & operator=(const GUIDialog_ViewSettings &s)
invalidated assignment operator
NamePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const std::string &title, const GUIVisualizationTextSettings &settings)
FXComboBox * myLaneEdgeScaleMode
... lane scaler
GUIVisualizationTextSettings getSettings()
FXComboBox * myLaneEdgeColorMode
... lane colorer
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
FXCheckButton * myHideMacroConnectors
long onUpdExportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to export settings into a file.
long onCmdColorChange(FXObject *, FXSelector, void *)
Called if something (color, width, etc.) has been changed.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
FXRealSpinDial * myContainerMinSizeDialer
FXRealSpinDial * myGridXSizeDialer
FXCheckButton * myPersonColorInterpolation
std::vector< FXRealSpinDial * > myContainerThresholds
long onCmdLoadDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be loaded from a file.
void update(const GUIVisualizationTextSettings &settings)
std::vector< FXRealSpinDial * > myVehicleThresholds
GUIVisualizationSizeSettings getSettings()
bool updateColorRanges(FXObject *sender, std::vector< FXColorWell * >::const_iterator colIt, std::vector< FXColorWell * >::const_iterator colEnd, std::vector< FXRealSpinDial * >::const_iterator threshIt, std::vector< FXRealSpinDial * >::const_iterator threshEnd, std::vector< FXButton * >::const_iterator buttonIt, GUIColorScheme &scheme)
MFXMutex * myDecalsLock
Lock used when changing the decals.
std::vector< FXRealSpinDial * > myJunctionThresholds
FXCheckButton * myContainerColorInterpolation
long onCmdDeleteSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be deleted.
GUISUMOAbstractView * myParent
The parent view (which settings are changed)
FXVerticalFrame * myPersonColorSettingFrame
std::vector< FXColorWell * > myContainerColors
std::vector< FXButton * > myJunctionButtons
GUIVisualizationSettings myBackup
A backup of the settings (used if the "Cancel" button is pressed)
std::vector< FXColorWell * > myLaneColors
std::vector< FXRealSpinDial * > myLaneThresholds
std::vector< FXButton * > myVehicleButtons
long onCmdImportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be read from a file.
long onUpdImportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to read settings from a file.