From 4cb21794ab2de1565dc53d4ef10a3ae7e118e003 Mon Sep 17 00:00:00 2001 From: enk Date: Thu, 15 Mar 2007 15:03:48 +0000 Subject: [PATCH] Porting to VTK-5.0.0 --- adm_local/unix/config_files/check_vtk.m4 | 2 +- build_configure | 6 ++ src/OCCViewer/Makefile.am | 5 +- src/SALOME_PY/Makefile.am | 2 +- src/SVTK/SALOME_Actor.cxx | 2 +- src/SVTK/SVTK_DeviceActor.cxx | 8 +-- src/SVTK/SVTK_DeviceActor.h | 4 +- src/SVTK/SVTK_Renderer.cxx | 2 +- src/VTKViewer/Makefile.am | 4 -- src/VTKViewer/VTKViewer.cxx | 2 - src/VTKViewer/VTKViewer_Actor.cxx | 6 +- src/VTKViewer/VTKViewer_Actor.h | 4 +- src/VTKViewer/VTKViewer_AppendFilter.cxx | 67 ++++++++++++++----- src/VTKViewer/VTKViewer_AppendFilter.h | 13 ++-- src/VTKViewer/VTKViewer_CellLocationsArray.h | 2 +- .../VTKViewer_ExtractUnstructuredGrid.cxx | 25 ++++++- .../VTKViewer_ExtractUnstructuredGrid.h | 5 +- src/VTKViewer/VTKViewer_GeometryFilter.cxx | 42 ++++++++---- src/VTKViewer/VTKViewer_GeometryFilter.h | 11 +-- src/VTKViewer/VTKViewer_PassThroughFilter.cxx | 19 +++++- src/VTKViewer/VTKViewer_PassThroughFilter.h | 3 +- src/VTKViewer/VTKViewer_ShrinkFilter.cxx | 23 +++++-- src/VTKViewer/VTKViewer_ShrinkFilter.h | 2 +- src/VTKViewer/VTKViewer_TransformFilter.cxx | 23 +++++-- src/VTKViewer/VTKViewer_TransformFilter.h | 3 +- src/VTKViewer/VTKViewer_Trihedron.cxx | 5 +- src/VTKViewer/VTKViewer_Trihedron.h | 4 +- src/VTKViewer/VTKViewer_VectorText.h | 4 +- src/VTKViewer/VTKViewer_ViewWindow.cxx | 2 +- 29 files changed, 215 insertions(+), 85 deletions(-) diff --git a/adm_local/unix/config_files/check_vtk.m4 b/adm_local/unix/config_files/check_vtk.m4 index a0733ebc3..96ec3b948 100644 --- a/adm_local/unix/config_files/check_vtk.m4 +++ b/adm_local/unix/config_files/check_vtk.m4 @@ -70,7 +70,7 @@ then fi LOCAL_INCLUDES="$OGL_INCLUDES" -LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid $OGL_LIBS $LXLIB -lX11 -lXt" +LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets $OGL_LIBS $LXLIB -lX11 -lXt" TRY_LINK_LIBS="-lvtkCommon $OGL_LIBS $LXLIB -lX11 -lXt" if test -z $VTKHOME diff --git a/build_configure b/build_configure index ae51779c0..38c83ea1c 100755 --- a/build_configure +++ b/build_configure @@ -36,6 +36,12 @@ do rm salome_adm/unix/config_files/${deprecated} done +# remove KERNEL CVS directories in subdirectory salome_adm +for deprecated in CVS unix/CVS unix/config_files/CVS +do + rm -rf salome_adm/${deprecated} +done + cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix # ____________________________________________________________________ diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am index 2cde3fb57..eb5b86205 100755 --- a/src/OCCViewer/Makefile.am +++ b/src/OCCViewer/Makefile.am @@ -34,8 +34,9 @@ salomeinclude_HEADERS= \ OCCViewer_ViewWindow.h \ OCCViewer_VService.h \ OCCViewer_CreateRestoreViewDlg.h \ - OCCViewer_SetRotationPointDlg.h \ - OCCViewer.h + OCCViewer.h \ + OCCViewer_ClippingDlg.h \ + OCCViewer_SetRotationPointDlg.h dist_libOCCViewer_la_SOURCES= \ OCCViewer_AISSelector.cxx \ diff --git a/src/SALOME_PY/Makefile.am b/src/SALOME_PY/Makefile.am index d2e43924a..6d94b90d4 100755 --- a/src/SALOME_PY/Makefile.am +++ b/src/SALOME_PY/Makefile.am @@ -41,4 +41,4 @@ libSalomePy_la_CPPFLAGS=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \ -I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomePy_la_LDFLAGS=$(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) \ ../SalomeApp/libSalomeApp.la \ - -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython + -lvtkCommonPythonD -lvtkGraphicsPythonD -lvtkImagingPythonD diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 8bd1cbd43..b9597c30c 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -36,7 +36,6 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" -#include "VTKViewer_PassThroughFilter.h" #include "VTKViewer_GeometryFilter.h" #include "SVTK_RectPicker.h" @@ -58,6 +57,7 @@ #include #include +#include #include #include diff --git a/src/SVTK/SVTK_DeviceActor.cxx b/src/SVTK/SVTK_DeviceActor.cxx index e5ab58ff9..a3bb03773 100644 --- a/src/SVTK/SVTK_DeviceActor.cxx +++ b/src/SVTK/SVTK_DeviceActor.cxx @@ -31,7 +31,6 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" -#include "VTKViewer_PassThroughFilter.h" #include "VTKViewer_GeometryFilter.h" // VTK Includes @@ -44,6 +43,8 @@ #include #include +#include + using namespace std; vtkStandardNewMacro(SVTK_DeviceActor); @@ -74,7 +75,7 @@ SVTK_DeviceActor myTransformFilter = VTKViewer_TransformFilter::New(); for(int i = 0; i < 6; i++) - myPassFilter.push_back(VTKViewer_PassThroughFilter::New()); + myPassFilter.push_back(vtkPassThroughFilter::New()); } /*! @@ -139,8 +140,7 @@ SVTK_DeviceActor }else if(vtkPolyDataMapper* aMapper = dynamic_cast(theMapper)){ aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput()); } - }else - myPassFilter[ 0 ]->SetInput( NULL ); + } Superclass::SetMapper(theMapper); } diff --git a/src/SVTK/SVTK_DeviceActor.h b/src/SVTK/SVTK_DeviceActor.h index fe89fdd07..47fc3e12d 100644 --- a/src/SVTK/SVTK_DeviceActor.h +++ b/src/SVTK/SVTK_DeviceActor.h @@ -39,13 +39,13 @@ class VTKViewer_Transform; class VTKViewer_TransformFilter; -class VTKViewer_PassThroughFilter; class VTKViewer_GeometryFilter; class vtkCell; class vtkDataSet; class vtkShrinkFilter; class vtkDataSetMapper; +class vtkPassThroughFilter; namespace SVTK { @@ -188,7 +188,7 @@ class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor VTKViewer_GeometryFilter *myGeomFilter; VTKViewer_TransformFilter *myTransformFilter; - std::vector myPassFilter; + std::vector myPassFilter; vtkShrinkFilter* myShrinkFilter; vtkDataSetMapper* myMapper; diff --git a/src/SVTK/SVTK_Renderer.cxx b/src/SVTK/SVTK_Renderer.cxx index d3020f1c1..9dd784fb1 100644 --- a/src/SVTK/SVTK_Renderer.cxx +++ b/src/SVTK/SVTK_Renderer.cxx @@ -112,7 +112,7 @@ SVTK_Renderer myEventCallbackCommand->Delete(); myTrihedron->AddToRender(GetDevice()); - GetDevice()->AddProp(GetCubeAxes()); + GetDevice()->AddViewProp(GetCubeAxes()); myBndBox[0] = myBndBox[2] = myBndBox[4] = 0; myBndBox[1] = myBndBox[3] = myBndBox[5] = myTrihedron->GetSize(); diff --git a/src/VTKViewer/Makefile.am b/src/VTKViewer/Makefile.am index f95942888..1eeae3737 100755 --- a/src/VTKViewer/Makefile.am +++ b/src/VTKViewer/Makefile.am @@ -36,7 +36,6 @@ salomeinclude_HEADERS= \ VTKViewer_AppendFilter.h \ VTKViewer_Algorithm.h \ VTKViewer_InteractorStyle.h \ - VTKViewer_PassThroughFilter.h \ VTKViewer_RenderWindow.h \ VTKViewer_RenderWindowInteractor.h \ VTKViewer_ShrinkFilter.h \ @@ -44,7 +43,6 @@ salomeinclude_HEADERS= \ VTKViewer_Transform.h \ VTKViewer_Trihedron.h \ VTKViewer_Utilities.h \ - VTKViewer_VectorText.h \ VTKViewer_ViewManager.h \ VTKViewer_ViewModel.h \ VTKViewer_ViewWindow.h \ @@ -58,7 +56,6 @@ dist_libVTKViewer_la_SOURCES= \ VTKViewer_GeometryFilter.cxx \ VTKViewer_AppendFilter.cxx \ VTKViewer_InteractorStyle.cxx \ - VTKViewer_PassThroughFilter.cxx \ VTKViewer_RenderWindow.cxx \ VTKViewer_RenderWindowInteractor.cxx \ VTKViewer_ShrinkFilter.cxx \ @@ -66,7 +63,6 @@ dist_libVTKViewer_la_SOURCES= \ VTKViewer_TransformFilter.cxx \ VTKViewer_Trihedron.cxx \ VTKViewer_Utilities.cxx \ - VTKViewer_VectorText.cxx \ VTKViewer_ViewManager.cxx \ VTKViewer_ViewModel.cxx \ VTKViewer_ConvexTool.cxx \ diff --git a/src/VTKViewer/VTKViewer.cxx b/src/VTKViewer/VTKViewer.cxx index 8a35f8bc1..a65c5c204 100644 --- a/src/VTKViewer/VTKViewer.cxx +++ b/src/VTKViewer/VTKViewer.cxx @@ -34,7 +34,6 @@ #include "VTKViewer_AppendFilter.h" #include "VTKViewer_Algorithm.h" #include "VTKViewer_InteractorStyle.h" -#include "VTKViewer_PassThroughFilter.h" #include "VTKViewer_RenderWindow.h" #include "VTKViewer_RenderWindowInteractor.h" #include "VTKViewer_ShrinkFilter.h" @@ -42,7 +41,6 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_Trihedron.h" #include "VTKViewer_Utilities.h" -#include "VTKViewer_VectorText.h" #include "VTKViewer_ViewManager.h" #include "VTKViewer_ViewModel.h" #include "VTKViewer_ViewWindow.h" diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx index 5f0e621e7..5c65df651 100755 --- a/src/VTKViewer/VTKViewer_Actor.cxx +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -36,7 +36,6 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" -#include "VTKViewer_PassThroughFilter.h" #include "VTKViewer_GeometryFilter.h" // VTK Includes @@ -47,6 +46,7 @@ #include #include #include +#include using namespace std; @@ -83,7 +83,7 @@ VTKViewer_Actor myPolygonOffsetUnits); for(int i = 0; i < 6; i++) - myPassFilter.push_back(VTKViewer_PassThroughFilter::New()); + myPassFilter.push_back(vtkPassThroughFilter::New()); } /*! @@ -347,7 +347,7 @@ VTKViewer_Actor unsigned long mTime = this->Superclass::GetMTime(); unsigned long time = myTransformFilter->GetMTime(); mTime = ( time > mTime ? time : mTime ); - if(vtkDataSet *aDataSet = myPassFilter[0]->GetInput()){ + if(vtkDataSet *aDataSet = dynamic_cast(myPassFilter[0]->GetInput())){ // bad usage of GetInput time = aDataSet->GetMTime(); mTime = ( time > mTime ? time : mTime ); } diff --git a/src/VTKViewer/VTKViewer_Actor.h b/src/VTKViewer/VTKViewer_Actor.h index 28d5af787..72035b6ae 100755 --- a/src/VTKViewer/VTKViewer_Actor.h +++ b/src/VTKViewer/VTKViewer_Actor.h @@ -43,11 +43,11 @@ class vtkDataSet; class vtkCamera; class vtkProperty; class vtkRenderer; +class vtkPassThroughFilter; class VTKViewer_Transform; class VTKViewer_GeometryFilter; class VTKViewer_TransformFilter; -class VTKViewer_PassThroughFilter; extern int VTKViewer_POINT_SIZE; extern int VTKViewer_LINE_WIDTH; @@ -317,7 +317,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor bool myStoreMapping; VTKViewer_GeometryFilter *myGeomFilter; VTKViewer_TransformFilter *myTransformFilter; - std::vector myPassFilter; + std::vector myPassFilter; int myRepresentation; vtkProperty *myProperty; diff --git a/src/VTKViewer/VTKViewer_AppendFilter.cxx b/src/VTKViewer/VTKViewer_AppendFilter.cxx index 4218c4f20..19390bac1 100644 --- a/src/VTKViewer/VTKViewer_AppendFilter.cxx +++ b/src/VTKViewer/VTKViewer_AppendFilter.cxx @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include @@ -95,17 +97,23 @@ VTKViewer_AppendFilter return myPoints.GetPointer(); } -void +int VTKViewer_AppendFilter -::Execute() +::RequestData( + vtkInformation *request, + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { + int aRet = 0; if(myPoints.GetPointer()) - MakeOutput(); + aRet = MakeOutput(request,inputVector,outputVector); else - Superclass::Execute(); + aRet = Superclass::RequestData(request,inputVector,outputVector); if(myDoMappingFlag) DoMapping(); + + return aRet; } @@ -119,8 +127,8 @@ VTKViewer_AppendFilter vtkIdType aPntStartId = 0; vtkIdType aCellStartId = 0; - for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){ - vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]); + for(vtkIdType aDataSetId = 0; aDataSetId < this->GetNumberOfInputPorts(); ++aDataSetId){ + vtkDataSet* aDataSet = (vtkDataSet *)(this->GetInput(aDataSetId)); // Do mapping of the nodes if(!myPoints.GetPointer()){ vtkIdType aNbPnts = aDataSet->GetNumberOfPoints(); @@ -246,25 +254,41 @@ VTKViewer_AppendFilter } -void +int VTKViewer_AppendFilter -::MakeOutput() +::MakeOutput( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { int idx; vtkIdType numPts, numCells, newCellId, cellId; vtkCellData *cd; vtkIdList *ptIds; vtkDataSet *ds; - vtkUnstructuredGrid *output = this->GetOutput(); + int numInputs = this->GetNumberOfInputConnections(0); + + // get the output info object + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the ouptut + vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); // numPts = myPoints->GetNumberOfPoints(); if (numPts < 1) { - return; + return 0; } // numCells = 0; - for (idx = 0; idx < this->NumberOfInputs; ++idx) { - ds = (vtkDataSet *)(this->Inputs[idx]); + vtkInformation *inInfo = 0; + for (idx = 0; idx < numInputs;++idx) { + inInfo = inputVector[0]->GetInformationObject(idx); + ds = 0; + if (inInfo) + { + ds = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + } if (ds != NULL) { if ( ds->GetNumberOfPoints() <= 0 && ds->GetNumberOfCells() <= 0 ) { continue; //no input, just skip @@ -273,7 +297,7 @@ VTKViewer_AppendFilter }//if non-empty dataset }//for all inputs if (numCells < 1) { - return; + return 0; } // // Now can allocate memory @@ -286,9 +310,15 @@ VTKViewer_AppendFilter // 1.points output->SetPoints(myPoints.GetPointer()); // 2.cells - for (idx = 0; idx < this->NumberOfInputs; ++idx) { - ds = (vtkDataSet *)(this->Inputs[idx]); + for (idx = 0; idx < numInputs; ++idx) { + inInfo = inputVector[0]->GetInformationObject(idx); + ds = 0; + if (inInfo) + { + ds = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + } if (ds != NULL) { + numCells = ds->GetNumberOfCells(); cd = ds->GetCellData(); // copy cell and cell data @@ -300,5 +330,12 @@ VTKViewer_AppendFilter } // ptIds->Delete(); + return 1; } +int VTKViewer_AppendFilter::FillInputPortInformation(int, vtkInformation *info) +{ + info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet"); + info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1); + return 1; +} diff --git a/src/VTKViewer/VTKViewer_AppendFilter.h b/src/VTKViewer/VTKViewer_AppendFilter.h index f7b1a171d..3ff617541 100644 --- a/src/VTKViewer/VTKViewer_AppendFilter.h +++ b/src/VTKViewer/VTKViewer_AppendFilter.h @@ -88,16 +88,17 @@ protected: * \brief Destructor. */ ~VTKViewer_AppendFilter(); - /*! \fn void Execute(); - * \brief Filter culculation method. - */ - virtual void Execute(); - // + + // Usual data generation method + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + + virtual int FillInputPortInformation(int port, vtkInformation *info); + void DoMapping(); void Reset(); - void MakeOutput(); + int MakeOutput(vtkInformation *, vtkInformationVector **, vtkInformationVector *); bool myDoMappingFlag; TVectorIds myNodeRanges; diff --git a/src/VTKViewer/VTKViewer_CellLocationsArray.h b/src/VTKViewer/VTKViewer_CellLocationsArray.h index 8cbd4d89b..4d965a8e1 100644 --- a/src/VTKViewer/VTKViewer_CellLocationsArray.h +++ b/src/VTKViewer/VTKViewer_CellLocationsArray.h @@ -22,7 +22,7 @@ #include "VTKViewer.h" -#if (VTK_MAJOR_VERSION >= 4) && (VTK_MINOR_VERSION >= 4) +#if ((VTK_MAJOR_VERSION == 4) && (VTK_MINOR_VERSION >= 4)) || (VTK_MAJOR_VERSION > 4) # include # define TCellLocationsArray vtkIdTypeArray #else diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx index 5cb422e11..ea3abb5ff 100755 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx @@ -34,6 +34,8 @@ #include #include #include +#include +#include using namespace std; @@ -146,9 +148,29 @@ inline void InsertPointCell(vtkCellArray *theConnectivity, } } -void VTKViewer_ExtractUnstructuredGrid::Execute(){ + +// int VTKViewer_ExtractUnstructuredGrid::RequestData( +// vtkInformation *vtkNotUsed(request), +// vtkInformationVector **inputVector, +// vtkInformationVector *outputVector) +void VTKViewer_ExtractUnstructuredGrid::Execute() +{ + /* + not ported yet to the new executive-based pipeline architecture. + + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkUnstructuredGrid *anInput = vtkUnstructuredGrid::SafeDownCast( + inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkUnstructuredGrid *anOutput = vtkUnstructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + */ vtkUnstructuredGrid *anInput = this->GetInput(); vtkUnstructuredGrid *anOutput = this->GetOutput(); + myOut2InId.clear(); myIn2OutId.clear(); /* if(MYDEBUG){ @@ -348,4 +370,5 @@ void VTKViewer_ExtractUnstructuredGrid::Execute(){ MESSAGE("Execute - myIn2OutId.size() = "< #include #include +#include +#include #include #include @@ -76,37 +78,54 @@ VTKViewer_GeometryFilter {} -void +int VTKViewer_GeometryFilter -::Execute() +::RequestData( + vtkInformation *request, + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { - vtkDataSet *input= this->GetInput(); + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkDataSet *input = vtkDataSet::SafeDownCast( + inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkPolyData *output = vtkPolyData::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkIdType numCells=input->GetNumberOfCells(); if (numCells == 0) { - return; + return 0; } if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){ - this->UnstructuredGridExecute(); - return; + return this->UnstructuredGridExecute(input, output, outInfo); }else - vtkGeometryFilter::Execute(); + return Superclass::RequestData(request,inputVector,outputVector); + + return 1; } -void +int VTKViewer_GeometryFilter -::UnstructuredGridExecute() +::UnstructuredGridExecute( + vtkDataSet *dataSetInput, + vtkPolyData *output, + vtkInformation *outInfo) { - vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)this->GetInput(); + + vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput; vtkCellArray *Connectivity = input->GetCells(); // Check input if ( Connectivity == NULL ) { vtkDebugMacro(<<"Nothing to extract"); - return; + return 0; } vtkIdType cellId; @@ -118,7 +137,6 @@ VTKViewer_GeometryFilter vtkIdType numCells=input->GetNumberOfCells(); vtkPointData *pd = input->GetPointData(); vtkCellData *cd = input->GetCellData(); - vtkPolyData *output = this->GetOutput(); vtkPointData *outputPD = output->GetPointData(); VTKViewer_OrderedTriangulator anOrderedTriangulator; diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.h b/src/VTKViewer/VTKViewer_GeometryFilter.h index 9c7425aa3..300c5a948 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.h +++ b/src/VTKViewer/VTKViewer_GeometryFilter.h @@ -92,14 +92,15 @@ protected: * \brief Destructor. */ ~VTKViewer_GeometryFilter(); - /*! \fn void Execute(); - * \brief Filter culculation method. - */ - void Execute(); + + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + + //special cases for performance + /*! \fn void UnstructuredGridExecute(); * \brief Filter culculation method for data object type is VTK_UNSTRUCTURED_GRID. */ - void UnstructuredGridExecute(); + int UnstructuredGridExecute (vtkDataSet *, vtkPolyData *, vtkInformation *); private: typedef std::vector TVectorId; diff --git a/src/VTKViewer/VTKViewer_PassThroughFilter.cxx b/src/VTKViewer/VTKViewer_PassThroughFilter.cxx index 172976d7e..f052b072c 100755 --- a/src/VTKViewer/VTKViewer_PassThroughFilter.cxx +++ b/src/VTKViewer/VTKViewer_PassThroughFilter.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include vtkCxxRevisionMacro(VTKViewer_PassThroughFilter, "$Revision$"); vtkStandardNewMacro(VTKViewer_PassThroughFilter); @@ -43,10 +45,20 @@ vtkStandardNewMacro(VTKViewer_PassThroughFilter); */ /*!Execute method.Output calculation.*/ -void VTKViewer_PassThroughFilter::Execute() +int VTKViewer_PassThroughFilter::RequestData( + vtkInformation *, + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { - vtkDataSet *input = static_cast(this->GetInput()); - vtkDataSet *output = static_cast(this->GetOutput()); + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkDataSet *input = vtkDataSet::SafeDownCast( + inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkDataSet *output = vtkDataSet::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); // This has to be here because it initialized all field datas. output->CopyStructure( input ); @@ -56,6 +68,7 @@ void VTKViewer_PassThroughFilter::Execute() output->GetPointData()->PassData( input->GetPointData() ); output->GetCellData()->PassData( input->GetCellData() ); + return 1; } /*!Methods invoked by print to print information about the object including superclasses.\n diff --git a/src/VTKViewer/VTKViewer_PassThroughFilter.h b/src/VTKViewer/VTKViewer_PassThroughFilter.h index 3e683348f..99b81ef52 100755 --- a/src/VTKViewer/VTKViewer_PassThroughFilter.h +++ b/src/VTKViewer/VTKViewer_PassThroughFilter.h @@ -36,7 +36,8 @@ protected: VTKViewer_PassThroughFilter() {};//!< Null body. virtual ~VTKViewer_PassThroughFilter() {};//!< Null body. - void Execute(); + virtual int RequestData(vtkInformation *, vtkInformationVector **, + vtkInformationVector *); //generate output data private: VTKViewer_PassThroughFilter( const VTKViewer_PassThroughFilter& ); //!< Not implemented. diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx index b4a7fb6a2..3391c08c7 100755 --- a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx @@ -34,6 +34,8 @@ #include #include #include +#include +#include vtkCxxRevisionMacro(VTKViewer_ShrinkFilter, "$Revision$"); vtkStandardNewMacro(VTKViewer_ShrinkFilter); @@ -49,8 +51,21 @@ VTKViewer_ShrinkFilter::~VTKViewer_ShrinkFilter() /*!Execute method. Calculate output.*/ -void VTKViewer_ShrinkFilter::Execute() +int VTKViewer_ShrinkFilter::RequestData( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkDataSet *input = vtkDataSet::SafeDownCast( + inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkPoints *newPts; int i, j, numIds, abort=0; vtkIdType cellId, numCells, numPts; @@ -58,8 +73,6 @@ void VTKViewer_ShrinkFilter::Execute() vtkFloatingPointType center[3], *p, pt[3]; vtkPointData *pd, *outPD;; vtkIdList *ptIds, *newPtIds; - vtkDataSet *input= this->GetInput(); - vtkUnstructuredGrid *output = this->GetOutput(); vtkIdType tenth; vtkFloatingPointType decimal; @@ -70,7 +83,7 @@ void VTKViewer_ShrinkFilter::Execute() if (numCells < 1 || numPts < 1) { vtkErrorMacro(<<"No data to shrink!"); - return; + return 0; } ptIds = vtkIdList::New(); @@ -154,6 +167,8 @@ void VTKViewer_ShrinkFilter::Execute() ptIds->Delete(); newPtIds->Delete(); newPts->Delete(); + + return 1; } /*!Sets store mapping.*/ diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.h b/src/VTKViewer/VTKViewer_ShrinkFilter.h index 336d30636..ab46c2514 100755 --- a/src/VTKViewer/VTKViewer_ShrinkFilter.h +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.h @@ -51,7 +51,7 @@ protected: VTKViewer_ShrinkFilter(); ~VTKViewer_ShrinkFilter(); - void Execute(); + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); /*!Not implemented.*/ void UnstructuredGridExecute(); diff --git a/src/VTKViewer/VTKViewer_TransformFilter.cxx b/src/VTKViewer/VTKViewer_TransformFilter.cxx index cdfc14a1f..1c1121044 100755 --- a/src/VTKViewer/VTKViewer_TransformFilter.cxx +++ b/src/VTKViewer/VTKViewer_TransformFilter.cxx @@ -34,17 +34,30 @@ #include #include #include - +#include +#include vtkStandardNewMacro(VTKViewer_TransformFilter); /*!Execution method. Calculate output.*/ -void VTKViewer_TransformFilter::Execute(){ +int VTKViewer_TransformFilter::RequestData( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) +{ + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkPointSet *input = vtkPointSet::SafeDownCast( + inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkPointSet *output = vtkPointSet::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkPoints *inPts; vtkPoints *newPts; int numPts, numCells; - vtkPointSet *input = this->GetInput(); - vtkPointSet *output = this->GetOutput(); vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData(); vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData(); output->CopyStructure( input ); @@ -67,4 +80,6 @@ void VTKViewer_TransformFilter::Execute(){ } outPD->PassData(pd); outCD->PassData(cd); + + return 1; } diff --git a/src/VTKViewer/VTKViewer_TransformFilter.h b/src/VTKViewer/VTKViewer_TransformFilter.h index 3087a03e9..69a286b06 100755 --- a/src/VTKViewer/VTKViewer_TransformFilter.h +++ b/src/VTKViewer/VTKViewer_TransformFilter.h @@ -42,7 +42,8 @@ protected: VTKViewer_TransformFilter(const VTKViewer_TransformFilter&) {/*!Do nothing*/} /*!Operator = */ void operator=(const VTKViewer_TransformFilter&) {/*!Do nothing*/} - void Execute(); + + int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); }; #endif diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx index 9caa0606a..f50d67b30 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.cxx +++ b/src/VTKViewer/VTKViewer_Trihedron.cxx @@ -32,8 +32,7 @@ #include #include #include - -#include "VTKViewer_VectorText.h" +#include vtkStandardNewMacro(VTKViewer_UnScaledActor); @@ -141,7 +140,7 @@ VTKViewer_Axis::VTKViewer_Axis() myLineActor->SetArrowActor(myArrowActor); /*! \li Initialize the Label pipe-line representation */ - myVectorText = VTKViewer_VectorText::New(); + myVectorText = vtkVectorText::New(); myMapper[2] = vtkPolyDataMapper::New(); myMapper[2]->SetInput(myVectorText->GetOutput()); diff --git a/src/VTKViewer/VTKViewer_Trihedron.h b/src/VTKViewer/VTKViewer_Trihedron.h index 01be4f77a..0d3b34561 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.h +++ b/src/VTKViewer/VTKViewer_Trihedron.h @@ -31,9 +31,9 @@ class vtkProperty; class vtkPolyDataMapper; class vtkLineSource; class vtkConeSource; +class vtkVectorText; class VTKViewer_Axis; -class VTKViewer_VectorText; /*! \class vtkFollower * See vtk documentation @@ -288,7 +288,7 @@ protected: /*! VTKViewer_VectorText pointer (Label) */ - VTKViewer_VectorText* myVectorText; + vtkVectorText* myVectorText; }; #endif diff --git a/src/VTKViewer/VTKViewer_VectorText.h b/src/VTKViewer/VTKViewer_VectorText.h index ac328ecec..347757082 100755 --- a/src/VTKViewer/VTKViewer_VectorText.h +++ b/src/VTKViewer/VTKViewer_VectorText.h @@ -75,7 +75,9 @@ protected: VTKViewer_VectorText(); ~VTKViewer_VectorText(); - void Execute(); + //! Main method, which calculate output + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + char *Text; char *Letters[127]; diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index aba392028..0e1ab38bb 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -131,7 +131,7 @@ VTKViewer_ViewWindow::~VTKViewer_ViewWindow() myRWInteractor->Delete(); //m_RW->Delete() ; - myRenderer->RemoveAllProps(); + myRenderer->RemoveAllViewProps(); //m_Renderer->Delete() ; myTrihedron->Delete(); } -- 2.39.2