------------------------------------------------------------------------------
| 410 | |
| 411 | //------------------------------------------------------------------------------ |
| 412 | int vtkGeoJSONReader::RequestData(vtkInformation* vtkNotUsed(request), |
| 413 | vtkInformationVector** vtkNotUsed(request), vtkInformationVector* outputVector) |
| 414 | { |
| 415 | // Get the info object |
| 416 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 417 | |
| 418 | // Get the output |
| 419 | vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 420 | |
| 421 | // Parse either string input of file, depending on mode |
| 422 | Json::Value root; |
| 423 | int parseResult = 0; |
| 424 | if (this->StringInputMode) |
| 425 | { |
| 426 | parseResult = this->Internal->CanParseString(this->StringInput, root); |
| 427 | } |
| 428 | else |
| 429 | { |
| 430 | parseResult = this->Internal->CanParseFile(this->FileName, root); |
| 431 | } |
| 432 | |
| 433 | if (parseResult != VTK_OK) |
| 434 | { |
| 435 | return VTK_ERROR; |
| 436 | } |
| 437 | |
| 438 | // If parsed successfully into Json, then convert it |
| 439 | // into appropriate vtkPolyData |
| 440 | if (root.isObject()) |
| 441 | { |
| 442 | this->Internal->ParseRoot( |
| 443 | root, output, this->OutlinePolygons, this->SerializedPropertiesArrayName); |
| 444 | |
| 445 | // Convert Concave Polygons to convex polygons using triangulation |
| 446 | if (output->GetNumberOfPolys() && this->TriangulatePolygons) |
| 447 | { |
| 448 | vtkNew<vtkTriangleFilter> filter; |
| 449 | filter->SetInputData(output); |
| 450 | filter->Update(); |
| 451 | |
| 452 | output->ShallowCopy(filter->GetOutput()); |
| 453 | } |
| 454 | } |
| 455 | return VTK_OK; |
| 456 | } |
| 457 | |
| 458 | //------------------------------------------------------------------------------ |
| 459 | void vtkGeoJSONReader::PrintSelf(ostream& os, vtkIndent indent) |
nothing calls this directly
no test coverage detected