feat: add real distance getter&setter to RulerAnnotationActor, add MeasureChangedEvent with realDistance changed.
This commit is contained in:
@@ -20,7 +20,18 @@
|
|||||||
|
|
||||||
vtkStandardNewMacro(RulerAnnotationActor)
|
vtkStandardNewMacro(RulerAnnotationActor)
|
||||||
|
|
||||||
RulerAnnotationActor::RulerAnnotationActor() {
|
void RulerAnnotationActor::SetDistanceName(const QString &aName)
|
||||||
|
{
|
||||||
|
mDistance = aName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RulerAnnotationActor::GetDistanceName()
|
||||||
|
{
|
||||||
|
return mDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
RulerAnnotationActor::RulerAnnotationActor()
|
||||||
|
{
|
||||||
text = vtkActor2D::New();
|
text = vtkActor2D::New();
|
||||||
vtkNew<vtkTextMapper> textMapper;
|
vtkNew<vtkTextMapper> textMapper;
|
||||||
textMapper->SetInput("0");
|
textMapper->SetInput("0");
|
||||||
@@ -64,7 +75,7 @@ void RulerAnnotationActor::BuildShape() {
|
|||||||
// p1[2] = 0.0;
|
// p1[2] = 0.0;
|
||||||
// p2[2] = 0.0;
|
// p2[2] = 0.0;
|
||||||
realDistance = std::sqrt(vtkMath::Distance2BetweenPoints(p1, p2));
|
realDistance = std::sqrt(vtkMath::Distance2BetweenPoints(p1, p2));
|
||||||
|
this->InvokeEvent(MeasureChangedEvent,&realDistance);
|
||||||
double dis;
|
double dis;
|
||||||
if (isCalibration) {
|
if (isCalibration) {
|
||||||
dis = calibDistance;
|
dis = calibDistance;
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetDistanceName(const QString& aName);
|
||||||
|
QString GetDistanceName();
|
||||||
|
|
||||||
|
double GetRealDistance(){
|
||||||
|
return realDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RulerAnnotationActor();
|
RulerAnnotationActor();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user