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