------------------------------------------------------------------------------
| 585 | |
| 586 | //------------------------------------------------------------------------------ |
| 587 | int vtkGDALVectorReader::RequestData( |
| 588 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 589 | { |
| 590 | (void)request; |
| 591 | (void)inputVector; |
| 592 | |
| 593 | if (!this->FileName) |
| 594 | { |
| 595 | // vtkWarningMacro( "No filename specified" ); |
| 596 | return 0; |
| 597 | } |
| 598 | |
| 599 | vtkMultiBlockDataSet* mbds = nullptr; |
| 600 | vtkInformation* oi = outputVector->GetInformationObject(0); |
| 601 | if (!oi) |
| 602 | { |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | mbds = vtkMultiBlockDataSet::SafeDownCast(oi->Get(vtkDataObject::DATA_OBJECT())); |
| 607 | if (!mbds) |
| 608 | { |
| 609 | return 0; |
| 610 | } |
| 611 | |
| 612 | // Deleting this->Implementation is required in order to force re-reading each |
| 613 | // time RequestData() is executed. |
| 614 | delete this->Implementation; |
| 615 | this->Implementation = nullptr; |
| 616 | |
| 617 | if (this->InitializeInternal() == VTK_ERROR) |
| 618 | { |
| 619 | return 1; |
| 620 | } |
| 621 | |
| 622 | vtkGDALVectorReader::Internal* p = this->Implementation; |
| 623 | |
| 624 | int lastLayer = p->Source->GetLayerCount() - 1; |
| 625 | int startLayer = this->ActiveLayer < 0 || this->ActiveLayer >= lastLayer ? 0 : this->ActiveLayer; |
| 626 | int endLayer = |
| 627 | this->ActiveLayer < 0 || this->ActiveLayer >= lastLayer ? lastLayer : this->ActiveLayer; |
| 628 | for (int layerIdx = startLayer; layerIdx <= endLayer; ++layerIdx) |
| 629 | { |
| 630 | OGRLayer* layer = p->Source->GetLayer(layerIdx); |
| 631 | if (!layer) |
| 632 | { |
| 633 | continue; |
| 634 | } |
| 635 | |
| 636 | if (layer->GetSpatialRef()) |
| 637 | { |
| 638 | char* projStr; |
| 639 | layer->GetSpatialRef()->exportToWkt(&projStr); |
| 640 | this->LayersProjection[layerIdx] = std::string(projStr); |
| 641 | CPLFree(projStr); |
| 642 | } |
| 643 | |
| 644 | p->ReadLayer(layer, mbds); |
nothing calls this directly
no test coverage detected