Core datums: Rework to improve new sketch

This commit is contained in:
PaddleStroke
2024-12-13 10:01:13 +01:00
committed by Max Wilfinger
parent 7083362acb
commit e977eb49e3
10 changed files with 185 additions and 77 deletions

View File

@@ -23,7 +23,6 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Inventor/nodes/SoText2.h>
# include <Inventor/nodes/SoAnnotation.h>
# include <Inventor/nodes/SoDrawStyle.h>
# include <Inventor/nodes/SoFont.h>
@@ -60,17 +59,12 @@ ViewProviderDatum::ViewProviderDatum() {
pRoot = new SoSeparator();
pRoot->ref();
// Create the Label node
pLabel = new SoText2();
pLabel->ref();
lineThickness = 2.0;
}
ViewProviderDatum::~ViewProviderDatum() {
pRoot->unref();
pLabel->unref();
}
@@ -132,20 +126,27 @@ void ViewProviderDatum::attach(App::DocumentObject* pcObject)
sep->addChild(visible);
// Scale feature to the given size
float sz = App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetFloat("LocalCoordinateSystemSize", 1.0); // NOLINT
soScale->setPart("shape", sep);
soScale->scaleFactor = sz;
resetTemporarySize();
highlight->addChild(soScale);
addDisplayMaskMode(highlight, "Base");
}
void ViewProviderDatum::setTemporaryScale(double factor)
{
soScale->scaleFactor = soScale->scaleFactor.getValue() * factor;
}
void ViewProviderDatum::resetTemporarySize()
{
float sz = App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetFloat("LocalCoordinateSystemSize", 1.0); // NOLINT
soScale->scaleFactor = sz;
}
void ViewProviderDatum::onChanged(const App::Property* prop) {
ViewProviderGeometryObject::onChanged(prop);