------------------------------------------------------------------------------
| 259 | |
| 260 | //------------------------------------------------------------------------------ |
| 261 | void vtkVariantArray::InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) |
| 262 | { |
| 263 | if (source->IsA("vtkVariantArray")) |
| 264 | { |
| 265 | vtkVariantArray* a = vtkArrayDownCast<vtkVariantArray>(source); |
| 266 | vtkIdType loci = i * this->NumberOfComponents; |
| 267 | vtkIdType locj = j * a->GetNumberOfComponents(); |
| 268 | for (vtkIdType cur = 0; cur < this->NumberOfComponents; cur++) |
| 269 | { |
| 270 | this->InsertValue(loci + cur, a->GetValue(locj + cur)); |
| 271 | } |
| 272 | } |
| 273 | else if (source->IsA("vtkDataArray")) |
| 274 | { |
| 275 | vtkDataArray* a = vtkArrayDownCast<vtkDataArray>(source); |
| 276 | vtkIdType loci = i * this->NumberOfComponents; |
| 277 | vtkIdType locj = j * a->GetNumberOfComponents(); |
| 278 | for (vtkIdType cur = 0; cur < this->NumberOfComponents; cur++) |
| 279 | { |
| 280 | vtkIdType tuple = (locj + cur) / a->GetNumberOfComponents(); |
| 281 | int component = static_cast<int>((locj + cur) % a->GetNumberOfComponents()); |
| 282 | this->InsertValue(loci + cur, ValueType(a->GetComponent(tuple, component))); |
| 283 | } |
| 284 | } |
| 285 | else if (source->IsA("vtkStringArray")) |
| 286 | { |
| 287 | vtkStringArray* a = vtkArrayDownCast<vtkStringArray>(source); |
| 288 | vtkIdType loci = i * this->NumberOfComponents; |
| 289 | vtkIdType locj = j * a->GetNumberOfComponents(); |
| 290 | for (vtkIdType cur = 0; cur < this->NumberOfComponents; cur++) |
| 291 | { |
| 292 | this->InsertValue(loci + cur, ValueType(a->GetValue(locj + cur))); |
| 293 | } |
| 294 | } |
| 295 | else |
| 296 | { |
| 297 | vtkWarningMacro("Unrecognized type is incompatible with vtkVariantArray."); |
| 298 | } |
| 299 | this->DataChanged(); |
| 300 | } |
| 301 | |
| 302 | //------------------------------------------------------------------------------ |
| 303 | void vtkVariantArray::InsertTuplesStartingAt( |
no test coverage detected