perf: Improve polygon render performance
This commit is contained in:
@@ -34,6 +34,7 @@ void OpenPolyAnnotationActor::BuildShape() {
|
|||||||
QString stamp = QString("%1-%2").arg(BaseDataPoints->GetMTime())
|
QString stamp = QString("%1-%2").arg(BaseDataPoints->GetMTime())
|
||||||
.arg(Renderer->GetActiveCamera()->GetMTime());
|
.arg(Renderer->GetActiveCamera()->GetMTime());
|
||||||
if (mRenderTime == stamp) return;
|
if (mRenderTime == stamp) return;
|
||||||
|
mRenderTime = stamp;
|
||||||
RebuildRenderPoint();
|
RebuildRenderPoint();
|
||||||
vtkNew<vtkPolyLineSource> source;
|
vtkNew<vtkPolyLineSource> source;
|
||||||
source->SetClosed(this->Closed);
|
source->SetClosed(this->Closed);
|
||||||
@@ -65,6 +66,7 @@ void OpenPolyAnnotationActor::BuildShape() {
|
|||||||
void OpenPolyAnnotationActor::SetPointWorldPosition(vtkIdType index, double x, double y, double z) {
|
void OpenPolyAnnotationActor::SetPointWorldPosition(vtkIdType index, double x, double y, double z) {
|
||||||
|
|
||||||
BaseDataPoints->SetPoint(index, x, y, z);
|
BaseDataPoints->SetPoint(index, x, y, z);
|
||||||
|
BaseDataPoints->Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenPolyAnnotationActor::onMeasureLeftButtonDown(vtkRenderWindowInteractor * iren) {
|
bool OpenPolyAnnotationActor::onMeasureLeftButtonDown(vtkRenderWindowInteractor * iren) {
|
||||||
@@ -84,6 +86,7 @@ bool OpenPolyAnnotationActor::onMeasureLeftButtonDown(vtkRenderWindowInteractor
|
|||||||
controlP->AddObserver(vtkCommand::LeaveEvent, this, &OpenPolyAnnotationActor::HighlightOff);
|
controlP->AddObserver(vtkCommand::LeaveEvent, this, &OpenPolyAnnotationActor::HighlightOff);
|
||||||
controlPointList.push_back(controlP);
|
controlPointList.push_back(controlP);
|
||||||
controlP->Index = BaseDataPoints->InsertNextPoint( p);
|
controlP->Index = BaseDataPoints->InsertNextPoint( p);
|
||||||
|
BaseDataPoints->Modified();
|
||||||
this->SetRenderer(renderer);
|
this->SetRenderer(renderer);
|
||||||
iren->Render();
|
iren->Render();
|
||||||
return true;
|
return true;
|
||||||
@@ -152,6 +155,7 @@ void OpenPolyAnnotationActor::selfDragCb(vtkObject *, unsigned long event, void
|
|||||||
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
|
MapScreenPointToWorld(pos[0], pos[1], this->Renderer, result);
|
||||||
controlPointList[i]->SetWorldPosition(result);
|
controlPointList[i]->SetWorldPosition(result);
|
||||||
}
|
}
|
||||||
|
BaseDataPoints->Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenPolyAnnotationActor::controlPointCb(vtkObject *sender, unsigned long event, void *data) {
|
void OpenPolyAnnotationActor::controlPointCb(vtkObject *sender, unsigned long event, void *data) {
|
||||||
@@ -161,6 +165,7 @@ void OpenPolyAnnotationActor::controlPointCb(vtkObject *sender, unsigned long ev
|
|||||||
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();
|
||||||
UpdatePerimeterAndAreaText();
|
UpdatePerimeterAndAreaText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user