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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // The dialog to change the view (gui) settings.
18 /****************************************************************************/
19 #ifndef GUIDialog_ViewSettings_h
20 #define GUIDialog_ViewSettings_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <fx.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class MFXMutex;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
48 class GUIDialog_ViewSettings : public FXDialogBox {
49  // is a FOX-object with an own mapping
50  FXDECLARE(GUIDialog_ViewSettings)
51 public:
52 
53  class NamePanel {
54  public:
55  NamePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
56  const std::string& title,
57  const GUIVisualizationTextSettings& settings);
58 
60  void update(const GUIVisualizationTextSettings& settings);
61 
62  FXCheckButton* myCheck;
63  FXRealSpinner* mySizeDial;
64  FXColorWell* myColorWell;
65  FXCheckButton* myConstSizeCheck;
66  };
67 
68  class SizePanel {
69  public:
70  SizePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
71  const GUIVisualizationSizeSettings& settings);
72 
74  void update(const GUIVisualizationSizeSettings& settings);
75 
76  FXRealSpinner* myMinSizeDial;
77  FXRealSpinner* myExaggerateDial;
78  FXCheckButton* myCheck;
79  };
80 
90  GUIVisualizationSettings* settings,
91  std::vector<GUISUMOAbstractView::Decal>* decals,
92  MFXMutex* decalsLock);
93 
94 
97 
99  void show();
100 
104  void setCurrent(GUIVisualizationSettings* settings);
105 
106 
107 
110 
112  long onCmdOk(FXObject*, FXSelector, void*);
113 
115  long onCmdCancel(FXObject*, FXSelector, void*);
116 
118  long onCmdColorChange(FXObject*, FXSelector, void*);
119 
121  long onCmdEditTable(FXObject*, FXSelector, void* data);
122 
124  long onCmdNameChange(FXObject*, FXSelector, void*);
125 
127  long onCmdSaveSetting(FXObject*, FXSelector, void* data);
129  long onUpdSaveSetting(FXObject*, FXSelector, void* data);
130 
132  long onCmdDeleteSetting(FXObject*, FXSelector, void* data);
134  long onUpdDeleteSetting(FXObject*, FXSelector, void* data);
135 
137  long onCmdExportSetting(FXObject*, FXSelector, void* data);
139  long onUpdExportSetting(FXObject*, FXSelector, void* data);
140 
142  long onCmdImportSetting(FXObject*, FXSelector, void* data);
144  long onUpdImportSetting(FXObject*, FXSelector, void* data);
145 
147  long onCmdLoadDecals(FXObject*, FXSelector, void* data);
149  long onCmdSaveDecals(FXObject*, FXSelector, void* data);
151 
152 
153 
157  std::string getCurrentScheme() const;
158 
159 
163  void setCurrentScheme(const std::string&);
164 
165 
166 private:
167  bool updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
168  std::vector<FXColorWell*>::const_iterator colEnd,
169  std::vector<FXRealSpinner*>::const_iterator threshIt,
170  std::vector<FXRealSpinner*>::const_iterator threshEnd,
171  std::vector<FXButton*>::const_iterator buttonIt,
172  GUIColorScheme& scheme);
173 
174  bool updateScaleRanges(FXObject* sender, std::vector<FXRealSpinner*>::const_iterator colIt,
175  std::vector<FXRealSpinner*>::const_iterator colEnd,
176  std::vector<FXRealSpinner*>::const_iterator threshIt,
177  std::vector<FXRealSpinner*>::const_iterator threshEnd,
178  std::vector<FXButton*>::const_iterator buttonIt,
179  GUIScaleScheme& scheme);
180 
183  FXMatrix* rebuildColorMatrix(FXVerticalFrame* frame,
184  std::vector<FXColorWell*>& colors,
185  std::vector<FXRealSpinner*>& thresholds,
186  std::vector<FXButton*>& buttons,
187  FXCheckButton* interpolation,
188  GUIColorScheme& scheme);
189 
192  FXMatrix* rebuildScaleMatrix(FXVerticalFrame* frame,
193  std::vector<FXRealSpinner*>& scales,
194  std::vector<FXRealSpinner*>& thresholds,
195  std::vector<FXButton*>& buttons,
196  FXCheckButton* interpolation,
197  GUIScaleScheme& scheme);
198 
199 
203  void rebuildColorMatrices(bool doCreate = false);
204 
205 
207  void rebuildList();
208 
209 
213  void loadSettings(const std::string& file);
214 
215 
219  void saveDecals(OutputDevice& dev) const;
220 
221 
225  void loadDecals(const std::string& file);
226 
228  void saveWindowSize();
229 
231  void loadWindowSize();
232 
233 private:
236 
239 
242 
244  std::vector<GUISUMOAbstractView::Decal>* myDecals;
245 
248 
251  FXComboBox* mySchemeName;
252  FXCheckButton* myShowGrid;
254 
255  FXColorWell* myBackgroundColor;
256  FXVerticalFrame* myDecalsFrame;
258 
260  FXComboBox* myLaneEdgeColorMode;
261  FXVerticalFrame* myLaneColorSettingFrame;
262  std::vector<FXColorWell*> myLaneColors;
263  std::vector<FXRealSpinner*> myLaneThresholds;
264  std::vector<FXButton*> myLaneButtons;
265  FXCheckButton* myLaneColorInterpolation;
268 
270  FXComboBox* myLaneEdgeScaleMode;
271  FXVerticalFrame* myLaneScaleSettingFrame;
272  std::vector<FXRealSpinner*> myLaneScales;
273  std::vector<FXRealSpinner*> myLaneScaleThresholds;
274  std::vector<FXButton*> myLaneScaleButtons;
275  FXCheckButton* myLaneScaleInterpolation;
276 
279  FXRealSpinner* myLaneWidthUpscaleDialer;
280  FXRealSpinner* myLaneMinWidthDialer;
281 
283  FXVerticalFrame* myVehicleColorSettingFrame;
284  std::vector<FXColorWell*> myVehicleColors;
285  std::vector<FXRealSpinner*> myVehicleThresholds;
286  std::vector<FXButton*> myVehicleButtons;
288  FXCheckButton* myShowBlinker, *myShowMinGap, *myShowBTRange; /* *myShowLaneChangePreference,*/
289 
291  FXVerticalFrame* myPersonColorSettingFrame;
292  std::vector<FXColorWell*> myPersonColors;
293  std::vector<FXRealSpinner*> myPersonThresholds;
294  std::vector<FXButton*> myPersonButtons;
296 
299  std::vector<FXColorWell*> myContainerColors;
300  std::vector<FXRealSpinner*> myContainerThresholds;
301  std::vector<FXButton*> myContainerButtons;
304 
305  FXComboBox* myJunctionColorMode;
306  FXVerticalFrame* myJunctionColorSettingFrame;
307  std::vector<FXColorWell*> myJunctionColors;
308  std::vector<FXRealSpinner*> myJunctionThresholds;
309  std::vector<FXButton*> myJunctionButtons;
311 
313  FXVerticalFrame* myPOIColorSettingFrame;
314  std::vector<FXColorWell*> myPOIColors;
315  std::vector<FXRealSpinner*> myPOIThresholds;
316  std::vector<FXButton*> myPOIButtons;
317  FXCheckButton* myPOIColorInterpolation;
318 
320  FXVerticalFrame* myPolyColorSettingFrame;
321  std::vector<FXColorWell*> myPolyColors;
322  std::vector<FXRealSpinner*> myPolyThresholds;
323  std::vector<FXButton*> myPolyButtons;
324  FXCheckButton* myPolyColorInterpolation;
325 
326  FXCheckButton* myShowLane2Lane;
327  FXCheckButton* myDrawJunctionShape;
329  FXCheckButton* myDither;
330  FXCheckButton* myShowSizeLegend;
331 
337 
339 
340 
341  // load/save-menu
344 
345 
346 protected:
349 
350 
351 private:
354 
357 
358 
359 };
360 
361 
362 #endif
363 
364 /****************************************************************************/
365 
void rebuildColorMatrices(bool doCreate=false)
Rebuilds color changing dialogs after choosing another coloring scheme.
bool updateColorRanges(FXObject *sender, std::vector< FXColorWell *>::const_iterator colIt, std::vector< FXColorWell *>::const_iterator colEnd, std::vector< FXRealSpinner *>::const_iterator threshIt, std::vector< FXRealSpinner *>::const_iterator threshEnd, std::vector< FXButton *>::const_iterator buttonIt, GUIColorScheme &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
bool updateScaleRanges(FXObject *sender, std::vector< FXRealSpinner *>::const_iterator colIt, std::vector< FXRealSpinner *>::const_iterator colEnd, std::vector< FXRealSpinner *>::const_iterator threshIt, std::vector< FXRealSpinner *>::const_iterator threshEnd, std::vector< FXButton *>::const_iterator buttonIt, GUIScaleScheme &scheme)
FXCheckButton * myPolyColorInterpolation
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< FXButton * > myPolyButtons
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent&#39;s decals.
std::vector< FXButton * > myPOIButtons
void loadDecals(const std::string &file)
Loads decals from a file.
std::vector< FXButton * > myPersonButtons
std::vector< FXColorWell * > myJunctionColors
void loadWindowSize()
load window position and size from the registry
void loadSettings(const std::string &file)
Loads a scheme from a file.
FXVerticalFrame * myPolyColorSettingFrame
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.
FXRealSpinner * myContainerMinSizeDialer
long onCmdExportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be exported into a file.
std::vector< FXRealSpinner * > myLaneScaleThresholds
std::vector< FXRealSpinner * > myLaneThresholds
long onCmdEditTable(FXObject *, FXSelector, void *data)
Called if the decals-table was changed.
std::vector< FXColorWell * > myPOIColors
FXRealSpinner * myContainerUpscaleDialer
FXVerticalFrame * myContainerColorSettingFrame
long onCmdNameChange(FXObject *, FXSelector, void *)
Called if the name of the scheme was changed.
std::vector< FXRealSpinner * > myPOIThresholds
std::vector< FXRealSpinner * > myPolyThresholds
std::vector< FXButton * > myContainerButtons
FXCheckButton * myVehicleColorInterpolation
GUIDialog_ViewSettings()
Default constructor (needed by FOX)
std::vector< FXRealSpinner * > myPersonThresholds
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< FXColorWell * > myVehicleColors
std::vector< FXRealSpinner * > myLaneScales
void saveWindowSize()
save window position and size to the registry
FXVerticalFrame * myLaneColorSettingFrame
std::vector< FXRealSpinner * > myVehicleThresholds
FXMatrix * rebuildColorMatrix(FXVerticalFrame *frame, std::vector< FXColorWell *> &colors, std::vector< FXRealSpinner *> &thresholds, std::vector< FXButton *> &buttons, FXCheckButton *interpolation, GUIColorScheme &scheme)
Rebuilds manipulators for the current coloring 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
long onCmdCancel(FXObject *, FXSelector, void *)
Called if the Cancel-button was pressed.
std::vector< FXRealSpinner * > myJunctionThresholds
std::vector< FXButton * > myLaneScaleButtons
long onCmdOk(FXObject *, FXSelector, void *)
Called if the OK-button was pressed.
FXMatrix * rebuildScaleMatrix(FXVerticalFrame *frame, std::vector< FXRealSpinner *> &scales, std::vector< FXRealSpinner *> &thresholds, std::vector< FXButton *> &buttons, FXCheckButton *interpolation, GUIScaleScheme &scheme)
Rebuilds manipulators for the current scaling scheme.
MFXAddEditTypedTable * myDecalsTable
GUIDialog_ViewSettings & operator=(const GUIDialog_ViewSettings &s)
invalidated assignment operator
FXCheckButton * myPOIColorInterpolation
NamePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const std::string &title, const GUIVisualizationTextSettings &settings)
FXComboBox * myLaneEdgeScaleMode
... lane scaler
GUIVisualizationTextSettings getSettings()
std::vector< FXColorWell * > myPolyColors
std::vector< FXRealSpinner * > myContainerThresholds
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:64
FXCheckButton * myPersonColorInterpolation
long onCmdLoadDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be loaded from a file.
void update(const GUIVisualizationTextSettings &settings)
FXVerticalFrame * myPOIColorSettingFrame
MFXMutex * myDecalsLock
Lock used when changing the decals.
FXRealSpinner * myLaneWidthUpscaleDialer
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< 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.
FXRealSpinner * myLaneMinWidthDialer