Commit ecaddd46 authored by Giuseppe D'Angelo's avatar Giuseppe D'Angelo Committed by David Gobbi
Browse files

BUG 13603: make vtkContourFilter properly push progress notifications

vtkContourFilter uses several specialized subfilters depending
on the input data type to perform the contouring. However, the
progress from these subfilters wasn't pushed through the
vtkContourFilter object. This patch installs an observer on
the subfilter and properly updates vtkContourFilter's progress.

The work for this patch has been sponsored by BP.

Change-Id: I849b442318b0a59a64099add2fa6ccd74967725a
parent 01ac9f14
......@@ -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