SUMO - Simulation of Urban MObility
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-2017 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 // ===========================================================================
56 class GUIDialog_ViewSettings : public FXDialogBox {
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 
106  void show();
107 
111  void setCurrent(GUIVisualizationSettings* settings);
112 
113 
114 
117 
119  long onCmdOk(FXObject*, FXSelector, void*);
120 
122  long onCmdCancel(FXObject*, FXSelector, void*);
123 
125  long onCmdColorChange(FXObject*, FXSelector, void*);
126 
128  long onCmdEditTable(FXObject*, FXSelector, void* data);
129 
131  long onCmdNameChange(FXObject*, FXSelector, void*);
132 
134  long onCmdSaveSetting(FXObject*, FXSelector, void* data);
136  long onUpdSaveSetting(FXObject*, FXSelector, void* data);
137 
139  long onCmdDeleteSetting(FXObject*, FXSelector, void* data);
141  long onUpdDeleteSetting(FXObject*, FXSelector, void* data);
142 
144  long onCmdExportSetting(FXObject*, FXSelector, void* data);
146  long onUpdExportSetting(FXObject*, FXSelector, void* data);
147 
149  long onCmdImportSetting(FXObject*, FXSelector, void* data);
151  long onUpdImportSetting(FXObject*, FXSelector, void* data);
152 
154  long onCmdLoadDecals(FXObject*, FXSelector, void* data);
156  long onCmdSaveDecals(FXObject*, FXSelector, void* data);
158 
159 
160 
164  std::string getCurrentScheme() const;
165 
166 
170  void setCurrentScheme(const std::string&);
171 
172 
173 private:
174  bool updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
175  std::vector<FXColorWell*>::const_iterator colEnd,
176  std::vector<FXRealSpinDial*>::const_iterator threshIt,
177  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
178  std::vector<FXButton*>::const_iterator buttonIt,
179  GUIColorScheme& scheme);
180 
181  bool updateScaleRanges(FXObject* sender, std::vector<FXRealSpinDial*>::const_iterator colIt,
182  std::vector<FXRealSpinDial*>::const_iterator colEnd,
183  std::vector<FXRealSpinDial*>::const_iterator threshIt,
184  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
185  std::vector<FXButton*>::const_iterator buttonIt,
186  GUIScaleScheme& scheme);
187 
190  FXMatrix* rebuildColorMatrix(FXVerticalFrame* frame,
191  std::vector<FXColorWell*>& colors,
192  std::vector<FXRealSpinDial*>& thresholds,
193  std::vector<FXButton*>& buttons,
194  FXCheckButton* interpolation,
195  GUIColorScheme& scheme);
196 
199  FXMatrix* rebuildScaleMatrix(FXVerticalFrame* frame,
200  std::vector<FXRealSpinDial*>& scales,
201  std::vector<FXRealSpinDial*>& thresholds,
202  std::vector<FXButton*>& buttons,
203  FXCheckButton* interpolation,
204  GUIScaleScheme& scheme);
205 
206 
210  void rebuildColorMatrices(bool doCreate = false);
211 
212 
214  void rebuildList();
215 
216 
220  void loadSettings(const std::string& file);
221 
222 
226  void saveDecals(OutputDevice& dev) const;
227 
228 
232  void loadDecals(const std::string& file);
233 
235  void saveWindowSize();
236 
237 private:
240 
243 
246 
248  std::vector<GUISUMOAbstractView::Decal>* myDecals;
249 
252 
255  FXComboBox* mySchemeName;
256  FXCheckButton* myShowGrid;
258 
259  FXColorWell* myBackgroundColor;
260  FXVerticalFrame* myDecalsFrame;
262 
264  FXComboBox* myLaneEdgeColorMode;
265  FXVerticalFrame* myLaneColorSettingFrame;
266  std::vector<FXColorWell*> myLaneColors;
267  std::vector<FXRealSpinDial*> myLaneThresholds;
268  std::vector<FXButton*> myLaneButtons;
269  FXCheckButton* myLaneColorInterpolation;
270 
272  FXComboBox* myLaneEdgeScaleMode;
273  FXVerticalFrame* myLaneScaleSettingFrame;
274  std::vector<FXRealSpinDial*> myLaneScales;
275  std::vector<FXRealSpinDial*> myLaneScaleThresholds;
276  std::vector<FXButton*> myLaneScaleButtons;
277  FXCheckButton* myLaneScaleInterpolation;
278 
281  FXRealSpinDial* myLaneWidthUpscaleDialer;
282  FXRealSpinDial* myLaneMinWidthDialer;
283 
285  FXVerticalFrame* myVehicleColorSettingFrame;
286  std::vector<FXColorWell*> myVehicleColors;
287  std::vector<FXRealSpinDial*> myVehicleThresholds;
288  std::vector<FXButton*> myVehicleButtons;
290  FXCheckButton* myShowBlinker, *myShowMinGap, *myShowBTRange; /* *myShowLaneChangePreference,*/
291 
293  FXVerticalFrame* myPersonColorSettingFrame;
294  std::vector<FXColorWell*> myPersonColors;
295  std::vector<FXRealSpinDial*> myPersonThresholds;
296  std::vector<FXButton*> myPersonButtons;
298 
301  std::vector<FXColorWell*> myContainerColors;
302  std::vector<FXRealSpinDial*> myContainerThresholds;
303  std::vector<FXButton*> myContainerButtons;
306 
307  FXComboBox* myJunctionColorMode;
308  FXVerticalFrame* myJunctionColorSettingFrame;
309  std::vector<FXColorWell*> myJunctionColors;
310  std::vector<FXRealSpinDial*> myJunctionThresholds;
311  std::vector<FXButton*> myJunctionButtons;
313 
314  FXCheckButton* myShowLane2Lane;
315  FXCheckButton* myDrawJunctionShape;
317  FXCheckButton* myAntialiase;
318  FXCheckButton* myDither;
319  FXCheckButton* myShowSizeLegend;
320 
326 
328 
329 
330  // load/save-menu
333 
334 
335 protected:
338 
339 
340 private:
343 
346 
347 
348 };
349 
350 
351 #endif
352 
353 /****************************************************************************/
354 
void rebuildColorMatrices(bool doCreate=false)
Rebuilds color changing dialogs after choosing another coloring scheme.
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.
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
void saveDecals(OutputDevice &dev) const
Writes the currently used decals into a file.
Stores the information about how to visualize structures.
The dialog to change the view (gui) settings.
std::vector< FXRealSpinDial * > myLaneScaleThresholds
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent&#39;s decals.
void loadDecals(const std::string &file)
Loads decals from a file.
std::vector< FXButton * > myPersonButtons
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.
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)
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.
FXCheckButton * myDrawCrossingsAndWalkingAreas
void show()
show view settings dialog
GUIVisualizationSettings * mySettings
The current settings.
std::vector< FXRealSpinDial * > myLaneScales
std::vector< FXColorWell * > myVehicleColors
FXRealSpinDial * myLaneWidthUpscaleDialer
void saveWindowSize()
save window position and size to the registry
FXVerticalFrame * myLaneColorSettingFrame
FXRealSpinDial * myLaneMinWidthDialer
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)
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
long onCmdOk(FXObject *, FXSelector, void *)
Called if the OK-button was pressed.
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
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
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
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.
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.