------------------------------------------------------------------------------ Description: Set the dataset that will be manipulated through the adaptor interface. \pre ds_exists: ds!=0
| 79 | // Set the dataset that will be manipulated through the adaptor interface. |
| 80 | // \pre ds_exists: ds!=0 |
| 81 | void vtkBridgeDataSet::SetDataSet(vtkDataSet* ds) |
| 82 | { |
| 83 | int i; |
| 84 | int c; |
| 85 | vtkPointData* pd; |
| 86 | vtkCellData* cd; |
| 87 | vtkBridgeAttribute* a; |
| 88 | |
| 89 | vtkSetObjectBodyMacro(Implementation, vtkDataSet, ds); |
| 90 | // refresh the attribute collection |
| 91 | this->Attributes->Reset(); |
| 92 | if (ds != nullptr) |
| 93 | { |
| 94 | // point data |
| 95 | pd = ds->GetPointData(); |
| 96 | c = pd->GetNumberOfArrays(); |
| 97 | i = 0; |
| 98 | while (i < c) |
| 99 | { |
| 100 | a = vtkBridgeAttribute::New(); |
| 101 | a->InitWithPointData(pd, i); |
| 102 | this->Attributes->InsertNextAttribute(a); |
| 103 | a->Delete(); |
| 104 | ++i; |
| 105 | } |
| 106 | // same thing for cell data. |
| 107 | cd = ds->GetCellData(); |
| 108 | c = cd->GetNumberOfArrays(); |
| 109 | i = 0; |
| 110 | while (i < c) |
| 111 | { |
| 112 | a = vtkBridgeAttribute::New(); |
| 113 | a->InitWithCellData(cd, i); |
| 114 | this->Attributes->InsertNextAttribute(a); |
| 115 | a->Delete(); |
| 116 | ++i; |
| 117 | } |
| 118 | this->Tessellator->Initialize(this); |
| 119 | } |
| 120 | this->Modified(); |
| 121 | } |
| 122 | |
| 123 | //------------------------------------------------------------------------------ |
| 124 | // Description: |