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  myCwaEdgeNamePanel = new NamePanel(m22, this, "Show crossing and walkingarea name", mySettings->cwaEdgeName);
240  }
241  {
242  // vehicles
243  new FXTabItem(tabbook, "Vehicles", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
244  FXVerticalFrame* frame3 =
245  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
246 
247  FXMatrix* m31 =
248  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
249  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
250  new FXLabel(m31, "Show As", 0, LAYOUT_CENTER_Y);
251  myVehicleShapeDetail = new FXComboBox(m31, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
252  myVehicleShapeDetail->appendItem("'triangles'");
253  myVehicleShapeDetail->appendItem("'boxes'");
254  myVehicleShapeDetail->appendItem("'simple shapes'");
255  myVehicleShapeDetail->appendItem("'raster images'");
256  myVehicleShapeDetail->setNumVisible(4);
257  myVehicleShapeDetail->setCurrentItem(settings->vehicleQuality);
258 
259  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
260 
261  FXMatrix* m32 =
262  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
263  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
264  new FXLabel(m32, "Color", 0, LAYOUT_CENTER_Y);
265  myVehicleColorMode = new FXComboBox(m32, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
266  mySettings->vehicleColorer.fill(*myVehicleColorMode);
267  myVehicleColorMode->setNumVisible(10);
268  myVehicleColorInterpolation = new FXCheckButton(m32, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
269 
270  FXScrollWindow* genScroll = new FXScrollWindow(frame3, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
271  myVehicleColorSettingFrame =
272  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
273 
274  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
275 
276  FXMatrix* m33 =
277  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
278  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
279  myShowBlinker = new FXCheckButton(m33, "Show blinker / brake lights", this, MID_SIMPLE_VIEW_COLORCHANGE);
280  myShowBlinker->setCheck(mySettings->showBlinker);
281  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
282  myShowMinGap = new FXCheckButton(m33, "Show minimum gap", this, MID_SIMPLE_VIEW_COLORCHANGE);
283  myShowMinGap->setCheck(mySettings->drawMinGap);
284  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
285  /*
286  myShowLaneChangePreference = new FXCheckButton(m33, "Show lane change preference", this, MID_SIMPLE_VIEW_COLORCHANGE);
287  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
288  new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y);
289  */
290  myVehicleNamePanel = new NamePanel(m33, this, "Show vehicle name", mySettings->vehicleName);
291  /*
292  FXCheckButton *tmpc = new FXCheckButton(m33, "Show braking lights", 0 ,0);
293  tmpc->disable();
294  tmpc = new FXCheckButton(m33, "Show needed headway", 0 ,0);
295  tmpc->disable();
296  */
297 
298  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
299 
300  FXMatrix* m34 =
301  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
302  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
303  FXMatrix* m341 =
304  new FXMatrix(m34, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
305  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
306  new FXLabel(m341, "Minimum size", 0, LAYOUT_CENTER_Y);
307  myVehicleMinSizeDialer =
308  new FXRealSpinDial(m341, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
309  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
310  myVehicleMinSizeDialer->setValue(mySettings->minVehicleSize);
311  FXMatrix* m342 =
312  new FXMatrix(m34, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
313  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
314  new FXLabel(m342, "Exaggerate by", 0, LAYOUT_CENTER_Y);
315  myVehicleUpscaleDialer =
316  new FXRealSpinDial(m342, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
317  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
318  myVehicleUpscaleDialer->setRange(0, 10000);
319  myVehicleUpscaleDialer->setValue(mySettings->vehicleExaggeration);
320  }
321 
322  {
323  // persons
324  new FXTabItem(tabbook, "Persons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
325  FXVerticalFrame* frame3 =
326  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
327 
328  FXMatrix* m101 =
329  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
330  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
331  new FXLabel(m101, "Show As", 0, LAYOUT_CENTER_Y);
332  myPersonShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
333  myPersonShapeDetail->appendItem("'triangles'");
334  myPersonShapeDetail->appendItem("'boxes'");
335  myPersonShapeDetail->appendItem("'simple shapes'");
336  myPersonShapeDetail->appendItem("'raster images'");
337  myPersonShapeDetail->setNumVisible(4);
338  myPersonShapeDetail->setCurrentItem(settings->personQuality);
339 
340  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
341 
342  FXMatrix* m102 =
343  new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
344  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
345  new FXLabel(m102, "Color", 0, LAYOUT_CENTER_Y);
346  myPersonColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
347  mySettings->personColorer.fill(*myPersonColorMode);
348  myPersonColorMode->setNumVisible(10);
349  myPersonColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
350 
351  FXScrollWindow* genScroll = new FXScrollWindow(frame3, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
352  myPersonColorSettingFrame =
353  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
354 
355  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
356 
357  FXMatrix* m103 =
358  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
359  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
360  myPersonNamePanel = new NamePanel(m103, this, "Show person name", mySettings->personName);
361 
362  new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X);
363 
364  FXMatrix* m104 =
365  new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
366  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
367  FXMatrix* m1041 =
368  new FXMatrix(m104, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
369  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
370  new FXLabel(m1041, "Minimum size", 0, LAYOUT_CENTER_Y);
371  myPersonMinSizeDialer =
372  new FXRealSpinDial(m1041, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
373  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
374  myPersonMinSizeDialer->setValue(mySettings->minPersonSize);
375  FXMatrix* m1042 =
376  new FXMatrix(m104, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
377  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
378  new FXLabel(m1042, "Exaggerate by", 0, LAYOUT_CENTER_Y);
379  myPersonUpscaleDialer =
380  new FXRealSpinDial(m1042, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
381  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
382  myPersonUpscaleDialer->setRange(0, 10000);
383  myPersonUpscaleDialer->setValue(mySettings->personExaggeration);
384  }
385  {
386  // nodes
387  new FXTabItem(tabbook, "Junctions", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
388  FXVerticalFrame* frame4 =
389  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
390  FXMatrix* m41 =
391  new FXMatrix(frame4, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
392  0, 0, 0, 0, 10, 10, 10, 2, 5, 5);
393  new FXLabel(m41, "Color", 0, LAYOUT_CENTER_Y);
394  myJunctionColorMode = new FXComboBox(m41, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
395  mySettings->junctionColorer.fill(*myJunctionColorMode);
396  myJunctionColorMode->setNumVisible(2);
397  myJunctionColorInterpolation = new FXCheckButton(m41, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
398 
399  FXScrollWindow* genScroll = new FXScrollWindow(frame4, LAYOUT_FILL_X | LAYOUT_SIDE_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_HEIGHT, 0, 0, 0, 80);
400  myJunctionColorSettingFrame =
401  new FXVerticalFrame(genScroll, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2);
402 
403  new FXHorizontalSeparator(frame4, SEPARATOR_GROOVE | LAYOUT_FILL_X);
404  FXMatrix* m42 =
405  new FXMatrix(frame4, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
406  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
407  myShowTLIndex = new FXCheckButton(m42, "Show link tls index", this, MID_SIMPLE_VIEW_COLORCHANGE);
408  myShowTLIndex->setCheck(mySettings->drawLinkTLIndex);
409  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
410  myShowJunctionIndex = new FXCheckButton(m42, "Show link junction index", this, MID_SIMPLE_VIEW_COLORCHANGE);
411  myShowJunctionIndex->setCheck(mySettings->drawLinkJunctionIndex);
412  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
413  myShowLane2Lane = new FXCheckButton(m42, "Show lane to lane connections", this, MID_SIMPLE_VIEW_COLORCHANGE);
414  myShowLane2Lane->setCheck(mySettings->showLane2Lane);
415  new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y);
416  myJunctionNamePanel = new NamePanel(m42, this, "Show junction name", mySettings->junctionName);
417  myInternalJunctionNamePanel = new NamePanel(m42, this, "Show internal junction name", mySettings->internalJunctionName);
418  myDrawJunctionShape = new FXCheckButton(m42, "Draw junction shape", this, MID_SIMPLE_VIEW_COLORCHANGE);
419  myDrawJunctionShape->setCheck(mySettings->drawJunctionShape);
420  } {
421  new FXTabItem(tabbook, "Detectors/Trigger", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
422  FXVerticalFrame* frame5 =
423  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
424 
425  FXMatrix* m51 =
426  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
427  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
428  myAddNamePanel = new NamePanel(m51, this, "Show detector name", mySettings->addName);
429  new FXHorizontalSeparator(frame5 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
430 
431  FXMatrix* m52 =
432  new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
433  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
434  FXMatrix* m521 =
435  new FXMatrix(m52, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
436  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
437  new FXLabel(m521, "Minimum size", 0, LAYOUT_CENTER_Y);
438  myDetectorMinSizeDialer =
439  new FXRealSpinDial(m521, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
440  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
441  FXMatrix* m522 =
442  new FXMatrix(m52, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
443  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
444  myDetectorMinSizeDialer->setValue(mySettings->minAddSize);
445  new FXLabel(m522, "Exaggerate by", 0, LAYOUT_CENTER_Y);
446  myDetectorUpscaleDialer =
447  new FXRealSpinDial(m522, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
448  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
449  myDetectorUpscaleDialer->setRange(0, 10000);
450  myDetectorUpscaleDialer->setValue(mySettings->addExaggeration);
451 
452 
453  /*
454  new FXLabel(m522, "Color", 0, LAYOUT_CENTER_Y);
455  myDetectorNameColor = new FXColorWell(m522, MFXUtils::getFXColor(settings->addNameColor),
456  this, MID_SIMPLE_VIEW_COLORCHANGE,
457  LAYOUT_FIX_WIDTH|LAYOUT_CENTER_Y|LAYOUT_SIDE_TOP|FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT,
458  0, 0, 100, 0, 0, 0, 0, 0);
459  */
460  } {
461  new FXTabItem(tabbook, "POIs", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
462  FXVerticalFrame* frame6 =
463  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
464 
465  FXMatrix* m61 =
466  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
467  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
468  myPOINamePanel = new NamePanel(m61, this, "Show poi names", mySettings->poiName);
469  new FXHorizontalSeparator(frame6 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
470 
471  FXMatrix* m62 =
472  new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
473  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
474  FXMatrix* m621 =
475  new FXMatrix(m62, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
476  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
477  new FXLabel(m621, "Minimum size to show", 0, LAYOUT_CENTER_Y);
478  myPOIMinSizeDialer =
479  new FXRealSpinDial(m621, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
480  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
481  FXMatrix* m622 =
482  new FXMatrix(m62, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
483  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
484  myPOIMinSizeDialer->setValue(mySettings->minPOISize);
485  new FXLabel(m622, "Exaggerate by", 0, LAYOUT_CENTER_Y);
486  myPOIUpscaleDialer =
487  new FXRealSpinDial(m622, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
488  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
489  myPOIUpscaleDialer->setRange(0, 10000);
490  myPOIUpscaleDialer->setValue(mySettings->addExaggeration);
491 
492 
493  } {
494  new FXTabItem(tabbook, "Polygons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
495  FXVerticalFrame* frame9 =
496  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
497 
498  FXMatrix* m91 =
499  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
500  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
501  myPolyNamePanel = new NamePanel(m91, this, "Show polygon names", mySettings->polyName);
502  new FXHorizontalSeparator(frame9 , SEPARATOR_GROOVE | LAYOUT_FILL_X);
503 
504  FXMatrix* m92 =
505  new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
506  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
507  FXMatrix* m921 =
508  new FXMatrix(m92, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
509  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
510  new FXLabel(m921, "Minimum size to show", 0, LAYOUT_CENTER_Y);
511  myPolyMinSizeDialer =
512  new FXRealSpinDial(m921, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
513  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
514  FXMatrix* m922 =
515  new FXMatrix(m92, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
516  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
517  myPolyMinSizeDialer->setValue(mySettings->minPolySize);
518  new FXLabel(m922, "Exaggerate by", 0, LAYOUT_CENTER_Y);
519  myPolyUpscaleDialer =
520  new FXRealSpinDial(m922, 10, this, MID_SIMPLE_VIEW_COLORCHANGE,
521  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
522  myPolyUpscaleDialer->setRange(0, 10000);
523  myPolyUpscaleDialer->setValue(mySettings->addExaggeration);
524 
525 
526  }{
527  new FXTabItem(tabbook, "Legend", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
528  FXVerticalFrame* frame7 =
529  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
530 
531  FXMatrix* m72 =
532  new FXMatrix(frame7, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
533  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
534  myShowSizeLegend = new FXCheckButton(m72, "Show Size Legend", this, MID_SIMPLE_VIEW_COLORCHANGE);
535  myShowSizeLegend->setCheck(mySettings->showSizeLegend);
536  new FXLabel(m72, "");
537  } {
538  new FXTabItem(tabbook, "openGL", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4);
539  FXVerticalFrame* frame8 =
540  new FXVerticalFrame(tabbook, FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
541 
542  FXMatrix* m82 =
543  new FXMatrix(frame8, 1, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
544  0, 0, 0, 0, 10, 10, 10, 10, 5, 5);
545  myAntialiase = new FXCheckButton(m82, "Antialiase", this, MID_SIMPLE_VIEW_COLORCHANGE);
546  myAntialiase->setCheck(mySettings->antialiase);
547  myDither = new FXCheckButton(m82, "Dither", this, MID_SIMPLE_VIEW_COLORCHANGE);
548  myDither->setCheck(mySettings->dither);
549  }
550  FXHorizontalFrame* f2 = new FXHorizontalFrame(contentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
551  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);
552  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);
553  initial->setFocus();
554 
555  rebuildColorMatrices(false);
557 }
558 
559 
561  myParent->remove(this);
562  delete myEdgeNamePanel;
564  delete myCwaEdgeNamePanel;
565  delete myStreetNamePanel;
566  delete myJunctionNamePanel;
568  delete myVehicleNamePanel;
569  delete myAddNamePanel;
570  delete myPOINamePanel;
571  delete myPolyNamePanel;
572 }
573 
574 
575 void
577  mySettings = settings;
578  myBackup = (*settings);
579  onCmdNameChange(0, 0, 0);
580 }
581 
582 
583 long
585  hide();
586  return 1;
587 }
588 
589 
590 long
592  hide();
593  (*mySettings) = myBackup;
594  return 1;
595 }
596 
597 
598 long
600  if (data != 0) {
601  FXString dataS = (char*) data; // !!!unicode
602  // check whether this item has been added twice
603  if (dataS == mySchemeName->getItemText(mySchemeName->getNumItems() - 1)) {
604  for (int i = 0; i < mySchemeName->getNumItems() - 1; ++i) {
605  if (dataS == mySchemeName->getItemText(i)) {
606  mySchemeName->removeItem(i);
607  }
608  }
609  }
610  myBackup = gSchemeStorage.get(dataS.text());
611  mySettings = &gSchemeStorage.get(dataS.text());
612  }
613  rebuildColorMatrices(true);
614 
616 
617  myLaneEdgeColorMode->setCurrentItem((FXint) mySettings->getLaneEdgeMode());
620  myShowRails->setCheck(mySettings->showRails);
627 
628  myVehicleColorMode->setCurrentItem((FXint) mySettings->vehicleColorer.getActive());
633  myShowMinGap->setCheck(mySettings->drawMinGap);
634  /*
635  myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference);
636  */
638 
639  myPersonColorMode->setCurrentItem((FXint) mySettings->personColorer.getActive());
640  myPersonShapeDetail->setCurrentItem(mySettings->personQuality);
644 
645  myJunctionColorMode->setCurrentItem((FXint) mySettings->junctionColorer.getActive());
650 
654 
658 
662 
665  myAntialiase->setCheck(mySettings->antialiase);
666  myDither->setCheck(mySettings->dither);
668 
670  update();
671  myParent->update();
672  return 1;
673 }
674 
675 
676 bool
677 GUIDialog_ViewSettings::updateColorRanges(FXObject* sender, std::vector<FXColorWell*>::const_iterator colIt,
678  std::vector<FXColorWell*>::const_iterator colEnd,
679  std::vector<FXRealSpinDial*>::const_iterator threshIt,
680  std::vector<FXRealSpinDial*>::const_iterator threshEnd,
681  std::vector<FXButton*>::const_iterator buttonIt,
682  GUIColorScheme& scheme) {
683  size_t pos = 0;
684  while (colIt != colEnd) {
685  if (scheme.isFixed()) {
686  if (sender == *colIt) {
687  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
688  }
689  } else {
690  if (sender == *threshIt) {
691  const SUMOReal val = (*threshIt)->getValue();
692  double lo, hi;
693  if (pos != 0) {
694  threshIt--;
695  (*threshIt)->getRange(lo, hi);
696  (*threshIt)->setRange(lo, val);
697  threshIt++;
698  }
699  threshIt++;
700  if (threshIt != threshEnd) {
701  (*threshIt)->getRange(lo, hi);
702  (*threshIt)->setRange(val, hi);
703  }
704  scheme.setThreshold(pos, val);
705  return false;
706  }
707  if (sender == *colIt) {
708  scheme.setColor(pos, MFXUtils::getRGBColor((*colIt)->getRGBA()));
709  return false;
710  }
711  if (sender == *buttonIt) {
712  if (pos == 0) {
713  scheme.addColor(MFXUtils::getRGBColor((*colIt)->getRGBA()), (*threshIt)->getValue());
714  } else {
715  scheme.removeColor(pos);
716  }
717  return true;
718  }
719  ++threshIt;
720  ++buttonIt;
721  }
722  ++colIt;
723  pos++;
724  }
725  return false;
726 }
727 
728 
729 long
730 GUIDialog_ViewSettings::onCmdColorChange(FXObject* sender, FXSelector, void* /*val*/) {
731  GUIVisualizationSettings tmpSettings = *mySettings;
732  size_t prevLaneMode = mySettings->getLaneEdgeMode();
733  size_t prevVehicleMode = mySettings->vehicleColorer.getActive();
734  size_t prevPersonMode = mySettings->personColorer.getActive();
735  size_t prevJunctionMode = mySettings->junctionColorer.getActive();
736  bool doRebuildColorMatrices = false;
737 
738  tmpSettings.name = mySettings->name;
739  tmpSettings.backgroundColor = MFXUtils::getRGBColor(myBackgroundColor->getRGBA());
740  tmpSettings.showGrid = (myShowGrid->getCheck() != FALSE);
741  tmpSettings.gridXSize = (SUMOReal) myGridXSizeDialer->getValue();
742  tmpSettings.gridYSize = (SUMOReal) myGridYSizeDialer->getValue();
743 
744 #ifdef HAVE_INTERNAL
745  if (GUIVisualizationSettings::UseMesoSim) {
746  tmpSettings.edgeColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
747  } else {
748 #endif
749  tmpSettings.laneColorer.setActive(myLaneEdgeColorMode->getCurrentItem());
750 #ifdef HAVE_INTERNAL
751  }
752 #endif
753  tmpSettings.laneShowBorders = (myShowLaneBorders->getCheck() != FALSE);
754  tmpSettings.showLinkDecals = (myShowLaneDecals->getCheck() != FALSE);
755  tmpSettings.showRails = (myShowRails->getCheck() != FALSE);
756  tmpSettings.edgeName = myEdgeNamePanel->getSettings();
758  tmpSettings.cwaEdgeName = myCwaEdgeNamePanel->getSettings();
759  tmpSettings.streetName = myStreetNamePanel->getSettings();
760  tmpSettings.hideConnectors = (myHideMacroConnectors->getCheck() != FALSE);
761  tmpSettings.laneWidthExaggeration = (SUMOReal) myLaneWidthUpscaleDialer->getValue();
762 
763  tmpSettings.vehicleColorer.setActive(myVehicleColorMode->getCurrentItem());
764  tmpSettings.vehicleQuality = myVehicleShapeDetail->getCurrentItem();
765  tmpSettings.vehicleExaggeration = (SUMOReal) myVehicleUpscaleDialer->getValue();
766  tmpSettings.minVehicleSize = (SUMOReal) myVehicleMinSizeDialer->getValue();
767  tmpSettings.showBlinker = (myShowBlinker->getCheck() != FALSE);
768  tmpSettings.drawMinGap = (myShowMinGap->getCheck() != FALSE);
769  /*
770  tmpSettings.drawLaneChangePreference = (myShowLaneChangePreference->getCheck() != FALSE);
771  */
772  tmpSettings.vehicleName = myVehicleNamePanel->getSettings();
773 
774  tmpSettings.personColorer.setActive(myPersonColorMode->getCurrentItem());
775  tmpSettings.personQuality = myPersonShapeDetail->getCurrentItem();
776  tmpSettings.personExaggeration = (SUMOReal) myPersonUpscaleDialer->getValue();
777  tmpSettings.minPersonSize = (SUMOReal) myPersonMinSizeDialer->getValue();
778  tmpSettings.personName = myPersonNamePanel->getSettings();
779 
780  tmpSettings.junctionColorer.setActive(myJunctionColorMode->getCurrentItem());
781  tmpSettings.drawLinkTLIndex = (myShowTLIndex->getCheck() != FALSE);
782  tmpSettings.drawLinkJunctionIndex = (myShowJunctionIndex->getCheck() != FALSE);
785 
786  tmpSettings.addExaggeration = (SUMOReal) myDetectorUpscaleDialer->getValue();
787  tmpSettings.minAddSize = (SUMOReal) myDetectorMinSizeDialer->getValue();
788  tmpSettings.addName = myAddNamePanel->getSettings();
789 
790  tmpSettings.poiExaggeration = (SUMOReal) myPOIUpscaleDialer->getValue();
791  tmpSettings.minPOISize = (SUMOReal) myPOIMinSizeDialer->getValue();
792  tmpSettings.poiName = myPOINamePanel->getSettings();
793 
794  tmpSettings.polyExaggeration = (SUMOReal) myPolyUpscaleDialer->getValue();
795  tmpSettings.minPolySize = (SUMOReal) myPolyMinSizeDialer->getValue();
796  tmpSettings.polyName = myPolyNamePanel->getSettings();
797 
798  tmpSettings.showLane2Lane = (myShowLane2Lane->getCheck() != FALSE);
799  tmpSettings.drawJunctionShape = (myDrawJunctionShape->getCheck() != FALSE);
800  tmpSettings.antialiase = (myAntialiase->getCheck() != FALSE);
801  tmpSettings.dither = (myDither->getCheck() != FALSE);
802  tmpSettings.showSizeLegend = (myShowSizeLegend->getCheck() != FALSE);
803 
804  // lanes
805  if (tmpSettings.getLaneEdgeMode() == prevLaneMode) {
806  if (updateColorRanges(sender, myLaneColors.begin(), myLaneColors.end(),
807  myLaneThresholds.begin(), myLaneThresholds.end(), myLaneButtons.begin(),
808  tmpSettings.getLaneEdgeScheme())) {
809  doRebuildColorMatrices = true;
810  }
811  if (sender == myLaneColorInterpolation) {
812  tmpSettings.getLaneEdgeScheme().setInterpolated(myLaneColorInterpolation->getCheck() != FALSE);
813  doRebuildColorMatrices = true;
814  }
815  } else {
816  doRebuildColorMatrices = true;
817  }
818  // vehicles
819  if (tmpSettings.vehicleColorer.getActive() == prevVehicleMode) {
820  if (updateColorRanges(sender, myVehicleColors.begin(), myVehicleColors.end(),
822  tmpSettings.vehicleColorer.getScheme())) {
823  doRebuildColorMatrices = true;
824  }
825  if (sender == myVehicleColorInterpolation) {
826  tmpSettings.vehicleColorer.getScheme().setInterpolated(myVehicleColorInterpolation->getCheck() != FALSE);
827  doRebuildColorMatrices = true;
828  }
829  } else {
830  doRebuildColorMatrices = true;
831  }
832  // persons
833  if (tmpSettings.personColorer.getActive() == prevPersonMode) {
834  if (updateColorRanges(sender, myPersonColors.begin(), myPersonColors.end(),
835  myPersonThresholds.begin(), myPersonThresholds.end(), myPersonButtons.begin(),
836  tmpSettings.personColorer.getScheme())) {
837  doRebuildColorMatrices = true;
838  }
839  if (sender == myPersonColorInterpolation) {
840  tmpSettings.personColorer.getScheme().setInterpolated(myPersonColorInterpolation->getCheck() != FALSE);
841  doRebuildColorMatrices = true;
842  }
843  } else {
844  doRebuildColorMatrices = true;
845  }
846  // junctions
847  if (tmpSettings.junctionColorer.getActive() == prevJunctionMode) {
848  if (updateColorRanges(sender, myJunctionColors.begin(), myJunctionColors.end(),
850  tmpSettings.junctionColorer.getScheme())) {
851  doRebuildColorMatrices = true;
852  }
853  if (sender == myJunctionColorInterpolation) {
854  tmpSettings.junctionColorer.getScheme().setInterpolated(myJunctionColorInterpolation->getCheck() != FALSE);
855  doRebuildColorMatrices = true;
856  }
857  } else {
858  doRebuildColorMatrices = true;
859  }
860 
861  if (tmpSettings == *mySettings) {
862  return 1;
863  }
864 
865  int index = mySchemeName->getCurrentItem();
866  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
867  // one of the initial settings is modified
868  // every time this happens we create a new scheme
869  int suffix = 1;
870  while (gSchemeStorage.contains("custom_" + toString(suffix))) {
871  suffix++;
872  }
873  tmpSettings.name = "custom_" + toString(suffix);
874  // the newly created settings must be entered in several places:
875  // - the comboBox mySchemeName of this dialog
876  // - the comboBox of the parent view (set as active)
877  // - the comboBox of all other views (only append) XXX @todo
878  index = mySchemeName->appendItem(tmpSettings.name.c_str());
879  mySchemeName->setCurrentItem(index);
880  myParent->getColoringSchemesCombo().appendItem(tmpSettings.name.c_str());
881  }
882  myParent->getColoringSchemesCombo().setCurrentItem(
883  myParent->getColoringSchemesCombo().findItem(tmpSettings.name.c_str()));
884  gSchemeStorage.add(tmpSettings); // overwrites existing
885  mySettings = &gSchemeStorage.get(tmpSettings.name);
886  myParent->setColorScheme(tmpSettings.name);
887 
888  if (doRebuildColorMatrices) {
889  rebuildColorMatrices(true);
890  }
891  myParent->forceRefresh();
892  getApp()->forceRefresh();
893  return 1;
894 }
895 
896 
897 void
898 GUIDialog_ViewSettings::loadSettings(const std::string& file) {
899  GUISettingsHandler handler(file);
900  std::string settingsName = handler.addSettings(myParent);
901  if (settingsName != "") {
902  FXint index = mySchemeName->appendItem(settingsName.c_str());
903  mySchemeName->setCurrentItem(index);
904  mySettings = &gSchemeStorage.get(settingsName);
905  }
906 }
907 
908 
909 void
910 GUIDialog_ViewSettings::saveDecals(const std::string& file) const {
911  try {
913  dev << "<decals>\n";
914  std::vector<GUISUMOAbstractView::Decal>::iterator j;
915  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
917  dev << " <decal filename=\"" << d.filename
918  << "\" centerX=\"" << d.centerX
919  << "\" centerY=\"" << d.centerY
920  << "\" centerZ=\"" << d.centerZ
921  << "\" width=\"" << d.width
922  << "\" height=\"" << d.height
923  << "\" altitude=\"" << d.altitude
924  << "\" rotation=\"" << d.rot
925  << "\" tilt=\"" << d.tilt
926  << "\" roll=\"" << d.roll
927  << "\" layer=\"" << d.layer
928  << "\"/>\n";
929  }
930  dev << "</decals>\n";
931  dev.close();
932  } catch (IOError& e) {
933  FXMessageBox::error(myParent, MBOX_OK, "Storing failed!", "%s", e.what());
934  }
935 }
936 
937 
938 void
939 GUIDialog_ViewSettings::loadDecals(const std::string& file) {
940  myDecalsLock->lock();
941  GUISettingsHandler handler(file);
942  if (handler.hasDecals()) {
943  (*myDecals) = handler.getDecals();
944  }
945  rebuildList();
946  myParent->update();
947  myDecalsLock->unlock();
948 }
949 
950 
951 long
952 GUIDialog_ViewSettings::onCmdSaveSetting(FXObject*, FXSelector, void* /*data*/) {
953  int index = mySchemeName->getCurrentItem();
954  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
955  return 1;
956  }
957  // get the name
958  std::string name = "";
959  while (name.length() == 0) {
960  FXDialogBox dialog(this, "Enter a name", DECOR_TITLE | DECOR_BORDER);
961  FXVerticalFrame* content = new FXVerticalFrame(&dialog, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10);
962  new FXLabel(content, "Please enter an alphanumeric name: ", NULL, LAYOUT_FILL_X | JUSTIFY_LEFT);
963  FXTextField* text = new FXTextField(content, 40, &dialog, FXDialogBox::ID_ACCEPT, TEXTFIELD_ENTER_ONLY | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X);
964  new FXHorizontalSeparator(content, SEPARATOR_GROOVE | LAYOUT_FILL_X);
965  FXHorizontalFrame* buttons = new FXHorizontalFrame(content, LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0);
966  new FXButton(buttons, "&OK", NULL, &dialog, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT);
967  new FXButton(buttons, "&Cancel", NULL, &dialog, FXDialogBox::ID_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT, 0, 0, 0, 0, 20, 20);
968  dialog.create();
969  text->setFocus();
970  if (!dialog.execute()) {
971  return 1;
972  }
973  name = text->getText().text();
974  for (size_t i = 0; i < name.length(); ++i) {
975  if (name[i] != '_' && (name[i] < 'a' || name[i] > 'z') && (name[i] < 'A' || name[i] > 'Z') && (name[i] < '0' || name[i] > '9')) {
976  name = "";
977  break;
978  }
979  }
980  }
981  GUIVisualizationSettings tmpSettings = *mySettings;
983  tmpSettings.name = name;
984  gSchemeStorage.add(tmpSettings);
985  mySchemeName->setItemText(index, tmpSettings.name.c_str());
986  myParent->getColoringSchemesCombo().setItemText(index, tmpSettings.name.c_str());
987  myParent->setColorScheme(tmpSettings.name);
988  mySettings = &gSchemeStorage.get(name);
989  myBackup = *mySettings;
990  gSchemeStorage.writeSettings(getApp());
991  return 1;
992 }
993 
994 
995 long
996 GUIDialog_ViewSettings::onUpdSaveSetting(FXObject* sender, FXSelector, void* ptr) {
997  sender->handle(this,
998  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
999  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1000  ptr);
1001  return 1;
1002 }
1003 
1004 
1005 long
1007  int index = mySchemeName->getCurrentItem();
1008  if (index < (int) gSchemeStorage.getNumInitialSettings()) {
1009  return 1;
1010  }
1011  std::string name = mySchemeName->getItem(index).text();
1012  gSchemeStorage.remove(name);
1013  mySchemeName->removeItem(index);
1014  onCmdNameChange(0, 0, (void*) mySchemeName->getItem(0).text());
1015  gSchemeStorage.writeSettings(getApp());
1016  return 1;
1017 }
1018 
1019 
1020 long
1021 GUIDialog_ViewSettings::onUpdDeleteSetting(FXObject* sender, FXSelector, void* ptr) {
1022  sender->handle(this,
1023  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1024  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1025  ptr);
1026  return 1;
1027 }
1028 
1029 
1030 long
1032  FXFileDialog opendialog(this, "Export view settings");
1033  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1034  opendialog.setSelectMode(SELECTFILE_ANY);
1035  opendialog.setPatternList("*.xml");
1036  if (gCurrentFolder.length() != 0) {
1037  opendialog.setDirectory(gCurrentFolder);
1038  }
1039  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1040  return 1;
1041  }
1042  try {
1043  OutputDevice& dev = OutputDevice::getDevice(opendialog.getFilename().text());
1044  mySettings->save(dev);
1045  dev.close();
1046  } catch (IOError& e) {
1047  FXMessageBox::error(this, MBOX_OK, "Storing failed!", "%s", e.what());
1048  }
1049  return 1;
1050 }
1051 
1052 
1053 long
1054 GUIDialog_ViewSettings::onUpdExportSetting(FXObject* sender, FXSelector, void* ptr) {
1055  sender->handle(this,
1056  mySchemeName->getCurrentItem() < (int) gSchemeStorage.getNumInitialSettings()
1057  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1058  ptr);
1059  return 1;
1060 }
1061 
1062 
1063 long
1065  FXFileDialog opendialog(this, "Import view settings");
1066  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1067  opendialog.setSelectMode(SELECTFILE_ANY);
1068  opendialog.setPatternList("*.xml");
1069  if (gCurrentFolder.length() != 0) {
1070  opendialog.setDirectory(gCurrentFolder);
1071  }
1072  if (opendialog.execute()) {
1073  gCurrentFolder = opendialog.getDirectory();
1074  loadSettings(opendialog.getFilename().text());
1075  }
1076  return 1;
1077 }
1078 
1079 
1080 long
1081 GUIDialog_ViewSettings::onCmdLoadDecals(FXObject*, FXSelector, void* /*data*/) {
1082  FXFileDialog opendialog(this, "Load Decals");
1083  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1084  opendialog.setSelectMode(SELECTFILE_ANY);
1085  opendialog.setPatternList("*.xml");
1086  if (gCurrentFolder.length() != 0) {
1087  opendialog.setDirectory(gCurrentFolder);
1088  }
1089  if (opendialog.execute()) {
1090  gCurrentFolder = opendialog.getDirectory();
1091  loadDecals(opendialog.getFilename().text());
1092  }
1093  return 1;
1094 }
1095 
1096 
1097 long
1098 GUIDialog_ViewSettings::onCmdSaveDecals(FXObject*, FXSelector, void* /*data*/) {
1099  FXFileDialog opendialog(this, "Save Decals");
1100  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
1101  opendialog.setSelectMode(SELECTFILE_ANY);
1102  opendialog.setPatternList("*.xml");
1103  if (gCurrentFolder.length() != 0) {
1104  opendialog.setDirectory(gCurrentFolder);
1105  }
1106  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1107  return 1;
1108  }
1109  saveDecals(opendialog.getFilename().text());
1110  return 1;
1111 }
1112 
1113 
1114 
1115 
1116 long
1117 GUIDialog_ViewSettings::onUpdImportSetting(FXObject* sender, FXSelector, void* ptr) {
1118  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1119  return 1;
1120 }
1121 
1122 
1123 void
1125  myDecalsTable->clearItems();
1126  // set table attributes
1127  myDecalsTable->setTableSize(10, 7);
1128  myDecalsTable->setColumnText(0, "picture file");
1129  myDecalsTable->setColumnText(1, "center x");
1130  myDecalsTable->setColumnText(2, "center y");
1131  myDecalsTable->setColumnText(3, "width");
1132  myDecalsTable->setColumnText(4, "height");
1133  myDecalsTable->setColumnText(5, "rotation");
1134  myDecalsTable->setColumnText(6, "layer");
1135  FXHeader* header = myDecalsTable->getColumnHeader();
1136  header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
1137  int k;
1138  for (k = 0; k < 7; k++) {
1139  header->setItemJustify(k, JUSTIFY_CENTER_X | JUSTIFY_TOP);
1140  header->setItemSize(k, 60);
1141  }
1142  header->setItemSize(0, 150);
1143  // insert already known decals information into table
1144  FXint row = 0;
1145  std::vector<GUISUMOAbstractView::Decal>::iterator j;
1146  for (j = myDecals->begin(); j != myDecals->end(); ++j) {
1148  myDecalsTable->setItemText(row, 0, d.filename.c_str());
1149  myDecalsTable->setItemText(row, 1, toString<SUMOReal>(d.centerX).c_str());
1150  myDecalsTable->setItemText(row, 2, toString<SUMOReal>(d.centerY).c_str());
1151  myDecalsTable->setItemText(row, 3, toString<SUMOReal>(d.width).c_str());
1152  myDecalsTable->setItemText(row, 4, toString<SUMOReal>(d.height).c_str());
1153  myDecalsTable->setItemText(row, 5, toString<SUMOReal>(d.rot).c_str());
1154  myDecalsTable->setItemText(row, 6, toString<SUMOReal>(d.layer).c_str());
1155  row++;
1156  }
1157  // insert dummy last field
1158  for (k = 0; k < 7; k++) {
1159  myDecalsTable->setItemText(row, k, " ");
1160  }
1161 }
1162 
1163 
1164 FXMatrix*
1166  std::vector<FXColorWell*>& colors,
1167  std::vector<FXRealSpinDial*>& thresholds,
1168  std::vector<FXButton*>& buttons,
1169  FXCheckButton* interpolation,
1170  GUIColorScheme& scheme) {
1171  MFXUtils::deleteChildren(frame);
1172  FXMatrix* m = new FXMatrix(frame, 3,
1173  LAYOUT_FILL_X | MATRIX_BY_COLUMNS,
1174  0, 0, 0, 0, 10, 10, 0, 0, 5, 3);
1175  colors.clear();
1176  thresholds.clear();
1177  buttons.clear();
1178  const bool fixed = scheme.isFixed();
1179  std::vector<RGBColor>::const_iterator colIt = scheme.getColors().begin();
1180  std::vector<SUMOReal>::const_iterator threshIt = scheme.getThresholds().begin();
1181  std::vector<std::string>::const_iterator nameIt = scheme.getNames().begin();
1182  FX::FXString buttonText = "Add";
1183  while (colIt != scheme.getColors().end()) {
1184  colors.push_back(new FXColorWell(m , MFXUtils::getFXColor(*colIt),
1186  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1187  0, 0, 100, 0, 0, 0, 0, 0));
1188  if (fixed) {
1189  new FXLabel(m, nameIt->c_str());
1190  new FXLabel(m, "");
1191  } else {
1192  const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0;
1193  FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions);
1194  threshDialer->setValue(*threshIt);
1195  thresholds.push_back(threshDialer);
1196  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));
1197  buttonText = "Remove";
1198  }
1199  colIt++;
1200  threshIt++;
1201  nameIt++;
1202  }
1203  interpolation->setCheck(scheme.isInterpolated());
1204  if (fixed) {
1205  interpolation->disable();
1206  } else {
1207  if (colors.size() > 1) {
1208  interpolation->enable();
1209  if (interpolation->getCheck() != FALSE) {
1210  thresholds.front()->enable();
1211  } else {
1212  thresholds.front()->disable();
1213  }
1214  } else {
1215  interpolation->disable();
1216  thresholds.front()->disable();
1217  }
1218  }
1219  return m;
1220 }
1221 
1222 
1223 void
1225  // decals
1226  delete myDecalsTable;
1228  LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH/*|LAYOUT_FIX_HEIGHT*/, 0, 0, 470, 0);
1229  myDecalsTable->setVisibleRows(5);
1230  myDecalsTable->setVisibleColumns(7);
1231  myDecalsTable->setTableSize(5, 7);
1232  myDecalsTable->setBackColor(FXRGB(255, 255, 255));
1233  myDecalsTable->getRowHeader()->setWidth(0);
1234  for (int i = 1; i <= 5; ++i) {
1236  myDecalsTable->setNumberCellParams(i, -10000000, 10000000, 1, 10, 100, "%.2f");
1237  }
1238  rebuildList();
1239  if (doCreate) {
1240  myDecalsTable->create();
1241  }
1243  if (doCreate) {
1244  m->create();
1245  }
1246  myLaneColorSettingFrame->getParent()->recalc();
1248  if (doCreate) {
1249  m->create();
1250  }
1251  myPersonColorSettingFrame->getParent()->recalc();
1253  if (doCreate) {
1254  m->create();
1255  }
1256  myPersonColorSettingFrame->getParent()->recalc();
1258  if (doCreate) {
1259  m->create();
1260  }
1261  myJunctionColorSettingFrame->getParent()->recalc();
1262  layout();
1263  update();
1264 }
1265 
1266 
1267 long
1270  std::string value = i->item->getText().text();
1271  // check whether the inserted value is empty
1272  if (value.find_first_not_of(" ") == std::string::npos) {
1273  return 1;
1274  }
1276  int row = i->row;
1277  // check whether we add a new entry or edit an existing entry
1278  if (row == static_cast<int>(myDecals->size())) {
1279  d.filename = "";
1280  d.centerX = SUMOReal(myParent->getGridWidth() / 2.);
1281  d.centerY = SUMOReal(myParent->getGridHeight() / 2.);
1282  d.width = 0.;
1283  d.height = 0.;
1284  d.initialised = false;
1285  d.rot = 0;
1286  d.layer = 0;
1287  myDecalsLock->lock();
1288  myDecals->push_back(d);
1289  myDecalsLock->unlock();
1290  } else if (row > static_cast<int>(myDecals->size())) {
1291  // ignore clicks two lines below existing entries
1292  return 1;
1293  } else {
1294  d = (*myDecals)[row];
1295  }
1296 
1297  switch (i->col) {
1298  case 0:
1299  if (d.initialised && d.filename != value) {
1300  d.initialised = false;
1301  }
1302  d.filename = value;
1303  break;
1304  case 1:
1305  try {
1306  d.centerX = 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 2:
1313  try {
1314  d.centerY = 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 3:
1321  try {
1322  d.width = 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 4:
1329  try {
1330  d.height = 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 5:
1337  try {
1338  d.rot = 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  case 6:
1345  try {
1346  d.layer = TplConvert::_2SUMOReal(value.c_str());
1347  } catch (NumberFormatException&) {
1348  std::string msg = "The value must be a float, is:" + value;
1349  FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str());
1350  }
1351  break;
1352  default:
1353  throw 1;
1354  }
1355  (*myDecals)[row] = d;
1356  if (!i->updateOnly) {
1357  rebuildList();
1358  }
1359  myParent->update();
1360  return 1;
1361 }
1362 
1363 
1364 std::string
1366  return mySchemeName->getItem(mySchemeName->getCurrentItem()).text();
1367 }
1368 
1369 
1370 void
1372  if (name.c_str() == mySchemeName->getItemText(mySchemeName->getCurrentItem())) {
1373  return;
1374  }
1375  for (int i = 0; i < mySchemeName->getNumItems(); ++i) {
1376  if (name.c_str() == mySchemeName->getItemText(i)) {
1377  mySchemeName->setCurrentItem(i);
1378  onCmdNameChange(0, 0, (void*)name.c_str());
1379  return;
1380  }
1381  }
1382 }
1383 
1385  FXMatrix* parent,
1386  GUIDialog_ViewSettings* target,
1387  const std::string& title,
1388  const GUIVisualizationTextSettings& settings) {
1389  myCheck = new FXCheckButton(parent, title.c_str(), target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL);
1390  myCheck->setCheck(settings.show);
1391  new FXLabel(parent, "");
1392  FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1393  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1394  new FXLabel(m1, "Size", 0, LAYOUT_CENTER_Y);
1395  mySizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE,
1396  LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
1397  mySizeDial->setRange(10, 1000);
1398  mySizeDial->setValue(settings.size);
1399  FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS,
1400  0, 0, 0, 0, 10, 10, 0, 0, 5, 5);
1401  new FXLabel(m2, "Color", 0, LAYOUT_CENTER_Y);
1402  myColorWell = new FXColorWell(m2, MFXUtils::getFXColor(settings.color),
1403  target, MID_SIMPLE_VIEW_COLORCHANGE,
1404  LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT,
1405  0, 0, 100, 0, 0, 0, 0, 0);
1406 }
1407 
1410  return GUIVisualizationTextSettings(myCheck->getCheck() != FALSE,
1411  mySizeDial->getValue(), MFXUtils::getRGBColor(myColorWell->getRGBA()));
1412 }
1413 
1414 
1415 void
1417  myCheck->setCheck(settings.show);
1418  mySizeDial->setValue(settings.size);
1419  myColorWell->setRGBA(MFXUtils::getFXColor(settings.color));
1420 }
1421 /****************************************************************************/
1422