diff --git a/src/src/Rendering/Core/DraggableActor.cpp b/src/src/Rendering/Core/DraggableActor.cpp index b17769a..6a76ea8 100644 --- a/src/src/Rendering/Core/DraggableActor.cpp +++ b/src/src/Rendering/Core/DraggableActor.cpp @@ -142,7 +142,14 @@ void DraggableActor::ReleaseGraphicsResources(vtkWindow *window) { } int DraggableActor::RenderOverlay(vtkViewport *viewport) { - BuildShape(); + if (BaseDataPoints->GetNumberOfPoints()<=0) return vtkProp::RenderOverlay(viewport); + QString newRenderTime = QString("%1-%2-%3").arg(BaseDataPoints->GetMTime()) + .arg(Renderer->GetMTime()).arg(Renderer->GetActiveCamera()->GetMTime()); + if (mRenderTime != newRenderTime) + { + BuildShape(); + mRenderTime=newRenderTime; + } if (senseArea->GetVisibility())senseArea->RenderOverlay(viewport); if (shadow2D->GetVisibility())shadow2D->RenderOverlay(viewport); if (actor2D->GetVisibility())actor2D->RenderOverlay(viewport); diff --git a/src/src/Rendering/Core/DraggableActor.h b/src/src/Rendering/Core/DraggableActor.h index 1338830..82eabba 100644 --- a/src/src/Rendering/Core/DraggableActor.h +++ b/src/src/Rendering/Core/DraggableActor.h @@ -159,6 +159,7 @@ protected: PointMapMode MapMode = MapToSlice; void RebuildRenderPoint(); + QString mRenderTime; private: DraggableActor(const DraggableActor &) = delete; diff --git a/src/src/Rendering/Measure/EllipseAnnotationActor.cpp b/src/src/Rendering/Measure/EllipseAnnotationActor.cpp index d7144d7..9741e19 100644 --- a/src/src/Rendering/Measure/EllipseAnnotationActor.cpp +++ b/src/src/Rendering/Measure/EllipseAnnotationActor.cpp @@ -39,16 +39,11 @@ namespace { } void EllipseAnnotationActor::BuildShape() { - if (!BaseDataPoints->GetNumberOfPoints()) return; - QString stamp = QString("%1-%2").arg(BaseDataPoints->GetMTime()) - .arg(Renderer->GetActiveCamera()->GetMTime()); - if (mRenderTime == stamp) return; - QStringList stamps = stamp.split("-"); - QStringList renderTimes = mRenderTime.split("-"); - mRenderTime = stamp; + QString stamp = QString("%1").arg(BaseDataPoints->GetMTime()); + QStringList renderTimes = mRenderTime.split('-'); RebuildRenderPoint(); //base data change change message - if (stamps[0] != renderTimes[0]) + if (stamp != renderTimes[0]) { double p_lt[3] = {0, 0, 0}; double* disp_lt = controlP_lt->GetRenderPosition(); MapScreenPointToWorld(disp_lt[0], disp_lt[1], this->Renderer, p_lt); diff --git a/src/src/Rendering/Measure/OpenPolyAnnotationActor.cpp b/src/src/Rendering/Measure/OpenPolyAnnotationActor.cpp index e5ee471..65ef248 100644 --- a/src/src/Rendering/Measure/OpenPolyAnnotationActor.cpp +++ b/src/src/Rendering/Measure/OpenPolyAnnotationActor.cpp @@ -30,11 +30,6 @@ void OpenPolyAnnotationActor::SetRenderer(vtkRenderer *ren) { } void OpenPolyAnnotationActor::BuildShape() { - if (!BaseDataPoints->GetNumberOfPoints()) return; - QString stamp = QString("%1-%2").arg(BaseDataPoints->GetMTime()) - .arg(Renderer->GetActiveCamera()->GetMTime()); - if (mRenderTime == stamp) return; - mRenderTime = stamp; RebuildRenderPoint(); vtkNew source; source->SetClosed(this->Closed); diff --git a/src/src/Rendering/Measure/RoundAnnotationActor.cpp b/src/src/Rendering/Measure/RoundAnnotationActor.cpp index fbfb622..b5823dd 100644 --- a/src/src/Rendering/Measure/RoundAnnotationActor.cpp +++ b/src/src/Rendering/Measure/RoundAnnotationActor.cpp @@ -39,16 +39,11 @@ namespace { } void RoundAnnotationActor::BuildShape() { - if (!BaseDataPoints->GetNumberOfPoints()) return; - QString stamp = QString("%1-%2").arg(BaseDataPoints->GetMTime()) - .arg(Renderer->GetActiveCamera()->GetMTime()); - if (mRenderTime == stamp) return; - QStringList stamps = stamp.split("-"); - QStringList renderTimes = mRenderTime.split("-"); - mRenderTime = stamp; + QString stamp = QString("%1").arg(BaseDataPoints->GetMTime()); + QStringList renderTimes = mRenderTime.split('-'); RebuildRenderPoint(); //base data change change message - if (stamps[0] != renderTimes[0]) + if (stamp != renderTimes[0]) { double p_lt[3] = {0, 0, 0}; double* disp_lt = controlP_lt->GetRenderPosition(); MapScreenPointToWorld(disp_lt[0], disp_lt[1], this->Renderer, p_lt);