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