54 vtkInformationVector** inputVector,
55 vtkInformationVector* outputVector)
64 int numPoints =
_points->size();
67 ERR(
"VtkPointsSource::RequestData(): Size of point vector is 0");
71 vtkSmartPointer<vtkInformation> outInfo =
72 outputVector->GetInformationObject(0);
73 vtkSmartPointer<vtkPolyData> output =
74 vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
76 vtkSmartPointer<vtkPoints> newPoints = vtkSmartPointer<vtkPoints>::New();
77 vtkSmartPointer<vtkCellArray> newVerts =
78 vtkSmartPointer<vtkCellArray>::New();
79 newPoints->SetNumberOfPoints(numPoints);
80 newVerts->Allocate(numPoints);
82 vtkSmartPointer<vtkIntArray> pointIDs = vtkSmartPointer<vtkIntArray>::New();
83 pointIDs->SetNumberOfComponents(1);
84 pointIDs->SetNumberOfValues(numPoints);
85 pointIDs->SetName(
"PointIDs");
87 if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) >
97 double coords[3] = {(*point)[0], (*point)[1], (*point)[2]};
98 newPoints->SetPoint(i, coords);
99 newVerts->InsertNextCell(1);
100 newVerts->InsertCellPoint(i);
102 pointIDs->SetValue(i, i);
106 output->SetPoints(newPoints);
107 output->SetVerts(newVerts);
108 output->GetCellData()->AddArray(pointIDs);
109 output->GetCellData()->SetActiveAttribute(
"PointIDs",
110 vtkDataSetAttributes::SCALARS);