SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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-sim.org/
13 // Copyright (C) 2001-2014 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_ViewSettings.h"
50 
51 #ifdef CHECK_MEMORY_LEAKS
52 #include <foreign/nvwa/debug_new.h>
53 #endif // CHECK_MEMORY_LEAKS
54 
55 
56 // ===========================================================================
57 // FOX callback mapping
58 // ===========================================================================
59 FXDEFMAP(GUIDialog_ViewSettings) GUIDialog_ViewSettingsMap[] = {
63  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_ViewSettings::onCmdOk),
66 
75 
78 
79 };
80 
81 
82 FXIMPLEMENT(GUIDialog_ViewSettings, FXDialogBox, GUIDialog_ViewSettingsMap, ARRAYNUMBER(GUIDialog_ViewSettingsMap))
83 
84 
85 // ===========================================================================
86 // method definitions
87 // ===========================================================================
89  GUIVisualizationSettings* settings,
90  std::vector<GUISUMOAbstractView::Decal>* decals,
91  MFXMutex* decalsLock) :
92  FXDialogBox(parent, "View Settings", DECOR_TITLE | DECOR_BORDER, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
93  myParent(parent), mySettings(settings),
94  myDecals(decals), myDecalsLock(decalsLock), myDecalsTable(0) {
95  myBackup = (*mySettings);
96 
97  FXVerticalFrame* contentFrame =
98  new FXVerticalFrame(this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
99  0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
100  //
101  {
102  FXHorizontalFrame* frame0 =
103  new FXHorizontalFrame(contentFrame, FRAME_THICK, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
104  mySchemeName = new FXComboBox(frame0, 20, this, MID_SIMPLE_VIEW_NAMECHANGE, COMBOBOX_INSERT_LAST | FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_CENTER_Y | COMBOBOX_STATIC);
105  const std::vector<std::string>& names = gSchemeStorage.getNames();
106  for (std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i) {
107  size_t index = mySchemeName->appendItem((*i).c_str());
108  if ((*i) == mySettings->name) {
109  mySchemeName->setCurrentItem((FXint) index);
110  }
111  }
112  mySchemeName->setNumVisible(5);
113 
114  new FXButton(frame0, "\t\tSave the setting to registry",
116  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
117  new FXButton(frame0, "\t\tRemove the setting from registry",
119  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
120  new FXButton(frame0, "\t\tExport setting to file",
122  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
123  new FXButton(frame0, "\t\tLoad setting from file",
125  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
126 
127  }
128  //
129  FXTabBook* tabbook =
130  new FXTabBook(contentFrame, 0, 0, TABBOOK_LEFTTABS | PACK_UNIFORM_WIDTH | PACK_UNIFORM_HEIGHT | LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_RIGHT,
131  0, 0, 0, 0, 0, 0, 0, 0);
132  {
133  // tab for the background
134  new FXTabItem(tabbook, "Background", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
135  FXVerticalFrame* frame1 =
136  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
137 
138  FXMatrix* m11 =
139  new FXMatrix(frame1, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
140  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
141  new FXLabel(m11, "Color", 0, LAYOUT_CENTER_Y);
142  myBackgroundColor = new FXColorWell(m11, MFXUtils::getFXColor(settings->backgroundColor),
144  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
145  0, 0, 100, 0, 0, 0, 0, 0);
146 
147  new FXHorizontalSeparator(frame1, SEPARATOR_GROOVE | LAYOUT_FILL_X);
148 
149  FXVerticalFrame* frame11 =
150  new FXVerticalFrame(frame1, LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
151  new FXLabel(frame11, "Decals:");
152  myDecalsFrame = new FXVerticalFrame(frame11);
153  FXHorizontalFrame* frame111 = new FXHorizontalFrame(frame11, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
154  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);
155  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);
156 
157  new FXHorizontalSeparator(frame1, SEPARATOR_GROOVE | LAYOUT_FILL_X);
158 
159  FXMatrix* m12 =
160  new FXMatrix(frame1, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
161  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
162  myShowGrid =
163  new FXCheckButton(m12, "Show grid", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
164  myShowGrid->setCheck(mySettings->showGrid);
165  new FXLabel(m12, "");
166  FXMatrix* m121 =
167  new FXMatrix(m12, 2, LAYOUT_CENTER_Y | LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
168  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
169  new FXLabel(m121, "x-spacing", 0, LAYOUT_CENTER_Y);
170  myGridXSizeDialer =
171  new FXRealSpinDial(m121, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
172  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
173  myGridXSizeDialer->setRange(1, 10000);
174  myGridXSizeDialer->setValue(mySettings->gridXSize);
175  FXMatrix* m122 =
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(m122, "y-spacing", 0, LAYOUT_CENTER_Y);
179  myGridYSizeDialer =
180  new FXRealSpinDial(m122, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
181  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
182  myGridYSizeDialer->setRange(1, 10000);
183  myGridYSizeDialer->setValue(mySettings->gridXSize);
184  }
185  {
186  // tab for the streets
187  new FXTabItem(tabbook, "Streets", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
188 
189  FXVerticalFrame* frame2 =
190  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
191  FXMatrix* m21 =
192  new FXMatrix(frame2, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
193  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
194  new FXLabel(m21, "Color", 0, LAYOUT_CENTER_Y);
195  myLaneEdgeColorMode = new FXComboBox(m21, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
196  myLaneEdgeColorMode->setNumVisible(10);
197  myLaneColorInterpolation = new FXCheckButton(m21, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
198  FXScrollWindow* genScroll = new FXScrollWindow(frame2, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
199  myLaneColorSettingFrame =
200  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
201 //we should insert a FXScrollWindow around the frame2
202 #ifdef HAVE_INTERNAL
203  if (GUIVisualizationSettings::UseMesoSim) {
204  mySettings->edgeColorer.fill(*myLaneEdgeColorMode);
205  } else {
206 #endif
207  mySettings->laneColorer.fill(*myLaneEdgeColorMode);
208 #ifdef HAVE_INTERNAL
209  }
210 #endif
211 
212  new FXHorizontalSeparator(frame2, SEPARATOR_GROOVE | LAYOUT_FILL_X);
213  FXMatrix* m22 =
214  new FXMatrix(frame2, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
215  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
216  myShowLaneBorders = new FXCheckButton(m22, "Show lane borders", this, MID_SIMPLE_VIEW_COLORCHANGE);
217  myShowLaneBorders->setCheck(mySettings->laneShowBorders);
218  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
219  myShowLaneDecals = new FXCheckButton(m22, "Show link decals", this, MID_SIMPLE_VIEW_COLORCHANGE);
220  myShowLaneDecals->setCheck(mySettings->showLinkDecals);
221  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
222  myShowRails = new FXCheckButton(m22, "Show rails", this, MID_SIMPLE_VIEW_COLORCHANGE);
223  myShowRails->setCheck(mySettings->showRails);
224  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
225  myHideMacroConnectors = new FXCheckButton(m22, "Hide macro connectors", this, MID_SIMPLE_VIEW_COLORCHANGE);
226  myHideMacroConnectors->setCheck(mySettings->hideConnectors);
227  new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y);
228  new FXLabel(m22, "Exaggerate width by", 0, LAYOUT_CENTER_Y);
229  myLaneWidthUpscaleDialer =
230  new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
231  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
232  myLaneWidthUpscaleDialer->setRange(0, 10000);
233  myLaneWidthUpscaleDialer->setValue(mySettings->laneWidthExaggeration);
234 
235  // edge name
236  myEdgeNamePanel = new NamePanel(m22, this, "Show edge name", mySettings->edgeName);
237  myStreetNamePanel = new NamePanel(m22, this, "Show street name", mySettings->streetName);
238  myInternalEdgeNamePanel = new NamePanel(m22, this, "Show internal edge name", mySettings->internalEdgeName);
239  }
240  {
241  // vehicles
242  new FXTabItem(tabbook, "Vehicles", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
243  FXVerticalFrame* frame3 =
244  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
245 
246  FXMatrix* m31 =
247  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
248  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
249  new FXLabel(m31, "Show As", 0, LAYOUT_CENTER_Y);
250  myVehicleShapeDetail = new FXComboBox(m31, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
251  myVehicleShapeDetail->appendItem("'triangles'");
252  myVehicleShapeDetail->appendItem("'boxes'");
253  myVehicleShapeDetail->appendItem("'simple shapes'");
254  myVehicleShapeDetail->appendItem("'raster images'");
255  myVehicleShapeDetail->setNumVisible(4);
256  myVehicleShapeDetail->setCurrentItem(settings->vehicleQuality);
257 
258  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
259 
260  FXMatrix* m32 =
261  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
262  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
263  new FXLabel(m32, "Color", 0, LAYOUT_CENTER_Y);
264  myVehicleColorMode = new FXComboBox(m32, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
265  mySettings->vehicleColorer.fill(*myVehicleColorMode);
266  myVehicleColorMode->setNumVisible(10);
267  myVehicleColorInterpolation = new FXCheckButton(m32, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
268 
269  FXScrollWindow* genScroll = new FXScrollWindow(frame3, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
270  myVehicleColorSettingFrame =
271  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
272 
273  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
274 
275  FXMatrix* m33 =
276  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
277  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
278  myShowBlinker = new FXCheckButton(m33, "Show blinker / brake lights", this, MID_SIMPLE_VIEW_COLORCHANGE);
279  myShowBlinker->setCheck(mySettings->showBlinker);
280  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
281  myShowMinGap = new FXCheckButton(m33, "Show minimum gap", this, MID_SIMPLE_VIEW_COLORCHANGE);
282  myShowMinGap->setCheck(mySettings->drawMinGap);
283  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
284  /*
285  myShowLaneChangePreference = new FXCheckButton(m33, "Show lane change preference", this, MID_SIMPLE_VIEW_COLORCHANGE);
286  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
287  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
288  */
289  myVehicleNamePanel = new NamePanel(m33, this, "Show vehicle name", mySettings->vehicleName);
290  /*
291  FXCheckButton *tmpc = new FXCheckButton(m33, "Show braking lights", 0 ,0);
292  tmpc->disable();
293  tmpc = new FXCheckButton(m33, "Show needed headway", 0 ,0);
294  tmpc->disable();
295  */
296 
297  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
298 
299  FXMatrix* m34 =
300  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
301  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
302  FXMatrix* m341 =
303  new FXMatrix(m34, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
304  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
305  new FXLabel(m341, "Minimum size", 0, LAYOUT_CENTER_Y);
306  myVehicleMinSizeDialer =
307  new FXRealSpinDial(m341, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
308  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
309  myVehicleMinSizeDialer->setValue(mySettings->minVehicleSize);
310  FXMatrix* m342 =
311  new FXMatrix(m34, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
312  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
313  new FXLabel(m342, "Exaggerate by", 0, LAYOUT_CENTER_Y);
314  myVehicleUpscaleDialer =
315  new FXRealSpinDial(m342, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
316  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
317  myVehicleUpscaleDialer->setRange(0, 10000);
318  myVehicleUpscaleDialer->setValue(mySettings->vehicleExaggeration);
319  }
320 
321  {
322  // persons
323  new FXTabItem(tabbook, "Persons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
324  FXVerticalFrame* frame3 =
325  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
326 
327  FXMatrix* m101 =
328  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
329  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
330  new FXLabel(m101, "Show As", 0, LAYOUT_CENTER_Y);
331  myPersonShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
332  myPersonShapeDetail->appendItem("'triangles'");
333  myPersonShapeDetail->appendItem("'boxes'");
334  myPersonShapeDetail->appendItem("'simple shapes'");
335  myPersonShapeDetail->appendItem("'raster images'");
336  myPersonShapeDetail->setNumVisible(4);
337  myPersonShapeDetail->setCurrentItem(settings->personQuality);
338 
339  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
340 
341  FXMatrix* m102 =
342  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
343  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
344  new FXLabel(m102, "Color", 0, LAYOUT_CENTER_Y);
345  myPersonColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
346  mySettings->personColorer.fill(*myPersonColorMode);
347  myPersonColorMode->setNumVisible(10);
348  myPersonColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
349 
350  FXScrollWindow* genScroll = new FXScrollWindow(frame3, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
351  myPersonColorSettingFrame =
352  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
353 
354  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
355 
356  FXMatrix* m103 =
357  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
358  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
359  myPersonNamePanel = new NamePanel(m103, this, "Show person name", mySettings->personName);
360 
361  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
362 
363  FXMatrix* m104 =
364  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
365  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
366  FXMatrix* m1041 =
367  new FXMatrix(m104, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
368  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
369  new FXLabel(m1041, "Minimum size", 0, LAYOUT_CENTER_Y);
370  myPersonMinSizeDialer =
371  new FXRealSpinDial(m1041, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
372  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
373  myPersonMinSizeDialer->setValue(mySettings->minPersonSize);
374  FXMatrix* m1042 =
375  new FXMatrix(m104, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
376  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
377  new FXLabel(m1042, "Exaggerate by", 0, LAYOUT_CENTER_Y);
378  myPersonUpscaleDialer =
379  new FXRealSpinDial(m1042, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
380  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
381  myPersonUpscaleDialer->setRange(0, 10000);
382  myPersonUpscaleDialer->setValue(mySettings->personExaggeration);
383  }
384  {
385  // nodes
386  new FXTabItem(tabbook, "Junctions", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
387  FXVerticalFrame* frame4 =
388  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
389  FXMatrix* m41 =
390  new FXMatrix(frame4, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
391  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
392  new FXLabel(m41, "Color", 0, LAYOUT_CENTER_Y);
393  myJunctionColorMode = new FXComboBox(m41, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
394  mySettings->junctionColorer.fill(*myJunctionColorMode);
395  myJunctionColorMode->setNumVisible(2);
396  myJunctionColorInterpolation = new FXCheckButton(m41, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
397 
398  FXScrollWindow* genScroll = new FXScrollWindow(frame4, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
399  myJunctionColorSettingFrame =
400  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
401 
402  new FXHorizontalSeparator(frame4, SEPARATOR_GROOVE | LAYOUT_FILL_X);
403  FXMatrix* m42 =
404  new FXMatrix(frame4, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
405  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
406  myShowTLIndex = new FXCheckButton(m42, "Show link tls index", this, MID_SIMPLE_VIEW_COLORCHANGE);
407  myShowTLIndex->setCheck(mySettings->drawLinkTLIndex);
408  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
409  myShowJunctionIndex = new FXCheckButton(m42, "Show link junction index", this, MID_SIMPLE_VIEW_COLORCHANGE);
410  myShowJunctionIndex->setCheck(mySettings->drawLinkJunctionIndex);
411  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
412  myShowLane2Lane = new FXCheckButton(m42, "Show lane to lane connections", this, MID_SIMPLE_VIEW_COLORCHANGE);
413  myShowLane2Lane->setCheck(mySettings->showLane2Lane);
414  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
415  myJunctionNamePanel = new NamePanel(m42, this, "Show junction name", mySettings->junctionName);
416  myInternalJunctionNamePanel = new NamePanel(m42, this, "Show internal junction name", mySettings->internalJunctionName);
417  myDrawJunctionShape = new FXCheckButton(m42, "Draw junction shape", this, MID_SIMPLE_VIEW_COLORCHANGE);
418  myDrawJunctionShape->setCheck(mySettings->drawJunctionShape);
419  } {
420  new FXTabItem(tabbook, "Detectors/Trigger", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
421  FXVerticalFrame* frame5 =
422  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
423 
424  FXMatrix* m51 =
425  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
426  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
427  myAddNamePanel = new NamePanel(m51, this, "Show detector name", mySettings->addName);
428  new FXHorizontalSeparator(frame5 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
429 
430  FXMatrix* m52 =
431  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
432  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
433  FXMatrix* m521 =
434  new FXMatrix(m52, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
435  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
436  new FXLabel(m521, "Minimum size", 0, LAYOUT_CENTER_Y);
437  myDetectorMinSizeDialer =
438  new FXRealSpinDial(m521, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
439  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
440  FXMatrix* m522 =
441  new FXMatrix(m52, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
442  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
443  myDetectorMinSizeDialer->setValue(mySettings->minAddSize);
444  new FXLabel(m522, "Exaggerate by", 0, LAYOUT_CENTER_Y);
445  myDetectorUpscaleDialer =
446  new FXRealSpinDial(m522, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
447  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
448  myDetectorUpscaleDialer->setRange(0, 10000);
449  myDetectorUpscaleDialer->setValue(mySettings->addExaggeration);
450 
451 
452  /*
453  new FXLabel(m522, "Color", 0, LAYOUT_CENTER_Y);
454  myDetectorNameColor = new FXColorWell(m522, MFXUtils::getFXColor(settings->addNameColor),
455  this, MID_SIMPLE_VIEW_COLORCHANGE,
456  LAYOUT_FIX_WIDTH|LAYOUT_CENTER_Y|LAYOUT_SIDE_TOP|FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT,
457  0, 0, 100, 0, 0, 0, 0, 0);
458  */
459  } {
460  new FXTabItem(tabbook, "POIs", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
461  FXVerticalFrame* frame6 =
462  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
463 
464  FXMatrix* m61 =
465  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
466  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
467  myPOINamePanel = new NamePanel(m61, this, "Show poi names", mySettings->poiName);
468  new FXHorizontalSeparator(frame6 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
469 
470  FXMatrix* m62 =
471  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
472  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
473  FXMatrix* m621 =
474  new FXMatrix(m62, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
475  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
476  new FXLabel(m621, "Minimum size to show", 0, LAYOUT_CENTER_Y);
477  myPOIMinSizeDialer =
478  new FXRealSpinDial(m621, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
479  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
480  FXMatrix* m622 =
481  new FXMatrix(m62, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
482  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
483  myPOIMinSizeDialer->setValue(mySettings->minPOISize);
484  new FXLabel(m622, "Exaggerate by", 0, LAYOUT_CENTER_Y);
485  myPOIUpscaleDialer =
486  new FXRealSpinDial(m622, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
487  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
488  myPOIUpscaleDialer->setRange(0, 10000);
489  myPOIUpscaleDialer->setValue(mySettings->addExaggeration);
490 
491 
492  } {
493  new FXTabItem(tabbook, "Polygons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
494  FXVerticalFrame* frame9 =
495  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
496 
497  FXMatrix* m91 =
498  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
499  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
500  myPolyNamePanel = new NamePanel(m91, this, "Show polygon names", mySettings->polyName);
501  new FXHorizontalSeparator(frame9 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
502 
503  FXMatrix* m92 =
504  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
505  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
506  FXMatrix* m921 =
507  new FXMatrix(m92, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
508  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
509  new FXLabel(m921, "Minimum size to show", 0, LAYOUT_CENTER_Y);
510  myPolyMinSizeDialer =
511  new FXRealSpinDial(m921, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
512  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
513  FXMatrix* m922 =
514  new FXMatrix(m92, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
515  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
516  myPolyMinSizeDialer->setValue(mySettings->minPolySize);
517  new FXLabel(m922, "Exaggerate by", 0, LAYOUT_CENTER_Y);
518  myPolyUpscaleDialer =
519  new FXRealSpinDial(m922, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
520  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
521  myPolyUpscaleDialer->setRange(0, 10000);
522  myPolyUpscaleDialer->setValue(mySettings->addExaggeration);
523 
524 
525  }{
526  new FXTabItem(tabbook, "Legend", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
527  FXVerticalFrame* frame7 =
528  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
529 
530  FXMatrix* m72 =
531  new FXMatrix(frame7, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
532  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
533  myShowSizeLegend = new FXCheckButton(m72, "Show Size Legend", this, MID_SIMPLE_VIEW_COLORCHANGE);
534  myShowSizeLegend->setCheck(mySettings->showSizeLegend);
535  new FXLabel(m72, "");
536  } {
537  new FXTabItem(tabbook, "openGL", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
538  FXVerticalFrame* frame8 =
539  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
540 
541  FXMatrix* m82 =
542  new FXMatrix(frame8, 1, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
543  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
544  myAntialiase = new FXCheckButton(m82, "Antialiase", this, MID_SIMPLE_VIEW_COLORCHANGE);
545  myAntialiase->setCheck(mySettings->antialiase);
546  myDither = new FXCheckButton(m82, "Dither", this, MID_SIMPLE_VIEW_COLORCHANGE);
547  myDither->setCheck(mySettings->dither);
548  }
549  FXHorizontalFrame* f2 = new FXHorizontalFrame(contentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
550  FXButton* initial = new FXButton(f2, "&Use", 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);
551  new FXButton(f2, "&Discard", 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);
552  initial->setFocus();
553 
554  rebuildColorMatrices(false);
556 }
557 
558 
560  myParent->remove(this);
561  delete myEdgeNamePanel;
563  delete myStreetNamePanel;
564  delete myJunctionNamePanel;
566  delete myVehicleNamePanel;
567  delete myAddNamePanel;
568  delete myPOINamePanel;
569  delete myPolyNamePanel;
570 }
571 
572 
573 void
575  mySettings = settings;
576  myBackup = (*settings);
577  onCmdNameChange(0, 0, 0);
578 }
579 
580 
581 long
583  hide();
584  return 1;
585 }
586 
587 
588 long
590  hide();
591  (*mySettings) = myBackup;
592  return 1;
593 }
594 
595 
596 long
598  if (data != 0) {
599  FXString dataS = (char*) data; // !!!unicode
600  // check whether this item has been added twice
601  if (dataS == mySchemeName->getItemText(mySchemeName->getNumItems() - 1)) {
602  for (int i = 0; i < mySchemeName->getNumItems() - 1; ++i) {
603  if (dataS == mySchemeName->getItemText(i)) {
604  mySchemeName->removeItem(i);
605  }
606  }
607  }
608  myBackup = gSchemeStorage.get(dataS.text());
609  mySettings = &gSchemeStorage.get(dataS.text());
610  }
611  rebuildColorMatrices(true);
612 
614 
615  myLaneEdgeColorMode->setCurrentItem((FXint) mySettings->getLaneEdgeMode());
618  myShowRails->setCheck(mySettings->showRails);
624 
625  myVehicleColorMode->setCurrentItem((FXint) mySettings->vehicleColorer.getActive());
630  myShowMinGap->setCheck(mySettings->drawMinGap);
631  /*
632  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
633  */
635 
636  myPersonColorMode->setCurrentItem((FXint) mySettings->personColorer.getActive());
637  myPersonShapeDetail->setCurrentItem(mySettings->personQuality);
641 
642  myJunctionColorMode->setCurrentItem((FXint) mySettings->junctionColorer.getActive());
647 
651 
655 
659 
662  myAntialiase->setCheck(mySettings->antialiase);
663  myDither->setCheck(mySettings->dither);
665 
667  update();
668  myParent->update();
669  return 1;
670 }
671 
672 
673 bool
674 GUIDialog_ViewSettings::updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
675  std::vector<FXColorWell*>::const_iterator colEnd,
676  std::vector<FXRealSpinDial*>::const_iterator threshIt,
677  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
678  std::vector<FXButton*>::const_iterator buttonIt,
679  GUIColorScheme& scheme) {
680  size_t pos = 0;
681  while (colIt != colEnd) {
682  if (scheme.isFixed()) {
683  if (sender == *colIt) {
684  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
685  }
686  } else {
687  if (sender == *threshIt) {
688  const SUMOReal val = (*threshIt)->getValue();
689  double lo, hi;
690  if (pos != 0) {
691  threshIt--;
692  (*threshIt)->getRange(lo, hi);
693  (*threshIt)->setRange(lo, val);
694  threshIt++;
695  }
696  threshIt++;
697  if (threshIt != threshEnd) {
698  (*threshIt)->getRange(lo, hi);
699  (*threshIt)->setRange(val, hi);
700  }
701  scheme.setThreshold(pos, val);
702  return false;
703  }
704  if (sender == *colIt) {
705  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
706  return false;
707  }
708  if (sender == *buttonIt) {
709  if (pos == 0) {
710  scheme.addColor(MFXUtils::getRGBColor((*colIt)->getRGBA()), (*threshIt)->getValue());
711  } else {
712  scheme.removeColor(pos);
713  }
714  return true;
715  }
716  ++threshIt;
717  ++buttonIt;
718  }
719  ++colIt;
720  pos++;
721  }
722  return false;
723 }
724 
725 
726 long
727 GUIDialog_ViewSettings::onCmdColorChange(FXObject* sender, FXSelector, void* /*val*/) {
728  GUIVisualizationSettings tmpSettings = *mySettings;
729  size_t prevLaneMode = mySettings->getLaneEdgeMode();
730  size_t prevVehicleMode = mySettings->vehicleColorer.getActive();
731  size_t prevPersonMode = mySettings->personColorer.getActive();
732  size_t prevJunctionMode = mySettings->junctionColorer.getActive();
733  bool doRebuildColorMatrices = false;
734 
735  tmpSettings.name = mySettings->name;
736  tmpSettings.backgroundColor = MFXUtils::getRGBColor(myBackgroundColor->getRGBA());
737  tmpSettings.showGrid = (myShowGrid->getCheck() != FALSE);
738  tmpSettings.gridXSize = (SUMOReal) myGridXSizeDialer->getValue();
739  tmpSettings.gridYSize = (SUMOReal) myGridYSizeDialer->getValue();
740 
741 #ifdef HAVE_INTERNAL
742  if (GUIVisualizationSettings::UseMesoSim) {
743  tmpSettings.edgeColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
744  } else {
745 #endif
746  tmpSettings.laneColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
747 #ifdef HAVE_INTERNAL
748  }
749 #endif
750  tmpSettings.laneShowBorders = (myShowLaneBorders->getCheck() != FALSE);
751  tmpSettings.showLinkDecals = (myShowLaneDecals->getCheck() != FALSE);
752  tmpSettings.showRails = (myShowRails->getCheck() != FALSE);
753  tmpSettings.edgeName = myEdgeNamePanel->getSettings();
755  tmpSettings.streetName = myStreetNamePanel->getSettings();
756  tmpSettings.hideConnectors = (myHideMacroConnectors->getCheck() != FALSE);
757  tmpSettings.laneWidthExaggeration = (SUMOReal) myLaneWidthUpscaleDialer->getValue();
758 
759  tmpSettings.vehicleColorer.setActive(myVehicleColorMode->getCurrentItem());
760  tmpSettings.vehicleQuality = myVehicleShapeDetail->getCurrentItem();
761  tmpSettings.vehicleExaggeration = (SUMOReal) myVehicleUpscaleDialer->getValue();
762  tmpSettings.minVehicleSize = (SUMOReal) myVehicleMinSizeDialer->getValue();
763  tmpSettings.showBlinker = (myShowBlinker->getCheck() != FALSE);
764  tmpSettings.drawMinGap = (myShowMinGap->getCheck() != FALSE);
765  /*
766  tmpSettings.drawLaneChangePreference = (myShowLaneChangePreference->getCheck() != FALSE);
767  */
768  tmpSettings.vehicleName = myVehicleNamePanel->getSettings();
769 
770  tmpSettings.personColorer.setActive(myPersonColorMode->getCurrentItem());
771  tmpSettings.personQuality = myPersonShapeDetail->getCurrentItem();
772  tmpSettings.personExaggeration = (SUMOReal) myPersonUpscaleDialer->getValue();
773  tmpSettings.minPersonSize = (SUMOReal) myPersonMinSizeDialer->getValue();
774  tmpSettings.personName = myPersonNamePanel->getSettings();
775 
776  tmpSettings.junctionColorer.setActive(myJunctionColorMode->getCurrentItem());
777  tmpSettings.drawLinkTLIndex = (myShowTLIndex->getCheck() != FALSE);
778  tmpSettings.drawLinkJunctionIndex = (myShowJunctionIndex->getCheck() != FALSE);
781 
782  tmpSettings.addExaggeration = (SUMOReal) myDetectorUpscaleDialer->getValue();
783  tmpSettings.minAddSize = (SUMOReal) myDetectorMinSizeDialer->getValue();
784  tmpSettings.addName = myAddNamePanel->getSettings();
785 
786  tmpSettings.poiExaggeration = (SUMOReal) myPOIUpscaleDialer->getValue();
787  tmpSettings.minPOISize = (SUMOReal) myPOIMinSizeDialer->getValue();
788  tmpSettings.poiName = myPOINamePanel->getSettings();
789 
790  tmpSettings.polyExaggeration = (SUMOReal) myPolyUpscaleDialer->getValue();
791  tmpSettings.minPolySize = (SUMOReal) myPolyMinSizeDialer->getValue();
792  tmpSettings.polyName = myPolyNamePanel->getSettings();
793 
794  tmpSettings.showLane2Lane = (myShowLane2Lane->getCheck() != FALSE);
795  tmpSettings.drawJunctionShape = (myDrawJunctionShape->getCheck() != FALSE);
796  tmpSettings.antialiase = (myAntialiase->getCheck() != FALSE);
797  tmpSettings.dither = (myDither->getCheck() != FALSE);
798  tmpSettings.showSizeLegend = (myShowSizeLegend->getCheck() != FALSE);
799 
800  // lanes
801  if (tmpSettings.getLaneEdgeMode() == prevLaneMode) {
802  if (updateColorRanges(sender, myLaneColors.begin(), myLaneColors.end(),
803  myLaneThresholds.begin(), myLaneThresholds.end(), myLaneButtons.begin(),
804  tmpSettings.getLaneEdgeScheme())) {
805  doRebuildColorMatrices = true;
806  }
807  if (sender == myLaneColorInterpolation) {
808  tmpSettings.getLaneEdgeScheme().setInterpolated(myLaneColorInterpolation->getCheck() != FALSE);
809  doRebuildColorMatrices = true;
810  }
811  } else {
812  doRebuildColorMatrices = true;
813  }
814  // vehicles
815  if (tmpSettings.vehicleColorer.getActive() == prevVehicleMode) {
816  if (updateColorRanges(sender, myVehicleColors.begin(), myVehicleColors.end(),
818  tmpSettings.vehicleColorer.getScheme())) {
819  doRebuildColorMatrices = true;
820  }
821  if (sender == myVehicleColorInterpolation) {
822  tmpSettings.vehicleColorer.getScheme().setInterpolated(myVehicleColorInterpolation->getCheck() != FALSE);
823  doRebuildColorMatrices = true;
824  }
825  } else {
826  doRebuildColorMatrices = true;
827  }
828  // persons
829  if (tmpSettings.personColorer.getActive() == prevPersonMode) {
830  if (updateColorRanges(sender, myPersonColors.begin(), myPersonColors.end(),
831  myPersonThresholds.begin(), myPersonThresholds.end(), myPersonButtons.begin(),
832  tmpSettings.personColorer.getScheme())) {
833  doRebuildColorMatrices = true;
834  }
835  if (sender == myPersonColorInterpolation) {
836  tmpSettings.personColorer.getScheme().setInterpolated(myPersonColorInterpolation->getCheck() != FALSE);
837  doRebuildColorMatrices = true;
838  }
839  } else {
840  doRebuildColorMatrices = true;
841  }
842  // junctions
843  if (tmpSettings.junctionColorer.getActive() == prevJunctionMode) {
844  if (updateColorRanges(sender, myJunctionColors.begin(), myJunctionColors.end(),
846  tmpSettings.junctionColorer.getScheme())) {
847  doRebuildColorMatrices = true;
848  }
849  if (sender == myJunctionColorInterpolation) {
850  tmpSettings.junctionColorer.getScheme().setInterpolated(myJunctionColorInterpolation->getCheck() != FALSE);
851  doRebuildColorMatrices = true;
852  }
853  } else {
854  doRebuildColorMatrices = true;
855  }
856 
857  if (tmpSettings == *mySettings) {
858  return 1;
859  }
860 
861  int index = mySchemeName->getCurrentItem();
862  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
863  // one of the initial settings is modified
864  // every time this happens we create a new scheme
865  int suffix = 1;
866  while (gSchemeStorage.contains("custom_" + toString(suffix))) {
867  suffix++;
868  }
869  tmpSettings.name = "custom_" + toString(suffix);
870  // the newly created settings must be entered in several places:
871  // - the comboBox mySchemeName of this dialog
872  // - the comboBox of the parent view (set as active)
873  // - the comboBox of all other views (only append) XXX @todo
874  index = mySchemeName->appendItem(tmpSettings.name.c_str());
875  mySchemeName->setCurrentItem(index);
876  myParent->getColoringSchemesCombo().appendItem(tmpSettings.name.c_str());
877  }
878  myParent->getColoringSchemesCombo().setCurrentItem(
879  myParent->getColoringSchemesCombo().findItem(tmpSettings.name.c_str()));
880  gSchemeStorage.add(tmpSettings); // overwrites existing
881  mySettings = &gSchemeStorage.get(tmpSettings.name);
882  myParent->setColorScheme(tmpSettings.name);
883 
884  if (doRebuildColorMatrices) {
885  rebuildColorMatrices(true);
886  }
887  myParent->forceRefresh();
888  getApp()->forceRefresh();
889  return 1;
890 }
891 
892 
893 void
894 GUIDialog_ViewSettings::loadSettings(const std::string& file) {
895  GUISettingsHandler handler(file);
896  std::string settingsName = handler.addSettings(myParent);
897  if (settingsName != "") {
898  FXint index = mySchemeName->appendItem(settingsName.c_str());
899  mySchemeName->setCurrentItem(index);
900  mySettings = &gSchemeStorage.get(settingsName);
901  }
902 }
903 
904 
905 void
906 GUIDialog_ViewSettings::saveDecals(const std::string& file) const {
907  try {
909  dev << "<decals>\n";
910  std::vector<GUISUMOAbstractView::Decal>::iterator j;
911  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
913  dev << " <decal filename=\"" << d.filename
914  << "\" centerX=\"" << d.centerX
915  << "\" centerY=\"" << d.centerY
916  << "\" centerZ=\"" << d.centerZ
917  << "\" width=\"" << d.width
918  << "\" height=\"" << d.height
919  << "\" altitude=\"" << d.altitude
920  << "\" rotation=\"" << d.rot
921  << "\" tilt=\"" << d.tilt
922  << "\" roll=\"" << d.roll
923  << "\" layer=\"" << d.layer
924  << "\"/>\n";
925  }
926  dev << "</decals>\n";
927  dev.close();
928  } catch (IOError& e) {
929  FXMessageBox::error(myParent, MBOX_OK, "Storing failed!", "%s", e.what());
930  }
931 }
932 
933 
934 void
935 GUIDialog_ViewSettings::loadDecals(const std::string& file) {
936  myDecalsLock->lock();
937  GUISettingsHandler handler(file);
938  if (handler.hasDecals()) {
939  (*myDecals) = handler.getDecals();
940  }
941  rebuildList();
942  myParent->update();
943  myDecalsLock->unlock();
944 }
945 
946 
947 long
948 GUIDialog_ViewSettings::onCmdSaveSetting(FXObject*, FXSelector, void* /*data*/) {
949  int index = mySchemeName->getCurrentItem();
950  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
951  return 1;
952  }
953  // get the name
954  std::string name = "";
955  while (name.length() == 0) {
956  FXDialogBox dialog(this, "Enter a name", DECOR_TITLE | DECOR_BORDER);
957  FXVerticalFrame* content = new FXVerticalFrame(&dialog, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10);
958  new FXLabel(content, "Please enter an alphanumeric name: ", NULL, LAYOUT_FILL_X | JUSTIFY_LEFT);
959  FXTextField* text = new FXTextField(content, 40, &dialog, FXDialogBox::ID_ACCEPT, TEXTFIELD_ENTER_ONLY | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X);
960  new FXHorizontalSeparator(content, SEPARATOR_GROOVE | LAYOUT_FILL_X);
961  FXHorizontalFrame* buttons = new FXHorizontalFrame(content, LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0);
962  new FXButton(buttons, "&OK", NULL, &dialog, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT);
963  new FXButton(buttons, "&Cancel", NULL, &dialog, FXDialogBox::ID_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT, 0, 0, 0, 0, 20, 20);
964  dialog.create();
965  text->setFocus();
966  if (!dialog.execute()) {
967  return 1;
968  }
969  name = text->getText().text();
970  for (size_t i = 0; i < name.length(); ++i) {
971  if (name[i] != '_' && (name[i] < 'a' || name[i] > 'z') && (name[i] < 'A' || name[i] > 'Z') && (name[i] < '0' || name[i] > '9')) {
972  name = "";
973  break;
974  }
975  }
976  }
977  GUIVisualizationSettings tmpSettings = *mySettings;
979  tmpSettings.name = name;
980  gSchemeStorage.add(tmpSettings);
981  mySchemeName->setItemText(index, tmpSettings.name.c_str());
982  myParent->getColoringSchemesCombo().setItemText(index, tmpSettings.name.c_str());
983  myParent->setColorScheme(tmpSettings.name);
984  mySettings = &gSchemeStorage.get(name);
985  myBackup = *mySettings;
986  gSchemeStorage.writeSettings(getApp());
987  return 1;
988 }
989 
990 
991 long
992 GUIDialog_ViewSettings::onUpdSaveSetting(FXObject* sender, FXSelector, void* ptr) {
993  sender->handle(this,
994  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
995  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
996  ptr);
997  return 1;
998 }
999 
1000 
1001 long
1003  int index = mySchemeName->getCurrentItem();
1004  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
1005  return 1;
1006  }
1007  std::string name = mySchemeName->getItem(index).text();
1008  gSchemeStorage.remove(name);
1009  mySchemeName->removeItem(index);
1010  onCmdNameChange(0, 0, (void*) mySchemeName->getItem(0).text());
1011  gSchemeStorage.writeSettings(getApp());
1012  return 1;
1013 }
1014 
1015 
1016 long
1017 GUIDialog_ViewSettings::onUpdDeleteSetting(FXObject* sender, FXSelector, void* ptr) {
1018  sender->handle(this,
1019  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1020  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1021  ptr);
1022  return 1;
1023 }
1024 
1025 
1026 long
1028  FXFileDialog opendialog(this, "Export view settings");
1029  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1030  opendialog.setSelectMode(SELECTFILE_ANY);
1031  opendialog.setPatternList("*.xml");
1032  if (gCurrentFolder.length() != 0) {
1033  opendialog.setDirectory(gCurrentFolder);
1034  }
1035  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1036  return 1;
1037  }
1038  try {
1039  OutputDevice& dev = OutputDevice::getDevice(opendialog.getFilename().text());
1040  mySettings->save(dev);
1041  dev.close();
1042  } catch (IOError& e) {
1043  FXMessageBox::error(this, MBOX_OK, "Storing failed!", "%s", e.what());
1044  }
1045  return 1;
1046 }
1047 
1048 
1049 long
1050 GUIDialog_ViewSettings::onUpdExportSetting(FXObject* sender, FXSelector, void* ptr) {
1051  sender->handle(this,
1052  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1053  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1054  ptr);
1055  return 1;
1056 }
1057 
1058 
1059 long
1061  FXFileDialog opendialog(this, "Import view settings");
1062  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1063  opendialog.setSelectMode(SELECTFILE_ANY);
1064  opendialog.setPatternList("*.xml");
1065  if (gCurrentFolder.length() != 0) {
1066  opendialog.setDirectory(gCurrentFolder);
1067  }
1068  if (opendialog.execute()) {
1069  gCurrentFolder = opendialog.getDirectory();
1070  loadSettings(opendialog.getFilename().text());
1071  }
1072  return 1;
1073 }
1074 
1075 
1076 long
1077 GUIDialog_ViewSettings::onCmdLoadDecals(FXObject*, FXSelector, void* /*data*/) {
1078  FXFileDialog opendialog(this, "Load Decals");
1079  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1080  opendialog.setSelectMode(SELECTFILE_ANY);
1081  opendialog.setPatternList("*.xml");
1082  if (gCurrentFolder.length() != 0) {
1083  opendialog.setDirectory(gCurrentFolder);
1084  }
1085  if (opendialog.execute()) {
1086  gCurrentFolder = opendialog.getDirectory();
1087  loadDecals(opendialog.getFilename().text());
1088  }
1089  return 1;
1090 }
1091 
1092 
1093 long
1094 GUIDialog_ViewSettings::onCmdSaveDecals(FXObject*, FXSelector, void* /*data*/) {
1095  FXFileDialog opendialog(this, "Save Decals");
1096  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1097  opendialog.setSelectMode(SELECTFILE_ANY);
1098  opendialog.setPatternList("*.xml");
1099  if (gCurrentFolder.length() != 0) {
1100  opendialog.setDirectory(gCurrentFolder);
1101  }
1102  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1103  return 1;
1104  }
1105  saveDecals(opendialog.getFilename().text());
1106  return 1;
1107 }
1108 
1109 
1110 
1111 
1112 long
1113 GUIDialog_ViewSettings::onUpdImportSetting(FXObject* sender, FXSelector, void* ptr) {
1114  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1115  return 1;
1116 }
1117 
1118 
1119 void
1121  myDecalsTable->clearItems();
1122  // set table attributes
1123  myDecalsTable->setTableSize(10, 7);
1124  myDecalsTable->setColumnText(0, "picture file");
1125  myDecalsTable->setColumnText(1, "center x");
1126  myDecalsTable->setColumnText(2, "center y");
1127  myDecalsTable->setColumnText(3, "width");
1128  myDecalsTable->setColumnText(4, "height");
1129  myDecalsTable->setColumnText(5, "rotation");
1130  myDecalsTable->setColumnText(6, "layer");
1131  FXHeader* header = myDecalsTable->getColumnHeader();
1132  header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
1133  int k;
1134  for (k = 0; k < 7; k++) {
1135  header->setItemJustify(k, JUSTIFY_CENTER_X | JUSTIFY_TOP);
1136  header->setItemSize(k, 60);
1137  }
1138  header->setItemSize(0, 150);
1139  // insert already known decals information into table
1140  FXint row = 0;
1141  std::vector<GUISUMOAbstractView::Decal>::iterator j;
1142  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
1144  myDecalsTable->setItemText(row, 0, d.filename.c_str());
1145  myDecalsTable->setItemText(row, 1, toString<SUMOReal>(d.centerX).c_str());
1146  myDecalsTable->setItemText(row, 2, toString<SUMOReal>(d.centerY).c_str());
1147  myDecalsTable->setItemText(row, 3, toString<SUMOReal>(d.width).c_str());
1148  myDecalsTable->setItemText(row, 4, toString<SUMOReal>(d.height).c_str());
1149  myDecalsTable->setItemText(row, 5, toString<SUMOReal>(d.rot).c_str());
1150  myDecalsTable->setItemText(row, 6, toString<SUMOReal>(d.layer).c_str());
1151  row++;
1152  }
1153  // insert dummy last field
1154  for (k = 0; k < 7; k++) {
1155  myDecalsTable->setItemText(row, k, " ");
1156  }
1157 }
1158 
1159 
1160 FXMatrix*
1162  std::vector<FXColorWell*>& colors,
1163  std::vector<FXRealSpinDial*>& thresholds,
1164  std::vector<FXButton*>& buttons,
1165  FXCheckButton* interpolation,
1166  GUIColorScheme& scheme) {
1167  MFXUtils::deleteChildren(frame);
1168  FXMatrix* m = new FXMatrix(frame, 3,
1169  LAYOUT_FILL_X | MATRIX_BY_COLUMNS,
1170  0, 0, 0, 0, 10, 10, 0, 0, 5, 3);
1171  colors.clear();
1172  thresholds.clear();
1173  buttons.clear();
1174  const bool fixed = scheme.isFixed();
1175  std::vector<RGBColor>::const_iterator colIt = scheme.getColors().begin();
1176  std::vector<SUMOReal>::const_iterator threshIt = scheme.getThresholds().begin();
1177  std::vector<std::string>::const_iterator nameIt = scheme.getNames().begin();
1178  FX::FXString buttonText = "Add";
1179  while (colIt != scheme.getColors().end()) {
1180  colors.push_back(new FXColorWell(m , MFXUtils::getFXColor(*colIt),
1182  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1183  0, 0, 100, 0, 0, 0, 0, 0));
1184  if (fixed) {
1185  new FXLabel(m, nameIt->c_str());
1186  new FXLabel(m, "");
1187  } else {
1188  const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0;
1189  FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions);
1190  threshDialer->setValue(*threshIt);
1191  thresholds.push_back(threshDialer);
1192  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));
1193  buttonText = "Remove";
1194  }
1195  colIt++;
1196  threshIt++;
1197  nameIt++;
1198  }
1199  interpolation->setCheck(scheme.isInterpolated());
1200  if (fixed) {
1201  interpolation->disable();
1202  } else {
1203  if (colors.size() > 1) {
1204  interpolation->enable();
1205  if (interpolation->getCheck() != FALSE) {
1206  thresholds.front()->enable();
1207  } else {
1208  thresholds.front()->disable();
1209  }
1210  } else {
1211  interpolation->disable();
1212  thresholds.front()->disable();
1213  }
1214  }
1215  return m;
1216 }
1217 
1218 
1219 void
1221  // decals
1222  delete myDecalsTable;
1224  LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH/*|LAYOUT_FIX_HEIGHT*/, 0, 0, 470, 0);
1225  myDecalsTable->setVisibleRows(5);
1226  myDecalsTable->setVisibleColumns(7);
1227  myDecalsTable->setTableSize(5, 7);
1228  myDecalsTable->setBackColor(FXRGB(255, 255, 255));
1229  myDecalsTable->getRowHeader()->setWidth(0);
1230  for (int i = 1; i <= 5; ++i) {
1232  myDecalsTable->setNumberCellParams(i, -10000000, 10000000, 1, 10, 100, "%.2f");
1233  }
1234  rebuildList();
1235  if (doCreate) {
1236  myDecalsTable->create();
1237  }
1239  if (doCreate) {
1240  m->create();
1241  }
1242  myLaneColorSettingFrame->getParent()->recalc();
1244  if (doCreate) {
1245  m->create();
1246  }
1247  myPersonColorSettingFrame->getParent()->recalc();
1249  if (doCreate) {
1250  m->create();
1251  }
1252  myPersonColorSettingFrame->getParent()->recalc();
1254  if (doCreate) {
1255  m->create();
1256  }
1257  myJunctionColorSettingFrame->getParent()->recalc();
1258  layout();
1259  update();
1260 }
1261 
1262 
1263 long
1266  std::string value = i->item->getText().text();
1267  // check whether the inserted value is empty
1268  if (value.find_first_not_of(" ") == std::string::npos) {
1269  return 1;
1270  }
1272  int row = i->row;
1273  // check whether we add a new entry or edit an existing entry
1274  if (row == static_cast<int>(myDecals->size())) {
1275  d.filename = "";
1276  d.centerX = SUMOReal(myParent->getGridWidth() / 2.);
1277  d.centerY = SUMOReal(myParent->getGridHeight() / 2.);
1278  d.width = 0.;
1279  d.height = 0.;
1280  d.initialised = false;
1281  d.rot = 0;
1282  d.layer = 0;
1283  myDecalsLock->lock();
1284  myDecals->push_back(d);
1285  myDecalsLock->unlock();
1286  } else if (row > static_cast<int>(myDecals->size())) {
1287  // ignore clicks two lines below existing entries
1288  return 1;
1289  } else {
1290  d = (*myDecals)[row];
1291  }
1292 
1293  switch (i->col) {
1294  case 0:
1295  if (d.initialised && d.filename != value) {
1296  d.initialised = false;
1297  }
1298  d.filename = value;
1299  break;
1300  case 1:
1301  try {
1302  d.centerX = TplConvert::_2SUMOReal(value.c_str());
1303  } catch (NumberFormatException&) {
1304  std::string msg = "The value must be a float, is:" + value;
1305  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1306  }
1307  break;
1308  case 2:
1309  try {
1310  d.centerY = TplConvert::_2SUMOReal(value.c_str());
1311  } catch (NumberFormatException&) {
1312  std::string msg = "The value must be a float, is:" + value;
1313  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1314  }
1315  break;
1316  case 3:
1317  try {
1318  d.width = TplConvert::_2SUMOReal(value.c_str());
1319  } catch (NumberFormatException&) {
1320  std::string msg = "The value must be a float, is:" + value;
1321  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1322  }
1323  break;
1324  case 4:
1325  try {
1326  d.height = TplConvert::_2SUMOReal(value.c_str());
1327  } catch (NumberFormatException&) {
1328  std::string msg = "The value must be a float, is:" + value;
1329  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1330  }
1331  break;
1332  case 5:
1333  try {
1334  d.rot = TplConvert::_2SUMOReal(value.c_str());
1335  } catch (NumberFormatException&) {
1336  std::string msg = "The value must be a float, is:" + value;
1337  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1338  }
1339  break;
1340  case 6:
1341  try {
1342  d.layer = TplConvert::_2SUMOReal(value.c_str());
1343  } catch (NumberFormatException&) {
1344  std::string msg = "The value must be a float, is:" + value;
1345  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1346  }
1347  break;
1348  default:
1349  throw 1;
1350  }
1351  (*myDecals)[row] = d;
1352  if (!i->updateOnly) {
1353  rebuildList();
1354  }
1355  myParent->update();
1356  return 1;
1357 }
1358 
1359 
1360 std::string
1362  return mySchemeName->getItem(mySchemeName->getCurrentItem()).text();
1363 }
1364 
1365 
1366 void
1368  if (name.c_str() == mySchemeName->getItemText(mySchemeName->getCurrentItem())) {
1369  return;
1370  }
1371  for (int i = 0; i < mySchemeName->getNumItems(); ++i) {
1372  if (name.c_str() == mySchemeName->getItemText(i)) {
1373  mySchemeName->setCurrentItem(i);
1374  onCmdNameChange(0, 0, (void*)name.c_str());
1375  return;
1376  }
1377  }
1378 }
1379 
1381  FXMatrix* parent,
1382  GUIDialog_ViewSettings* target,
1383  const std::string& title,
1384  const GUIVisualizationTextSettings& settings) {
1385  myCheck = new FXCheckButton(parent, title.c_str(), target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
1386  myCheck->setCheck(settings.show);
1387  new FXLabel(parent, "");
1388  FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1389  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1390  new FXLabel(m1, "Size", 0, LAYOUT_CENTER_Y);
1391  mySizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE,
1392  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
1393  mySizeDial->setRange(10, 1000);
1394  mySizeDial->setValue(settings.size);
1395  FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1396  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1397  new FXLabel(m2, "Color", 0, LAYOUT_CENTER_Y);
1398  myColorWell = new FXColorWell(m2, MFXUtils::getFXColor(settings.color),
1399  target, MID_SIMPLE_VIEW_COLORCHANGE,
1400  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1401  0, 0, 100, 0, 0, 0, 0, 0);
1402 }
1403 
1406  return GUIVisualizationTextSettings(myCheck->getCheck() != FALSE,
1407  mySizeDial->getValue(), MFXUtils::getRGBColor(myColorWell->getRGBA()));
1408 }
1409 
1410 
1411 void
1413  myCheck->setCheck(settings.show);
1414  mySizeDial->setValue(settings.size);
1415  myColorWell->setRGBA(MFXUtils::getFXColor(settings.color));
1416 }
1417 /****************************************************************************/
1418 
void rebuildColorMatrices(bool doCreate=false)
Rebuilds color changing dialogs after choosing another coloring scheme.
bool allowsNegativeValues() const
float vehicleExaggeration
The vehicle exaggeration (upscale)
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.
FXCheckButton * myLaneColorInterpolation
void close()
Closes the device and removes it from the dictionary.
GUICompleteSchemeStorage gSchemeStorage
bool showSizeLegend
Information whether the size legend shall be drawn.
FXCheckButton * myJunctionColorInterpolation
FXRealSpinDial * myPersonMinSizeDialer
For the delete - button.
Definition: GUIAppEnum.h:331
Cancel-button was pushed.
Definition: GUIAppEnum.h:275
GUIVisualizationTextSettings streetName
float laneWidthExaggeration
The lane exaggeration (upscale thickness)
size_t getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
bool isFixed() const
SUMOReal roll
The roll of the image to the ground plane (in degrees)
bool isInterpolated() const
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
Informs the dialog about switching to another scheme.
Definition: GUIAppEnum.h:327
For the export-to-file - button.
Definition: GUIAppEnum.h:333
bool showBlinker
Information whether vehicle blinkers shall be drawn.
GUIVisualizationTextSettings addName
FXRealSpinDial * myPOIMinSizeDialer
FXRealSpinDial * myVehicleMinSizeDialer
GUIVisualizationTextSettings personName
std::vector< FXButton * > myLaneButtons
FXRealSpinDial * myDetectorUpscaleDialer
float minAddSize
The minimum size of additional structures to let them be drawn.
bool drawLinkTLIndex
Information whether a link's tls index shall be drawn.
static SUMOReal _2SUMOReal(const E *const data)
Definition: TplConvert.h:223
FXDEFMAP(GUIDialog_ViewSettings) GUIDialog_ViewSettingsMap[]
GUIVisualizationTextSettings poiName
GUIColorScheme & getLaneEdgeScheme()
Returns the current lane (edge) coloring schme.
float polyExaggeration
The additional shapes (upscale)
GUIColorer laneColorer
The lane colorer.
Stores the information about how to visualize structures.
The dialog to change the view (gui) settings.
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:119
void remove(GUIDialog_EditViewport *)
float poiExaggeration
The additional shapes (upscale)
std::vector< GUISUMOAbstractView::Decal > * myDecals
The parent's decals.
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it...
Definition: MFXUtils.cpp:52
bool showRails
Information whether rails shall be drawn.
void setInterpolated(const bool interpolate, SUMOReal interpolationStart=0.f)
void loadDecals(const std::string &file)
Loads decals from a file.
std::vector< FXButton * > myPersonButtons
std::vector< FXColorWell * > myJunctionColors
GUIVisualizationTextSettings vehicleName
void removeColor(const size_t pos)
void loadSettings(const std::string &file)
Loads a scheme from a file.
bool hasDecals() const
Returns whether any decals have been parsed.
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.
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
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.
void setThreshold(const size_t pos, const SUMOReal threshold)
SUMOReal width
The width of the image (net coordinates in x-direction, in m)
long onCmdEditTable(FXObject *, FXSelector, void *data)
Called if the decals-table was changed.
const std::vector< SUMOReal > & getThresholds() const
bool dither
Information whether dithering shall be enabled.
Ok-button was pushed.
Definition: GUIAppEnum.h:273
FXRealSpinDial * myPolyUpscaleDialer
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.
void saveDecals(const std::string &file) const
Writes the currently used decals into a file.
float personExaggeration
The person exaggeration (upscale)
size_t getActive() const
Definition: GUIColorer.h:72
GUIColorer vehicleColorer
The vehicle colorer.
GUIVisualizationTextSettings edgeName
FXTableItem * item
FXCheckButton * myVehicleColorInterpolation
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
For the load-decals - button.
Definition: GUIAppEnum.h:337
void setActive(size_t scheme)
Definition: GUIColorer.h:66
std::string name
The name of this setting.
float addExaggeration
The additional structures exaggeration (upscale)
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
void rebuildList()
Rebuilds the decals table.
The Table.
Definition: GUIAppEnum.h:261
SUMOReal altitude
The altitude of the image (net coordinates in z-direction, in m)
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 color changing dialogs after choosing another coloring scheme.
SUMOReal centerY
The center of the image in y-direction (net coordinates, in m)
bool drawMinGap
Information whether the minimum gap shall be drawn.
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
void remove(const std::string &name)
Removes the setting with the given name.
unsigned int getNumInitialSettings() const
Returns the number of initial settings.
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
FXVerticalFrame * myLaneColorSettingFrame
FXComboBox & getColoringSchemesCombo()
FXRealSpinDial * myPersonUpscaleDialer
bool initialised
Whether this image was initialised (inserted as a texture)
GUIColorer personColorer
The person colorer.
GUIVisualizationTextSettings internalJunctionName
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.
For the save-to-db - button.
Definition: GUIAppEnum.h:329
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:52
std::vector< FXColorWell * > myPersonColors
FXRealSpinDial * myGridYSizeDialer
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.
float minPOISize
The minimum size of shapes to let them be drawn.
const std::vector< RGBColor > & getColors() const
long onCmdOk(FXObject *, FXSelector, void *)
Called if the OK-button was pressed.
For the save-decals - button.
Definition: GUIAppEnum.h:339
void unlock()
release mutex lock
Definition: MFXMutex.cpp:94
SUMOReal height
The height of the image (net coordinates in y-direction, in m)
SUMOReal centerX
The center of the image in x-direction (net coordinates, in m)
MFXAddEditTypedTable * myDecalsTable
float minPersonSize
The minimum size of persons to let them be drawn.
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
GUIColorScheme & getScheme()
Definition: GUIColorer.h:76
NamePanel(FXMatrix *parent, GUIDialog_ViewSettings *target, const std::string &title, const GUIVisualizationTextSettings &settings)
FXRealSpinDial * myPOIUpscaleDialer
unsigned int addColor(const RGBColor &color, const SUMOReal threshold, const std::string &name="")
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
GUIVisualizationTextSettings getSettings()
void writeSettings(FXApp *app)
Writes the current scheme into the registry.
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
FXCheckButton * myHideMacroConnectors
bool drawLinkJunctionIndex
Information whether a link's junction index shall be drawn.
SUMOReal getGridWidth() const
virtual bool setColorScheme(const std::string &)
int personQuality
The quality of person drawing.
void lock()
lock mutex
Definition: MFXMutex.cpp:84
bool showGrid
Information whether a grid shall be shown.
const std::vector< std::string > & getNames() const
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.
void setColor(const size_t pos, const RGBColor &color)
float minVehicleSize
The minimum size of vehicles to let them be drawn.
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
void setCellType(size_t pos, CellType t)
#define SUMOReal
Definition: config.h:215
FXRealSpinDial * myGridXSizeDialer
An XML-handler for visualisation schemes.
void save(OutputDevice &dev) const
Writes the settings into an output device.
FXCheckButton * myPersonColorInterpolation
bool drawJunctionShape
whether the shape of the junction should be drawn
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)
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)
MFXMutex * myDecalsLock
Lock used when changing the decals.
FXRealSpinDial * myVehicleUpscaleDialer
void setNumberCellParams(size_t pos, double min, double max, double steps1, double steps2, double steps3, const std::string &format)
std::vector< FXRealSpinDial * > myJunctionThresholds
FXRealSpinDial * myPolyMinSizeDialer
For the import-from-file - button.
Definition: GUIAppEnum.h:335
long onCmdDeleteSetting(FXObject *, FXSelector, void *data)
Called if the settings shall be deleted.
GUISUMOAbstractView * myParent
The parent view (which settings are changed)
FXVerticalFrame * myPersonColorSettingFrame
static FXIcon * getIcon(GUIIcon which)
std::vector< FXButton * > myJunctionButtons
GUIVisualizationSettings myBackup
A backup of the settings (used if the "Cancel" button is pressed)
FXRealSpinDial * myDetectorMinSizeDialer
std::vector< FXColorWell * > myLaneColors
std::vector< FXRealSpinDial * > myLaneThresholds
Informs the dialog about a value's change.
Definition: GUIAppEnum.h:325
std::vector< FXButton * > myVehicleButtons
float minPolySize
The minimum size of shapes to let them be drawn.
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.
long onUpdImportSetting(FXObject *, FXSelector, void *data)
Called when updating the button that allows to read settings from a file.
GUIVisualizationTextSettings polyName