| 471 | } |
| 472 | |
| 473 | bool vtkCellGrid::AddCellAttribute(vtkCellAttribute* attribute) |
| 474 | { |
| 475 | if (!attribute) |
| 476 | { |
| 477 | return false; |
| 478 | } |
| 479 | auto it = this->Attributes.find(attribute->GetHash()); |
| 480 | if (it != this->Attributes.end()) |
| 481 | { |
| 482 | // Either we have a hash collision or the attribute already exists. |
| 483 | if (it->second != attribute) |
| 484 | { |
| 485 | vtkWarningMacro("Attempting to add attribute " |
| 486 | << attribute << " (" << attribute->GetName().Data() << "), but " << it->second << " (" |
| 487 | << it->second->GetName().Data() << ") already exists with the same hash " |
| 488 | << it->second->GetHash() << ". Ignoring."); |
| 489 | } |
| 490 | return false; |
| 491 | } |
| 492 | this->Attributes[attribute->GetHash()] = attribute; |
| 493 | attribute->SetId(this->NextAttribute++); |
| 494 | return true; |
| 495 | } |
| 496 | |
| 497 | bool vtkCellGrid::RemoveCellAttribute(vtkCellAttribute* attribute) |
| 498 | { |