[Paraview] add a vtk filter

Nyx abny abnocte at gmail.com
Mon Apr 9 11:56:14 EDT 2007


Hi,

I'm trying to add a filter to ParaView, but I'm having problems compiling
the code. I have this files:

*vtkFlipCoordsFilter.h*

#ifndef __vtkFlipCoordsFilter_h
#define __vtkFlipCoordsFilter_h

#include "vtkPointSetAlgorithm.h"

class VTK_EXPORT vtkFlipCoordsFilter : public vtkPointSetAlgorithm
{
public:
vtkTypeRevisionMacro(vtkFlipCoordsFilter,vtkPointSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkFlipCoordsFilter* New();


//Description:
//Set/get wich axis coordinates should be negated.
//x=0, y=1, z=2
vtkSetClampMacro(Axis, int, 0, 2);
vtkGetMacro(Axis, int);

protected:
vtkFlipCoordsFilter();
~vtkFlipCoordsFilter();

int RequestData(vtkInformation *, vtkInformationVector **,
vtkInformationVector *);
int Axis;
private:
vtkFlipCoordsFilter(const vtkFlipCoordsFilter&); //not implemented
void operator= (const vtkFlipCoordsFilter&);//not implemented
};

#endif

*vtkFlipCoordsFilter.cxx

*#include "vtkFlipCoordsFilter.h"

#include "vtkCellData.h"
#include "vtkPointData.h"
#include "vtkPoints.h"
#include "vtkPointSet.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"

vtkStandardNewMacro(vtkFlipCoordsFilter);
vtkCxxRevisionMacro(vtkFlipCoordsFilter, "$Revision: 1.1 $");

//----------------------------------------------------------------------------
vtkFlipCoordsFilter::vtkFlipCoordsFilter(){
this->Axis = 1;
}

//----------------------------------------------------------------------------
int vtkFlipCoordsFilter::RequestData(vtkInformation* vtkNotUsed(request),
vtkInformationVector** inputVector, vtkInformationVector* outputVector){

// get the information objects
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);

// get the input and output
vtkPointSet *input =
vtkPointSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkPointSet *output =
vtkPointSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));

// Copy the structure of the input dataset to the output.
output->CopyStructure(input);

int numPts = input->GetNumberOfPoints();
vtkPoints *points = input->GetPoints();
vtkPoints *newPts = vtkPoints::New();
newPts->SetNumberOfPoints(numPts);

double pt[3];
int i;

for (i = 0; i < numPts; i++)
{
// Negate the specified coordinate.
points->GetPoint(i, pt);
pt[this->Axis] *= -1;
newPts->SetPoint(i, pt);
}

output->GetPointData()->CopyNormalsOff(); // distorted geometry
output->GetPointData()->PassData(input->GetPointData());
output->GetCellData()->CopyNormalsOff(); // distorted geometry
output->GetCellData()->PassData(input->GetCellData());

output->SetPoints(newPts);
newPts->Delete();

return 1;
}

//----------------------------------------------------------------------------
void vtkFlipCoordsFilter::PrintSelf(ostream& os, vtkIndent indent){
this->Superclass::PrintSelf(os, indent);

os << indent << "Axis: " << this->Axis << endl;
}

ccmake runs fine, but when I run make I get this message (verbose is on):

abnocte at abnocte-laptop:~/software/modulos/flipCoords$ make
/home/abnocte/software/cmake-2.4.3-Linux-i386/bin/cmake
-H/home/abnocte/software/modulos/flipCoords
-B/home/abnocte/software/modulos/flipCoords --check-build-system
CMakeFiles/Makefile.cmake 0
/home/abnocte/software/cmake-2.4.3-Linux-i386/bin/cmake -E
cmake_progress_start /home/abnocte/software/modulos/flipCoords/CMakeFiles 4
make -f CMakeFiles/Makefile2 all
make[1]: se ingresa al directorio
`/home/abnocte/software/modulos/flipCoords'
make -f CMakeFiles/myCustom.dir/build.make CMakeFiles/myCustom.dir/depend
make[2]: se ingresa al directorio
`/home/abnocte/software/modulos/flipCoords'
/home/abnocte/software/cmake-2.4.3-Linux-i386/bin/cmake -E
cmake_progress_report /home/abnocte/software/modulos/flipCoords/CMakeFiles 4
[ 25%] Generating vtkFlipCoordsFilterClientServer.cxx *
<- this is never generated*
./vtkFlipCoordsFilter.h 1
/home/abnocte/software/modulos/flipCoords/vtkFlipCoordsFilterClientServer.cxx
./vtkFlipCoordsFilter.h: 6: class: not found
./vtkFlipCoordsFilter.h: 9: Syntax error: word unexpected (expecting ")")
make[2]: *** [vtkFlipCoordsFilterClientServer.cxx] Error 2
make[2]: se sale del directorio `/home/abnocte/software/modulos/flipCoords'
make[1]: *** [CMakeFiles/myCustom.dir/all] Error 2
make[1]: se sale del directorio `/home/abnocte/software/modulos/flipCoords'
make: *** [all] Error 2*
*

Any ideas??
*
*Thanks*
**
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20070409/8f716b4b/attachment.htm


More information about the ParaView mailing list