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