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-2013 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, "Nodes", 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  } {
418  new FXTabItem(tabbook, "Detectors/Trigger", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
419  FXVerticalFrame* frame5 =
420  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
421 
422  FXMatrix* m51 =
423  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
424  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
425  myAddNamePanel = new NamePanel(m51, this, "Show detector name", mySettings->addName);
426  new FXHorizontalSeparator(frame5 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
427 
428  FXMatrix* m52 =
429  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
430  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
431  FXMatrix* m521 =
432  new FXMatrix(m52, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
433  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
434  new FXLabel(m521, "Minimum size", 0, LAYOUT_CENTER_Y);
435  myDetectorMinSizeDialer =
436  new FXRealSpinDial(m521, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
437  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
438  FXMatrix* m522 =
439  new FXMatrix(m52, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
440  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
441  myDetectorMinSizeDialer->setValue(mySettings->minAddSize);
442  new FXLabel(m522, "Exaggerate by", 0, LAYOUT_CENTER_Y);
443  myDetectorUpscaleDialer =
444  new FXRealSpinDial(m522, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
445  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
446  myDetectorUpscaleDialer->setRange(0, 10000);
447  myDetectorUpscaleDialer->setValue(mySettings->addExaggeration);
448 
449 
450  /*
451  new FXLabel(m522, "Color", 0, LAYOUT_CENTER_Y);
452  myDetectorNameColor = new FXColorWell(m522, MFXUtils::getFXColor(settings->addNameColor),
453  this, MID_SIMPLE_VIEW_COLORCHANGE,
454  LAYOUT_FIX_WIDTH|LAYOUT_CENTER_Y|LAYOUT_SIDE_TOP|FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT,
455  0, 0, 100, 0, 0, 0, 0, 0);
456  */
457  } {
458  new FXTabItem(tabbook, "POIs", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
459  FXVerticalFrame* frame6 =
460  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
461 
462  FXMatrix* m61 =
463  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
464  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
465  myPOINamePanel = new NamePanel(m61, this, "Show poi names", mySettings->poiName);
466  new FXHorizontalSeparator(frame6 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
467 
468  FXMatrix* m62 =
469  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
470  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
471  FXMatrix* m621 =
472  new FXMatrix(m62, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
473  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
474  new FXLabel(m621, "Minimum size to show", 0, LAYOUT_CENTER_Y);
475  myPOIMinSizeDialer =
476  new FXRealSpinDial(m621, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
477  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
478  FXMatrix* m622 =
479  new FXMatrix(m62, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
480  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
481  myPOIMinSizeDialer->setValue(mySettings->minPOISize);
482  new FXLabel(m622, "Exaggerate by", 0, LAYOUT_CENTER_Y);
483  myPOIUpscaleDialer =
484  new FXRealSpinDial(m622, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
485  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
486  myPOIUpscaleDialer->setRange(0, 10000);
487  myPOIUpscaleDialer->setValue(mySettings->addExaggeration);
488 
489 
490  } {
491  new FXTabItem(tabbook, "Polygons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
492  FXVerticalFrame* frame9 =
493  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
494 
495  FXMatrix* m91 =
496  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
497  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
498  myPolyNamePanel = new NamePanel(m91, this, "Show polygon names", mySettings->polyName);
499  new FXHorizontalSeparator(frame9 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
500 
501  FXMatrix* m92 =
502  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
503  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
504  FXMatrix* m921 =
505  new FXMatrix(m92, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
506  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
507  new FXLabel(m921, "Minimum size to show", 0, LAYOUT_CENTER_Y);
508  myPolyMinSizeDialer =
509  new FXRealSpinDial(m921, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
510  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
511  FXMatrix* m922 =
512  new FXMatrix(m92, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
513  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
514  myPolyMinSizeDialer->setValue(mySettings->minPolySize);
515  new FXLabel(m922, "Exaggerate by", 0, LAYOUT_CENTER_Y);
516  myPolyUpscaleDialer =
517  new FXRealSpinDial(m922, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
518  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
519  myPolyUpscaleDialer->setRange(0, 10000);
520  myPolyUpscaleDialer->setValue(mySettings->addExaggeration);
521 
522 
523  }{
524  new FXTabItem(tabbook, "Legend", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
525  FXVerticalFrame* frame7 =
526  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
527 
528  FXMatrix* m72 =
529  new FXMatrix(frame7, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
530  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
531  myShowSizeLegend = new FXCheckButton(m72, "Show Size Legend", this, MID_SIMPLE_VIEW_COLORCHANGE);
532  myShowSizeLegend->setCheck(mySettings->showSizeLegend);
533  new FXLabel(m72, "");
534  } {
535  new FXTabItem(tabbook, "openGL", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
536  FXVerticalFrame* frame8 =
537  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
538 
539  FXMatrix* m82 =
540  new FXMatrix(frame8, 1, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
541  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
542  myAntialiase = new FXCheckButton(m82, "Antialiase", this, MID_SIMPLE_VIEW_COLORCHANGE);
543  myAntialiase->setCheck(mySettings->antialiase);
544  myDither = new FXCheckButton(m82, "Dither", this, MID_SIMPLE_VIEW_COLORCHANGE);
545  myDither->setCheck(mySettings->dither);
546  }
547  FXHorizontalFrame* f2 = new FXHorizontalFrame(contentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
548  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);
549  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);
550  initial->setFocus();
551 
552  rebuildColorMatrices(false);
554 }
555 
556 
558  myParent->remove(this);
559  delete myEdgeNamePanel;
561  delete myStreetNamePanel;
562  delete myJunctionNamePanel;
564  delete myVehicleNamePanel;
565  delete myAddNamePanel;
566  delete myPOINamePanel;
567  delete myPolyNamePanel;
568 }
569 
570 
571 void
573  mySettings = settings;
574  myBackup = (*settings);
575  onCmdNameChange(0, 0, 0);
576 }
577 
578 
579 long
581  hide();
582  return 1;
583 }
584 
585 
586 long
588  hide();
589  (*mySettings) = myBackup;
590  return 1;
591 }
592 
593 
594 long
596  if (data != 0) {
597  FXString dataS = (char*) data; // !!!unicode
598  // check whether this item has been added twice
599  if (dataS == mySchemeName->getItemText(mySchemeName->getNumItems() - 1)) {
600  for (int i = 0; i < mySchemeName->getNumItems() - 1; ++i) {
601  if (dataS == mySchemeName->getItemText(i)) {
602  mySchemeName->removeItem(i);
603  }
604  }
605  }
606  myBackup = gSchemeStorage.get(dataS.text());
607  mySettings = &gSchemeStorage.get(dataS.text());
608  }
609  rebuildColorMatrices(true);
610 
612 
613  myLaneEdgeColorMode->setCurrentItem((FXint) mySettings->getLaneEdgeMode());
616  myShowRails->setCheck(mySettings->showRails);
622 
623  myVehicleColorMode->setCurrentItem((FXint) mySettings->vehicleColorer.getActive());
628  myShowMinGap->setCheck(mySettings->drawMinGap);
629  /*
630  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
631  */
633 
634  myPersonColorMode->setCurrentItem((FXint) mySettings->personColorer.getActive());
635  myPersonShapeDetail->setCurrentItem(mySettings->personQuality);
639 
640  myJunctionColorMode->setCurrentItem((FXint) mySettings->junctionColorer.getActive());
645 
649 
653 
657 
659  myAntialiase->setCheck(mySettings->antialiase);
660  myDither->setCheck(mySettings->dither);
662 
664  update();
665  myParent->update();
666  return 1;
667 }
668 
669 
670 bool
671 GUIDialog_ViewSettings::updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
672  std::vector<FXColorWell*>::const_iterator colEnd,
673  std::vector<FXRealSpinDial*>::const_iterator threshIt,
674  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
675  std::vector<FXButton*>::const_iterator buttonIt,
676  GUIColorScheme& scheme) {
677  size_t pos = 0;
678  while (colIt != colEnd) {
679  if (scheme.isFixed()) {
680  if (sender == *colIt) {
681  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
682  }
683  } else {
684  if (sender == *threshIt) {
685  const SUMOReal val = (*threshIt)->getValue();
686  double lo, hi;
687  if (pos != 0) {
688  threshIt--;
689  (*threshIt)->getRange(lo, hi);
690  (*threshIt)->setRange(lo, val);
691  threshIt++;
692  }
693  threshIt++;
694  if (threshIt != threshEnd) {
695  (*threshIt)->getRange(lo, hi);
696  (*threshIt)->setRange(val, hi);
697  }
698  scheme.setThreshold(pos, val);
699  return false;
700  }
701  if (sender == *colIt) {
702  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
703  return false;
704  }
705  if (sender == *buttonIt) {
706  if (pos == 0) {
707  scheme.addColor(MFXUtils::getRGBColor((*colIt)->getRGBA()), (*threshIt)->getValue());
708  } else {
709  scheme.removeColor(pos);
710  }
711  return true;
712  }
713  ++threshIt;
714  ++buttonIt;
715  }
716  ++colIt;
717  pos++;
718  }
719  return false;
720 }
721 
722 
723 long
724 GUIDialog_ViewSettings::onCmdColorChange(FXObject* sender, FXSelector, void* /*val*/) {
725  GUIVisualizationSettings tmpSettings = *mySettings;
726  size_t prevLaneMode = mySettings->getLaneEdgeMode();
727  size_t prevVehicleMode = mySettings->vehicleColorer.getActive();
728  size_t prevPersonMode = mySettings->personColorer.getActive();
729  size_t prevJunctionMode = mySettings->junctionColorer.getActive();
730  bool doRebuildColorMatrices = false;
731 
732  tmpSettings.name = mySettings->name;
733  tmpSettings.backgroundColor = MFXUtils::getRGBColor(myBackgroundColor->getRGBA());
734  tmpSettings.showGrid = (myShowGrid->getCheck() != FALSE);
735  tmpSettings.gridXSize = (SUMOReal) myGridXSizeDialer->getValue();
736  tmpSettings.gridYSize = (SUMOReal) myGridYSizeDialer->getValue();
737 
738 #ifdef HAVE_INTERNAL
739  if (GUIVisualizationSettings::UseMesoSim) {
740  tmpSettings.edgeColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
741  } else {
742 #endif
743  tmpSettings.laneColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
744 #ifdef HAVE_INTERNAL
745  }
746 #endif
747  tmpSettings.laneShowBorders = (myShowLaneBorders->getCheck() != FALSE);
748  tmpSettings.showLinkDecals = (myShowLaneDecals->getCheck() != FALSE);
749  tmpSettings.showRails = (myShowRails->getCheck() != FALSE);
750  tmpSettings.edgeName = myEdgeNamePanel->getSettings();
752  tmpSettings.streetName = myStreetNamePanel->getSettings();
753  tmpSettings.hideConnectors = (myHideMacroConnectors->getCheck() != FALSE);
754  tmpSettings.laneWidthExaggeration = (SUMOReal) myLaneWidthUpscaleDialer->getValue();
755 
756  tmpSettings.vehicleColorer.setActive(myVehicleColorMode->getCurrentItem());
757  tmpSettings.vehicleQuality = myVehicleShapeDetail->getCurrentItem();
758  tmpSettings.vehicleExaggeration = (SUMOReal) myVehicleUpscaleDialer->getValue();
759  tmpSettings.minVehicleSize = (SUMOReal) myVehicleMinSizeDialer->getValue();
760  tmpSettings.showBlinker = (myShowBlinker->getCheck() != FALSE);
761  tmpSettings.drawMinGap = (myShowMinGap->getCheck() != FALSE);
762  /*
763  tmpSettings.drawLaneChangePreference = (myShowLaneChangePreference->getCheck() != FALSE);
764  */
765  tmpSettings.vehicleName = myVehicleNamePanel->getSettings();
766 
767  tmpSettings.personColorer.setActive(myPersonColorMode->getCurrentItem());
768  tmpSettings.personQuality = myPersonShapeDetail->getCurrentItem();
769  tmpSettings.personExaggeration = (SUMOReal) myPersonUpscaleDialer->getValue();
770  tmpSettings.minPersonSize = (SUMOReal) myPersonMinSizeDialer->getValue();
771  tmpSettings.personName = myPersonNamePanel->getSettings();
772 
773  tmpSettings.junctionColorer.setActive(myJunctionColorMode->getCurrentItem());
774  tmpSettings.drawLinkTLIndex = (myShowTLIndex->getCheck() != FALSE);
775  tmpSettings.drawLinkJunctionIndex = (myShowJunctionIndex->getCheck() != FALSE);
778 
779  tmpSettings.addExaggeration = (SUMOReal) myDetectorUpscaleDialer->getValue();
780  tmpSettings.minAddSize = (SUMOReal) myDetectorMinSizeDialer->getValue();
781  tmpSettings.addName = myAddNamePanel->getSettings();
782 
783  tmpSettings.poiExaggeration = (SUMOReal) myPOIUpscaleDialer->getValue();
784  tmpSettings.minPOISize = (SUMOReal) myPOIMinSizeDialer->getValue();
785  tmpSettings.poiName = myPOINamePanel->getSettings();
786 
787  tmpSettings.polyExaggeration = (SUMOReal) myPolyUpscaleDialer->getValue();
788  tmpSettings.minPolySize = (SUMOReal) myPolyMinSizeDialer->getValue();
789  tmpSettings.polyName = myPolyNamePanel->getSettings();
790 
791  tmpSettings.showLane2Lane = (myShowLane2Lane->getCheck() != FALSE);
792  tmpSettings.antialiase = (myAntialiase->getCheck() != FALSE);
793  tmpSettings.dither = (myDither->getCheck() != FALSE);
794  tmpSettings.showSizeLegend = (myShowSizeLegend->getCheck() != FALSE);
795 
796  // lanes
797  if (tmpSettings.getLaneEdgeMode() == prevLaneMode) {
798  if (updateColorRanges(sender, myLaneColors.begin(), myLaneColors.end(),
799  myLaneThresholds.begin(), myLaneThresholds.end(), myLaneButtons.begin(),
800  tmpSettings.getLaneEdgeScheme())) {
801  doRebuildColorMatrices = true;
802  }
803  if (sender == myLaneColorInterpolation) {
804  tmpSettings.getLaneEdgeScheme().setInterpolated(myLaneColorInterpolation->getCheck() != FALSE);
805  doRebuildColorMatrices = true;
806  }
807  } else {
808  doRebuildColorMatrices = true;
809  }
810  // vehicles
811  if (tmpSettings.vehicleColorer.getActive() == prevVehicleMode) {
812  if (updateColorRanges(sender, myVehicleColors.begin(), myVehicleColors.end(),
814  tmpSettings.vehicleColorer.getScheme())) {
815  doRebuildColorMatrices = true;
816  }
817  if (sender == myVehicleColorInterpolation) {
818  tmpSettings.vehicleColorer.getScheme().setInterpolated(myVehicleColorInterpolation->getCheck() != FALSE);
819  doRebuildColorMatrices = true;
820  }
821  } else {
822  doRebuildColorMatrices = true;
823  }
824  // persons
825  if (tmpSettings.personColorer.getActive() == prevPersonMode) {
826  if (updateColorRanges(sender, myPersonColors.begin(), myPersonColors.end(),
827  myPersonThresholds.begin(), myPersonThresholds.end(), myPersonButtons.begin(),
828  tmpSettings.personColorer.getScheme())) {
829  doRebuildColorMatrices = true;
830  }
831  if (sender == myPersonColorInterpolation) {
832  tmpSettings.personColorer.getScheme().setInterpolated(myPersonColorInterpolation->getCheck() != FALSE);
833  doRebuildColorMatrices = true;
834  }
835  } else {
836  doRebuildColorMatrices = true;
837  }
838  // junctions
839  if (tmpSettings.junctionColorer.getActive() == prevJunctionMode) {
840  if (updateColorRanges(sender, myJunctionColors.begin(), myJunctionColors.end(),
842  tmpSettings.junctionColorer.getScheme())) {
843  doRebuildColorMatrices = true;
844  }
845  if (sender == myJunctionColorInterpolation) {
846  tmpSettings.junctionColorer.getScheme().setInterpolated(myJunctionColorInterpolation->getCheck() != FALSE);
847  doRebuildColorMatrices = true;
848  }
849  } else {
850  doRebuildColorMatrices = true;
851  }
852 
853  if (tmpSettings == *mySettings) {
854  return 1;
855  }
856 
857  int index = mySchemeName->getCurrentItem();
858  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
859  // one of the initial settings is modified
860  // every time this happens we create a new scheme
861  int suffix = 1;
862  while (gSchemeStorage.contains("custom_" + toString(suffix))) {
863  suffix++;
864  }
865  tmpSettings.name = "custom_" + toString(suffix);
866  // the newly created settings must be entered in several places:
867  // - the comboBox mySchemeName of this dialog
868  // - the comboBox of the parent view (set as active)
869  // - the comboBox of all other views (only append) XXX @todo
870  index = mySchemeName->appendItem(tmpSettings.name.c_str());
871  mySchemeName->setCurrentItem(index);
872  myParent->getColoringSchemesCombo().appendItem(tmpSettings.name.c_str());
873  }
874  myParent->getColoringSchemesCombo().setCurrentItem(
875  myParent->getColoringSchemesCombo().findItem(tmpSettings.name.c_str()));
876  gSchemeStorage.add(tmpSettings); // overwrites existing
877  mySettings = &gSchemeStorage.get(tmpSettings.name);
878  myParent->setColorScheme(tmpSettings.name);
879 
880  if (doRebuildColorMatrices) {
881  rebuildColorMatrices(true);
882  }
883  myParent->forceRefresh();
884  getApp()->forceRefresh();
885  return 1;
886 }
887 
888 
889 void
890 GUIDialog_ViewSettings::loadSettings(const std::string& file) {
891  GUISettingsHandler handler(file);
892  std::string settingsName = handler.addSettings(myParent);
893  if (settingsName != "") {
894  FXint index = mySchemeName->appendItem(settingsName.c_str());
895  mySchemeName->setCurrentItem(index);
896  mySettings = &gSchemeStorage.get(settingsName);
897  }
898 }
899 
900 
901 void
902 GUIDialog_ViewSettings::saveDecals(const std::string& file) const {
903  try {
905  dev << "<decals>\n";
906  std::vector<GUISUMOAbstractView::Decal>::iterator j;
907  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
909  dev << " <decal filename=\"" << d.filename
910  << "\" centerX=\"" << d.centerX
911  << "\" centerY=\"" << d.centerY
912  << "\" centerZ=\"" << d.centerZ
913  << "\" width=\"" << d.width
914  << "\" height=\"" << d.height
915  << "\" altitude=\"" << d.altitude
916  << "\" rotation=\"" << d.rot
917  << "\" tilt=\"" << d.tilt
918  << "\" roll=\"" << d.roll
919  << "\" layer=\"" << d.layer
920  << "\"/>\n";
921  }
922  dev << "</decals>\n";
923  dev.close();
924  } catch (IOError& e) {
925  FXMessageBox::error(myParent, MBOX_OK, "Storing failed!", "%s", e.what());
926  }
927 }
928 
929 
930 void
931 GUIDialog_ViewSettings::loadDecals(const std::string& file) {
932  myDecalsLock->lock();
933  GUISettingsHandler handler(file);
934  if (handler.hasDecals()) {
935  (*myDecals) = handler.getDecals();
936  }
937  rebuildList();
938  myParent->update();
939  myDecalsLock->unlock();
940 }
941 
942 
943 long
944 GUIDialog_ViewSettings::onCmdSaveSetting(FXObject*, FXSelector, void* /*data*/) {
945  int index = mySchemeName->getCurrentItem();
946  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
947  return 1;
948  }
949  // get the name
950  std::string name = "";
951  while (name.length() == 0) {
952  FXDialogBox dialog(this, "Enter a name", DECOR_TITLE | DECOR_BORDER);
953  FXVerticalFrame* content = new FXVerticalFrame(&dialog, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10);
954  new FXLabel(content, "Please enter an alphanumeric name: ", NULL, LAYOUT_FILL_X | JUSTIFY_LEFT);
955  FXTextField* text = new FXTextField(content, 40, &dialog, FXDialogBox::ID_ACCEPT, TEXTFIELD_ENTER_ONLY | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X);
956  new FXHorizontalSeparator(content, SEPARATOR_GROOVE | LAYOUT_FILL_X);
957  FXHorizontalFrame* buttons = new FXHorizontalFrame(content, LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0);
958  new FXButton(buttons, "&OK", NULL, &dialog, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT);
959  new FXButton(buttons, "&Cancel", NULL, &dialog, FXDialogBox::ID_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT, 0, 0, 0, 0, 20, 20);
960  dialog.create();
961  text->setFocus();
962  if (!dialog.execute()) {
963  return 1;
964  }
965  name = text->getText().text();
966  for (size_t i = 0; i < name.length(); ++i) {
967  if (name[i] != '_' && (name[i] < 'a' || name[i] > 'z') && (name[i] < 'A' || name[i] > 'Z') && (name[i] < '0' || name[i] > '9')) {
968  name = "";
969  break;
970  }
971  }
972  }
973  GUIVisualizationSettings tmpSettings = *mySettings;
975  tmpSettings.name = name;
976  gSchemeStorage.add(tmpSettings);
977  mySchemeName->setItemText(index, tmpSettings.name.c_str());
978  myParent->getColoringSchemesCombo().setItemText(index, tmpSettings.name.c_str());
979  myParent->setColorScheme(tmpSettings.name);
980  mySettings = &gSchemeStorage.get(name);
981  myBackup = *mySettings;
982  gSchemeStorage.writeSettings(getApp());
983  return 1;
984 }
985 
986 
987 long
988 GUIDialog_ViewSettings::onUpdSaveSetting(FXObject* sender, FXSelector, void* ptr) {
989  sender->handle(this,
990  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
991  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
992  ptr);
993  return 1;
994 }
995 
996 
997 long
999  int index = mySchemeName->getCurrentItem();
1000  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
1001  return 1;
1002  }
1003  std::string name = mySchemeName->getItem(index).text();
1004  gSchemeStorage.remove(name);
1005  mySchemeName->removeItem(index);
1006  onCmdNameChange(0, 0, (void*) mySchemeName->getItem(0).text());
1007  gSchemeStorage.writeSettings(getApp());
1008  return 1;
1009 }
1010 
1011 
1012 long
1013 GUIDialog_ViewSettings::onUpdDeleteSetting(FXObject* sender, FXSelector, void* ptr) {
1014  sender->handle(this,
1015  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1016  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1017  ptr);
1018  return 1;
1019 }
1020 
1021 
1022 long
1024  FXFileDialog opendialog(this, "Export view settings");
1025  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1026  opendialog.setSelectMode(SELECTFILE_ANY);
1027  opendialog.setPatternList("*.xml");
1028  if (gCurrentFolder.length() != 0) {
1029  opendialog.setDirectory(gCurrentFolder);
1030  }
1031  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1032  return 1;
1033  }
1034  try {
1035  OutputDevice& dev = OutputDevice::getDevice(opendialog.getFilename().text());
1036  mySettings->save(dev);
1037  dev.close();
1038  } catch (IOError& e) {
1039  FXMessageBox::error(this, MBOX_OK, "Storing failed!", "%s", e.what());
1040  }
1041  return 1;
1042 }
1043 
1044 
1045 long
1046 GUIDialog_ViewSettings::onUpdExportSetting(FXObject* sender, FXSelector, void* ptr) {
1047  sender->handle(this,
1048  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1049  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1050  ptr);
1051  return 1;
1052 }
1053 
1054 
1055 long
1057  FXFileDialog opendialog(this, "Import view settings");
1058  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1059  opendialog.setSelectMode(SELECTFILE_ANY);
1060  opendialog.setPatternList("*.xml");
1061  if (gCurrentFolder.length() != 0) {
1062  opendialog.setDirectory(gCurrentFolder);
1063  }
1064  if (opendialog.execute()) {
1065  gCurrentFolder = opendialog.getDirectory();
1066  loadSettings(opendialog.getFilename().text());
1067  }
1068  return 1;
1069 }
1070 
1071 
1072 long
1073 GUIDialog_ViewSettings::onCmdLoadDecals(FXObject*, FXSelector, void* /*data*/) {
1074  FXFileDialog opendialog(this, "Load Decals");
1075  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1076  opendialog.setSelectMode(SELECTFILE_ANY);
1077  opendialog.setPatternList("*.xml");
1078  if (gCurrentFolder.length() != 0) {
1079  opendialog.setDirectory(gCurrentFolder);
1080  }
1081  if (opendialog.execute()) {
1082  gCurrentFolder = opendialog.getDirectory();
1083  loadDecals(opendialog.getFilename().text());
1084  }
1085  return 1;
1086 }
1087 
1088 
1089 long
1090 GUIDialog_ViewSettings::onCmdSaveDecals(FXObject*, FXSelector, void* /*data*/) {
1091  FXFileDialog opendialog(this, "Save Decals");
1092  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1093  opendialog.setSelectMode(SELECTFILE_ANY);
1094  opendialog.setPatternList("*.xml");
1095  if (gCurrentFolder.length() != 0) {
1096  opendialog.setDirectory(gCurrentFolder);
1097  }
1098  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1099  return 1;
1100  }
1101  saveDecals(opendialog.getFilename().text());
1102  return 1;
1103 }
1104 
1105 
1106 
1107 
1108 long
1109 GUIDialog_ViewSettings::onUpdImportSetting(FXObject* sender, FXSelector, void* ptr) {
1110  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1111  return 1;
1112 }
1113 
1114 
1115 void
1117  myDecalsTable->clearItems();
1118  // set table attributes
1119  myDecalsTable->setTableSize(10, 7);
1120  myDecalsTable->setColumnText(0, "picture file");
1121  myDecalsTable->setColumnText(1, "center x");
1122  myDecalsTable->setColumnText(2, "center y");
1123  myDecalsTable->setColumnText(3, "width");
1124  myDecalsTable->setColumnText(4, "height");
1125  myDecalsTable->setColumnText(5, "rotation");
1126  myDecalsTable->setColumnText(6, "layer");
1127  FXHeader* header = myDecalsTable->getColumnHeader();
1128  header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
1129  int k;
1130  for (k = 0; k < 7; k++) {
1131  header->setItemJustify(k, JUSTIFY_CENTER_X | JUSTIFY_TOP);
1132  header->setItemSize(k, 60);
1133  }
1134  header->setItemSize(0, 150);
1135  // insert already known decals information into table
1136  FXint row = 0;
1137  std::vector<GUISUMOAbstractView::Decal>::iterator j;
1138  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
1140  myDecalsTable->setItemText(row, 0, d.filename.c_str());
1141  myDecalsTable->setItemText(row, 1, toString<SUMOReal>(d.centerX).c_str());
1142  myDecalsTable->setItemText(row, 2, toString<SUMOReal>(d.centerY).c_str());
1143  myDecalsTable->setItemText(row, 3, toString<SUMOReal>(d.width).c_str());
1144  myDecalsTable->setItemText(row, 4, toString<SUMOReal>(d.height).c_str());
1145  myDecalsTable->setItemText(row, 5, toString<SUMOReal>(d.rot).c_str());
1146  myDecalsTable->setItemText(row, 6, toString<SUMOReal>(d.layer).c_str());
1147  row++;
1148  }
1149  // insert dummy last field
1150  for (k = 0; k < 7; k++) {
1151  myDecalsTable->setItemText(row, k, " ");
1152  }
1153 }
1154 
1155 
1156 FXMatrix*
1158  std::vector<FXColorWell*>& colors,
1159  std::vector<FXRealSpinDial*>& thresholds,
1160  std::vector<FXButton*>& buttons,
1161  FXCheckButton* interpolation,
1162  GUIColorScheme& scheme) {
1163  MFXUtils::deleteChildren(frame);
1164  FXMatrix* m = new FXMatrix(frame, 3,
1165  LAYOUT_FILL_X | MATRIX_BY_COLUMNS,
1166  0, 0, 0, 0, 10, 10, 0, 0, 5, 3);
1167  colors.clear();
1168  thresholds.clear();
1169  buttons.clear();
1170  const bool fixed = scheme.isFixed();
1171  std::vector<RGBColor>::const_iterator colIt = scheme.getColors().begin();
1172  std::vector<SUMOReal>::const_iterator threshIt = scheme.getThresholds().begin();
1173  std::vector<std::string>::const_iterator nameIt = scheme.getNames().begin();
1174  FX::FXString buttonText = "Add";
1175  while (colIt != scheme.getColors().end()) {
1176  colors.push_back(new FXColorWell(m , MFXUtils::getFXColor(*colIt),
1178  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1179  0, 0, 100, 0, 0, 0, 0, 0));
1180  if (fixed) {
1181  new FXLabel(m, nameIt->c_str());
1182  new FXLabel(m, "");
1183  } else {
1184  const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0;
1185  FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions);
1186  threshDialer->setValue(*threshIt);
1187  thresholds.push_back(threshDialer);
1188  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));
1189  buttonText = "Remove";
1190  }
1191  colIt++;
1192  threshIt++;
1193  nameIt++;
1194  }
1195  interpolation->setCheck(scheme.isInterpolated());
1196  if (fixed) {
1197  interpolation->disable();
1198  } else {
1199  if (colors.size() > 1) {
1200  interpolation->enable();
1201  if (interpolation->getCheck() != FALSE) {
1202  thresholds.front()->enable();
1203  } else {
1204  thresholds.front()->disable();
1205  }
1206  } else {
1207  interpolation->disable();
1208  thresholds.front()->disable();
1209  }
1210  }
1211  return m;
1212 }
1213 
1214 
1215 void
1217  // decals
1218  delete myDecalsTable;
1220  LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH/*|LAYOUT_FIX_HEIGHT*/, 0, 0, 470, 0);
1221  myDecalsTable->setVisibleRows(5);
1222  myDecalsTable->setVisibleColumns(7);
1223  myDecalsTable->setTableSize(5, 7);
1224  myDecalsTable->setBackColor(FXRGB(255, 255, 255));
1225  myDecalsTable->getRowHeader()->setWidth(0);
1226  for (int i = 1; i <= 5; ++i) {
1228  myDecalsTable->setNumberCellParams(i, -10000000, 10000000, 1, 10, 100, "%.2f");
1229  }
1230  rebuildList();
1231  if (doCreate) {
1232  myDecalsTable->create();
1233  }
1235  if (doCreate) {
1236  m->create();
1237  }
1238  myLaneColorSettingFrame->getParent()->recalc();
1240  if (doCreate) {
1241  m->create();
1242  }
1243  myPersonColorSettingFrame->getParent()->recalc();
1245  if (doCreate) {
1246  m->create();
1247  }
1248  myPersonColorSettingFrame->getParent()->recalc();
1250  if (doCreate) {
1251  m->create();
1252  }
1253  myJunctionColorSettingFrame->getParent()->recalc();
1254  layout();
1255  update();
1256 }
1257 
1258 
1259 long
1262  std::string value = i->item->getText().text();
1263  // check whether the inserted value is empty
1264  if (value.find_first_not_of(" ") == std::string::npos) {
1265  return 1;
1266  }
1268  int row = i->row;
1269  // check whether we add a new entry or edit an existing entry
1270  if (row == static_cast<int>(myDecals->size())) {
1271  d.filename = "";
1272  d.centerX = SUMOReal(myParent->getGridWidth() / 2.);
1273  d.centerY = SUMOReal(myParent->getGridHeight() / 2.);
1274  d.width = 0.;
1275  d.height = 0.;
1276  d.initialised = false;
1277  d.rot = 0;
1278  d.layer = 0;
1279  myDecalsLock->lock();
1280  myDecals->push_back(d);
1281  myDecalsLock->unlock();
1282  } else if (row > static_cast<int>(myDecals->size())) {
1283  // ignore clicks two lines below existing entries
1284  return 1;
1285  } else {
1286  d = (*myDecals)[row];
1287  }
1288 
1289  switch (i->col) {
1290  case 0:
1291  if (d.initialised && d.filename != value) {
1292  d.initialised = false;
1293  }
1294  d.filename = value;
1295  break;
1296  case 1:
1297  try {
1298  d.centerX = TplConvert::_2SUMOReal(value.c_str());
1299  } catch (NumberFormatException&) {
1300  std::string msg = "The value must be a float, is:" + value;
1301  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1302  }
1303  break;
1304  case 2:
1305  try {
1306  d.centerY = TplConvert::_2SUMOReal(value.c_str());
1307  } catch (NumberFormatException&) {
1308  std::string msg = "The value must be a float, is:" + value;
1309  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1310  }
1311  break;
1312  case 3:
1313  try {
1314  d.width = TplConvert::_2SUMOReal(value.c_str());
1315  } catch (NumberFormatException&) {
1316  std::string msg = "The value must be a float, is:" + value;
1317  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1318  }
1319  break;
1320  case 4:
1321  try {
1322  d.height = TplConvert::_2SUMOReal(value.c_str());
1323  } catch (NumberFormatException&) {
1324  std::string msg = "The value must be a float, is:" + value;
1325  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1326  }
1327  break;
1328  case 5:
1329  try {
1330  d.rot = TplConvert::_2SUMOReal(value.c_str());
1331  } catch (NumberFormatException&) {
1332  std::string msg = "The value must be a float, is:" + value;
1333  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1334  }
1335  break;
1336  case 6:
1337  try {
1338  d.layer = TplConvert::_2SUMOReal(value.c_str());
1339  } catch (NumberFormatException&) {
1340  std::string msg = "The value must be a float, is:" + value;
1341  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1342  }
1343  break;
1344  default:
1345  throw 1;
1346  }
1347  (*myDecals)[row] = d;
1348  if (!i->updateOnly) {
1349  rebuildList();
1350  }
1351  myParent->update();
1352  return 1;
1353 }
1354 
1355 
1356 std::string
1358  return mySchemeName->getItem(mySchemeName->getCurrentItem()).text();
1359 }
1360 
1361 
1362 void
1364  if (name.c_str() == mySchemeName->getItemText(mySchemeName->getCurrentItem())) {
1365  return;
1366  }
1367  for (int i = 0; i < mySchemeName->getNumItems(); ++i) {
1368  if (name.c_str() == mySchemeName->getItemText(i)) {
1369  mySchemeName->setCurrentItem(i);
1370  onCmdNameChange(0, 0, (void*)name.c_str());
1371  return;
1372  }
1373  }
1374 }
1375 
1377  FXMatrix* parent,
1378  GUIDialog_ViewSettings* target,
1379  const std::string& title,
1380  const GUIVisualizationTextSettings& settings) {
1381  myCheck = new FXCheckButton(parent, title.c_str(), target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
1382  myCheck->setCheck(settings.show);
1383  new FXLabel(parent, "");
1384  FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1385  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1386  new FXLabel(m1, "Size", 0, LAYOUT_CENTER_Y);
1387  mySizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE,
1388  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
1389  mySizeDial->setRange(10, 1000);
1390  mySizeDial->setValue(settings.size);
1391  FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1392  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1393  new FXLabel(m2, "Color", 0, LAYOUT_CENTER_Y);
1394  myColorWell = new FXColorWell(m2, MFXUtils::getFXColor(settings.color),
1395  target, MID_SIMPLE_VIEW_COLORCHANGE,
1396  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1397  0, 0, 100, 0, 0, 0, 0, 0);
1398 }
1399 
1402  return GUIVisualizationTextSettings(myCheck->getCheck() != FALSE,
1403  mySizeDial->getValue(), MFXUtils::getRGBColor(myColorWell->getRGBA()));
1404 }
1405 
1406 
1407 void
1409  myCheck->setCheck(settings.show);
1410  mySizeDial->setValue(settings.size);
1411  myColorWell->setRGBA(MFXUtils::getFXColor(settings.color));
1412 }
1413 /****************************************************************************/
1414