SUMO - Simulation of Urban MObility
GUIDialog_ViewSettings.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // The dialog to change the view (gui) settings.
20 /****************************************************************************/
21 #ifndef GUIDialog_ViewSettings_h
22 #define GUIDialog_ViewSettings_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>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class MFXMutex;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
55 class GUIDialog_ViewSettings : public FXDialogBox {
56  // is a FOX-object with an own mapping
57  FXDECLARE(GUIDialog_ViewSettings)
58 public:
59 
60  class NamePanel {
61  public:
62  NamePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
63  const std::string& title,
64  const GUIVisualizationTextSettings& settings);
65 
67  void update(const GUIVisualizationTextSettings& settings);
68 
69  FXCheckButton* myCheck;
70  FXRealSpinDial* mySizeDial;
71  FXColorWell* myColorWell;
72  };
73 
74  class SizePanel {
75  public:
76  SizePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
77  const GUIVisualizationSizeSettings& settings);
78 
80  void update(const GUIVisualizationSizeSettings& settings);
81 
82  FXRealSpinDial* myMinSizeDial;
83  FXRealSpinDial* myExaggerateDial;
84  FXCheckButton* myCheck;
85  };
86 
96  GUIVisualizationSettings* settings,
97  std::vector<GUISUMOAbstractView::Decal>* decals,
98  MFXMutex* decalsLock);
99 
100 
103 
105  void show();
106 
110  void setCurrent(GUIVisualizationSettings* settings);
111 
112 
113 
116 
118  long onCmdOk(FXObject*, FXSelector, void*);
119 
121  long onCmdCancel(FXObject*, FXSelector, void*);
122 
124  long onCmdColorChange(FXObject*, FXSelector, void*);
125 
127  long onCmdEditTable(FXObject*, FXSelector, void* data);
128 
130  long onCmdNameChange(FXObject*, FXSelector, void*);
131 
133  long onCmdSaveSetting(FXObject*, FXSelector, void* data);
135  long onUpdSaveSetting(FXObject*, FXSelector, void* data);
136 
138  long onCmdDeleteSetting(FXObject*, FXSelector, void* data);
140  long onUpdDeleteSetting(FXObject*, FXSelector, void* data);
141 
143  long onCmdExportSetting(FXObject*, FXSelector, void* data);
145  long onUpdExportSetting(FXObject*, FXSelector, void* data);
146 
148  long onCmdImportSetting(FXObject*, FXSelector, void* data);
150  long onUpdImportSetting(FXObject*, FXSelector, void* data);
151 
153  long onCmdLoadDecals(FXObject*, FXSelector, void* data);
155  long onCmdSaveDecals(FXObject*, FXSelector, void* data);
157 
158 
159 
163  std::string getCurrentScheme() const;
164 
165 
169  void setCurrentScheme(const std::string&);
170 
171 
172 private:
173  bool updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
174  std::vector<FXColorWell*>::const_iterator colEnd,
175  std::vector<FXRealSpinDial*>::const_iterator threshIt,
176  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
177  std::vector<FXButton*>::const_iterator buttonIt,
178  GUIColorScheme& scheme);
179 
180  bool updateScaleRanges(FXObject* sender, std::vector<FXRealSpinDial*>::const_iterator colIt,
181  std::vector<FXRealSpinDial*>::const_iterator colEnd,
182  std::vector<FXRealSpinDial*>::const_iterator threshIt,
183  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
184  std::vector<FXButton*>::const_iterator buttonIt,
185  GUIScaleScheme& scheme);
186 
189  FXMatrix* rebuildColorMatrix(FXVerticalFrame* frame,
190  std::vector<FXColorWell*>& colors,
191  std::vector<FXRealSpinDial*>& thresholds,
192  std::vector<FXButton*>& buttons,
193  FXCheckButton* interpolation,
194  GUIColorScheme& scheme);
195 
198  FXMatrix* rebuildScaleMatrix(FXVerticalFrame* frame,
199  std::vector<FXRealSpinDial*>& scales,
200  std::vector<FXRealSpinDial*>& thresholds,
201  std::vector<FXButton*>& buttons,
202  FXCheckButton* interpolation,
203  GUIScaleScheme& scheme);
204 
205 
209  void rebuildColorMatrices(bool doCreate = false);
210 
211 
213  void rebuildList();
214 
215 
219  void loadSettings(const std::string& file);
220 
221 
225  void saveDecals(OutputDevice& dev) const;
226 
227 
231  void loadDecals(const std::string& file);
232 
234  void saveWindowSize();
235 
236 private:
239 
242 
245 
247  std::vector<GUISUMOAbstractView::Decal>* myDecals;
248 
251 
254  FXComboBox* mySchemeName;
255  FXCheckButton* myShowGrid;
257 
258  FXColorWell* myBackgroundColor;
259  FXVerticalFrame* myDecalsFrame;
261 
263  FXComboBox* myLaneEdgeColorMode;
264  FXVerticalFrame* myLaneColorSettingFrame;
265  std::vector<FXColorWell*> myLaneColors;
266  std::vector<FXRealSpinDial*> myLaneThresholds;
267  std::vector<FXButton*> myLaneButtons;
268  FXCheckButton* myLaneColorInterpolation;
271 
273  FXComboBox* myLaneEdgeScaleMode;
274  FXVerticalFrame* myLaneScaleSettingFrame;
275  std::vector<FXRealSpinDial*> myLaneScales;
276  std::vector<FXRealSpinDial*> myLaneScaleThresholds;
277  std::vector<FXButton*> myLaneScaleButtons;
278  FXCheckButton* myLaneScaleInterpolation;
279 
282  FXRealSpinDial* myLaneWidthUpscaleDialer;
283  FXRealSpinDial* myLaneMinWidthDialer;
284 
286  FXVerticalFrame* myVehicleColorSettingFrame;
287  std::vector<FXColorWell*> myVehicleColors;
288  std::vector<FXRealSpinDial*> myVehicleThresholds;
289  std::vector<FXButton*> myVehicleButtons;
291  FXCheckButton* myShowBlinker, *myShowMinGap, *myShowBTRange; /* *myShowLaneChangePreference,*/
292 
294  FXVerticalFrame* myPersonColorSettingFrame;
295  std::vector<FXColorWell*> myPersonColors;
296  std::vector<FXRealSpinDial*> myPersonThresholds;
297  std::vector<FXButton*> myPersonButtons;
299 
302  std::vector<FXColorWell*> myContainerColors;
303  std::vector<FXRealSpinDial*> myContainerThresholds;
304  std::vector<FXButton*> myContainerButtons;
307 
308  FXComboBox* myJunctionColorMode;
309  FXVerticalFrame* myJunctionColorSettingFrame;
310  std::vector<FXColorWell*> myJunctionColors;
311  std::vector<FXRealSpinDial*> myJunctionThresholds;
312  std::vector<FXButton*> myJunctionButtons;
314 
315  FXCheckButton* myShowLane2Lane;
316  FXCheckButton* myDrawJunctionShape;
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:70
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.