perf: imporve annotationactor render performance
This commit is contained in:
@@ -109,6 +109,7 @@ void DraggableActor::Transform(float x, float y) {
|
|||||||
if (this->OnDrag) {
|
if (this->OnDrag) {
|
||||||
OnDrag(renderPoints);
|
OnDrag(renderPoints);
|
||||||
}
|
}
|
||||||
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DraggableActor::ApplyTransform() {
|
void DraggableActor::ApplyTransform() {
|
||||||
@@ -143,8 +144,11 @@ void DraggableActor::ReleaseGraphicsResources(vtkWindow *window) {
|
|||||||
|
|
||||||
int DraggableActor::RenderOverlay(vtkViewport *viewport) {
|
int DraggableActor::RenderOverlay(vtkViewport *viewport) {
|
||||||
if (BaseDataPoints->GetNumberOfPoints()<=0) return vtkProp::RenderOverlay(viewport);
|
if (BaseDataPoints->GetNumberOfPoints()<=0) return vtkProp::RenderOverlay(viewport);
|
||||||
QString newRenderTime = QString("%1-%2-%3").arg(BaseDataPoints->GetMTime())
|
QString rendererSize = QString("rendererSize:%1,%2").arg(Renderer->GetRenderWindow()->GetSize()[0]).arg(Renderer->GetRenderWindow()->GetSize()[1]);
|
||||||
.arg(Renderer->GetMTime()).arg(Renderer->GetActiveCamera()->GetMTime());
|
QString newRenderTime = QString("%1-%2-%3-%4").arg(BaseDataPoints->GetMTime())
|
||||||
|
.arg(rendererSize).arg(Renderer->GetActiveCamera()->GetMTime())
|
||||||
|
.arg(GetMTime());
|
||||||
|
|
||||||
if (mRenderTime != newRenderTime)
|
if (mRenderTime != newRenderTime)
|
||||||
{
|
{
|
||||||
BuildShape();
|
BuildShape();
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ void AngleAnnotationActor::onMeasureMouseMove(vtkRenderWindowInteractor *iren) {
|
|||||||
}
|
}
|
||||||
controlP3->SetWorldPosition(p);
|
controlP3->SetWorldPosition(p);
|
||||||
this->SetWorldPosition3(p);
|
this->SetWorldPosition3(p);
|
||||||
|
Modified();
|
||||||
iren->Render();
|
iren->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +180,7 @@ bool AngleAnnotationActor::onMeasureLeftButtonDown(vtkRenderWindowInteractor *ir
|
|||||||
this->placedPointCount = 3;
|
this->placedPointCount = 3;
|
||||||
controlP2->Highlight(0);
|
controlP2->Highlight(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
iren->Render();
|
iren->Render();
|
||||||
return this->placedPointCount < 3;
|
return this->placedPointCount < 3;
|
||||||
}
|
}
|
||||||
@@ -209,6 +211,7 @@ void AngleAnnotationActor::controlPointCb(vtkObject *sender, unsigned long event
|
|||||||
double result[3] = {0, 0, 0};
|
double result[3] = {0, 0, 0};
|
||||||
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
|
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
|
||||||
BaseDataPoints->SetPoint(index, result);
|
BaseDataPoints->SetPoint(index, result);
|
||||||
|
BaseDataPoints->Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AngleAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) {
|
void AngleAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ void LineAnnotationActor::controlPointCb(vtkObject *sender, unsigned long event,
|
|||||||
double result[3] = {0, 0, 0};
|
double result[3] = {0, 0, 0};
|
||||||
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
|
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
|
||||||
BaseDataPoints->SetPoint(index, result);
|
BaseDataPoints->SetPoint(index, result);
|
||||||
|
BaseDataPoints->Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) {
|
void LineAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) {
|
||||||
@@ -95,6 +96,7 @@ void LineAnnotationActor::onMeasureMouseMove(vtkRenderWindowInteractor *iren) {
|
|||||||
MapScreenPointToWorld(x,y,renderer,p);
|
MapScreenPointToWorld(x,y,renderer,p);
|
||||||
controlP2->SetWorldPosition(p);
|
controlP2->SetWorldPosition(p);
|
||||||
this->SetWorldPosition2(p);
|
this->SetWorldPosition2(p);
|
||||||
|
Modified();
|
||||||
iren->Render();
|
iren->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user