------------------------------------------------------------------------------
| 167 | |
| 168 | //------------------------------------------------------------------------------ |
| 169 | int vtkAnnotationLink::RequestData(vtkInformation* vtkNotUsed(info), |
| 170 | vtkInformationVector** inVector, vtkInformationVector* outVector) |
| 171 | { |
| 172 | vtkInformation* inInfo = inVector[0]->GetInformationObject(0); |
| 173 | vtkTable* inputMap = vtkTable::GetData(inVector[1]); |
| 174 | vtkAnnotationLayers* input = nullptr; |
| 175 | vtkSelection* inputSelection = nullptr; |
| 176 | if (inInfo) |
| 177 | { |
| 178 | input = vtkAnnotationLayers::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 179 | inputSelection = vtkSelection::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 180 | } |
| 181 | |
| 182 | vtkInformation* outInfo = outVector->GetInformationObject(0); |
| 183 | vtkAnnotationLayers* output = |
| 184 | vtkAnnotationLayers::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 185 | |
| 186 | vtkInformation* mapInfo = outVector->GetInformationObject(1); |
| 187 | vtkMultiBlockDataSet* maps = |
| 188 | vtkMultiBlockDataSet::SafeDownCast(mapInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 189 | |
| 190 | vtkInformation* selInfo = outVector->GetInformationObject(2); |
| 191 | vtkSelection* sel = vtkSelection::SafeDownCast(selInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 192 | |
| 193 | // Give preference to input annotations |
| 194 | if (input) |
| 195 | { |
| 196 | this->ShallowCopyToOutput(input, output, sel); |
| 197 | } |
| 198 | else if (this->AnnotationLayers) |
| 199 | { |
| 200 | this->ShallowCopyToOutput(this->AnnotationLayers, output, sel); |
| 201 | } |
| 202 | |
| 203 | // If there is an input selection, set it on the annotation layers |
| 204 | if (inputSelection) |
| 205 | { |
| 206 | sel->ShallowCopy(inputSelection); |
| 207 | output->SetCurrentSelection(sel); |
| 208 | } |
| 209 | |
| 210 | // If there are input domain maps, give preference to them |
| 211 | if (inputMap) |
| 212 | { |
| 213 | vtkSmartPointer<vtkTable> outMap = vtkSmartPointer<vtkTable>::New(); |
| 214 | outMap->ShallowCopy(inputMap); |
| 215 | maps->SetBlock(0, outMap); |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | unsigned int numMaps = static_cast<unsigned int>(this->DomainMaps->GetNumberOfItems()); |
| 220 | maps->SetNumberOfBlocks(numMaps); |
| 221 | for (unsigned int i = 0; i < numMaps; ++i) |
| 222 | { |
| 223 | vtkSmartPointer<vtkTable> map = vtkSmartPointer<vtkTable>::New(); |
| 224 | map->ShallowCopy(this->DomainMaps->GetItem(i)); |
| 225 | maps->SetBlock(i, map); |
| 226 | } |
nothing calls this directly
no test coverage detected