| 675 | } |
| 676 | |
| 677 | bool vtkCellGrid::SetShapeAttribute(vtkCellAttribute* shape) |
| 678 | { |
| 679 | if (!shape) |
| 680 | { |
| 681 | if (this->HaveShape) |
| 682 | { |
| 683 | this->HaveShape = false; |
| 684 | this->Modified(); |
| 685 | return true; |
| 686 | } |
| 687 | return false; |
| 688 | } |
| 689 | if (shape->GetHash() == this->ShapeAttribute.GetId() && this->HaveShape) |
| 690 | { |
| 691 | return false; // No change. |
| 692 | } |
| 693 | // If we don't already own this attribute, add it to this->Attributes: |
| 694 | auto it = this->Attributes.find(shape->GetHash()); |
| 695 | if (it == this->Attributes.end()) |
| 696 | { |
| 697 | this->Attributes[shape->GetHash()] = shape; |
| 698 | } |
| 699 | else if (it->second != shape) |
| 700 | { |
| 701 | vtkErrorMacro("Hash collision for shape attribute. Ignoring call to SetShapeAttribute()."); |
| 702 | return false; |
| 703 | } |
| 704 | this->HaveShape = true; |
| 705 | this->ShapeAttribute = shape->GetHash(); |
| 706 | this->Modified(); |
| 707 | return true; |
| 708 | } |
| 709 | |
| 710 | bool vtkCellGrid::Query(vtkCellGridQuery* query) |
| 711 | { |