perf: imporve annotationactor render performance

This commit is contained in:
kradchen
2025-07-17 09:56:01 +08:00
parent 104ab3a25d
commit af7f39c935
3 changed files with 11 additions and 2 deletions

View File

@@ -109,6 +109,7 @@ void DraggableActor::Transform(float x, float y) {
if (this->OnDrag) {
OnDrag(renderPoints);
}
Modified();
}
void DraggableActor::ApplyTransform() {
@@ -143,8 +144,11 @@ void DraggableActor::ReleaseGraphicsResources(vtkWindow *window) {
int DraggableActor::RenderOverlay(vtkViewport *viewport) {
if (BaseDataPoints->GetNumberOfPoints()<=0) return vtkProp::RenderOverlay(viewport);
QString newRenderTime = QString("%1-%2-%3").arg(BaseDataPoints->GetMTime())
.arg(Renderer->GetMTime()).arg(Renderer->GetActiveCamera()->GetMTime());
QString rendererSize = QString("rendererSize:%1,%2").arg(Renderer->GetRenderWindow()->GetSize()[0]).arg(Renderer->GetRenderWindow()->GetSize()[1]);
QString newRenderTime = QString("%1-%2-%3-%4").arg(BaseDataPoints->GetMTime())
.arg(rendererSize).arg(Renderer->GetActiveCamera()->GetMTime())
.arg(GetMTime());
if (mRenderTime != newRenderTime)
{
BuildShape();

View File

@@ -152,6 +152,7 @@ void AngleAnnotationActor::onMeasureMouseMove(vtkRenderWindowInteractor *iren) {
}
controlP3->SetWorldPosition(p);
this->SetWorldPosition3(p);
Modified();
iren->Render();
}
@@ -179,6 +180,7 @@ bool AngleAnnotationActor::onMeasureLeftButtonDown(vtkRenderWindowInteractor *ir
this->placedPointCount = 3;
controlP2->Highlight(0);
}
iren->Render();
return this->placedPointCount < 3;
}
@@ -209,6 +211,7 @@ void AngleAnnotationActor::controlPointCb(vtkObject *sender, unsigned long event
double result[3] = {0, 0, 0};
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
BaseDataPoints->SetPoint(index, result);
BaseDataPoints->Modified();
}
void AngleAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) {

View File

@@ -73,6 +73,7 @@ void LineAnnotationActor::controlPointCb(vtkObject *sender, unsigned long event,
double result[3] = {0, 0, 0};
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
BaseDataPoints->SetPoint(index, result);
BaseDataPoints->Modified();
}
void LineAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) {
@@ -95,6 +96,7 @@ void LineAnnotationActor::onMeasureMouseMove(vtkRenderWindowInteractor *iren) {
MapScreenPointToWorld(x,y,renderer,p);
controlP2->SetWorldPosition(p);
this->SetWorldPosition2(p);
Modified();
iren->Render();
}