Commit 99c6b8c2 authored by David Gobbi's avatar David Gobbi Committed by Code Review
Browse files

Merge topic 'vtkContourFilter-progress-fix' into master

ecaddd46 BUG 13603: make vtkContourFilter properly push progress notifications
parents 07670a92 ecaddd46
......@@ -14,6 +14,7 @@
=========================================================================*/
#include "vtkContourFilter.h"
#include "vtkCallbackCommand.h"
#include "vtkCell.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
......@@ -72,6 +73,20 @@ vtkContourFilter::vtkContourFilter()
this->GridSynchronizedTemplates = vtkGridSynchronizedTemplates3D::New();
this->RectilinearSynchronizedTemplates = vtkRectilinearSynchronizedTemplates::New();
this->InternalProgressCallbackCommand = vtkCallbackCommand::New();
this->InternalProgressCallbackCommand->SetCallback(
&vtkContourFilter::InternalProgressCallbackFunction);
this->InternalProgressCallbackCommand->SetClientData(this);
this->SynchronizedTemplates2D->AddObserver(vtkCommand::ProgressEvent,
this->InternalProgressCallbackCommand);
this->SynchronizedTemplates3D->AddObserver(vtkCommand::ProgressEvent,
this->InternalProgressCallbackCommand);
this->GridSynchronizedTemplates->AddObserver(vtkCommand::ProgressEvent,
this->InternalProgressCallbackCommand);
this->RectilinearSynchronizedTemplates->AddObserver(vtkCommand::ProgressEvent,
this->InternalProgressCallbackCommand);
// by default process active point scalars
this->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,
vtkDataSetAttributes::SCALARS);
......@@ -97,6 +112,7 @@ vtkContourFilter::~vtkContourFilter()
this->SynchronizedTemplates3D->Delete();
this->GridSynchronizedTemplates->Delete();
this->RectilinearSynchronizedTemplates->Delete();
this->InternalProgressCallbackCommand->Delete();
}
// Overload standard modified time function. If contour values are modified,
......@@ -804,3 +820,14 @@ void vtkContourFilter::ReportReferences(vtkGarbageCollector* collector)
// reference loop.
vtkGarbageCollectorReport(collector, this->ScalarTree, "ScalarTree");
}
//----------------------------------------------------------------------------
void vtkContourFilter::InternalProgressCallbackFunction(vtkObject *vtkNotUsed(caller),
unsigned long vtkNotUsed(eid),
void *clientData,
void *callData)
{
vtkContourFilter *contourFilter = static_cast<vtkContourFilter *>(clientData);
double progress = *static_cast<double *>(callData);
contourFilter->UpdateProgress(progress);
}
......@@ -55,6 +55,7 @@ class vtkSynchronizedTemplates2D;
class vtkSynchronizedTemplates3D;
class vtkGridSynchronizedTemplates3D;
class vtkRectilinearSynchronizedTemplates;
class vtkCallbackCommand;
class VTKFILTERSCORE_EXPORT vtkContourFilter : public vtkPolyDataAlgorithm
{
......@@ -188,6 +189,12 @@ protected:
vtkSynchronizedTemplates3D *SynchronizedTemplates3D;
vtkGridSynchronizedTemplates3D *GridSynchronizedTemplates;
vtkRectilinearSynchronizedTemplates *RectilinearSynchronizedTemplates;
vtkCallbackCommand *InternalProgressCallbackCommand;
static void InternalProgressCallbackFunction(vtkObject *caller,
unsigned long eid,
void *clientData,
void *callData);
private:
vtkContourFilter(const vtkContourFilter&); // Not implemented.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment