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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // The dialog to change the view (gui) settings.
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <fx.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class MFXIconComboBox;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
45 class GUIDialog_ViewSettings : public FXDialogBox {
46  // is a FOX-object with an own mapping
47  FXDECLARE(GUIDialog_ViewSettings)
48 public:
49 
50  class NamePanel {
51  public:
52  NamePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
53  const std::string& title,
54  const GUIVisualizationTextSettings& settings);
55 
57  void update(const GUIVisualizationTextSettings& settings);
58 
59  FXCheckButton* myCheck;
60  FXRealSpinner* mySizeDial;
61  FXColorWell* myColorWell;
62  FXColorWell* myBGColorWell;
63  FXCheckButton* myConstSizeCheck;
64  FXMatrix* myMatrix0;
65  };
66 
67  class SizePanel {
68  public:
69  SizePanel(FXMatrix* parent, GUIDialog_ViewSettings* target,
70  const GUIVisualizationSizeSettings& settings);
71 
73  void update(const GUIVisualizationSizeSettings& settings);
74 
75  FXRealSpinner* myMinSizeDial;
76  FXRealSpinner* myExaggerateDial;
77  FXCheckButton* myCheck;
78  FXCheckButton* myCheckSelected;
79  };
80 
90  GUIVisualizationSettings* settings,
91  std::vector<GUISUMOAbstractView::Decal>* decals,
92  FXMutex* 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 
234  void updateVehicleParams();
235 
237  void updatePOIParams();
238 
239 private:
242 
245 
248 
250  std::vector<GUISUMOAbstractView::Decal>* myDecals;
251 
253  FXMutex* myDecalsLock;
254 
257  FXComboBox* mySchemeName;
258  FXCheckButton* myShowGrid;
260 
261  FXColorWell* myBackgroundColor;
262  FXVerticalFrame* myDecalsFrame;
264 
266  FXColorWell* mySelectionColor;
267  FXColorWell* mySelectedEdgeColor;
268  FXColorWell* mySelectedLaneColor;
273  FXColorWell* mySelectedRouteColor;
275  FXColorWell* mySelectedPersonColor;
278 
281  FXVerticalFrame* myLaneColorSettingFrame;
282  std::vector<FXColorWell*> myLaneColors;
283  std::vector<FXRealSpinner*> myLaneThresholds;
284  std::vector<FXButton*> myLaneButtons;
285  FXCheckButton* myLaneColorInterpolation;
287  FXCheckButton* myLaneColorRainbowCheck;
290  FXComboBox* myParamKey;
291 
294  FXVerticalFrame* myLaneScaleSettingFrame;
295  std::vector<FXRealSpinner*> myLaneScales;
296  std::vector<FXRealSpinner*> myLaneScaleThresholds;
297  std::vector<FXButton*> myLaneScaleButtons;
298  FXCheckButton* myLaneScaleInterpolation;
299 
302  FXRealSpinner* myLaneWidthUpscaleDialer;
303  FXRealSpinner* myLaneMinWidthDialer;
304 
305  // Vehicles
307  FXVerticalFrame* myVehicleColorSettingFrame;
308  std::vector<FXColorWell*> myVehicleColors;
309  std::vector<FXRealSpinner*> myVehicleThresholds;
310  std::vector<FXButton*> myVehicleButtons;
312  FXCheckButton* myShowBlinker, *myShowMinGap, *myShowBrakeGap, *myShowBTRange, *myShowRouteIndex; /* *myShowLaneChangePreference,*/
313  FXComboBox* myVehicleParamKey;
315 
316  // Persons
318  FXVerticalFrame* myPersonColorSettingFrame;
319  std::vector<FXColorWell*> myPersonColors;
320  std::vector<FXRealSpinner*> myPersonThresholds;
321  std::vector<FXButton*> myPersonButtons;
323 
324  // Containers
327  std::vector<FXColorWell*> myContainerColors;
328  std::vector<FXRealSpinner*> myContainerThresholds;
329  std::vector<FXButton*> myContainerButtons;
332 
333  // junctions
335  FXVerticalFrame* myJunctionColorSettingFrame;
336  std::vector<FXColorWell*> myJunctionColors;
337  std::vector<FXRealSpinner*> myJunctionThresholds;
338  std::vector<FXButton*> myJunctionButtons;
340 
341  // POIs
343  FXVerticalFrame* myPOIColorSettingFrame;
344  std::vector<FXColorWell*> myPOIColors;
345  std::vector<FXRealSpinner*> myPOIThresholds;
346  std::vector<FXButton*> myPOIButtons;
347  FXCheckButton* myPOIColorInterpolation;
348  FXComboBox* myPOITextParamKey;
349 
350  // Polygons
352  FXVerticalFrame* myPolyColorSettingFrame;
353  std::vector<FXColorWell*> myPolyColors;
354  std::vector<FXRealSpinner*> myPolyThresholds;
355  std::vector<FXButton*> myPolyButtons;
356  FXCheckButton* myPolyColorInterpolation;
357 
358  FXCheckButton* myShowLane2Lane;
359  FXCheckButton* myDrawJunctionShape;
361  FXCheckButton* myDither;
362  FXCheckButton* myFPS;
363  FXCheckButton* myDrawBoundaries;
366  FXCheckButton* myShowSizeLegend;
367  FXCheckButton* myShowColorLegend;
368  FXCheckButton* myShowVehicleColorLegend;
369 
380 
382 
383 
384  // load/save-menu
387 
388 
389 protected:
390  FOX_CONSTRUCTOR(GUIDialog_ViewSettings)
391 
392 
393 private:
396 
399 
400 
401 };
GUIVisualizationTextSettings getSettings()
void update(const GUIVisualizationTextSettings &settings)
NamePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const std::string &title, const GUIVisualizationTextSettings &settings)
SizePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const GUIVisualizationSizeSettings &settings)
void update(const GUIVisualizationSizeSettings &settings)
GUIVisualizationSizeSettings getSettings()
The dialog to change the view (gui) settings.
long onCmdExportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be exported into a file.
FXVerticalFrame * myVehicleColorSettingFrame
FXCheckButton * myVehicleColorInterpolation
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
FXCheckButton * myHideMacroConnectors
GUISUMOAbstractView * myParent
The parent view (which settings are changed)
FXMutex * myDecalsLock
Lock used when changing the decals.
void rebuildList()
Rebuilds the decals table.
std::vector< FXColorWell * > myPolyColors
FXVerticalFrame * myJunctionColorSettingFrame
long onCmdNameChange(FXObject *, FXSelector, void *)
Called if the name of the scheme was changed.
FXVerticalFrame * myContainerColorSettingFrame
FXRealSpinner * myLaneWidthUpscaleDialer
MFXIconComboBox * myPersonShapeDetail
std::vector< FXColorWell * > myPOIColors
MFXIconComboBox * myPOIColorMode
std::vector< FXButton * > myLaneScaleButtons
long onCmdSaveDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be saved to a file.
std::vector< FXColorWell * > myPersonColors
std::vector< FXRealSpinner * > myPolyThresholds
FXCheckButton * myPOIColorInterpolation
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent's decals.
std::vector< FXButton * > myContainerButtons
std::vector< FXRealSpinner * > myJunctionThresholds
MFXIconComboBox * myVehicleShapeDetail
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.
FXRealSpinner * myContainerMinSizeDialer
std::vector< FXRealSpinner * > myPersonThresholds
void show()
show view settings dialog
std::vector< FXButton * > myJunctionButtons
MFXIconComboBox * myContainerColorMode
MFXIconComboBox * myPolyShapeDetail
FXColorWell * mySelectedProhibitionColor
FXCheckButton * myShowVehicleColorLegend
MFXIconComboBox * myLaneEdgeColorMode
... lane colorer
FXCheckButton * myLaneColorRainbowCheck
GUIDialog_ViewSettings(const GUIDialog_ViewSettings &s)
invalidated copy constructor
MFXIconComboBox * myContainerShapeDetail
std::vector< FXColorWell * > myJunctionColors
FXRealSpinner * myLaneMinWidthDialer
void saveWindowSize()
save window position and size to the registry
FXCheckButton * myPersonColorInterpolation
FXColorWell * mySelectionColor
selection colors
FXVerticalFrame * myLaneScaleSettingFrame
std::vector< FXColorWell * > myVehicleColors
long onCmdLoadDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be loaded from a file.
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.
MFXIconComboBox * myLaneEdgeScaleMode
... lane scaler
std::vector< FXRealSpinner * > myVehicleThresholds
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
FXCheckButton * myPolyColorInterpolation
GUIDialog_ViewSettings & operator=(const GUIDialog_ViewSettings &s)
invalidated assignment operator
std::vector< FXButton * > myPersonButtons
void loadWindowSize()
load window position and size from the registry
FXCheckButton * myJunctionColorInterpolation
long onCmdCancel(FXObject *, FXSelector, void *)
Called if the Cancel-button was pressed.
MFXAddEditTypedTable * myDecalsTable
FXVerticalFrame * myLaneColorSettingFrame
FXCheckButton * myLaneScaleInterpolation
FXCheckButton * myForceDrawForPositionSelection
long onCmdImportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be read from a file.
MFXIconComboBox * myJunctionColorMode
long onUpdImportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to read settings from a file.
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
void rebuildColorMatrices(bool doCreate=false)
Rebuilds color changing dialogs after choosing another coloring scheme.
void saveDecals(OutputDevice &dev) const
Writes the currently used decals into a file.
FXVerticalFrame * myPolyColorSettingFrame
std::vector< FXRealSpinner * > myLaneScales
void loadSettings(const std::string &file)
Loads a scheme from a file.
MFXIconComboBox * myPersonColorMode
FXCheckButton * myDrawCrossingsAndWalkingAreas
std::vector< FXButton * > myLaneButtons
GUIDialog_ViewSettings(GUISUMOAbstractView *parent, GUIVisualizationSettings *settings, std::vector< GUISUMOAbstractView::Decal > *decals, FXMutex *decalsLock)
Constructor.
FXCheckButton * myLaneColorInterpolation
FXVerticalFrame * myPersonColorSettingFrame
FXCheckButton * myContainerColorInterpolation
std::vector< FXColorWell * > myLaneColors
GUIVisualizationSettings * mySettings
The current settings.
long onCmdDeleteSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be deleted.
void loadDecals(const std::string &file)
Loads decals from a file.
FXVerticalFrame * myPOIColorSettingFrame
long onCmdColorChange(FXObject *, FXSelector, void *)
Called if something (color, width, etc.) has been changed.
std::vector< FXColorWell * > myContainerColors
FXCheckButton * myForceDrawForRectangleSelection
std::vector< FXRealSpinner * > myLaneScaleThresholds
FXRealSpinner * myLaneColorRainbowThreshold
GUIVisualizationSettings myBackup
A backup of the settings (used if the "Cancel" button is pressed)
std::vector< FXRealSpinner * > myContainerThresholds
void updatePOIParams()
reload known POI parameters
long onCmdEditTable(FXObject *, FXSelector, void *data)
Called if the decals-table was changed.
long onCmdOk(FXObject *, FXSelector, void *)
Called if the OK-button was pressed.
long onCmdSaveSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be saved into the registry.
MFXIconComboBox * myPOIShapeDetail
FXRealSpinner * myContainerUpscaleDialer
long onUpdSaveSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to save the settings into the registry.
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)
std::vector< FXRealSpinner * > myLaneThresholds
long onUpdDeleteSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to delete settings.
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)
long onUpdExportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to export settings into a file.
std::vector< FXButton * > myPOIButtons
MFXIconComboBox * myVehicleColorMode
MFXIconComboBox * myPolyColorMode
void updateVehicleParams()
reload known vehicle parameters
std::vector< FXRealSpinner * > myPOIThresholds
std::vector< FXButton * > myPolyButtons
std::vector< FXButton * > myVehicleButtons
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60