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