| 348 | } |
| 349 | |
| 350 | bool vtkStatisticalModel::SetTable( |
| 351 | int type, int index, vtkTable* table, const std::string& tableName) |
| 352 | { |
| 353 | auto it = this->ModelTables.find(type); |
| 354 | if (it == this->ModelTables.end()) |
| 355 | { |
| 356 | // Call SetNumberOfTables(type, number) first. |
| 357 | return false; |
| 358 | } |
| 359 | if (index < 0 || index >= static_cast<int>(it->second.size())) |
| 360 | { |
| 361 | return false; |
| 362 | } |
| 363 | if (it->second[index].GetPointer() == table) |
| 364 | { |
| 365 | if (it->second[index] && |
| 366 | it->second[index]->GetInformation()->Get(vtkCompositeDataSet::NAME()) != tableName) |
| 367 | { |
| 368 | if (tableName.empty()) |
| 369 | { |
| 370 | it->second[index]->GetInformation()->Remove(vtkCompositeDataSet::NAME()); |
| 371 | } |
| 372 | else |
| 373 | { |
| 374 | it->second[index]->GetInformation()->Set(vtkCompositeDataSet::NAME(), tableName.c_str()); |
| 375 | } |
| 376 | this->Modified(); |
| 377 | return true; |
| 378 | } |
| 379 | // Table is already set to the same value. |
| 380 | return false; |
| 381 | } |
| 382 | it->second[index] = table; |
| 383 | if (!tableName.empty()) |
| 384 | { |
| 385 | it->second[index]->GetInformation()->Set(vtkCompositeDataSet::NAME(), tableName.c_str()); |
| 386 | } |
| 387 | this->Modified(); |
| 388 | return true; |
| 389 | } |
| 390 | |
| 391 | bool vtkStatisticalModel::SetTableName(int type, int index, const std::string& name) |
| 392 | { |