// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// File: VISU_StreamLinesPL.cxx
#include "VISU_UsedPointsFilter.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
#include <vtkObjectFactory.h>
#include <vtkUnstructuredGrid.h>
#include <vtkPointData.h>
#include <vtkPoints.h>
#include <vtkIdList.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_UsedPointsFilter);
//----------------------------------------------------------------------------
-VISU_UsedPointsFilter
-::VISU_UsedPointsFilter()
+VISU_UsedPointsFilter::VISU_UsedPointsFilter()
{
PercentsOfUsedPoints = 1.0;
}
-
//----------------------------------------------------------------------------
-VISU_UsedPointsFilter
-::~VISU_UsedPointsFilter()
+VISU_UsedPointsFilter::~VISU_UsedPointsFilter()
{}
//----------------------------------------------------------------------------
-void
-VISU_UsedPointsFilter
-::Execute()
+int VISU_UsedPointsFilter::RequestData (vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
{
- vtkDataSet *anInput = this->GetInput();
- vtkPointSet *anOutput = this->GetOutput();
- anOutput->GetPointData()->CopyAllOff();
- anOutput->GetCellData()->CopyAllOff();
- anOutput->CopyStructure(anInput);
+ // 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()));
+ vtkPointSet *output = vtkPointSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ //////////
+ output->GetPointData()->CopyAllOff();
+ output->GetCellData()->CopyAllOff();
+ output->CopyStructure(input);
vtkPoints* aPoints = vtkPoints::New();
vtkIdList *anIdList = vtkIdList::New();
- vtkIdType iEnd = anInput->GetNumberOfPoints();
- for(vtkIdType i = 0; i < iEnd; i++){
- anInput->GetPointCells(i,anIdList);
- if(anIdList->GetNumberOfIds() > 0)
- aPoints->InsertNextPoint(anInput->GetPoint(i));
+ vtkIdType iEnd = input->GetNumberOfPoints();
+ for (vtkIdType i = 0; i < iEnd; i++) {
+ input->GetPointCells(i, anIdList);
+ if (anIdList->GetNumberOfIds() > 0)
+ aPoints->InsertNextPoint(input->GetPoint(i));
}
vtkPoints* aNewPoints = vtkPoints::New();
iEnd = aPoints->GetNumberOfPoints();
- if (PercentsOfUsedPoints > 0){
+ if (PercentsOfUsedPoints > 0) {
vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
- if(anOffset < 1) anOffset = 1;
- for(vtkIdType i = 0; i < iEnd; i += anOffset)
+ if (anOffset < 1) anOffset = 1;
+ for (vtkIdType i = 0; i < iEnd; i += anOffset)
aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
}
- anOutput->SetPoints(aNewPoints);
+ output->SetPoints(aNewPoints);
aNewPoints->Delete();
aPoints->Delete();
-}
-
-//----------------------------------------------------------------------------
+ return 1;
+}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// File: VISU_UsedPointsFilter.hxx
#ifndef VISU_UsedPointsFilter_HeaderFile
#define VISU_UsedPointsFilter_HeaderFile
-#include <vtkDataSetToUnstructuredGridFilter.h>
+#include <vtkPointSetAlgorithm.h>
//----------------------------------------------------------------------------
-class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter
+class VISU_UsedPointsFilter : public vtkPointSetAlgorithm
{
public:
- vtkTypeMacro(VISU_UsedPointsFilter, vtkDataSetToUnstructuredGridFilter);
+ vtkTypeMacro(VISU_UsedPointsFilter, vtkPointSetAlgorithm);
- static
- VISU_UsedPointsFilter*
+ static
+ VISU_UsedPointsFilter*
New();
vtkSetMacro(PercentsOfUsedPoints,float);
virtual
~VISU_UsedPointsFilter();
- virtual
- void
- Execute();
+ int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
float PercentsOfUsedPoints;
};