feat: add real distance getter&setter to RulerAnnotationActor, add MeasureChangedEvent with realDistance changed.

This commit is contained in:
kradchen
2025-07-14 16:33:28 +08:00
parent e1b5cf4b20
commit 2c6fb5aa95
2 changed files with 21 additions and 2 deletions

View File

@@ -20,7 +20,18 @@
vtkStandardNewMacro(RulerAnnotationActor)
RulerAnnotationActor::RulerAnnotationActor() {
void RulerAnnotationActor::SetDistanceName(const QString &aName)
{
mDistance = aName;
}
QString RulerAnnotationActor::GetDistanceName()
{
return mDistance;
}
RulerAnnotationActor::RulerAnnotationActor()
{
text = vtkActor2D::New();
vtkNew<vtkTextMapper> textMapper;
textMapper->SetInput("0");
@@ -64,7 +75,7 @@ void RulerAnnotationActor::BuildShape() {
// p1[2] = 0.0;
// p2[2] = 0.0;
realDistance = std::sqrt(vtkMath::Distance2BetweenPoints(p1, p2));
this->InvokeEvent(MeasureChangedEvent,&realDistance);
double dis;
if (isCalibration) {
dis = calibDistance;

View File

@@ -32,6 +32,14 @@ public:
}
}
void SetDistanceName(const QString& aName);
QString GetDistanceName();
double GetRealDistance(){
return realDistance;
}
protected:
RulerAnnotationActor();