Eclipse 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-2019 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 MFXIconComboBox;
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  FXColorWell* myBGColorWell;
66  FXCheckButton* myConstSizeCheck;
67  };
68 
69  class SizePanel {
70  public:
71  SizePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
72  const GUIVisualizationSizeSettings& settings);
73 
75  void update(const GUIVisualizationSizeSettings& settings);
76 
77  FXRealSpinner* myMinSizeDial;
78  FXRealSpinner* myExaggerateDial;
79  FXCheckButton* myCheck;
80  FXCheckButton* myCheckSelected;
81  };
82 
92  GUIVisualizationSettings* settings,
93  std::vector<GUISUMOAbstractView::Decal>* decals,
94  FXMutex* decalsLock);
95 
96 
99 
101  void show();
102 
106  void setCurrent(GUIVisualizationSettings* settings);
107 
108 
109 
112 
114  long onCmdOk(FXObject*, FXSelector, void*);
115 
117  long onCmdCancel(FXObject*, FXSelector, void*);
118 
120  long onCmdColorChange(FXObject*, FXSelector, void*);
121 
123  long onCmdEditTable(FXObject*, FXSelector, void* data);
124 
126  long onCmdNameChange(FXObject*, FXSelector, void*);
127 
129  long onCmdSaveSetting(FXObject*, FXSelector, void* data);
131  long onUpdSaveSetting(FXObject*, FXSelector, void* data);
132 
134  long onCmdDeleteSetting(FXObject*, FXSelector, void* data);
136  long onUpdDeleteSetting(FXObject*, FXSelector, void* data);
137 
139  long onCmdExportSetting(FXObject*, FXSelector, void* data);
141  long onUpdExportSetting(FXObject*, FXSelector, void* data);
142 
144  long onCmdImportSetting(FXObject*, FXSelector, void* data);
146  long onUpdImportSetting(FXObject*, FXSelector, void* data);
147 
149  long onCmdLoadDecals(FXObject*, FXSelector, void* data);
151  long onCmdSaveDecals(FXObject*, FXSelector, void* data);
153 
154 
155 
159  std::string getCurrentScheme() const;
160 
161 
165  void setCurrentScheme(const std::string&);
166 
167 
168 private:
169  bool updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
170  std::vector<FXColorWell*>::const_iterator colEnd,
171  std::vector<FXRealSpinner*>::const_iterator threshIt,
172  std::vector<FXRealSpinner*>::const_iterator threshEnd,
173  std::vector<FXButton*>::const_iterator buttonIt,
174  GUIColorScheme& scheme);
175 
176  bool updateScaleRanges(FXObject* sender, std::vector<FXRealSpinner*>::const_iterator colIt,
177  std::vector<FXRealSpinner*>::const_iterator colEnd,
178  std::vector<FXRealSpinner*>::const_iterator threshIt,
179  std::vector<FXRealSpinner*>::const_iterator threshEnd,
180  std::vector<FXButton*>::const_iterator buttonIt,
181  GUIScaleScheme& scheme);
182 
185  FXMatrix* rebuildColorMatrix(FXVerticalFrame* frame,
186  std::vector<FXColorWell*>& colors,
187  std::vector<FXRealSpinner*>& thresholds,
188  std::vector<FXButton*>& buttons,
189  FXCheckButton* interpolation,
190  GUIColorScheme& scheme);
191 
194  FXMatrix* rebuildScaleMatrix(FXVerticalFrame* frame,
195  std::vector<FXRealSpinner*>& scales,
196  std::vector<FXRealSpinner*>& thresholds,
197  std::vector<FXButton*>& buttons,
198  FXCheckButton* interpolation,
199  GUIScaleScheme& scheme);
200 
201 
205  void rebuildColorMatrices(bool doCreate = false);
206 
207 
209  void rebuildList();
210 
211 
215  void loadSettings(const std::string& file);
216 
217 
221  void saveDecals(OutputDevice& dev) const;
222 
223 
227  void loadDecals(const std::string& file);
228 
230  void saveWindowSize();
231 
233  void loadWindowSize();
234 
235 private:
238 
241 
244 
246  std::vector<GUISUMOAbstractView::Decal>* myDecals;
247 
249  FXMutex* myDecalsLock;
250 
253  FXComboBox* mySchemeName;
254  FXCheckButton* myShowGrid;
256 
257  FXColorWell* myBackgroundColor;
258  FXVerticalFrame* myDecalsFrame;
260 
262  FXColorWell* mySelectionColor;
263  FXColorWell* mySelectedEdgeColor;
264  FXColorWell* mySelectedLaneColor;
269  FXColorWell* mySelectedRouteColor;
271  FXColorWell* mySelectedPersonColor;
273 
276  FXVerticalFrame* myLaneColorSettingFrame;
277  std::vector<FXColorWell*> myLaneColors;
278  std::vector<FXRealSpinner*> myLaneThresholds;
279  std::vector<FXButton*> myLaneButtons;
280  FXCheckButton* myLaneColorInterpolation;
282  FXCheckButton* myLaneColorRainbowCheck;
285  FXComboBox* myParamKey;
286 
289  FXVerticalFrame* myLaneScaleSettingFrame;
290  std::vector<FXRealSpinner*> myLaneScales;
291  std::vector<FXRealSpinner*> myLaneScaleThresholds;
292  std::vector<FXButton*> myLaneScaleButtons;
293  FXCheckButton* myLaneScaleInterpolation;
294 
297  FXRealSpinner* myLaneWidthUpscaleDialer;
298  FXRealSpinner* myLaneMinWidthDialer;
299 
301  FXVerticalFrame* myVehicleColorSettingFrame;
302  std::vector<FXColorWell*> myVehicleColors;
303  std::vector<FXRealSpinner*> myVehicleThresholds;
304  std::vector<FXButton*> myVehicleButtons;
306  FXCheckButton* myShowBlinker, *myShowMinGap, *myShowBrakeGap, *myShowBTRange; /* *myShowLaneChangePreference,*/
307 
309  FXVerticalFrame* myPersonColorSettingFrame;
310  std::vector<FXColorWell*> myPersonColors;
311  std::vector<FXRealSpinner*> myPersonThresholds;
312  std::vector<FXButton*> myPersonButtons;
314 
317  std::vector<FXColorWell*> myContainerColors;
318  std::vector<FXRealSpinner*> myContainerThresholds;
319  std::vector<FXButton*> myContainerButtons;
322 
324  FXVerticalFrame* myJunctionColorSettingFrame;
325  std::vector<FXColorWell*> myJunctionColors;
326  std::vector<FXRealSpinner*> myJunctionThresholds;
327  std::vector<FXButton*> myJunctionButtons;
329 
331  FXVerticalFrame* myPOIColorSettingFrame;
332  std::vector<FXColorWell*> myPOIColors;
333  std::vector<FXRealSpinner*> myPOIThresholds;
334  std::vector<FXButton*> myPOIButtons;
335  FXCheckButton* myPOIColorInterpolation;
336 
338  FXVerticalFrame* myPolyColorSettingFrame;
339  std::vector<FXColorWell*> myPolyColors;
340  std::vector<FXRealSpinner*> myPolyThresholds;
341  std::vector<FXButton*> myPolyButtons;
342  FXCheckButton* myPolyColorInterpolation;
343 
344  FXCheckButton* myShowLane2Lane;
345  FXCheckButton* myDrawJunctionShape;
347  FXCheckButton* myDither;
348  FXCheckButton* myFPS;
349  FXCheckButton* myDrawBoundaries;
350  FXCheckButton* myForceDrawForSelecting;
351  FXCheckButton* myShowSizeLegend;
352  FXCheckButton* myShowColorLegend;
353 
362 
364 
365 
366  // load/save-menu
369 
370 
371 protected:
374 
375 
376 private:
379 
382 
383 
384 };
385 
386 
387 #endif
388 
389 /****************************************************************************/
390 
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
MFXIconComboBox * myPOIShapeDetail
FXCheckButton * myJunctionColorInterpolation
MFXIconComboBox * myVehicleColorMode
FXVerticalFrame * myLaneScaleSettingFrame
FXCheckButton * myLaneColorRainbowCheck
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
MFXIconComboBox * myPolyColorMode
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
MFXIconComboBox * myLaneEdgeScaleMode
... lane scaler
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent&#39;s decals.
std::vector< FXButton * > myPOIButtons
MFXIconComboBox * myVehicleShapeDetail
void loadDecals(const std::string &file)
Loads decals from a file.
std::vector< FXButton * > myPersonButtons
std::vector< FXColorWell * > myJunctionColors
MFXIconComboBox * myContainerColorMode
void loadWindowSize()
load window position and size from the registry
void loadSettings(const std::string &file)
Loads a scheme from a file.
FXVerticalFrame * myPolyColorSettingFrame
MFXIconComboBox * myPersonColorMode
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
FXRealSpinner * myLaneColorRainbowThreshold
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)
MFXIconComboBox * myJunctionColorMode
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
MFXIconComboBox * myLaneEdgeColorMode
... lane colorer
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)
GUIVisualizationTextSettings getSettings()
std::vector< FXColorWell * > myPolyColors
MFXIconComboBox * myPolyShapeDetail
std::vector< FXRealSpinner * > myContainerThresholds
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
FXCheckButton * myHideMacroConnectors
FXColorWell * mySelectedProhibitionColor
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.
FXCheckButton * myForceDrawForSelecting
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
FXCheckButton * myPersonColorInterpolation
FXMutex * myDecalsLock
Lock used when changing the decals.
long onCmdLoadDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be loaded from a file.
void update(const GUIVisualizationTextSettings &settings)
FXVerticalFrame * myPOIColorSettingFrame
FXRealSpinner * myLaneWidthUpscaleDialer
FXCheckButton * myContainerColorInterpolation
MFXIconComboBox * myPOIColorMode
long onCmdDeleteSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be deleted.
MFXIconComboBox * myContainerShapeDetail
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
MFXIconComboBox * myPersonShapeDetail
FXColorWell * mySelectionColor
selection colors
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