feat: add real distance getter&setter to RulerAnnotationActor, add MeasureChangedEvent with realDistance changed.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -32,6 +32,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void SetDistanceName(const QString& aName);
|
||||
QString GetDistanceName();
|
||||
|
||||
double GetRealDistance(){
|
||||
return realDistance;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
RulerAnnotationActor();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user