SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIDialog_ViewSettings.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // The dialog to change the view (gui) settings.
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
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 <fstream>
38 #include <utils/common/RGBColor.h>
40 #include <utils/common/ToString.h>
49 #include "GUIDialog_EditViewport.h"
50 #include "GUIDialog_ViewSettings.h"
51 
52 #ifdef CHECK_MEMORY_LEAKS
53 #include <foreign/nvwa/debug_new.h>
54 #endif // CHECK_MEMORY_LEAKS
55 
56 
57 // ===========================================================================
58 // FOX callback mapping
59 // ===========================================================================
60 FXDEFMAP(GUIDialog_ViewSettings) GUIDialog_ViewSettingsMap[] = {
64  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_ViewSettings::onCmdOk),
67 
76 
79 
80 };
81 
82 
83 FXIMPLEMENT(GUIDialog_ViewSettings, FXDialogBox, GUIDialog_ViewSettingsMap, ARRAYNUMBER(GUIDialog_ViewSettingsMap))
84 
85 
86 // ===========================================================================
87 // method definitions
88 // ===========================================================================
90  GUIVisualizationSettings* settings,
91  std::vector<GUISUMOAbstractView::Decal>* decals,
92  MFXMutex* decalsLock) :
93  FXDialogBox(parent, "View Settings", DECOR_TITLE | DECOR_BORDER | DECOR_RESIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
94  myParent(parent), mySettings(settings),
95  myDecals(decals), myDecalsLock(decalsLock),
96  myDecalsTable(0) {
97  myBackup = (*mySettings);
98 
99  FXVerticalFrame* contentFrame =
100  new FXVerticalFrame(this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
101  0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
102  //
103  {
104  FXHorizontalFrame* frame0 =
105  new FXHorizontalFrame(contentFrame, FRAME_THICK, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
106  mySchemeName = new FXComboBox(frame0, 20, this, MID_SIMPLE_VIEW_NAMECHANGE, COMBOBOX_INSERT_LAST | FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_CENTER_Y | COMBOBOX_STATIC);
107  const std::vector<std::string>& names = gSchemeStorage.getNames();
108  for (std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i) {
109  int index = mySchemeName->appendItem((*i).c_str());
110  if ((*i) == mySettings->name) {
111  mySchemeName->setCurrentItem((FXint) index);
112  }
113  }
114  mySchemeName->setNumVisible(5);
115 
116  new FXButton(frame0, "\t\tSave the setting to registry",
118  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
119  new FXButton(frame0, "\t\tRemove the setting from registry",
121  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
122  new FXButton(frame0, "\t\tExport setting to file",
124  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
125  new FXButton(frame0, "\t\tLoad setting from file",
127  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
128 
129  new FXVerticalSeparator(frame0);
130  new FXLabel(frame0, "Export includes:", 0, LAYOUT_CENTER_Y);
131  mySaveViewPort = new FXCheckButton(frame0, "Viewport");
132  mySaveDelay = new FXCheckButton(frame0, "Delay");
133  mySaveDecals = new FXCheckButton(frame0, "Decals");
134 
135  }
136  //
137  FXTabBook* tabbook =
138  new FXTabBook(contentFrame, 0, 0, TABBOOK_LEFTTABS | PACK_UNIFORM_WIDTH | PACK_UNIFORM_HEIGHT | LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_RIGHT,
139  0, 0, 0, 0, 0, 0, 0, 0);
140  {
141  // tab for the background
142  new FXTabItem(tabbook, "Background", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
143  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
144  FXVerticalFrame* frame1 =
145  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
146 
147  FXMatrix* m11 =
148  new FXMatrix(frame1, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
149  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
150  new FXLabel(m11, "Color", 0, LAYOUT_CENTER_Y);
151  myBackgroundColor = new FXColorWell(m11, MFXUtils::getFXColor(settings->backgroundColor),
153  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
154  0, 0, 100, 0, 0, 0, 0, 0);
155 
156  new FXHorizontalSeparator(frame1, SEPARATOR_GROOVE | LAYOUT_FILL_X);
157 
158  FXVerticalFrame* frame11 =
159  new FXVerticalFrame(frame1, LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
160  new FXLabel(frame11, "Decals:");
161  myDecalsFrame = new FXVerticalFrame(frame11);
162  FXHorizontalFrame* frame111 = new FXHorizontalFrame(frame11, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
163  new FXButton(frame111, "&Load Decals", NULL, this, MID_SIMPLE_VIEW_LOAD_DECALS, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4);
164  new FXButton(frame111, "&Save Decals", NULL, this, MID_SIMPLE_VIEW_SAVE_DECALS, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4);
165 
166  new FXHorizontalSeparator(frame1, SEPARATOR_GROOVE | LAYOUT_FILL_X);
167 
168  FXMatrix* m12 =
169  new FXMatrix(frame1, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
170  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
171  myShowGrid =
172  new FXCheckButton(m12, "Show grid", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
173  myShowGrid->setCheck(mySettings->showGrid);
174  new FXLabel(m12, "");
175  FXMatrix* m121 =
176  new FXMatrix(m12, 2, LAYOUT_CENTER_Y | LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
177  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
178  new FXLabel(m121, "x-spacing", 0, LAYOUT_CENTER_Y);
179  myGridXSizeDialer =
180  new FXRealSpinDial(m121, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
181  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
182  myGridXSizeDialer->setRange(1, 10000);
183  myGridXSizeDialer->setValue(mySettings->gridXSize);
184  FXMatrix* m122 =
185  new FXMatrix(m12, 2, LAYOUT_CENTER_Y | LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
186  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
187  new FXLabel(m122, "y-spacing", 0, LAYOUT_CENTER_Y);
188  myGridYSizeDialer =
189  new FXRealSpinDial(m122, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
190  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
191  myGridYSizeDialer->setRange(1, 10000);
192  myGridYSizeDialer->setValue(mySettings->gridXSize);
193  }
194  {
195  // tab for the streets
196  new FXTabItem(tabbook, "Streets", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
197  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
198  FXVerticalFrame* frame2 =
199  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
200  // ... color settings
201  FXVerticalFrame* frame22 =
202  new FXVerticalFrame(frame2, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
203  FXMatrix* m21 =
204  new FXMatrix(frame22, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
205  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
206  new FXLabel(m21, "Color", 0, LAYOUT_CENTER_Y);
207  myLaneEdgeColorMode = new FXComboBox(m21, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
208  myLaneColorInterpolation = new FXCheckButton(m21, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
209  myLaneColorSettingFrame = new FXVerticalFrame(frame22, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
210 
211  new FXHorizontalSeparator(frame2, SEPARATOR_GROOVE | LAYOUT_FILL_X);
212  // ... scale settings
213  FXVerticalFrame* frame23 =
214  new FXVerticalFrame(frame2, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
215  FXMatrix* m23 =
216  new FXMatrix(frame23, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
217  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
218  new FXLabel(m23, "Scale width", 0, LAYOUT_CENTER_Y);
219  myLaneEdgeScaleMode = new FXComboBox(m23, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
220  myLaneScaleInterpolation = new FXCheckButton(m23, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
221  myLaneScaleSettingFrame = new FXVerticalFrame(frame23, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
222 
224  mySettings->edgeColorer.fill(*myLaneEdgeColorMode);
225  mySettings->edgeScaler.fill(*myLaneEdgeScaleMode);
226  myLaneEdgeColorMode->setNumVisible((int)mySettings->edgeColorer.size());
227  myLaneEdgeScaleMode->setNumVisible((int)mySettings->edgeScaler.size());
228  } else {
229  mySettings->laneColorer.fill(*myLaneEdgeColorMode);
230  mySettings->laneScaler.fill(*myLaneEdgeScaleMode);
231  myLaneEdgeColorMode->setNumVisible((int)mySettings->laneColorer.size());
232  myLaneEdgeScaleMode->setNumVisible((int)mySettings->laneScaler.size());
233  }
234 
235  new FXHorizontalSeparator(frame2, SEPARATOR_GROOVE | LAYOUT_FILL_X);
236  FXMatrix* m22 =
237  new FXMatrix(frame2, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
238  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
239  myShowLaneBorders = new FXCheckButton(m22, "Show lane borders", this, MID_SIMPLE_VIEW_COLORCHANGE);
240  myShowLaneBorders->setCheck(mySettings->laneShowBorders);
241  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
242  myShowLaneDecals = new FXCheckButton(m22, "Show turning arrows", this, MID_SIMPLE_VIEW_COLORCHANGE);
243  myShowLaneDecals->setCheck(mySettings->showLinkDecals);
244  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
245  myShowLinkRules = new FXCheckButton(m22, "Show right-of-way rules", this, MID_SIMPLE_VIEW_COLORCHANGE);
246  myShowLinkRules->setCheck(mySettings->showLinkRules);
247  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
248  myShowRails = new FXCheckButton(m22, "Show rails", this, MID_SIMPLE_VIEW_COLORCHANGE);
249  myShowRails->setCheck(mySettings->showRails);
250  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
251  myHideMacroConnectors = new FXCheckButton(m22, "Hide macro connectors", this, MID_SIMPLE_VIEW_COLORCHANGE);
252  myHideMacroConnectors->setCheck(mySettings->hideConnectors);
253  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
254  myShowLaneDirection = new FXCheckButton(m22, "Show lane direction", this, MID_SIMPLE_VIEW_COLORCHANGE);
255  myShowLaneDirection->setCheck(mySettings->showLaneDirection);
256  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
257  myShowSublanes = new FXCheckButton(m22, "Show sublanes", this, MID_SIMPLE_VIEW_COLORCHANGE);
258  myShowSublanes->setCheck(mySettings->showSublanes);
259  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
260  new FXLabel(m22, "Exaggerate width by", 0, LAYOUT_CENTER_Y);
261  myLaneWidthUpscaleDialer =
262  new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
263  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
264  myLaneWidthUpscaleDialer->setRange(0, 10000);
265  myLaneWidthUpscaleDialer->setValue(mySettings->laneWidthExaggeration);
266 
267  new FXLabel(m22, "Minimum size", 0, LAYOUT_CENTER_Y);
268  myLaneMinWidthDialer =
269  new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
270  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
271  myLaneMinWidthDialer->setRange(0, 10000);
272  myLaneMinWidthDialer->setValue(mySettings->laneMinSize);
273 
274  // edge name
275  myEdgeNamePanel = new NamePanel(m22, this, "Show edge name", mySettings->edgeName);
276  myStreetNamePanel = new NamePanel(m22, this, "Show street name", mySettings->streetName);
277  }
278  {
279  // vehicles
280  new FXTabItem(tabbook, "Vehicles", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
281  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
282  FXVerticalFrame* frame3 =
283  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
284 
285  FXMatrix* m31 =
286  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
287  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
288  new FXLabel(m31, "Show As", 0, LAYOUT_CENTER_Y);
289  myVehicleShapeDetail = new FXComboBox(m31, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
290  myVehicleShapeDetail->appendItem("'triangles'");
291  myVehicleShapeDetail->appendItem("'boxes'");
292  myVehicleShapeDetail->appendItem("'simple shapes'");
293  myVehicleShapeDetail->appendItem("'raster images'");
294  myVehicleShapeDetail->setNumVisible(4);
295  myVehicleShapeDetail->setCurrentItem(settings->vehicleQuality);
296 
297  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
298 
299  FXMatrix* m32 =
300  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
301  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
302  new FXLabel(m32, "Color", 0, LAYOUT_CENTER_Y);
303  myVehicleColorMode = new FXComboBox(m32, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
304  mySettings->vehicleColorer.fill(*myVehicleColorMode);
305  myVehicleColorMode->setNumVisible((int)mySettings->vehicleColorer.size());
306  myVehicleColorInterpolation = new FXCheckButton(m32, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
307 
308  myVehicleColorSettingFrame =
309  new FXVerticalFrame(frame3, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
310 
311  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
312 
313  FXMatrix* m33 =
314  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
315  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
316  myShowBlinker = new FXCheckButton(m33, "Show blinker / brake lights", this, MID_SIMPLE_VIEW_COLORCHANGE);
317  myShowBlinker->setCheck(mySettings->showBlinker);
318  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
319  myShowMinGap = new FXCheckButton(m33, "Show minimum gap", this, MID_SIMPLE_VIEW_COLORCHANGE);
320  myShowMinGap->setCheck(mySettings->drawMinGap);
321  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
322  myShowBTRange = new FXCheckButton(m33, "Show Bluetooth range", this, MID_SIMPLE_VIEW_COLORCHANGE);
323  myShowBTRange->setCheck(mySettings->showBTRange);
324  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
325  /*
326  myShowLaneChangePreference = new FXCheckButton(m33, "Show lane change preference", this, MID_SIMPLE_VIEW_COLORCHANGE);
327  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
328  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
329  */
330  myVehicleNamePanel = new NamePanel(m33, this, "Show vehicle name", mySettings->vehicleName);
331  /*
332  FXCheckButton *tmpc = new FXCheckButton(m33, "Show braking lights", 0 ,0);
333  tmpc->disable();
334  tmpc = new FXCheckButton(m33, "Show needed headway", 0 ,0);
335  tmpc->disable();
336  */
337 
338  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
339 
340  FXMatrix* m34 =
341  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
342  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
343  myVehicleSizePanel = new SizePanel(m34, this, mySettings->vehicleSize);
344  }
345 
346  {
347  // persons
348  new FXTabItem(tabbook, "Persons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
349  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
350  FXVerticalFrame* frame3 =
351  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
352 
353  FXMatrix* m101 =
354  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
355  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
356  new FXLabel(m101, "Show As", 0, LAYOUT_CENTER_Y);
357  myPersonShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
358  myPersonShapeDetail->appendItem("'triangles'");
359  myPersonShapeDetail->appendItem("'boxes'");
360  myPersonShapeDetail->appendItem("'simple shapes'");
361  myPersonShapeDetail->appendItem("'raster images'");
362  myPersonShapeDetail->setNumVisible(4);
363  myPersonShapeDetail->setCurrentItem(settings->personQuality);
364 
365  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
366 
367  FXMatrix* m102 =
368  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
369  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
370  new FXLabel(m102, "Color", 0, LAYOUT_CENTER_Y);
371  myPersonColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
372  mySettings->personColorer.fill(*myPersonColorMode);
373  myPersonColorMode->setNumVisible(10);
374  myPersonColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
375 
376  myPersonColorSettingFrame =
377  new FXVerticalFrame(frame3, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
378 
379  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
380 
381  FXMatrix* m103 =
382  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
383  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
384  myPersonNamePanel = new NamePanel(m103, this, "Show person name", mySettings->personName);
385 
386  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
387 
388  FXMatrix* m104 =
389  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
390  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
391  myPersonSizePanel = new SizePanel(m104, this, mySettings->personSize);
392  }
393 
394  {
395  // containers
396  new FXTabItem(tabbook, "Containers", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
397  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
398  FXVerticalFrame* frame3 =
399  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
400 
401  FXMatrix* m101 =
402  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
403  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
404  new FXLabel(m101, "Show As", 0, LAYOUT_CENTER_Y);
405  myContainerShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
406  myContainerShapeDetail->appendItem("'triangles'");
407  myContainerShapeDetail->appendItem("'boxes'");
408  myContainerShapeDetail->appendItem("'simple shapes'");
409  myContainerShapeDetail->appendItem("'raster images'");
410  myContainerShapeDetail->setNumVisible(4);
411  myContainerShapeDetail->setCurrentItem(settings->containerQuality);
412 
413  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
414 
415  FXMatrix* m102 =
416  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
417  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
418  new FXLabel(m102, "Color", 0, LAYOUT_CENTER_Y);
419  myContainerColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
420  mySettings->containerColorer.fill(*myContainerColorMode);
421  myContainerColorMode->setNumVisible(9);
422  myContainerColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
423 
424  myContainerColorSettingFrame =
425  new FXVerticalFrame(frame3, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
426 
427  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
428 
429  FXMatrix* m103 =
430  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
431  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
432  myContainerNamePanel = new NamePanel(m103, this, "Show container name", mySettings->containerName);
433 
434  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
435 
436  FXMatrix* m104 =
437  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
438  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
439  myContainerSizePanel = new SizePanel(m104, this, mySettings->containerSize);
440  }
441  {
442  // nodes
443  new FXTabItem(tabbook, "Junctions", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
444  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
445  FXVerticalFrame* frame4 =
446  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
447  FXMatrix* m41 =
448  new FXMatrix(frame4, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
449  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
450  new FXLabel(m41, "Color", 0, LAYOUT_CENTER_Y);
451  myJunctionColorMode = new FXComboBox(m41, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
452  mySettings->junctionColorer.fill(*myJunctionColorMode);
453  myJunctionColorMode->setNumVisible(3);
454  myJunctionColorInterpolation = new FXCheckButton(m41, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
455 
456  myJunctionColorSettingFrame =
457  new FXVerticalFrame(frame4, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
458 
459  new FXHorizontalSeparator(frame4, SEPARATOR_GROOVE | LAYOUT_FILL_X);
460  FXMatrix* m42 =
461  new FXMatrix(frame4, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
462  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
463  myTLIndexPanel = new NamePanel(m42, this, "Show link tls index", mySettings->drawLinkTLIndex);
464  myJunctionIndexPanel = new NamePanel(m42, this, "Show link junction index", mySettings->drawLinkJunctionIndex);
465  myShowLane2Lane = new FXCheckButton(m42, "Show lane to lane connections", this, MID_SIMPLE_VIEW_COLORCHANGE);
466  myShowLane2Lane->setCheck(mySettings->showLane2Lane);
467  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
468  myJunctionNamePanel = new NamePanel(m42, this, "Show junction name", mySettings->junctionName);
469  myInternalJunctionNamePanel = new NamePanel(m42, this, "Show internal junction name", mySettings->internalJunctionName);
470  myInternalEdgeNamePanel = new NamePanel(m42, this, "Show internal edge name", mySettings->internalEdgeName);
471  myCwaEdgeNamePanel = new NamePanel(m42, this, "Show crossing and walkingarea name", mySettings->cwaEdgeName);
472  myDrawJunctionShape = new FXCheckButton(m42, "Draw junction shape", this, MID_SIMPLE_VIEW_COLORCHANGE);
473  myDrawJunctionShape->setCheck(mySettings->drawJunctionShape);
474  myDrawCrossingsAndWalkingAreas = new FXCheckButton(m42, "Draw crossings/walkingareas", this, MID_SIMPLE_VIEW_COLORCHANGE);
475  myDrawCrossingsAndWalkingAreas->setCheck(mySettings->drawCrossingsAndWalkingareas);
476 
477  new FXHorizontalSeparator(frame4, SEPARATOR_GROOVE | LAYOUT_FILL_X);
478 
479  FXMatrix* m43 =
480  new FXMatrix(frame4, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
481  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
482  myJunctionSizePanel = new SizePanel(m43, this, mySettings->junctionSize);
483  } {
484  // detectors / triggers
485  new FXTabItem(tabbook, "Detectors/Trigger", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
486  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
487  FXVerticalFrame* frame5 =
488  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
489 
490  FXMatrix* m51 =
491  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
492  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
493  myAddNamePanel = new NamePanel(m51, this, "Show detector name", mySettings->addName);
494  new FXHorizontalSeparator(frame5 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
495 
496  FXMatrix* m52 =
497  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
498  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
499  myAddSizePanel = new SizePanel(m52, this, mySettings->addSize);
500 
501  /*
502  new FXLabel(m522, "Color", 0, LAYOUT_CENTER_Y);
503  myDetectorNameColor = new FXColorWell(m522, MFXUtils::getFXColor(settings->addNameColor),
504  this, MID_SIMPLE_VIEW_COLORCHANGE,
505  LAYOUT_FIX_WIDTH|LAYOUT_CENTER_Y|LAYOUT_SIDE_TOP|FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT,
506  0, 0, 100, 0, 0, 0, 0, 0);
507  */
508  } {
509  // POIs
510  new FXTabItem(tabbook, "POIs", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
511  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
512  FXVerticalFrame* frame6 =
513  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
514 
515  FXMatrix* m61 =
516  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
517  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
518  myPOINamePanel = new NamePanel(m61, this, "Show poi names", mySettings->poiName);
519  myPOITypePanel = new NamePanel(m61, this, "Show poi types", mySettings->poiType);
520  new FXHorizontalSeparator(frame6 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
521 
522  FXMatrix* m62 =
523  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
524  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
525  myPOISizePanel = new SizePanel(m62, this, mySettings->poiSize);
526 
527  } {
528  // Polygons
529  new FXTabItem(tabbook, "Polygons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
530  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
531  FXVerticalFrame* frame9 =
532  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
533 
534  FXMatrix* m91 =
535  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
536  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
537  myPolyNamePanel = new NamePanel(m91, this, "Show polygon names", mySettings->polyName);
538  myPolyTypePanel = new NamePanel(m91, this, "Show polygon types", mySettings->polyType);
539  new FXHorizontalSeparator(frame9 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
540 
541  myPolySizePanel = new SizePanel(m91, this, mySettings->polySize);
542 
543  }{
544  // Legend
545  new FXTabItem(tabbook, "Legend", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
546  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
547  FXVerticalFrame* frame7 =
548  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
549 
550  FXMatrix* m72 =
551  new FXMatrix(frame7, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
552  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
553  myShowSizeLegend = new FXCheckButton(m72, "Show Size Legend", this, MID_SIMPLE_VIEW_COLORCHANGE);
554  myShowSizeLegend->setCheck(mySettings->showSizeLegend);
555  new FXLabel(m72, "");
556  } {
557  // openGL
558  new FXTabItem(tabbook, "openGL", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
559  FXScrollWindow* genScroll = new FXScrollWindow(tabbook);
560  FXVerticalFrame* frame8 =
561  new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
562 
563  FXMatrix* m82 =
564  new FXMatrix(frame8, 1, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
565  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
566  myAntialiase = new FXCheckButton(m82, "Antialiase", this, MID_SIMPLE_VIEW_COLORCHANGE);
567  myAntialiase->setCheck(mySettings->antialiase);
568  myDither = new FXCheckButton(m82, "Dither", this, MID_SIMPLE_VIEW_COLORCHANGE);
569  myDither->setCheck(mySettings->dither);
570  }
571  FXHorizontalFrame* f2 = new FXHorizontalFrame(contentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
572  FXButton* initial = new FXButton(f2, "&OK", NULL, this, MID_SETTINGS_OK, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
573  new FXButton(f2, "&Cancel", NULL, this, MID_SETTINGS_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
574  initial->setFocus();
575 
576  rebuildColorMatrices(false);
578 
579  const FXint minSize = 400;
580  setX(MIN2(getApp()->reg().readIntEntry("VIEWSETTINGS", "x", 150), getApp()->getRootWindow()->getWidth() - minSize));
581  setY(MIN2(getApp()->reg().readIntEntry("VIEWSETTINGS", "y", 150), getApp()->getRootWindow()->getHeight() - minSize));
582  setWidth(MAX2(getApp()->reg().readIntEntry("VIEWSETTINGS", "width", 700), minSize));
583  setHeight(MAX2(getApp()->reg().readIntEntry("VIEWSETTINGS", "height", 500), minSize));
584 }
585 
586 
588  myParent->remove(this);
589  // delete name panels
592  delete myCwaEdgeNamePanel;
593  delete myStreetNamePanel;
594  delete myJunctionIndexPanel;
595  delete myTLIndexPanel;
596  delete myJunctionNamePanel;
597  delete myVehicleNamePanel;
598  delete myAddNamePanel;
599  delete myPOINamePanel;
600  delete myPOITypePanel;
601  delete myPolyNamePanel;
602  delete myPolyTypePanel;
603  delete myEdgeNamePanel;
604  // delete size panels
605  delete myVehicleSizePanel;
606  delete myPersonSizePanel;
607  delete myJunctionSizePanel;
608  delete myPOISizePanel;
609  delete myPolySizePanel;
610  delete myAddSizePanel;
611 }
612 
613 
614 void
616  mySettings = settings;
617  myBackup = (*settings);
618  onCmdNameChange(0, 0, 0);
619 }
620 
621 
622 long
623 GUIDialog_ViewSettings::onCmdOk(FXObject*, FXSelector, void*) {
624  saveWindowSize();
625  hide();
626  return 1;
627 }
628 
629 
630 long
631 GUIDialog_ViewSettings::onCmdCancel(FXObject*, FXSelector, void*) {
632  saveWindowSize();
633  hide();
634  (*mySettings) = myBackup;
635  return 1;
636 }
637 
638 
639 long
640 GUIDialog_ViewSettings::onCmdNameChange(FXObject*, FXSelector, void* data) {
641  if (data != 0) {
642  FXString dataS = (char*) data; // !!!unicode
643  // check whether this item has been added twice
644  if (dataS == mySchemeName->getItemText(mySchemeName->getNumItems() - 1)) {
645  for (int i = 0; i < mySchemeName->getNumItems() - 1; ++i) {
646  if (dataS == mySchemeName->getItemText(i)) {
647  mySchemeName->removeItem(i);
648  }
649  }
650  }
651  myBackup = gSchemeStorage.get(dataS.text());
652  mySettings = &gSchemeStorage.get(dataS.text());
653  }
654  rebuildColorMatrices(true);
655 
657 
658  myLaneEdgeColorMode->setCurrentItem((FXint) mySettings->getLaneEdgeMode());
659  myLaneEdgeScaleMode->setCurrentItem((FXint) mySettings->getLaneEdgeScaleMode());
663  myShowRails->setCheck(mySettings->showRails);
673 
674  myVehicleColorMode->setCurrentItem((FXint) mySettings->vehicleColorer.getActive());
677  myShowMinGap->setCheck(mySettings->drawMinGap);
679  /*
680  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
681  */
684 
685  myPersonColorMode->setCurrentItem((FXint) mySettings->personColorer.getActive());
686  myPersonShapeDetail->setCurrentItem(mySettings->personQuality);
689 
690  myContainerColorMode->setCurrentItem((FXint) mySettings->containerColorer.getActive());
694 
695  myJunctionColorMode->setCurrentItem((FXint) mySettings->junctionColorer.getActive());
701 
704 
708 
712 
716  myAntialiase->setCheck(mySettings->antialiase);
717  myDither->setCheck(mySettings->dither);
719 
721  update();
722  myParent->update();
723  return 1;
724 }
725 
726 
727 bool
728 GUIDialog_ViewSettings::updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
729  std::vector<FXColorWell*>::const_iterator colEnd,
730  std::vector<FXRealSpinDial*>::const_iterator threshIt,
731  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
732  std::vector<FXButton*>::const_iterator buttonIt,
733  GUIColorScheme& scheme) {
734  int pos = 0;
735  while (colIt != colEnd) {
736  if (scheme.isFixed()) {
737  if (sender == *colIt) {
738  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
739  }
740  } else {
741  if (sender == *threshIt) {
742  const SUMOReal val = (*threshIt)->getValue();
743  double lo, hi;
744  if (pos != 0) {
745  threshIt--;
746  (*threshIt)->getRange(lo, hi);
747  (*threshIt)->setRange(lo, val);
748  threshIt++;
749  }
750  threshIt++;
751  if (threshIt != threshEnd) {
752  (*threshIt)->getRange(lo, hi);
753  (*threshIt)->setRange(val, hi);
754  }
755  scheme.setThreshold(pos, val);
756  return false;
757  }
758  if (sender == *colIt) {
759  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
760  return false;
761  }
762  if (sender == *buttonIt) {
763  if (pos == 0) {
764  scheme.addColor(MFXUtils::getRGBColor((*colIt)->getRGBA()), (*threshIt)->getValue());
765  } else {
766  scheme.removeColor(pos);
767  }
768  return true;
769  }
770  ++threshIt;
771  ++buttonIt;
772  }
773  ++colIt;
774  pos++;
775  }
776  return false;
777 }
778 
779 
780 bool
781 GUIDialog_ViewSettings::updateScaleRanges(FXObject* sender, std::vector<FXRealSpinDial*>::const_iterator scaleIt,
782  std::vector<FXRealSpinDial*>::const_iterator scaleEnd,
783  std::vector<FXRealSpinDial*>::const_iterator threshIt,
784  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
785  std::vector<FXButton*>::const_iterator buttonIt,
786  GUIScaleScheme& scheme) {
787  int pos = 0;
788  while (scaleIt != scaleEnd) {
789  if (scheme.isFixed()) {
790  if (sender == *scaleIt) {
791  scheme.setColor(pos, (*scaleIt)->getValue());
792  }
793  } else {
794  if (sender == *threshIt) {
795  const SUMOReal val = (*threshIt)->getValue();
796  double lo, hi;
797  if (pos != 0) {
798  threshIt--;
799  (*threshIt)->getRange(lo, hi);
800  (*threshIt)->setRange(lo, val);
801  threshIt++;
802  }
803  threshIt++;
804  if (threshIt != threshEnd) {
805  (*threshIt)->getRange(lo, hi);
806  (*threshIt)->setRange(val, hi);
807  }
808  scheme.setThreshold(pos, val);
809  return false;
810  }
811  if (sender == *scaleIt) {
812  scheme.setColor(pos, (*scaleIt)->getValue());
813  return false;
814  }
815  if (sender == *buttonIt) {
816  if (pos == 0) {
817  scheme.addColor((*scaleIt)->getValue(), (*threshIt)->getValue());
818  } else {
819  scheme.removeColor(pos);
820  }
821  return true;
822  }
823  ++threshIt;
824  ++buttonIt;
825  }
826  ++scaleIt;
827  pos++;
828  }
829  return false;
830 }
831 
832 
833 long
834 GUIDialog_ViewSettings::onCmdColorChange(FXObject* sender, FXSelector, void* /*val*/) {
835  GUIVisualizationSettings tmpSettings = *mySettings;
836  int prevLaneMode = mySettings->getLaneEdgeMode();
837  int prevLaneScaleMode = mySettings->getLaneEdgeScaleMode();
838  int prevVehicleMode = mySettings->vehicleColorer.getActive();
839  int prevPersonMode = mySettings->personColorer.getActive();
840  int prevContainerMode = mySettings->containerColorer.getActive();
841  int prevJunctionMode = mySettings->junctionColorer.getActive();
842  bool doRebuildColorMatrices = false;
843 
844  tmpSettings.name = mySettings->name;
845  tmpSettings.backgroundColor = MFXUtils::getRGBColor(myBackgroundColor->getRGBA());
846  tmpSettings.showGrid = (myShowGrid->getCheck() != FALSE);
847  tmpSettings.gridXSize = (SUMOReal) myGridXSizeDialer->getValue();
848  tmpSettings.gridYSize = (SUMOReal) myGridYSizeDialer->getValue();
849 
851  tmpSettings.edgeColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
852  tmpSettings.edgeScaler.setActive(myLaneEdgeScaleMode->getCurrentItem());
853  } else {
854  tmpSettings.laneColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
855  tmpSettings.laneScaler.setActive(myLaneEdgeScaleMode->getCurrentItem());
856  }
857  tmpSettings.laneShowBorders = (myShowLaneBorders->getCheck() != FALSE);
858  tmpSettings.showLinkDecals = (myShowLaneDecals->getCheck() != FALSE);
859  tmpSettings.showLinkRules = (myShowLinkRules->getCheck() != FALSE);
860  tmpSettings.showRails = (myShowRails->getCheck() != FALSE);
861  tmpSettings.edgeName = myEdgeNamePanel->getSettings();
863  tmpSettings.cwaEdgeName = myCwaEdgeNamePanel->getSettings();
864  tmpSettings.streetName = myStreetNamePanel->getSettings();
865  tmpSettings.hideConnectors = (myHideMacroConnectors->getCheck() != FALSE);
866  tmpSettings.showLaneDirection = (myShowLaneDirection->getCheck() != FALSE);
867  tmpSettings.showSublanes = (myShowSublanes->getCheck() != FALSE);
868  tmpSettings.laneWidthExaggeration = (SUMOReal) myLaneWidthUpscaleDialer->getValue();
869  tmpSettings.laneMinSize = (SUMOReal) myLaneMinWidthDialer->getValue();
870 
871  tmpSettings.vehicleColorer.setActive(myVehicleColorMode->getCurrentItem());
872  tmpSettings.vehicleQuality = myVehicleShapeDetail->getCurrentItem();
873  tmpSettings.showBlinker = (myShowBlinker->getCheck() != FALSE);
874  tmpSettings.drawMinGap = (myShowMinGap->getCheck() != FALSE);
875  tmpSettings.showBTRange = (myShowBTRange->getCheck() != FALSE);
876  /*
877  tmpSettings.drawLaneChangePreference = (myShowLaneChangePreference->getCheck() != FALSE);
878  */
879  tmpSettings.vehicleName = myVehicleNamePanel->getSettings();
880  tmpSettings.vehicleSize = myVehicleSizePanel->getSettings();
881 
882  tmpSettings.personColorer.setActive(myPersonColorMode->getCurrentItem());
883  tmpSettings.personQuality = myPersonShapeDetail->getCurrentItem();
884  tmpSettings.personName = myPersonNamePanel->getSettings();
885  tmpSettings.personSize = myPersonSizePanel->getSettings();
886 
887  tmpSettings.containerColorer.setActive(myContainerColorMode->getCurrentItem());
888  tmpSettings.containerQuality = myContainerShapeDetail->getCurrentItem();
891 
892  tmpSettings.junctionColorer.setActive(myJunctionColorMode->getCurrentItem());
893  tmpSettings.drawLinkTLIndex = myTLIndexPanel->getSettings();
898 
899  tmpSettings.addName = myAddNamePanel->getSettings();
900  tmpSettings.addSize = myAddSizePanel->getSettings();
901 
902  tmpSettings.poiName = myPOINamePanel->getSettings();
903  tmpSettings.poiType = myPOITypePanel->getSettings();
904  tmpSettings.poiSize = myPOISizePanel->getSettings();
905 
906  tmpSettings.polyName = myPolyNamePanel->getSettings();
907  tmpSettings.polyType = myPolyTypePanel->getSettings();
908  tmpSettings.polySize = myPolySizePanel->getSettings();
909 
910  tmpSettings.showLane2Lane = (myShowLane2Lane->getCheck() != FALSE);
911  tmpSettings.drawJunctionShape = (myDrawJunctionShape->getCheck() != FALSE);
912  tmpSettings.drawCrossingsAndWalkingareas = (myDrawCrossingsAndWalkingAreas->getCheck() != FALSE);
913  tmpSettings.antialiase = (myAntialiase->getCheck() != FALSE);
914  tmpSettings.dither = (myDither->getCheck() != FALSE);
915  tmpSettings.showSizeLegend = (myShowSizeLegend->getCheck() != FALSE);
916 
917  // lanes (colors)
918  if (tmpSettings.getLaneEdgeMode() == prevLaneMode) {
919  if (updateColorRanges(sender, myLaneColors.begin(), myLaneColors.end(),
920  myLaneThresholds.begin(), myLaneThresholds.end(), myLaneButtons.begin(),
921  tmpSettings.getLaneEdgeScheme())) {
922  doRebuildColorMatrices = true;
923  }
924  if (sender == myLaneColorInterpolation) {
925  tmpSettings.getLaneEdgeScheme().setInterpolated(myLaneColorInterpolation->getCheck() != FALSE);
926  doRebuildColorMatrices = true;
927  }
928  } else {
929  doRebuildColorMatrices = true;
930  }
931  // lanes (scaling)
932  if (tmpSettings.getLaneEdgeScaleMode() == prevLaneScaleMode) {
933  if (updateScaleRanges(sender, myLaneScales.begin(), myLaneScales.end(),
935  tmpSettings.getLaneEdgeScaleScheme())) {
936  doRebuildColorMatrices = true;
937  }
938  if (sender == myLaneScaleInterpolation) {
939  tmpSettings.getLaneEdgeScaleScheme().setInterpolated(myLaneScaleInterpolation->getCheck() != FALSE);
940  doRebuildColorMatrices = true;
941  }
942  } else {
943  doRebuildColorMatrices = true;
944  }
945  // vehicles
946  if (tmpSettings.vehicleColorer.getActive() == prevVehicleMode) {
947  if (updateColorRanges(sender, myVehicleColors.begin(), myVehicleColors.end(),
949  tmpSettings.vehicleColorer.getScheme())) {
950  doRebuildColorMatrices = true;
951  }
952  if (sender == myVehicleColorInterpolation) {
953  tmpSettings.vehicleColorer.getScheme().setInterpolated(myVehicleColorInterpolation->getCheck() != FALSE);
954  doRebuildColorMatrices = true;
955  }
956  } else {
957  doRebuildColorMatrices = true;
958  }
959  // persons
960  if (tmpSettings.personColorer.getActive() == prevPersonMode) {
961  if (updateColorRanges(sender, myPersonColors.begin(), myPersonColors.end(),
962  myPersonThresholds.begin(), myPersonThresholds.end(), myPersonButtons.begin(),
963  tmpSettings.personColorer.getScheme())) {
964  doRebuildColorMatrices = true;
965  }
966  if (sender == myPersonColorInterpolation) {
967  tmpSettings.personColorer.getScheme().setInterpolated(myPersonColorInterpolation->getCheck() != FALSE);
968  doRebuildColorMatrices = true;
969  }
970  } else {
971  doRebuildColorMatrices = true;
972  }
973  // containers
974  if (tmpSettings.containerColorer.getActive() == prevContainerMode) {
975  if (updateColorRanges(sender, myContainerColors.begin(), myContainerColors.end(),
977  tmpSettings.containerColorer.getScheme())) {
978  doRebuildColorMatrices = true;
979  }
980  if (sender == myContainerColorInterpolation) {
981  tmpSettings.containerColorer.getScheme().setInterpolated(myContainerColorInterpolation->getCheck() != FALSE);
982  doRebuildColorMatrices = true;
983  }
984  } else {
985  doRebuildColorMatrices = true;
986  }
987  // junctions
988  if (tmpSettings.junctionColorer.getActive() == prevJunctionMode) {
989  if (updateColorRanges(sender, myJunctionColors.begin(), myJunctionColors.end(),
991  tmpSettings.junctionColorer.getScheme())) {
992  doRebuildColorMatrices = true;
993  }
994  if (sender == myJunctionColorInterpolation) {
995  tmpSettings.junctionColorer.getScheme().setInterpolated(myJunctionColorInterpolation->getCheck() != FALSE);
996  doRebuildColorMatrices = true;
997  }
998  } else {
999  doRebuildColorMatrices = true;
1000  }
1001 
1002  if (tmpSettings == *mySettings) {
1003  return 1;
1004  }
1005 
1006  int index = mySchemeName->getCurrentItem();
1007  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
1008  // one of the initial settings is modified
1009  // every time this happens we create a new scheme
1010  int suffix = 1;
1011  while (gSchemeStorage.contains("custom_" + toString(suffix))) {
1012  suffix++;
1013  }
1014  tmpSettings.name = "custom_" + toString(suffix);
1015  // the newly created settings must be entered in several places:
1016  // - the comboBox mySchemeName of this dialog
1017  // - the comboBox of the parent view (set as active)
1018  // - the comboBox of all other views (only append) XXX @todo
1019  index = mySchemeName->appendItem(tmpSettings.name.c_str());
1020  mySchemeName->setCurrentItem(index);
1021  myParent->getColoringSchemesCombo().appendItem(tmpSettings.name.c_str());
1022  }
1023  myParent->getColoringSchemesCombo().setCurrentItem(
1024  myParent->getColoringSchemesCombo().findItem(tmpSettings.name.c_str()));
1025  gSchemeStorage.add(tmpSettings); // overwrites existing
1026  mySettings = &gSchemeStorage.get(tmpSettings.name);
1027  myParent->setColorScheme(tmpSettings.name);
1028 
1029  if (doRebuildColorMatrices) {
1030  rebuildColorMatrices(true);
1031  }
1032  myParent->forceRefresh();
1033  getApp()->forceRefresh();
1034  return 1;
1035 }
1036 
1037 
1038 void
1039 GUIDialog_ViewSettings::loadSettings(const std::string& file) {
1040  GUISettingsHandler handler(file);
1041  std::string settingsName = handler.addSettings(myParent);
1042  if (settingsName != "") {
1043  FXint index = mySchemeName->appendItem(settingsName.c_str());
1044  mySchemeName->setCurrentItem(index);
1045  mySettings = &gSchemeStorage.get(settingsName);
1046  }
1047  if (handler.hasDecals()) {
1048  myDecalsLock->lock();
1049  (*myDecals) = handler.getDecals();
1050  rebuildList();
1051  myParent->update();
1052  myDecalsLock->unlock();
1053  }
1054  if (handler.getDelay() >= 0) {
1055  myParent->setDelay(handler.getDelay());
1056  }
1057  handler.applyViewport(myParent);
1058  rebuildColorMatrices(true);
1059 }
1060 
1061 
1062 void
1064  std::vector<GUISUMOAbstractView::Decal>::iterator j;
1065  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
1068  dev.writeAttr("filename", d.filename);
1074  dev.writeAttr("altitude", d.altitude);
1075  dev.writeAttr("rotation", d.rot);
1076  dev.writeAttr("tilt", d.tilt);
1077  dev.writeAttr("roll", d.roll);
1079  dev.writeAttr("screenRelative", d.screenRelative);
1080  dev.closeTag();
1081  }
1082 }
1083 
1084 
1085 void
1086 GUIDialog_ViewSettings::loadDecals(const std::string& file) {
1087  myDecalsLock->lock();
1088  GUISettingsHandler handler(file);
1089  if (handler.hasDecals()) {
1090  (*myDecals) = handler.getDecals();
1091  }
1092  rebuildList();
1093  myParent->update();
1094  myDecalsLock->unlock();
1095 }
1096 
1097 
1098 long
1099 GUIDialog_ViewSettings::onCmdSaveSetting(FXObject*, FXSelector, void* /*data*/) {
1100  int index = mySchemeName->getCurrentItem();
1101  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
1102  return 1;
1103  }
1104  // get the name
1105  std::string name = "";
1106  while (name.length() == 0) {
1107  FXDialogBox dialog(this, "Enter a name", DECOR_TITLE | DECOR_BORDER);
1108  FXVerticalFrame* content = new FXVerticalFrame(&dialog, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10);
1109  new FXLabel(content, "Please enter an alphanumeric name: ", NULL, LAYOUT_FILL_X | JUSTIFY_LEFT);
1110  FXTextField* text = new FXTextField(content, 40, &dialog, FXDialogBox::ID_ACCEPT, TEXTFIELD_ENTER_ONLY | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X);
1111  new FXHorizontalSeparator(content, SEPARATOR_GROOVE | LAYOUT_FILL_X);
1112  FXHorizontalFrame* buttons = new FXHorizontalFrame(content, LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0);
1113  new FXButton(buttons, "&OK", NULL, &dialog, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT);
1114  new FXButton(buttons, "&Cancel", NULL, &dialog, FXDialogBox::ID_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT, 0, 0, 0, 0, 20, 20);
1115  dialog.create();
1116  text->setFocus();
1117  if (!dialog.execute()) {
1118  return 1;
1119  }
1120  name = text->getText().text();
1121  for (int i = 0; i < (int)name.length(); ++i) {
1122  if (name[i] != '_' && (name[i] < 'a' || name[i] > 'z') && (name[i] < 'A' || name[i] > 'Z') && (name[i] < '0' || name[i] > '9')) {
1123  name = "";
1124  break;
1125  }
1126  }
1127  }
1128  GUIVisualizationSettings tmpSettings = *mySettings;
1130  tmpSettings.name = name;
1131  gSchemeStorage.add(tmpSettings);
1132  mySchemeName->setItemText(index, tmpSettings.name.c_str());
1133  myParent->getColoringSchemesCombo().setItemText(index, tmpSettings.name.c_str());
1134  myParent->setColorScheme(tmpSettings.name);
1135  mySettings = &gSchemeStorage.get(name);
1136  myBackup = *mySettings;
1137  gSchemeStorage.writeSettings(getApp());
1138  return 1;
1139 }
1140 
1141 
1142 long
1143 GUIDialog_ViewSettings::onUpdSaveSetting(FXObject* sender, FXSelector, void* ptr) {
1144  sender->handle(this,
1145  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1146  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1147  ptr);
1148  return 1;
1149 }
1150 
1151 
1152 long
1153 GUIDialog_ViewSettings::onCmdDeleteSetting(FXObject*, FXSelector, void* /*data*/) {
1154  int index = mySchemeName->getCurrentItem();
1155  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
1156  return 1;
1157  }
1158  std::string name = mySchemeName->getItem(index).text();
1159  gSchemeStorage.remove(name);
1160  mySchemeName->removeItem(index);
1161  onCmdNameChange(0, 0, (void*) mySchemeName->getItem(0).text());
1162  gSchemeStorage.writeSettings(getApp());
1163  return 1;
1164 }
1165 
1166 
1167 long
1168 GUIDialog_ViewSettings::onUpdDeleteSetting(FXObject* sender, FXSelector, void* ptr) {
1169  sender->handle(this,
1170  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1171  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1172  ptr);
1173  return 1;
1174 }
1175 
1176 
1177 long
1178 GUIDialog_ViewSettings::onCmdExportSetting(FXObject*, FXSelector, void* /*data*/) {
1179  FXString file = MFXUtils::getFilename2Write(this, "Export view settings", ".xml", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder);
1180  if (file == "") {
1181  return 1;
1182  }
1183  try {
1184  OutputDevice& dev = OutputDevice::getDevice(file.text());
1186  mySettings->save(dev);
1187  if (mySaveViewPort->getCheck()) {
1189  }
1190  if (mySaveDelay->getCheck()) {
1191  dev.openTag(SUMO_TAG_DELAY);
1193  dev.closeTag();
1194  }
1195  if (mySaveDecals->getCheck()) {
1196  saveDecals(dev);
1197  }
1198  dev.closeTag();
1199  dev.close();
1200  } catch (IOError& e) {
1201  FXMessageBox::error(this, MBOX_OK, "Storing failed!", "%s", e.what());
1202  }
1203  return 1;
1204 }
1205 
1206 
1207 long
1208 GUIDialog_ViewSettings::onUpdExportSetting(FXObject* sender, FXSelector, void* ptr) {
1209  sender->handle(this,
1210  (mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1211  && !mySaveViewPort->getCheck() && !mySaveDelay->getCheck() && !mySaveDecals->getCheck()) ?
1212  FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1213  ptr);
1214  return 1;
1215 }
1216 
1217 
1218 long
1219 GUIDialog_ViewSettings::onCmdImportSetting(FXObject*, FXSelector, void* /*data*/) {
1220  FXFileDialog opendialog(this, "Import view settings");
1221  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1222  opendialog.setSelectMode(SELECTFILE_ANY);
1223  opendialog.setPatternList("*.xml");
1224  if (gCurrentFolder.length() != 0) {
1225  opendialog.setDirectory(gCurrentFolder);
1226  }
1227  if (opendialog.execute()) {
1228  gCurrentFolder = opendialog.getDirectory();
1229  loadSettings(opendialog.getFilename().text());
1230  }
1231  return 1;
1232 }
1233 
1234 
1235 long
1236 GUIDialog_ViewSettings::onCmdLoadDecals(FXObject*, FXSelector, void* /*data*/) {
1237  FXFileDialog opendialog(this, "Load Decals");
1238  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1239  opendialog.setSelectMode(SELECTFILE_ANY);
1240  opendialog.setPatternList("*.xml");
1241  if (gCurrentFolder.length() != 0) {
1242  opendialog.setDirectory(gCurrentFolder);
1243  }
1244  if (opendialog.execute()) {
1245  gCurrentFolder = opendialog.getDirectory();
1246  loadDecals(opendialog.getFilename().text());
1247  }
1248  return 1;
1249 }
1250 
1251 
1252 long
1253 GUIDialog_ViewSettings::onCmdSaveDecals(FXObject*, FXSelector, void* /*data*/) {
1254  FXString file = MFXUtils::getFilename2Write(this, "Save Decals", ".xml", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder);
1255  if (file == "") {
1256  return 1;
1257  }
1258  try {
1259  OutputDevice& dev = OutputDevice::getDevice(file.text());
1260  dev.openTag("decals");
1261  saveDecals(dev);
1262  dev.closeTag();
1263  dev.close();
1264  } catch (IOError& e) {
1265  FXMessageBox::error(myParent, MBOX_OK, "Storing failed!", "%s", e.what());
1266  }
1267  return 1;
1268 }
1269 
1270 
1271 
1272 
1273 long
1274 GUIDialog_ViewSettings::onUpdImportSetting(FXObject* sender, FXSelector, void* ptr) {
1275  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1276  return 1;
1277 }
1278 
1279 
1280 void
1282  myDecalsTable->clearItems();
1283  const int cols = 8;
1284  // set table attributes
1285  const int numRows = MAX2((int)10, (int)myDecals->size() + 1);
1286  myDecalsTable->setTableSize(numRows, cols);
1287  myDecalsTable->setColumnText(0, "picture file");
1288  myDecalsTable->setColumnText(1, "center x");
1289  myDecalsTable->setColumnText(2, "center y");
1290  myDecalsTable->setColumnText(3, "width");
1291  myDecalsTable->setColumnText(4, "height");
1292  myDecalsTable->setColumnText(5, "rotation");
1293  myDecalsTable->setColumnText(6, "layer");
1294  myDecalsTable->setColumnText(7, "relative");
1295  FXHeader* header = myDecalsTable->getColumnHeader();
1296  header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
1297  int k;
1298  for (k = 0; k < cols; k++) {
1299  header->setItemJustify(k, JUSTIFY_CENTER_X | JUSTIFY_TOP);
1300  header->setItemSize(k, 60);
1301  }
1302  header->setItemSize(0, 150);
1303  // insert already known decals information into table
1304  FXint row = 0;
1305  std::vector<GUISUMOAbstractView::Decal>::iterator j;
1306  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
1308  myDecalsTable->setItemText(row, 0, d.filename.c_str());
1309  myDecalsTable->setItemText(row, 1, toString<SUMOReal>(d.centerX).c_str());
1310  myDecalsTable->setItemText(row, 2, toString<SUMOReal>(d.centerY).c_str());
1311  myDecalsTable->setItemText(row, 3, toString<SUMOReal>(d.width).c_str());
1312  myDecalsTable->setItemText(row, 4, toString<SUMOReal>(d.height).c_str());
1313  myDecalsTable->setItemText(row, 5, toString<SUMOReal>(d.rot).c_str());
1314  myDecalsTable->setItemText(row, 6, toString<SUMOReal>(d.layer).c_str());
1315  myDecalsTable->setItemText(row, 7, toString<SUMOReal>(d.screenRelative).c_str());
1316  row++;
1317  }
1318  // insert dummy last field
1319  for (k = 0; k < 7; k++) {
1320  myDecalsTable->setItemText(row, k, " ");
1321  }
1322 }
1323 
1324 
1325 FXMatrix*
1327  std::vector<FXColorWell*>& colors,
1328  std::vector<FXRealSpinDial*>& thresholds,
1329  std::vector<FXButton*>& buttons,
1330  FXCheckButton* interpolation,
1331  GUIColorScheme& scheme) {
1332  MFXUtils::deleteChildren(frame);
1333  FXMatrix* m = new FXMatrix(frame, 3,
1334  LAYOUT_FILL_X | MATRIX_BY_COLUMNS,
1335  0, 0, 0, 0, 10, 10, 0, 0, 5, 3);
1336  colors.clear();
1337  thresholds.clear();
1338  buttons.clear();
1339  const bool fixed = scheme.isFixed();
1340  std::vector<RGBColor>::const_iterator colIt = scheme.getColors().begin();
1341  std::vector<SUMOReal>::const_iterator threshIt = scheme.getThresholds().begin();
1342  std::vector<std::string>::const_iterator nameIt = scheme.getNames().begin();
1343  FX::FXString buttonText = "Add";
1344  while (colIt != scheme.getColors().end()) {
1345  colors.push_back(new FXColorWell(m , MFXUtils::getFXColor(*colIt),
1347  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1348  0, 0, 100, 0, 0, 0, 0, 0));
1349  if (fixed) {
1350  new FXLabel(m, nameIt->c_str());
1351  new FXLabel(m, "");
1352  } else {
1353  const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0;
1354  FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions);
1355  threshDialer->setValue(*threshIt);
1356  thresholds.push_back(threshDialer);
1357  buttons.push_back(new FXButton(m, buttonText, NULL, this, MID_SIMPLE_VIEW_COLORCHANGE, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4));
1358  buttonText = "Remove";
1359  }
1360  colIt++;
1361  threshIt++;
1362  nameIt++;
1363  }
1364  interpolation->setCheck(scheme.isInterpolated());
1365  if (fixed) {
1366  interpolation->disable();
1367  } else {
1368  if (colors.size() > 1) {
1369  interpolation->enable();
1370  if (interpolation->getCheck() != FALSE) {
1371  thresholds.front()->enable();
1372  } else {
1373  thresholds.front()->disable();
1374  }
1375  } else {
1376  interpolation->disable();
1377  thresholds.front()->disable();
1378  }
1379  }
1380  return m;
1381 }
1382 
1383 
1384 FXMatrix*
1386  std::vector<FXRealSpinDial*>& scales,
1387  std::vector<FXRealSpinDial*>& thresholds,
1388  std::vector<FXButton*>& buttons,
1389  FXCheckButton* interpolation,
1390  GUIScaleScheme& scheme) {
1391  MFXUtils::deleteChildren(frame);
1392  FXMatrix* m = new FXMatrix(frame, 3,
1393  LAYOUT_FILL_X | MATRIX_BY_COLUMNS,
1394  0, 0, 0, 0, 10, 10, 0, 0, 5, 3);
1395  scales.clear();
1396  thresholds.clear();
1397  buttons.clear();
1398  const bool fixed = scheme.isFixed();
1399  std::vector<SUMOReal>::const_iterator scaleIt = scheme.getColors().begin();
1400  std::vector<SUMOReal>::const_iterator threshIt = scheme.getThresholds().begin();
1401  std::vector<std::string>::const_iterator nameIt = scheme.getNames().begin();
1402  FX::FXString buttonText = "Add";
1403  while (scaleIt != scheme.getColors().end()) {
1404  FXRealSpinDial* scaleDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX);
1405  scaleDialer->setValue(*scaleIt);
1406  scales.push_back(scaleDialer);
1407  if (fixed) {
1408  new FXLabel(m, nameIt->c_str());
1409  new FXLabel(m, "");
1410  } else {
1411  const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0;
1412  FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions);
1413  threshDialer->setValue(*threshIt);
1414  thresholds.push_back(threshDialer);
1415  buttons.push_back(new FXButton(m, buttonText, NULL, this, MID_SIMPLE_VIEW_COLORCHANGE, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4));
1416  buttonText = "Remove";
1417  }
1418  scaleIt++;
1419  threshIt++;
1420  nameIt++;
1421  }
1422  interpolation->setCheck(scheme.isInterpolated());
1423  if (fixed) {
1424  interpolation->disable();
1425  } else {
1426  if (scales.size() > 1) {
1427  interpolation->enable();
1428  if (interpolation->getCheck() != FALSE) {
1429  thresholds.front()->enable();
1430  } else {
1431  thresholds.front()->disable();
1432  }
1433  } else {
1434  interpolation->disable();
1435  thresholds.front()->disable();
1436  }
1437  }
1438  return m;
1439 }
1440 
1441 
1442 void
1444  // decals
1445  delete myDecalsTable;
1447  LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH/*|LAYOUT_FIX_HEIGHT*/, 0, 0, 470, 0);
1448  myDecalsTable->setVisibleRows(5);
1449  myDecalsTable->setVisibleColumns(7);
1450  myDecalsTable->setTableSize(5, 7);
1451  myDecalsTable->setBackColor(FXRGB(255, 255, 255));
1452  myDecalsTable->getRowHeader()->setWidth(0);
1453  for (int i = 1; i <= 5; ++i) {
1455  myDecalsTable->setNumberCellParams(i, -10000000, 10000000, 1, 10, 100, "%.2f");
1456  }
1457  rebuildList();
1458  if (doCreate) {
1459  myDecalsTable->create();
1460  }
1462  if (doCreate) {
1463  m->create();
1464  }
1465  myLaneColorSettingFrame->getParent()->recalc();
1466 
1468  if (doCreate) {
1469  m->create();
1470  }
1471  myLaneScaleSettingFrame->getParent()->recalc();
1472 
1474  if (doCreate) {
1475  m->create();
1476  }
1477  myVehicleColorSettingFrame->getParent()->recalc();
1478 
1480  if (doCreate) {
1481  m->create();
1482  }
1483  myPersonColorSettingFrame->getParent()->recalc();
1485  if (doCreate) {
1486  m->create();
1487  }
1488  myContainerColorSettingFrame->getParent()->recalc();
1490  if (doCreate) {
1491  m->create();
1492  }
1493  myJunctionColorSettingFrame->getParent()->recalc();
1494 
1495  layout();
1496  update();
1497 }
1498 
1499 
1500 long
1501 GUIDialog_ViewSettings::onCmdEditTable(FXObject*, FXSelector, void* data) {
1503  std::string value = i->item->getText().text();
1504  // check whether the inserted value is empty
1505  if (value.find_first_not_of(" ") == std::string::npos) {
1506  return 1;
1507  }
1509  int row = i->row;
1510  // check whether we add a new entry or edit an existing entry
1511  if (row == static_cast<int>(myDecals->size())) {
1512  d.filename = "";
1513  d.centerX = SUMOReal(myParent->getGridWidth() / 2.);
1514  d.centerY = SUMOReal(myParent->getGridHeight() / 2.);
1515  d.width = 0.;
1516  d.height = 0.;
1517  d.initialised = false;
1518  d.rot = 0;
1519  d.layer = 0;
1520  d.screenRelative = false;
1521  myDecalsLock->lock();
1522  myDecals->push_back(d);
1523  myDecalsLock->unlock();
1524  } else if (row > static_cast<int>(myDecals->size())) {
1525  // ignore clicks two lines below existing entries
1526  return 1;
1527  } else {
1528  d = (*myDecals)[row];
1529  }
1530 
1531  switch (i->col) {
1532  case 0:
1533  if (d.initialised && d.filename != value) {
1534  d.initialised = false;
1535  }
1536  d.filename = value;
1537  break;
1538  case 1:
1539  try {
1540  d.centerX = TplConvert::_2SUMOReal(value.c_str());
1541  } catch (NumberFormatException&) {
1542  std::string msg = "The value must be a float, is:" + value;
1543  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1544  }
1545  break;
1546  case 2:
1547  try {
1548  d.centerY = TplConvert::_2SUMOReal(value.c_str());
1549  } catch (NumberFormatException&) {
1550  std::string msg = "The value must be a float, is:" + value;
1551  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1552  }
1553  break;
1554  case 3:
1555  try {
1556  d.width = TplConvert::_2SUMOReal(value.c_str());
1557  } catch (NumberFormatException&) {
1558  std::string msg = "The value must be a float, is:" + value;
1559  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1560  }
1561  break;
1562  case 4:
1563  try {
1564  d.height = TplConvert::_2SUMOReal(value.c_str());
1565  } catch (NumberFormatException&) {
1566  std::string msg = "The value must be a float, is:" + value;
1567  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1568  }
1569  break;
1570  case 5:
1571  try {
1572  d.rot = TplConvert::_2SUMOReal(value.c_str());
1573  } catch (NumberFormatException&) {
1574  std::string msg = "The value must be a float, is:" + value;
1575  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1576  }
1577  break;
1578  case 6:
1579  try {
1580  d.layer = TplConvert::_2SUMOReal(value.c_str());
1581  } catch (NumberFormatException&) {
1582  std::string msg = "The value must be a float, is:" + value;
1583  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1584  }
1585  break;
1586  case 7:
1587  try {
1588  d.screenRelative = TplConvert::_2bool(value.c_str());
1589  } catch (NumberFormatException&) {
1590  std::string msg = "The value must be a bool, is:" + value;
1591  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1592  }
1593  break;
1594  default:
1595  throw 1;
1596  }
1597  (*myDecals)[row] = d;
1598  if (!i->updateOnly) {
1599  rebuildList();
1600  }
1601  myParent->update();
1602  return 1;
1603 }
1604 
1605 
1606 std::string
1608  return mySchemeName->getItem(mySchemeName->getCurrentItem()).text();
1609 }
1610 
1611 
1612 void
1614  if (name.c_str() == mySchemeName->getItemText(mySchemeName->getCurrentItem())) {
1615  return;
1616  }
1617  for (int i = 0; i < mySchemeName->getNumItems(); ++i) {
1618  if (name.c_str() == mySchemeName->getItemText(i)) {
1619  mySchemeName->setCurrentItem(i);
1620  onCmdNameChange(0, 0, (void*)name.c_str());
1621  return;
1622  }
1623  }
1624 }
1625 
1627  FXMatrix* parent,
1628  GUIDialog_ViewSettings* target,
1629  const std::string& title,
1630  const GUIVisualizationTextSettings& settings) {
1631  myCheck = new FXCheckButton(parent, title.c_str(), target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
1632  myCheck->setCheck(settings.show);
1633  new FXLabel(parent, "");
1634  FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1635  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1636  new FXLabel(m1, "Size", 0, LAYOUT_CENTER_Y);
1637  mySizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE,
1638  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
1639  mySizeDial->setRange(10, 1000);
1640  mySizeDial->setValue(settings.size);
1641  FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1642  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1643  new FXLabel(m2, "Color", 0, LAYOUT_CENTER_Y);
1644  myColorWell = new FXColorWell(m2, MFXUtils::getFXColor(settings.color),
1645  target, MID_SIMPLE_VIEW_COLORCHANGE,
1646  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1647  0, 0, 100, 0, 0, 0, 0, 0);
1648 }
1649 
1650 
1653  return GUIVisualizationTextSettings(myCheck->getCheck() != FALSE,
1654  mySizeDial->getValue(), MFXUtils::getRGBColor(myColorWell->getRGBA()));
1655 }
1656 
1657 
1658 void
1660  myCheck->setCheck(settings.show);
1661  mySizeDial->setValue(settings.size);
1662  myColorWell->setRGBA(MFXUtils::getFXColor(settings.color));
1663 }
1664 
1665 
1667  FXMatrix* parent,
1668  GUIDialog_ViewSettings* target,
1669  const GUIVisualizationSizeSettings& settings) {
1670  myCheck = new FXCheckButton(parent, "Draw with constant size when zoomed out", target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
1671  myCheck->setCheck(settings.constantSize);
1672  new FXLabel(parent, "");
1673  FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1674  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1675  new FXLabel(m1, "Minimum Size", 0, LAYOUT_CENTER_Y);
1676  myMinSizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE,
1677  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
1678  myMinSizeDial->setValue(settings.minSize);
1679  FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1680  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1681  new FXLabel(m2, "Exaggerate by", 0, LAYOUT_CENTER_Y);
1682  myExaggerateDial = new FXRealSpinDial(m2, 10, target, MID_SIMPLE_VIEW_COLORCHANGE,
1683  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
1684  myExaggerateDial->setRange(0, 10000);
1685  myExaggerateDial->setValue(settings.exaggeration);
1686 }
1687 
1688 
1692  myMinSizeDial->getValue(), myExaggerateDial->getValue(), myCheck->getCheck() != FALSE);
1693 }
1694 
1695 
1696 void
1698  myCheck->setCheck(settings.constantSize);
1699  myMinSizeDial->setValue(settings.minSize);
1700  myExaggerateDial->setValue(settings.exaggeration);
1701 }
1702 
1703 
1704 void
1706  getApp()->reg().writeIntEntry("VIEWSETTINGS", "x", getX());
1707  getApp()->reg().writeIntEntry("VIEWSETTINGS", "y", getY());
1708  getApp()->reg().writeIntEntry("VIEWSETTINGS", "width", getWidth());
1709  getApp()->reg().writeIntEntry("VIEWSETTINGS", "height", getHeight());
1710 }
1711 
1712 /****************************************************************************/
1713 
void rebuildColorMatrices(bool doCreate=false)
Rebuilds color changing dialogs after choosing another coloring scheme.
GUIVisualizationSizeSettings junctionSize
GUIDialog_EditViewport * getViewportEditor()
get the viewport and create it on first access
GUIVisualizationTextSettings junctionName
A decal (an image) that can be shown.
FXVerticalFrame * myVehicleColorSettingFrame
long onUpdSaveSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to save the settings into the registry.
int getNumInitialSettings() const
Returns the number of initial settings.
FXCheckButton * myLaneColorInterpolation
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:257
void close()
Closes the device and removes it from the dictionary.
const std::vector< T > & getColors() const
GUICompleteSchemeStorage gSchemeStorage
bool showSizeLegend
Information whether the size legend shall be drawn.
FXCheckButton * myJunctionColorInterpolation
bool isInterpolated() const
GUIVisualizationTextSettings poiType
FXVerticalFrame * myLaneScaleSettingFrame
GUIVisualizationTextSettings streetName
SUMOReal roll
The roll of the image to the ground plane (in degrees)
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
bool showBlinker
Information whether vehicle blinkers shall be drawn.
GUIVisualizationTextSettings addName
GUIVisualizationTextSettings personName
void setThreshold(const int pos, const SUMOReal threshold)
std::vector< FXButton * > myLaneButtons
static SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal value described by it
Definition: TplConvert.h:290
FXDEFMAP(GUIDialog_ViewSettings) GUIDialog_ViewSettingsMap[]
GUIVisualizationTextSettings poiName
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
Definition: TplConvert.h:364
GUIColorScheme & getLaneEdgeScheme()
Returns the current lane (edge) coloring schme.
bool showBTRange
Information whether the communication range shall be drawn.
GUIColorer laneColorer
The lane colorer.
SUMOReal laneWidthExaggeration
The lane exaggeration (upscale thickness)
GUIColorer containerColorer
The container colorer.
A layer number.
Stores the information about how to visualize structures.
The dialog to change the view (gui) settings.
SUMOReal minSize
The minimum size to draw this object.
SizePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const GUIVisualizationSizeSettings &settings)
GUIColorer edgeColorer
The mesoscopic edge colorer.
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:119
void remove(GUIDialog_EditViewport *)
remove viewport
std::vector< FXRealSpinDial * > myLaneScaleThresholds
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent's decals.
bool showRails
Information whether rails shall be drawn.
void loadDecals(const std::string &file)
Loads decals from a file.
std::vector< FXButton * > myPersonButtons
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.
std::vector< FXColorWell * > myJunctionColors
GUIVisualizationTextSettings vehicleName
bool screenRelative
Whether this image should be skipped in 2D-views.
void loadSettings(const std::string &file)
Loads a scheme from a file.
bool hasDecals() const
Returns whether any decals have been parsed.
T MAX2(T a, T b)
Definition: StdDefs.h:75
static void deleteChildren(FXWindow *w)
Deletes all children of the given window.
Definition: MFXUtils.cpp:43
long onCmdSaveDecals(FXObject *, FXSelector, void *data)
Called if the decals shall be saved to a file.
For the export-to-file - button.
Definition: GUIAppEnum.h:369
bool showLaneDirection
Whether to show direction indicators for lanes.
void writeXML(OutputDevice &dev)
write the settings to the given device
GUIVisualizationTextSettings cwaEdgeName
FXString gCurrentFolder
The folder used as last.
long onCmdSaveSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be saved into the registry.
bool laneShowBorders
Information whether lane borders shall be drawn.
SUMOReal getGridHeight() const
get grid Height
SUMOReal centerZ
The center of the image in z-direction (net coordinates, in m)
long onCmdExportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be exported into a file.
SUMOReal width
The width of the image (net coordinates in x-direction, in m)
bool showLinkRules
Information whether link rules (colored bars) shall be drawn.
long onCmdEditTable(FXObject *, FXSelector, void *data)
Called if the decals-table was changed.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition: MFXUtils.cpp:95
bool dither
Information whether dithering shall be enabled.
FXVerticalFrame * myContainerColorSettingFrame
std::vector< FXRealSpinDial * > myPersonThresholds
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
long onCmdNameChange(FXObject *, FXSelector, void *)
Called if the name of the scheme was changed.
GUIVisualizationSizeSettings polySize
GUIColorer vehicleColorer
The vehicle colorer.
SUMOReal getDelay() const
Returns the parsed delay.
bool isFixed() const
GUIVisualizationTextSettings edgeName
FXTableItem * item
void setInterpolated(const bool interpolate, SUMOReal interpolationStart=0.f)
std::vector< FXButton * > myContainerButtons
FXCheckButton * myVehicleColorInterpolation
GUIVisualizationSizeSettings addSize
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
void setNumberCellParams(int pos, double min, double max, double steps1, double steps2, double steps3, const std::string &format)
void setCellType(int pos, CellType t)
int addColor(const T &color, const SUMOReal threshold, const std::string &name="")
std::string name
The name of this setting.
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
void rebuildList()
Rebuilds the decals table.
The Table.
Definition: GUIAppEnum.h:289
void update(const GUIVisualizationSizeSettings &settings)
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
SUMOReal altitude
The altitude of the image (net coordinates in z-direction, in m)
FXCheckButton * myDrawCrossingsAndWalkingAreas
GUIVisualizationSettings * mySettings
The current settings.
GUIVisualizationTextSettings internalEdgeName
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.
std::vector< FXRealSpinDial * > myLaneScales
SUMOReal centerY
The center of the image in y-direction (net coordinates, in m)
bool drawMinGap
Information whether the minimum gap shall be drawn.
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
std::vector< FXColorWell * > myVehicleColors
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
FXRealSpinDial * myLaneWidthUpscaleDialer
Cancel-button was pushed.
Definition: GUIAppEnum.h:303
void remove(const std::string &name)
Removes the setting with the given name.
GUIVisualizationTextSettings polyType
bool showSublanes
Whether to show sublane boundaries.
void saveWindowSize()
save window position and size to the registry
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
bool allowsNegativeValues() const
FXVerticalFrame * myLaneColorSettingFrame
FXComboBox & getColoringSchemesCombo()
get coloring schemes combo
FXRealSpinDial * myLaneMinWidthDialer
SUMOReal exaggeration
The size exaggeration (upscale)
bool initialised
Whether this image was initialised (inserted as a texture)
GUIVisualizationTextSettings drawLinkTLIndex
T MIN2(T a, T b)
Definition: StdDefs.h:69
Ok-button was pushed.
Definition: GUIAppEnum.h:301
GUIColorer personColorer
The person colorer.
int getLaneEdgeScaleMode() const
Returns the number of the active lane (edge) scaling schme.
GUIVisualizationTextSettings internalJunctionName
For the import-from-file - button.
Definition: GUIAppEnum.h:371
const std::vector< std::string > & getNames() const
GUIColorer junctionColorer
The junction colorer.
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
std::string filename
The path to the file the image is located at.
SUMOReal gridXSize
Information about the grid spacings.
long onUpdDeleteSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to delete settings.
FXVerticalFrame * myJunctionColorSettingFrame
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
FXCheckButton * myLaneScaleInterpolation
GUIScaler edgeScaler
The mesoscopic edge scaler.
SUMOReal getDelay() const
Returns the delay of the parent application.
GUIScaleScheme & getLaneEdgeScaleScheme()
Returns the current lane (edge) scaling schme.
std::vector< FXColorWell * > myPersonColors
FXRealSpinDial * myGridYSizeDialer
int containerQuality
The quality of container drawing.
long onCmdCancel(FXObject *, FXSelector, void *)
Called if the Cancel-button was pressed.
RGBColor backgroundColor
The background color to use.
bool antialiase
Information whether antialiase shall be enabled.
std::vector< FXButton * > myLaneScaleButtons
void saveDecals(OutputDevice &dev) const
Writes the currently used decals into a file.
Informs the dialog about a value's change.
Definition: GUIAppEnum.h:361
For the delete - button.
Definition: GUIAppEnum.h:367
long onCmdOk(FXObject *, FXSelector, void *)
Called if the OK-button was pressed.
void setColor(const int pos, const T &color)
virtual bool setColorScheme(const std::string &)
set color scheme
For the save-decals - button.
Definition: GUIAppEnum.h:375
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
For the load-decals - button.
Definition: GUIAppEnum.h:373
SUMOReal height
The height of the image (net coordinates in y-direction, in m)
GUIVisualizationSizeSettings poiSize
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)
SUMOReal centerX
The center of the image in x-direction (net coordinates, in m)
MFXAddEditTypedTable * myDecalsTable
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
NamePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const std::string &title, const GUIVisualizationTextSettings &settings)
GUIVisualizationSizeSettings containerSize
FXComboBox * myLaneEdgeScaleMode
... lane scaler
void removeColor(const int pos)
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
GUIVisualizationTextSettings getSettings()
Informs the dialog about switching to another scheme.
Definition: GUIAppEnum.h:363
void writeSettings(FXApp *app)
Writes the current scheme into the registry.
FXComboBox * myLaneEdgeColorMode
... lane colorer
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
FXCheckButton * myHideMacroConnectors
SUMOReal getGridWidth() const
get grid width
GUIVisualizationSizeSettings personSize
int personQuality
The quality of person drawing.
void lock()
lock mutex
Definition: MFXMutex.cpp:86
bool showGrid
Information whether a grid shall be shown.
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
long onUpdExportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to export settings into a file.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:125
SUMOReal layer
The layer of the image.
long onCmdColorChange(FXObject *, FXSelector, void *)
Called if something (color, width, etc.) has been changed.
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
void setDelay(SUMOReal delay)
Sets the delay of the parent application.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:214
FXRealSpinDial * myGridXSizeDialer
An XML-handler for visualisation schemes.
void save(OutputDevice &dev) const
Writes the settings into an output device.
FXCheckButton * myPersonColorInterpolation
GUIVisualizationSizeSettings vehicleSize
bool drawJunctionShape
whether the shape of the junction should be drawn
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
SUMOReal tilt
The tilt of the image to the ground plane (in degrees)
GUIVisualizationSizeSettings getSettings()
int vehicleQuality
The quality of vehicle drawing.
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)
static bool UseMesoSim
this should be set at the same time as MSGlobals::gUseMesoSim
MFXMutex * myDecalsLock
Lock used when changing the decals.
SUMOReal laneMinSize
The minimum visual lane width for drawing.
std::vector< FXRealSpinDial * > myJunctionThresholds
FXCheckButton * myContainerColorInterpolation
GUIScaler laneScaler
The lane scaler.
const std::vector< SUMOReal > & getThresholds() const
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
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
std::vector< FXButton * > myJunctionButtons
GUIVisualizationTextSettings drawLinkJunctionIndex
GUIVisualizationSettings myBackup
A backup of the settings (used if the "Cancel" button is pressed)
std::vector< FXColorWell * > myLaneColors
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::vector< FXRealSpinDial * > myLaneThresholds
std::vector< FXButton * > myVehicleButtons
SUMOReal rot
The rotation of the image in the ground plane (in degrees)
long onCmdImportSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be read from a file.
void add(const GUIVisualizationSettings &scheme)
Adds a visualization scheme.
For the save-to-db - button.
Definition: GUIAppEnum.h:365
long onUpdImportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to read settings from a file.
GUIVisualizationTextSettings polyName
GUIVisualizationTextSettings containerName