Commit aacfacb2 authored by Ken Martin's avatar Ken Martin

some cleanup and changes

parent 4383930c
......@@ -23,7 +23,7 @@
#include "vtkPolyData.h"
#include "vtkPolyLine.h"
vtkCxxRevisionMacro(vtkTubeFilter, "1.80");
vtkCxxRevisionMacro(vtkTubeFilter, "1.80.10.1");
vtkStandardNewMacro(vtkTubeFilter);
// Construct object with radius 0.5, radius variation turned off, the number
......@@ -50,7 +50,7 @@ vtkTubeFilter::vtkTubeFilter()
void vtkTubeFilter::Execute()
{
vtkPolyData *input = this->GetInput();
vtkPolyData *input = this->GetPolyDataInput(0);
vtkPolyData *output = this->GetOutput();
vtkPointData *pd=input->GetPointData();
vtkPointData *outPD=output->GetPointData();
......
......@@ -50,7 +50,7 @@
#ifndef __vtkTubeFilter_h
#define __vtkTubeFilter_h
#include "vtkPolyDataToPolyDataFilter.h"
#include "vtkPolyDataAlgorithm.h"
#define VTK_VARY_RADIUS_OFF 0
#define VTK_VARY_RADIUS_BY_SCALAR 1
......@@ -69,10 +69,10 @@ class vtkFloatArray;
class vtkPointData;
class vtkPoints;
class VTK_GRAPHICS_EXPORT vtkTubeFilter : public vtkPolyDataToPolyDataFilter
class VTK_GRAPHICS_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
{
public:
vtkTypeRevisionMacro(vtkTubeFilter,vtkPolyDataToPolyDataFilter);
vtkTypeRevisionMacro(vtkTubeFilter,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -20,7 +20,7 @@
#include "math.h"
vtkCxxRevisionMacro(vtkGridTransform, "1.25");
vtkCxxRevisionMacro(vtkGridTransform, "1.25.4.1");
vtkStandardNewMacro(vtkGridTransform);
vtkCxxSetObjectMacro(vtkGridTransform,DisplacementGrid,vtkImageData);
......@@ -1294,17 +1294,17 @@ void vtkGridTransform::InternalUpdate()
grid->UpdateInformation();
if (grid->GetNumberOfScalarComponents() != 3)
if (grid->GetPipelineNumberOfScalarComponents() != 3)
{
vtkErrorMacro(<< "TransformPoint: displacement grid must have 3 components");
return;
}
if (grid->GetScalarType() != VTK_CHAR &&
grid->GetScalarType() != VTK_UNSIGNED_CHAR &&
grid->GetScalarType() != VTK_SHORT &&
grid->GetScalarType() != VTK_UNSIGNED_SHORT &&
grid->GetScalarType() != VTK_FLOAT &&
grid->GetScalarType() != VTK_DOUBLE)
if (grid->GetPipelineScalarType() != VTK_CHAR &&
grid->GetPipelineScalarType() != VTK_UNSIGNED_CHAR &&
grid->GetPipelineScalarType() != VTK_SHORT &&
grid->GetPipelineScalarType() != VTK_UNSIGNED_SHORT &&
grid->GetPipelineScalarType() != VTK_FLOAT &&
grid->GetPipelineScalarType() != VTK_DOUBLE)
{
vtkErrorMacro(<< "TransformPoint: displacement grid is of unsupported numerical type");
return;
......@@ -1314,7 +1314,7 @@ void vtkGridTransform::InternalUpdate()
grid->Update();
this->GridPointer = grid->GetScalarPointer();
this->GridScalarType = grid->GetScalarType();
this->GridScalarType = grid->GetPipelineScalarType();
grid->GetSpacing(this->GridSpacing);
grid->GetOrigin(this->GridOrigin);
......
......@@ -31,7 +31,7 @@
#include <limits.h>
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLImageMapper, "1.57");
vtkCxxRevisionMacro(vtkOpenGLImageMapper, "1.57.10.1");
vtkStandardNewMacro(vtkOpenGLImageMapper);
#endif
......@@ -377,7 +377,7 @@ void vtkOpenGLImageMapperRenderChar(vtkOpenGLImageMapper *self, vtkImageData *da
int* tempIncs = data->GetIncrements();
int inInc1 = tempIncs[1];
int bpp = data->GetNumberOfScalarComponents();
int bpp = data->GetPointData()->GetScalars()->GetNumberOfComponents();
double range[2];
data->GetPointData()->GetScalars()->GetDataTypeRange( range );
......@@ -583,7 +583,7 @@ void vtkOpenGLImageMapper::RenderData(vtkViewport* viewport,
#if defined(sparc) && defined(GL_VERSION_1_1)
glDisable(GL_BLEND);
#endif
switch (data->GetScalarType())
switch (data->GetPointData()->GetScalars()->GetDataType())
{
case VTK_DOUBLE:
vtkOpenGLImageMapperRender(this, data,
......
......@@ -27,7 +27,7 @@
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnsignedCharArray.h"
vtkCxxRevisionMacro(vtkRendererSource, "1.55");
vtkCxxRevisionMacro(vtkRendererSource, "1.55.2.1");
vtkStandardNewMacro(vtkRendererSource);
vtkCxxSetObjectMacro(vtkRendererSource,Input,vtkRenderer);
......@@ -41,7 +41,6 @@ vtkRendererSource::vtkRendererSource()
this->DepthValuesInScalars = 0;
this->SetNumberOfInputPorts(0);
this->SetNumberOfOutputPorts(1);
}
......@@ -54,30 +53,21 @@ vtkRendererSource::~vtkRendererSource()
}
}
#ifdef VTK_USE_EXECUTIVES
void vtkRendererSource::AlgorithmExecute(vtkInformation *,
vtkInformationVector *,
vtkInformationVector *outputVector)
#else
void vtkRendererSource::ExecuteData(vtkDataObject *outp)
#endif
void vtkRendererSource::ExecuteData(vtkInformation *,
vtkInformationVector *,
vtkInformationVector *outputVector)
{
int numOutPts;
float x1,y1,x2,y2;
unsigned char *pixels, *ptr;
int dims[3];
#ifdef VTK_USE_EXECUTIVES
vtkInformation* info = outputVector->GetInformationObject(0);
vtkImageData *output =
vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
int uExtent[6];
info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uExtent);
output->SetExtent(uExtent);
#else
vtkImageData *output = vtkImageData::SafeDownCast(outp);
output->SetExtent(output->GetUpdateExtent());
#endif
output->AllocateScalars();
vtkUnsignedCharArray *outScalars =
......@@ -288,21 +278,20 @@ unsigned long vtkRendererSource::GetMTime()
//----------------------------------------------------------------------------
// Consider renderer for PiplineMTime
#ifndef VTK_USE_EXECUTIVES
void vtkRendererSource::UpdateInformation()
void vtkRendererSource::ExecuteInformation (
vtkInformation * vtkNotUsed(request),
vtkInformationVector * vtkNotUsed( inputVector ),
vtkInformationVector *outputVector)
{
unsigned long t1;
vtkImageData *output = this->GetOutput();
vtkRenderer *ren = this->GetInput();
float x1,y1,x2,y2;
if (output == NULL || ren == NULL || ren->GetRenderWindow() == NULL)
if (ren == NULL || ren->GetRenderWindow() == NULL)
{
vtkErrorMacro("The input renderer has not been set yet!!!");
return;
}
// calc the pixel range for the renderer
float x1,y1,x2,y2;
x1 = ren->GetViewport()[0] * ((ren->GetRenderWindow())->GetSize()[0] - 1);
y1 = ren->GetViewport()[1] * ((ren->GetRenderWindow())->GetSize()[1] - 1);
x2 = ren->GetViewport()[2] * ((ren->GetRenderWindow())->GetSize()[0] - 1);
......@@ -314,147 +303,17 @@ void vtkRendererSource::UpdateInformation()
x2 = (this->Input->GetRenderWindow())->GetSize()[0] - 1;
y2 = (this->Input->GetRenderWindow())->GetSize()[1] - 1;
}
output->SetWholeExtent(0, static_cast<int>(x2-x1),
0, static_cast<int>(y2-y1), 0, 0);
output->SetScalarType(VTK_UNSIGNED_CHAR);
output->SetNumberOfScalarComponents(3 + (this->DepthValuesInScalars ? 1:0));
// Update information on the input and
// compute information that is general to vtkDataObject.
t1 = this->GetMTime();
output->SetPipelineMTime(t1);
this->InformationTime.Modified();
}
#endif
int vtkRendererSource::ProcessUpstreamRequest(
vtkInformation *request,
vtkInformationVector *,
vtkInformationVector *)
{
#ifdef VTK_USE_EXECUTIVES
if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))
{
// we have no inputs so there is nothing to do
return 1;
}
#else
(void)request;
#endif
return 0;
}
int vtkRendererSource::ProcessDownstreamRequest(
vtkInformation *request,
vtkInformationVector *inputVector,
vtkInformationVector *outputVector)
{
#ifdef VTK_USE_EXECUTIVES
// this is basically execute information
if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))
{
vtkDebugMacro("ProcessDownstreamRequest(REQUEST_INFORMATION) "
"calling ExecuteInformation.");
// Ask the subclass to fill in the information for the outputs.
this->InvokeEvent(vtkCommand::ExecuteInformationEvent, NULL);
// the executive has already passed all passable values to the output
// information, we just need to change any that should be different from
// the input
vtkInformation* info = outputVector->GetInformationObject(0);
vtkRenderer *ren = this->GetInput();
if (ren == NULL || ren->GetRenderWindow() == NULL)
{
vtkErrorMacro("The input renderer has not been set yet!!!");
return 0;
}
// calc the pixel range for the renderer
float x1,y1,x2,y2;
x1 = ren->GetViewport()[0] * ((ren->GetRenderWindow())->GetSize()[0] - 1);
y1 = ren->GetViewport()[1] * ((ren->GetRenderWindow())->GetSize()[1] - 1);
x2 = ren->GetViewport()[2] * ((ren->GetRenderWindow())->GetSize()[0] - 1);
y2 = ren->GetViewport()[3] *((ren->GetRenderWindow())->GetSize()[1] - 1);
if (this->WholeWindow)
{
x1 = 0;
y1 = 0;
x2 = (this->Input->GetRenderWindow())->GetSize()[0] - 1;
y2 = (this->Input->GetRenderWindow())->GetSize()[1] - 1;
}
int extent[6] = {0, static_cast<int>(x2-x1),
0, static_cast<int>(y2-y1),
0, 0};
info->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), extent, 6);
info->Set(vtkDataObject::SCALAR_TYPE(), VTK_UNSIGNED_CHAR);
info->Set(vtkDataObject::SCALAR_NUMBER_OF_COMPONENTS(),
3 + (this->DepthValuesInScalars ? 1:0));
// make sure the output is there
vtkImageData *output =
vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
if (!output)
{
output = vtkImageData::New();
info->Set(vtkDataObject::DATA_OBJECT(), output);
output->Delete();
}
output->SetScalarType(VTK_UNSIGNED_CHAR);
output->SetNumberOfScalarComponents(
3 + (this->DepthValuesInScalars ? 1:0));
return 1;
}
int extent[6] = {0, static_cast<int>(x2-x1),
0, static_cast<int>(y2-y1),
0, 0};
// generate the data
else if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))
{
// get the output data object
vtkInformation* info = outputVector->GetInformationObject(0);
vtkImageData *output =
vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
output->PrepareForNewData();
this->InvokeEvent(vtkCommand::StartEvent,NULL);
this->AbortExecute = 0;
this->Progress = 0.0;
this->AlgorithmExecute(request, inputVector, outputVector);
if(!this->AbortExecute)
{
this->UpdateProgress(1.0);
}
this->InvokeEvent(vtkCommand::EndEvent,NULL);
// get the info objects
vtkInformation* outInfo = outputVector->GetInformationObject(0);
// Mark the data as up-to-date.
output->DataHasBeenGenerated();
return 1;
}
return 0;
#else
return this->Superclass::ProcessDownstreamRequest(request, inputVector,
outputVector);
#endif
}
outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), extent, 6);
int vtkRendererSource::FillOutputPortInformation(
int port, vtkInformation* info)
{
// invoke super first
int retVal = this->Superclass::FillOutputPortInformation(port, info);
// now add our info
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkImageData");
info->Set(vtkDataObject::DATA_EXTENT_TYPE(), VTK_3D_EXTENT);
return retVal;
outInfo->Set(vtkDataObject::SCALAR_TYPE(), VTK_UNSIGNED_CHAR);
outInfo->Set(vtkDataObject::SCALAR_NUMBER_OF_COMPONENTS(),
3 + (this->DepthValuesInScalars ? 1:0));
}
......@@ -31,15 +31,15 @@
#ifndef __vtkRendererSource_h
#define __vtkRendererSource_h
#include "vtkImageSource.h"
#include "vtkImageAlgorithm.h"
class vtkRenderer;
class VTK_RENDERING_EXPORT vtkRendererSource : public vtkImageSource
class VTK_RENDERING_EXPORT vtkRendererSource : public vtkImageAlgorithm
{
public:
static vtkRendererSource *New();
vtkTypeRevisionMacro(vtkRendererSource,vtkImageSource);
vtkTypeRevisionMacro(vtkRendererSource,vtkImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......@@ -88,22 +88,13 @@ protected:
vtkRendererSource();
~vtkRendererSource();
#ifdef VTK_USE_EXECUTIVES
void AlgorithmExecute(vtkInformation *request,
vtkInformationVector *inputVector,
vtkInformationVector *outputVector);
#else
virtual void ExecuteData(vtkDataObject *outp);
void UpdateInformation();
#endif
void ExecuteData(vtkInformation *request,
vtkInformationVector *inputVector,
vtkInformationVector *outputVector);
virtual int ProcessUpstreamRequest(vtkInformation *,
vtkInformationVector *,
vtkInformationVector *);
virtual int ProcessDownstreamRequest(vtkInformation *,
vtkInformationVector *,
vtkInformationVector *);
virtual int FillOutputPortInformation(int port, vtkInformation* info);
virtual void ExecuteInformation(vtkInformation *,
vtkInformationVector *,
vtkInformationVector *);
vtkRenderer *Input;
int WholeWindow;
......
......@@ -16,11 +16,14 @@
#include "vtkCamera.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkRenderWindow.h"
#include "vtkRendererCollection.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkWindowToImageFilter, "1.29");
vtkCxxRevisionMacro(vtkWindowToImageFilter, "1.29.2.1");
vtkStandardNewMacro(vtkWindowToImageFilter);
//----------------------------------------------------------------------------
......@@ -34,6 +37,8 @@ vtkWindowToImageFilter::vtkWindowToImageFilter()
this->Viewport[1] = 0;
this->Viewport[2] = 1;
this->Viewport[3] = 1;
this->SetNumberOfInputPorts(0);
}
//----------------------------------------------------------------------------
......@@ -61,7 +66,7 @@ void vtkWindowToImageFilter::SetInput(vtkWindow *input)
//----------------------------------------------------------------------------
void vtkWindowToImageFilter::PrintSelf(ostream& os, vtkIndent indent)
{
vtkImageSource::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
if ( this->Input )
{
......@@ -82,7 +87,10 @@ void vtkWindowToImageFilter::PrintSelf(ostream& os, vtkIndent indent)
//----------------------------------------------------------------------------
// This method returns the largest region that can be generated.
void vtkWindowToImageFilter::ExecuteInformation()
void vtkWindowToImageFilter::ExecuteInformation (
vtkInformation * vtkNotUsed(request),
vtkInformationVector * vtkNotUsed( inputVector ),
vtkInformationVector *outputVector)
{
if (this->Input == NULL )
{
......@@ -101,26 +109,24 @@ void vtkWindowToImageFilter::ExecuteInformation()
this->Viewport[3] = 1;
}
vtkImageData *out = this->GetOutput();
// set the extent
int *size = this->Input->GetSize();
out->SetWholeExtent(0,
int((this->Viewport[2] - this->Viewport[0])*size[0] + 0.5)*this->Magnification - 1,
0,
int((this->Viewport[3] - this->Viewport[1])*size[1] + 0.5)*this->Magnification - 1,
0, 0);
// set the spacing
out->SetSpacing(1.0, 1.0, 1.0);
// set the origin.
out->SetOrigin(0.0, 0.0, 0.0);
// set the scalar components
out->SetNumberOfScalarComponents(3);
out->SetScalarType(VTK_UNSIGNED_CHAR);
int wExtent[6];
wExtent[0]= 0;
wExtent[1] = int((this->Viewport[2] - this->Viewport[0])*size[0] + 0.5)*
this->Magnification - 1;
wExtent[2] = 0;
wExtent[3] = int((this->Viewport[3] - this->Viewport[1])*size[1] + 0.5)*
this->Magnification - 1;
wExtent[4] = 0;
wExtent[5] = 0;
// get the info objects
vtkInformation* outInfo = outputVector->GetInformationObject(0);
outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wExtent, 6);
outInfo->Set(vtkDataObject::SCALAR_TYPE(), VTK_UNSIGNED_CHAR);
outInfo->Set(vtkDataObject::SCALAR_NUMBER_OF_COMPONENTS(),3);
}
......
......@@ -42,16 +42,16 @@
#ifndef __vtkWindowToImageFilter_h
#define __vtkWindowToImageFilter_h
#include "vtkImageSource.h"
#include "vtkImageAlgorithm.h"
class vtkWindow;
class VTK_RENDERING_EXPORT vtkWindowToImageFilter : public vtkImageSource
class VTK_RENDERING_EXPORT vtkWindowToImageFilter : public vtkImageAlgorithm
{
public:
static vtkWindowToImageFilter *New();
vtkTypeRevisionMacro(vtkWindowToImageFilter,vtkImageSource);
vtkTypeRevisionMacro(vtkWindowToImageFilter,vtkImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......@@ -66,6 +66,7 @@ public:
// The magnification of the current render window
vtkSetClampMacro(Magnification,int,1,2048);
vtkGetMacro(Magnification,int);
// Description:
// Set/Get the flag that determines which buffer to read from.
// The default is to read from the front buffer.
......@@ -96,8 +97,13 @@ protected:
int ReadFrontBuffer;
int ShouldRerender;
double Viewport[4];
void ExecuteInformation();
virtual void ExecuteInformation(vtkInformation *,
vtkInformationVector *,
vtkInformationVector *);
void ExecuteData(vtkDataObject *data);
private:
vtkWindowToImageFilter(const vtkWindowToImageFilter&); // Not implemented.
void operator=(const vtkWindowToImageFilter&); // 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