65 vtkInformationVector** inputVector,
66 vtkInformationVector* outputVector)
75 int numPoints =
_points->size();
78 ERR(
"VtkPointsSource::RequestData(): Size of point vector is 0");
82 vtkSmartPointer<vtkInformation> outInfo =
83 outputVector->GetInformationObject(0);
84 vtkSmartPointer<vtkPolyData> output =
85 vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
87 vtkSmartPointer<vtkPoints> newPoints = vtkSmartPointer<vtkPoints>::New();
88 vtkSmartPointer<vtkCellArray> newVerts =
89 vtkSmartPointer<vtkCellArray>::New();
90 newPoints->SetNumberOfPoints(numPoints);
91 newVerts->Allocate(numPoints);
93 vtkSmartPointer<vtkIntArray> pointIDs = vtkSmartPointer<vtkIntArray>::New();
94 pointIDs->SetNumberOfComponents(1);
95 pointIDs->SetNumberOfValues(numPoints);
96 pointIDs->SetName(
"PointIDs");
98 if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) >
108 double coords[3] = {(*point)[0], (*point)[1], (*point)[2]};
109 newPoints->SetPoint(i, coords);
110 newVerts->InsertNextCell(1);
111 newVerts->InsertCellPoint(i);
113 pointIDs->SetValue(i, i);
117 output->SetPoints(newPoints);
118 output->SetVerts(newVerts);
119 output->GetCellData()->AddArray(pointIDs);
120 output->GetCellData()->SetActiveAttribute(
"PointIDs",
121 vtkDataSetAttributes::SCALARS);