Commit 9455068e authored by Amy Squillacote's avatar Amy Squillacote

ENH: provide a method so you can specify a function to be used during the...

ENH: provide a method so you can specify a function to be used during the RequestInformation pass; this allows this source to work with image data
parent 1bef8a44
......@@ -24,7 +24,7 @@
#include "vtkObjectFactory.h"
#include "vtkCommand.h"
vtkCxxRevisionMacro(vtkProgrammableSource, "1.25");
vtkCxxRevisionMacro(vtkProgrammableSource, "1.26");
vtkStandardNewMacro(vtkProgrammableSource);
// Construct programmable filter with empty execute method.
......@@ -33,6 +33,7 @@ vtkProgrammableSource::vtkProgrammableSource()
this->ExecuteMethod = NULL;
this->ExecuteMethodArg = NULL;
this->ExecuteMethodArgDelete = NULL;
this->RequestInformationMethod = NULL;
this->SetNumberOfInputPorts(0);
this->SetNumberOfOutputPorts(5);
......@@ -97,6 +98,15 @@ void vtkProgrammableSource::SetExecuteMethodArgDelete(void (*f)(void *))
}
}
void vtkProgrammableSource::SetRequestInformationMethod(void (*f)(void *))
{
if ( f != this->RequestInformationMethod )
{
this->RequestInformationMethod = f;
this->Modified();
}
}
// Get the output as a concrete type. This method is typically used by the
// writer of the source function to get the output as a particular type (i.e.,
......@@ -306,3 +316,18 @@ int vtkProgrammableSource::RequestDataObject(
}
return 1;
}
int vtkProgrammableSource::RequestInformation(vtkInformation *,
vtkInformationVector **,
vtkInformationVector *)
{
vtkDebugMacro(<<"requesting information");
// Now invoke the procedure, if specified.
if ( this->RequestInformationMethod != NULL )
{
(*this->RequestInformationMethod)(NULL);
}
return 1;
}
......@@ -58,6 +58,10 @@ public:
// Set the arg delete method. This is used to free user memory.
void SetExecuteMethodArgDelete(void (*f)(void *));
// Description:
// Specify the function to use to fill in information about the source data.
void SetRequestInformationMethod(void (*f)(void *));
// Description:
// Get the output as a concrete type. This method is typically used by the
// writer of the source function to get the output as a particular type
......@@ -87,10 +91,12 @@ protected:
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
void (*ExecuteMethod)(void *); //function to invoke
void (*ExecuteMethodArgDelete)(void *);
void *ExecuteMethodArg;
void *ExecuteMethodArg;
void (*RequestInformationMethod)(void *); // function to invoke
vtkTimeStamp ExecuteTime;
int RequestedDataType;
......
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