Gui: support to customize the font size of bounding boxes

This commit is contained in:
wmayer
2021-03-02 16:28:35 +01:00
parent c1b3fba031
commit dfba396b4f
3 changed files with 60 additions and 0 deletions

View File

@@ -34,6 +34,7 @@
# include <Inventor/nodes/SoBaseColor.h>
# include <Inventor/nodes/SoCamera.h>
# include <Inventor/nodes/SoDrawStyle.h>
# include <Inventor/nodes/SoFont.h>
# include <Inventor/nodes/SoMaterial.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoSwitch.h>
@@ -250,6 +251,14 @@ unsigned long ViewProviderGeometryObject::getBoundColor() const
return bbcol;
}
namespace {
float getBoundBoxFontSize()
{
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
return hGrp->GetFloat("BoundingBoxFontSize", 10.0);
}
}
void ViewProviderGeometryObject::showBoundingBox(bool show)
{
if (!pcBoundSwitch && show) {
@@ -265,6 +274,9 @@ void ViewProviderGeometryObject::showBoundingBox(bool show)
pcBoundColor->rgb.setValue(r, g, b);
pBoundingSep->addChild(pcBoundColor);
SoFont* font = new SoFont();
font->size.setValue(getBoundBoxFontSize());
pBoundingSep->addChild(font);
pBoundingSep->addChild(new SoResetTransform());
pBoundingSep->addChild(pcBoundingBox);