MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

IO/PDAL/vtkPDALReader.cxx:108–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108int vtkPDALReader::RequestData(vtkInformation* vtkNotUsed(request),
109 vtkInformationVector** vtkNotUsed(request), vtkInformationVector* outputVector)
110{
111 try
112 {
113 // Get the info object
114 vtkInformation* outInfo = outputVector->GetInformationObject(0);
115
116 // Get the output
117 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
118
119 pdal::StageFactory factory;
120 std::string driverName = pdal::StageFactory::inferReaderDriver(this->FileName);
121 if (driverName.empty())
122 {
123 vtkErrorMacro("Cannot infer the reader driver for " << this->FileName);
124 return 0;
125 }
126
127 pdal::Option opt_filename("filename", this->FileName);
128 pdal::Options opts;
129 opts.add(opt_filename);
130 pdal::Stage* reader = factory.createStage(driverName);
131 if (!reader)
132 {
133 vtkErrorMacro("Cannot open file " << this->FileName);
134 return 0;
135 }
136 reader->setOptions(opts);
137
138 vtkNew<vtkPolyData> pointsPolyData;
139 this->ReadPointRecordData(*reader, pointsPolyData);
140
141 // Convert points to verts in output polydata
142 vtkNew<vtkVertexGlyphFilter> vertexFilter;
143 vertexFilter->SetInputData(pointsPolyData);
144 vertexFilter->Update();
145 output->ShallowCopy(vertexFilter->GetOutput());
146 return VTK_OK;
147 }
148 catch (const pdal::pdal_error& e)
149 {
150 vtkErrorMacro(<< "PDAL error: " << e.what());
151 }
152 return 0;
153}
154
155//------------------------------------------------------------------------------
156void vtkPDALReader::ReadPointRecordData(pdal::Stage& reader, vtkPolyData* pointsPolyData)

Callers

nothing calls this directly

Calls 10

ReadPointRecordDataMethod · 0.95
GetInformationObjectMethod · 0.80
GetMethod · 0.45
emptyMethod · 0.45
addMethod · 0.45
SetInputDataMethod · 0.45
UpdateMethod · 0.45
ShallowCopyMethod · 0.45
GetOutputMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected