73 FXIMPLEMENT(
GUIDialog_ViewSettings, FXDialogBox, GUIDialog_ViewSettingsMap, ARRAYNUMBER(GUIDialog_ViewSettingsMap))
81 myParent(parent), mySettings(settings),
82 myDecals(decals), myDecalsLock(decalsLock),
83 myDecalsTable(
nullptr) {
84 myBackup = (*mySettings);
92 for (std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i) {
93 int index = mySchemeName->appendItem((*i).c_str());
94 if ((*i) == mySettings->name) {
95 mySchemeName->setCurrentItem((FXint) index);
98 mySchemeName->setNumVisible(5);
105 new FXVerticalSeparator(frame0);
107 mySaveViewPort =
new FXCheckButton(frame0,
"Viewport");
108 mySaveDelay =
new FXCheckButton(frame0,
"Delay");
109 mySaveDecals =
new FXCheckButton(frame0,
"Decals");
110 mySaveBreakpoints =
new FXCheckButton(frame0,
"Breakpoints");
111 if (settings->netedit) {
112 mySaveBreakpoints->disable();
120 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
130 new FXLabel(frame11,
"Decals:");
131 myDecalsFrame =
new FXVerticalFrame(frame11);
140 myShowGrid->setCheck(mySettings->showGrid);
141 new FXLabel(m12,
"");
145 myGridXSizeDialer->setRange(1, 10000);
146 myGridXSizeDialer->setValue(mySettings->gridXSize);
150 myGridYSizeDialer->setRange(1, 10000);
151 myGridYSizeDialer->setValue(mySettings->gridXSize);
156 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
166 myParamKey->disable();
167 myParamKey->setEditable(
true);
172 (BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT), 0, 0, 0, 0, 20, 20, 4, 4);
186 mySettings->edgeColorer.fill(*myLaneEdgeColorMode);
187 mySettings->edgeScaler.fill(*myLaneEdgeScaleMode);
188 myLaneEdgeColorMode->setNumVisible((
int)mySettings->edgeColorer.size());
189 myLaneEdgeScaleMode->setNumVisible((
int)mySettings->edgeScaler.size());
191 mySettings->laneColorer.fill(*myLaneEdgeColorMode);
192 mySettings->laneScaler.fill(*myLaneEdgeScaleMode);
193 myLaneEdgeColorMode->setNumVisible((
int)mySettings->laneColorer.size());
194 myLaneEdgeScaleMode->setNumVisible((
int)mySettings->laneScaler.size());
200 myShowLaneBorders->setCheck(mySettings->laneShowBorders);
202 myShowBikeMarkings->setCheck(mySettings->showBikeMarkings);
204 myShowLaneDecals->setCheck(mySettings->showLinkDecals);
207 myShowLinkRules->setCheck(mySettings->showLinkRules);
210 myShowRails->setCheck(mySettings->showRails);
213 myHideMacroConnectors->setCheck(mySettings->hideConnectors);
216 myShowLaneDirection->setCheck(mySettings->showLaneDirection);
219 myShowSublanes->setCheck(mySettings->showSublanes);
220 mySpreadSuperposed =
new FXCheckButton(m22,
"Spread bidirectional railway\t\tMake both directional edges for a bidirectional railway visible",
this,
MID_SIMPLE_VIEW_COLORCHANGE);
221 mySpreadSuperposed->setCheck(mySettings->spreadSuperposed);
224 myLaneWidthUpscaleDialer->setRange(0, 10000);
225 myLaneWidthUpscaleDialer->setValue(mySettings->laneWidthExaggeration);
229 myLaneMinWidthDialer->setRange(0, 10000);
230 myLaneMinWidthDialer->setValue(mySettings->laneMinSize);
233 myEdgeNamePanel =
new NamePanel(m22,
this,
"Show edge name", mySettings->edgeName);
234 myStreetNamePanel =
new NamePanel(m22,
this,
"Show street name", mySettings->streetName);
235 myEdgeValuePanel =
new NamePanel(m22,
this,
"Show edge color value", mySettings->edgeValue);
240 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
246 myVehicleShapeDetail->appendItem(
"'triangles'");
247 myVehicleShapeDetail->appendItem(
"'boxes'");
248 myVehicleShapeDetail->appendItem(
"'simple shapes'");
249 myVehicleShapeDetail->appendItem(
"'raster images'");
250 myVehicleShapeDetail->setNumVisible(4);
251 myVehicleShapeDetail->setCurrentItem(settings->vehicleQuality);
258 mySettings->vehicleColorer.fill(*myVehicleColorMode);
259 myVehicleColorMode->setNumVisible((
int)mySettings->vehicleColorer.size());
262 myVehicleParamKey->setEditable(
true);
263 myVehicleParamKey->disable();
270 myVehicleNamePanel =
new NamePanel(m35,
this,
"Show vehicle name", mySettings->vehicleName);
271 myVehicleValuePanel =
new NamePanel(m35,
this,
"Show vehicle color value", mySettings->vehicleValue);
272 myVehicleTextPanel =
new NamePanel(m35,
this,
"Show vehicle text param", mySettings->vehicleText);
274 myVehicleTextParamKey->setEditable(
true);
280 myShowBlinker->setCheck(mySettings->showBlinker);
282 myShowMinGap->setCheck(mySettings->drawMinGap);
284 myShowBrakeGap->setCheck(mySettings->drawBrakeGap);
286 myShowBTRange->setCheck(mySettings->showBTRange);
288 myShowRouteIndex->setCheck(mySettings->showRouteIndex);
298 myVehicleSizePanel =
new SizePanel(m34,
this, mySettings->vehicleSize);
304 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
310 myPersonShapeDetail->appendItem(
"'triangles'");
311 myPersonShapeDetail->appendItem(
"'circles'");
312 myPersonShapeDetail->appendItem(
"'simple shapes'");
313 myPersonShapeDetail->appendItem(
"'raster images'");
314 myPersonShapeDetail->setNumVisible(4);
315 myPersonShapeDetail->setCurrentItem(settings->personQuality);
322 mySettings->personColorer.fill(*myPersonColorMode);
323 myPersonColorMode->setNumVisible(10);
331 myPersonNamePanel =
new NamePanel(m103,
this,
"Show person name", mySettings->personName);
332 myPersonValuePanel =
new NamePanel(m103,
this,
"Show person color value", mySettings->personValue);
337 myPersonSizePanel =
new SizePanel(m104,
this, mySettings->personSize);
342 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
348 myContainerShapeDetail->appendItem(
"'triangles'");
349 myContainerShapeDetail->appendItem(
"'boxes'");
350 myContainerShapeDetail->appendItem(
"'simple shapes'");
351 myContainerShapeDetail->appendItem(
"'raster images'");
352 myContainerShapeDetail->setNumVisible(4);
353 myContainerShapeDetail->setCurrentItem(settings->containerQuality);
360 mySettings->containerColorer.fill(*myContainerColorMode);
361 myContainerColorMode->setNumVisible(9);
369 myContainerNamePanel =
new NamePanel(m103,
this,
"Show container name", mySettings->containerName);
374 myContainerSizePanel =
new SizePanel(m104,
this, mySettings->containerSize);
379 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
384 mySettings->junctionColorer.fill(*myJunctionColorMode);
385 myJunctionColorMode->setNumVisible(4);
390 (BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT), 0, 0, 0, 0, 20, 20, 4, 4);
394 myJunctionSizePanel =
new SizePanel(m42,
this, mySettings->junctionSize);
396 myDrawJunctionShape->setCheck(mySettings->drawJunctionShape);
398 myDrawCrossingsAndWalkingAreas->setCheck(mySettings->drawCrossingsAndWalkingareas);
400 myShowLane2Lane->setCheck(mySettings->showLane2Lane);
403 myTLIndexPanel =
new NamePanel(m42,
this,
"Show link tls index", mySettings->drawLinkTLIndex);
404 myJunctionIndexPanel =
new NamePanel(m42,
this,
"Show link junction index", mySettings->drawLinkJunctionIndex);
405 myJunctionNamePanel =
new NamePanel(m42,
this,
"Show junction name", mySettings->junctionName);
406 myInternalJunctionNamePanel =
new NamePanel(m42,
this,
"Show internal junction name", mySettings->internalJunctionName);
407 myInternalEdgeNamePanel =
new NamePanel(m42,
this,
"Show internal edge name", mySettings->internalEdgeName);
408 myCwaEdgeNamePanel =
new NamePanel(m42,
this,
"Show crossing and walkingarea name", mySettings->cwaEdgeName);
409 myTLSPhaseIndexPanel =
new NamePanel(m42,
this,
"Show traffic light phase", mySettings->tlsPhaseIndex);
414 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
418 myAddNamePanel =
new NamePanel(m51,
this,
"Show object name", mySettings->addName);
419 myAddFullNamePanel =
new NamePanel(m51,
this,
"Show full name", mySettings->addFullName);
423 myAddSizePanel =
new SizePanel(m52,
this, mySettings->addSize);
433 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
439 mySettings->poiColorer.fill(*myPOIColorMode);
440 myPOIColorMode->setNumVisible(3);
447 myPOINamePanel =
new NamePanel(m61,
this,
"Show poi names", mySettings->poiName);
448 myPOITypePanel =
new NamePanel(m61,
this,
"Show poi types", mySettings->poiType);
452 myPOISizePanel =
new SizePanel(m62,
this, mySettings->poiSize);
458 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
464 mySettings->polyColorer.fill(*myPolyColorMode);
465 myPolyColorMode->setNumVisible(3);
472 myPolyNamePanel =
new NamePanel(m91,
this,
"Show polygon name", mySettings->polyName);
473 myPolyTypePanel =
new NamePanel(m91,
this,
"Show polygon types", mySettings->polyType);
476 myPolySizePanel =
new SizePanel(m91,
this, mySettings->polySize);
478 if (settings->netedit) {
481 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
514 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
519 myShowSizeLegend->setCheck(mySettings->showSizeLegend);
520 new FXLabel(m72,
"");
522 myShowColorLegend->setCheck(mySettings->showColorLegend);
523 new FXLabel(m72,
"");
528 FXScrollWindow* genScroll =
new FXScrollWindow(tabbook);
533 myDither->setCheck(mySettings->dither);
536 myFPS->setCheck(mySettings->fps);
539 myDrawBoundaries->setCheck(mySettings->drawBoundaries);
542 myForceDrawForPositionSelection->setCheck(mySettings->forceDrawForPositionSelection);
544 myForceDrawForRectangleSelection =
new FXCheckButton(m86,
"Force draw for rectangle selection",
this,
MID_SIMPLE_VIEW_COLORCHANGE);
545 myForceDrawForRectangleSelection->setCheck(mySettings->forceDrawForRectangleSelection);
552 rebuildColorMatrices(
false);
627 if (data !=
nullptr) {
628 FXString dataS = (
char*) data;
631 for (
int i = 0; i <
mySchemeName->getNumItems() - 1; ++i) {
742 std::vector<FXColorWell*>::const_iterator colEnd,
743 std::vector<FXRealSpinner*>::const_iterator threshIt,
744 std::vector<FXRealSpinner*>::const_iterator threshEnd,
745 std::vector<FXButton*>::const_iterator buttonIt,
748 while (colIt != colEnd) {
750 if (sender == *colIt) {
754 if (sender == *threshIt) {
755 const double val = (*threshIt)->getValue();
759 (*threshIt)->getRange(lo, hi);
760 (*threshIt)->setRange(lo, val);
764 if (threshIt != threshEnd) {
765 (*threshIt)->getRange(lo, hi);
766 (*threshIt)->setRange(val, hi);
771 if (sender == *colIt) {
775 if (sender == *buttonIt) {
778 }
else if (sender == *(buttonIt + 1)) {
795 std::vector<FXRealSpinner*>::const_iterator scaleEnd,
796 std::vector<FXRealSpinner*>::const_iterator threshIt,
797 std::vector<FXRealSpinner*>::const_iterator threshEnd,
798 std::vector<FXButton*>::const_iterator buttonIt,
801 while (scaleIt != scaleEnd) {
803 if (sender == *scaleIt) {
804 scheme.
setColor(pos, (*scaleIt)->getValue());
807 if (sender == *threshIt) {
808 const double val = (*threshIt)->getValue();
812 (*threshIt)->getRange(lo, hi);
813 (*threshIt)->setRange(lo, val);
817 if (threshIt != threshEnd) {
818 (*threshIt)->getRange(lo, hi);
819 (*threshIt)->setRange(val, hi);
824 if (sender == *scaleIt) {
825 scheme.
setColor(pos, (*scaleIt)->getValue());
828 if (sender == *buttonIt) {
829 scheme.
addColor((*scaleIt)->getValue(), (*threshIt)->getValue());
831 }
else if (sender == *(buttonIt + 1)) {
856 bool doRebuildColorMatrices =
false;
972 tmpSettings.
fps = (
myFPS->getCheck() != FALSE);
983 doRebuildColorMatrices =
true;
987 doRebuildColorMatrices =
true;
993 doRebuildColorMatrices =
true;
997 doRebuildColorMatrices =
true;
1000 doRebuildColorMatrices =
true;
1007 doRebuildColorMatrices =
true;
1011 doRebuildColorMatrices =
true;
1014 doRebuildColorMatrices =
true;
1021 doRebuildColorMatrices =
true;
1025 doRebuildColorMatrices =
true;
1028 doRebuildColorMatrices =
true;
1035 doRebuildColorMatrices =
true;
1039 doRebuildColorMatrices =
true;
1042 doRebuildColorMatrices =
true;
1049 doRebuildColorMatrices =
true;
1053 doRebuildColorMatrices =
true;
1056 doRebuildColorMatrices =
true;
1063 doRebuildColorMatrices =
true;
1067 doRebuildColorMatrices =
true;
1070 doRebuildColorMatrices =
true;
1077 doRebuildColorMatrices =
true;
1081 doRebuildColorMatrices =
true;
1084 doRebuildColorMatrices =
true;
1091 doRebuildColorMatrices =
true;
1095 doRebuildColorMatrices =
true;
1098 doRebuildColorMatrices =
true;
1128 if (doRebuildColorMatrices) {
1132 getApp()->forceRefresh();
1141 if (settingsName !=
"") {
1142 FXint index =
mySchemeName->appendItem(settingsName.c_str());
1166 std::vector<GUISUMOAbstractView::Decal>::iterator j;
1207 std::string name =
"";
1208 while (name.length() == 0) {
1219 if (!dialog.execute()) {
1222 name = text->getText().text();
1223 for (
int i = 0; i < (int)name.length(); ++i) {
1224 if (name[i] !=
'_' && (name[i] <
'a' || name[i] >
'z') && (name[i] <
'A' || name[i] >
'Z') && (name[i] <
'0' || name[i] >
'9')) {
1232 tmpSettings.
name = name;
1246 sender->handle(
this,
1248 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1260 std::string name =
mySchemeName->getItem(index).text();
1271 sender->handle(
this,
1273 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1310 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
1318 sender->handle(
this,
1321 FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1329 FXFileDialog opendialog(
this,
"Import view settings");
1331 opendialog.setSelectMode(SELECTFILE_ANY);
1332 opendialog.setPatternList(
"*.xml");
1336 if (opendialog.execute()) {
1346 FXFileDialog opendialog(
this,
"Load Decals");
1348 opendialog.setSelectMode(SELECTFILE_ANY);
1349 opendialog.setPatternList(
"*.xml");
1353 if (opendialog.execute()) {
1374 FXMessageBox::error(
myParent, MBOX_OK,
"Storing failed!",
"%s", e.what());
1384 sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1394 const int numRows =
MAX2((
int)10, (
int)
myDecals->size() + 1);
1405 header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
1407 for (k = 0; k < cols; k++) {
1409 header->setItemSize(k, 60);
1411 header->setItemSize(0, 150);
1414 std::vector<GUISUMOAbstractView::Decal>::iterator j;
1428 for (k = 0; k < 7; k++) {
1436 std::vector<FXColorWell*>& colors,
1437 std::vector<FXRealSpinner*>& thresholds,
1438 std::vector<FXButton*>& buttons,
1439 FXCheckButton* interpolation,
1446 const bool fixed = scheme.
isFixed();
1447 std::vector<RGBColor>::const_iterator colIt = scheme.
getColors().begin();
1448 std::vector<double>::const_iterator threshIt = scheme.
getThresholds().begin();
1449 std::vector<std::string>::const_iterator nameIt = scheme.
getNames().begin();
1450 while (colIt != scheme.
getColors().end()) {
1453 new FXLabel(m, nameIt->c_str());
1459 threshDialer->setValue(*threshIt);
1460 thresholds.push_back(threshDialer);
1470 interpolation->disable();
1472 if (colors.size() > 1) {
1473 interpolation->enable();
1474 if (interpolation->getCheck() != FALSE) {
1475 thresholds.front()->enable();
1477 thresholds.front()->disable();
1480 interpolation->disable();
1481 thresholds.front()->disable();
1490 std::vector<FXRealSpinner*>& scales,
1491 std::vector<FXRealSpinner*>& thresholds,
1492 std::vector<FXButton*>& buttons,
1493 FXCheckButton* interpolation,
1500 const bool fixed = scheme.
isFixed();
1501 std::vector<double>::const_iterator scaleIt = scheme.
getColors().begin();
1502 std::vector<double>::const_iterator threshIt = scheme.
getThresholds().begin();
1503 std::vector<std::string>::const_iterator nameIt = scheme.
getNames().begin();
1504 while (scaleIt != scheme.
getColors().end()) {
1506 scaleDialer->setValue(*scaleIt);
1507 scales.push_back(scaleDialer);
1509 new FXLabel(m, nameIt->c_str());
1515 threshDialer->setValue(*threshIt);
1516 thresholds.push_back(threshDialer);
1526 interpolation->disable();
1528 if (scales.size() > 1) {
1529 interpolation->enable();
1530 if (interpolation->getCheck() != FALSE) {
1531 thresholds.front()->enable();
1533 thresholds.front()->disable();
1536 interpolation->disable();
1537 thresholds.front()->disable();
1554 for (
int i = 1; i <= 5; ++i) {
1681 std::string value = i->
item->getText().text();
1683 if (value.find_first_not_of(
" ") == std::string::npos) {
1689 if (row == static_cast<int>(
myDecals->size())) {
1702 }
else if (row > static_cast<int>(
myDecals->size())) {
1706 d = (*myDecals)[row];
1720 std::string msg =
"The value must be a float, is:" + value;
1721 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1728 std::string msg =
"The value must be a float, is:" + value;
1729 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1736 std::string msg =
"The value must be a float, is:" + value;
1737 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1744 std::string msg =
"The value must be a float, is:" + value;
1745 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1752 std::string msg =
"The value must be a float, is:" + value;
1753 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1760 std::string msg =
"The value must be a float, is:" + value;
1761 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1768 std::string msg =
"The value must be a bool, is:" + value;
1769 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
1775 (*myDecals)[row] = d;
1795 for (
int i = 0; i <
mySchemeName->getNumItems(); ++i) {
1807 const std::string& title,
1830 mySizeDial->getValue(),
1833 myConstSizeCheck->getCheck() != FALSE);
1839 myCheck->setCheck(settings.
show);
1840 mySizeDial->setValue(settings.
size);
1843 myConstSizeCheck->setCheck(settings.
constSize);
1858 myMinSizeDial->setValue(settings.
minSize);
1862 myExaggerateDial->setRange(0, 10000);
1870 myMinSizeDial->getValue(), myExaggerateDial->getValue(),
1871 myCheck->getCheck() != FALSE,
1872 myCheckSelected->getCheck() != FALSE);
1880 myMinSizeDial->setValue(settings.
minSize);
1887 getApp()->reg().writeIntEntry(
"VIEWSETTINGS",
"x", getX());
1888 getApp()->reg().writeIntEntry(
"VIEWSETTINGS",
"y", getY());
1889 getApp()->reg().writeIntEntry(
"VIEWSETTINGS",
"width", getWidth());
1890 getApp()->reg().writeIntEntry(
"VIEWSETTINGS",
"height", getHeight());
1896 const FXint minSize = 400;
1897 const FXint minTitlebarHeight = 20;
1898 setX(
MAX2(0,
MIN2(getApp()->reg().readIntEntry(
"VIEWSETTINGS",
"x", 150),
1899 getApp()->getRootWindow()->getWidth() - minSize)));
1900 setY(
MAX2(minTitlebarHeight,
1901 MIN2(getApp()->reg().readIntEntry(
"VIEWSETTINGS",
"y", 150),
1902 getApp()->getRootWindow()->getHeight() - minSize)));
1903 setWidth(
MAX2(getApp()->reg().readIntEntry(
"VIEWSETTINGS",
"width", 700), minSize));
1904 setHeight(
MAX2(getApp()->reg().readIntEntry(
"VIEWSETTINGS",
"height", 500), minSize));