Skip to content

Commit

Permalink
Added new view options for disable hiding elements wit high zoom. Refs
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Mar 17, 2024
1 parent 3a6cf54 commit 9d8f4cf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/utils/gui/settings/GUISettingsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ GUISettingsHandler::myStartElement(int element, const SUMOSAXAttributes& attrs)
mySettings.showLaneDirection = StringUtils::toBool(attrs.getStringSecure("showDirection", toString(mySettings.showLaneDirection)));
mySettings.showSublanes = StringUtils::toBool(attrs.getStringSecure("showSublanes", toString(mySettings.showSublanes)));
mySettings.spreadSuperposed = StringUtils::toBool(attrs.getStringSecure("spreadSuperposed", toString(mySettings.spreadSuperposed)));
mySettings.disableHideByZoom = StringUtils::toBool(attrs.getStringSecure("disableHideByZoom", toString(mySettings.disableHideByZoom)));
mySettings.edgeParam = attrs.getStringSecure("edgeParam", mySettings.edgeParam);
mySettings.laneParam = attrs.getStringSecure("laneParam", mySettings.laneParam);
mySettings.vehicleParam = attrs.getStringSecure("vehicleParam", mySettings.vehicleParam);
Expand Down
17 changes: 13 additions & 4 deletions src/utils/gui/settings/GUIVisualizationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ GUIVisualizationSettings::GUIVisualizationSettings(const std::string& _name, boo
showLaneDirection(false),
showSublanes(true),
spreadSuperposed(false),
disableHideByZoom(false),
edgeParam("EDGE_KEY"),
laneParam("LANE_KEY"),
vehicleParam("PARAM_NUMERICAL"),
Expand Down Expand Up @@ -1745,6 +1746,7 @@ GUIVisualizationSettings::save(OutputDevice& dev) const {
dev.writeAttr("showDirection", showLaneDirection);
dev.writeAttr("showSublanes", showSublanes);
dev.writeAttr("spreadSuperposed", spreadSuperposed);
dev.writeAttr("disableHideByZoom", disableHideByZoom);
dev.writeAttr("edgeParam", edgeParam);
dev.writeAttr("laneParam", laneParam);
dev.writeAttr("vehicleParam", vehicleParam);
Expand Down Expand Up @@ -2076,6 +2078,9 @@ GUIVisualizationSettings::operator==(const GUIVisualizationSettings& v2) {
if (spreadSuperposed != v2.spreadSuperposed) {
return false;
}
if (disableHideByZoom != v2.disableHideByZoom) {
return false;
}
if (edgeParam != v2.edgeParam) {
return false;
}
Expand Down Expand Up @@ -2386,12 +2391,16 @@ GUIVisualizationSettings::flippedTextAngle(double objectAngle) const {

bool
GUIVisualizationSettings::checkBoundarySizeDrawing(const double w, const double h) const {
const double size = MAX2(w, h);
if (drawForViewObjectsHandler) {
if (disableHideByZoom) {
return true;
} else {
// for low computers 20. for high 10
return (scale * size) > 15;
const double size = MAX2(w, h);
if (drawForViewObjectsHandler) {
return true;
} else {
// for low computers 20. for high 10
return (scale * size) > 15;
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/utils/gui/settings/GUIVisualizationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ class GUIVisualizationSettings {
/// @brief Whether to improve visualisation of superposed (rail) edges
bool spreadSuperposed;

/// @brief disable hide by zoom
bool disableHideByZoom;

/// @brief key for coloring by edge parameter
std::string edgeParam, laneParam;
/// @brief key for coloring by vehicle parameter
Expand Down
17 changes: 12 additions & 5 deletions src/utils/gui/windows/GUIDialog_ViewSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ GUIDialog_ViewSettings::onCmdNameChange(FXObject*, FXSelector, void* ptr) {
myShowLaneDirection->setCheck(mySettings->showLaneDirection);
myShowSublanes->setCheck(mySettings->showSublanes);
mySpreadSuperposed->setCheck(mySettings->spreadSuperposed);
myDisableHideByZoom->setCheck(mySettings->disableHideByZoom);
myLaneColorRainbowCheck->setCheck(mySettings->edgeValueHideCheck);
myLaneColorRainbowThreshold->setValue(mySettings->edgeValueHideThreshold);
myLaneColorRainbowCheck2->setCheck(mySettings->edgeValueHideCheck2);
Expand Down Expand Up @@ -584,6 +585,7 @@ GUIDialog_ViewSettings::onCmdColorChange(FXObject* sender, FXSelector, void* /*v
tmpSettings.showLaneDirection = (myShowLaneDirection->getCheck() != FALSE);
tmpSettings.showSublanes = (myShowSublanes->getCheck() != FALSE);
tmpSettings.spreadSuperposed = (mySpreadSuperposed->getCheck() != FALSE);
tmpSettings.disableHideByZoom = (myDisableHideByZoom->getCheck() != FALSE);
if (sender == myParamKey) {
if (tmpSettings.getLaneEdgeScheme().getName() == GUIVisualizationSettings::SCHEME_NAME_EDGE_PARAM_NUMERICAL) {
tmpSettings.edgeParam = myParamKey->getText().text();
Expand Down Expand Up @@ -1821,6 +1823,7 @@ GUIDialog_ViewSettings::buildStreetsFrame(FXTabBook* tabbook) {

myShowRails = new FXCheckButton(matrixLanes, TL("Show rails"), this, MID_SIMPLE_VIEW_COLORCHANGE);
myShowRails->setCheck(mySettings->showRails);

mySpreadSuperposed = new FXCheckButton(matrixLanes, TL("Spread bidirectional railways/roads"), this, MID_SIMPLE_VIEW_COLORCHANGE);
mySpreadSuperposed->setHelpText(TL("Make both directional edges for a bidirectional railways or roads visible"));
mySpreadSuperposed->setCheck(mySettings->spreadSuperposed);
Expand Down Expand Up @@ -2316,13 +2319,17 @@ GUIDialog_ViewSettings::buildOpenGLFrame(FXTabBook* tabbook) {
myComboRows = new FXRealSpinner(m81, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial1);
myComboRows->setValue(GUIDesignComboBoxVisibleItemsLarge);
FXMatrix* m82 = new FXMatrix(verticalFrame, 1, GUIDesignMatrixViewSettings);
myDither = new FXCheckButton(m82, TL("Dither"), this, MID_SIMPLE_VIEW_COLORCHANGE);
myDither->setCheck(mySettings->dither);
myDisableHideByZoom = new FXCheckButton(m82, TL("Disable hide by zoom"), this, MID_SIMPLE_VIEW_COLORCHANGE);
myDisableHideByZoom->setHelpText(TL("Disable hidding edges with high zoom out"));
myDisableHideByZoom->setCheck(mySettings->disableHideByZoom);
FXMatrix* m83 = new FXMatrix(verticalFrame, 1, GUIDesignMatrixViewSettings);
myFPS = new FXCheckButton(m83, "FPS", this, MID_SIMPLE_VIEW_COLORCHANGE);
myFPS->setCheck(mySettings->fps);
myDither = new FXCheckButton(m83, TL("Dither"), this, MID_SIMPLE_VIEW_COLORCHANGE);
myDither->setCheck(mySettings->dither);
FXMatrix* m84 = new FXMatrix(verticalFrame, 1, GUIDesignMatrixViewSettings);
myDrawBoundaries = new FXCheckButton(m84, TL("Draw boundaries"), this, MID_SIMPLE_VIEW_COLORCHANGE);
myFPS = new FXCheckButton(m84, "FPS", this, MID_SIMPLE_VIEW_COLORCHANGE);
myFPS->setCheck(mySettings->fps);
FXMatrix* m85 = new FXMatrix(verticalFrame, 1, GUIDesignMatrixViewSettings);
myDrawBoundaries = new FXCheckButton(m85, TL("Draw boundaries"), this, MID_SIMPLE_VIEW_COLORCHANGE);
myDrawBoundaries->setCheck(mySettings->drawBoundaries);
FXMatrix* m86 = new FXMatrix(verticalFrame, 1, GUIDesignMatrixViewSettings);
myForceDrawForRectangleSelection = new FXCheckButton(m86, TL("Force draw for rectangle selection"), this, MID_SIMPLE_VIEW_COLORCHANGE);
Expand Down
1 change: 1 addition & 0 deletions src/utils/gui/windows/GUIDialog_ViewSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class GUIDialog_ViewSettings : public FXDialogBox, public GUIPersistentWindowPos
FXCheckButton* myShowLaneDirection = nullptr;
FXCheckButton* myShowSublanes = nullptr;
FXCheckButton* mySpreadSuperposed = nullptr;
FXCheckButton* myDisableHideByZoom = nullptr;
FXRealSpinner* myLaneWidthUpscaleDialer = nullptr;
FXRealSpinner* myLaneMinWidthDialer = nullptr;

Expand Down

0 comments on commit 9d8f4cf

Please sign in to comment.