------------------------------------------------------------------------------
| 161 | |
| 162 | //------------------------------------------------------------------------------ |
| 163 | void vtkMultiBlockVolumeMapper::ComputeBounds() |
| 164 | { |
| 165 | auto input = this->GetDataObjectTreeInput(); |
| 166 | assert(input != nullptr); |
| 167 | if (input->GetMTime() == this->BoundsComputeTime) |
| 168 | { |
| 169 | // don't need to recompute bounds. |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | // Loop over the hierarchy of data objects to compute bounds |
| 174 | vtkBoundingBox bbox; |
| 175 | vtkCompositeDataIterator* iter = input->NewIterator(); |
| 176 | for (iter->GoToFirstItem(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) |
| 177 | { |
| 178 | if (vtkImageData* img = vtkImageData::SafeDownCast(iter->GetCurrentDataObject())) |
| 179 | if (img) |
| 180 | { |
| 181 | double bds[6]; |
| 182 | img->GetBounds(bds); |
| 183 | bbox.AddBounds(bds); |
| 184 | } |
| 185 | } |
| 186 | iter->Delete(); |
| 187 | |
| 188 | vtkMath::UninitializeBounds(this->Bounds); |
| 189 | if (bbox.IsValid()) |
| 190 | { |
| 191 | bbox.GetBounds(this->Bounds); |
| 192 | } |
| 193 | |
| 194 | this->BoundsComputeTime = input->GetMTime(); |
| 195 | } |
| 196 | |
| 197 | //------------------------------------------------------------------------------ |
| 198 | vtkDataObjectTree* vtkMultiBlockVolumeMapper::GetDataObjectTreeInput() |
no test coverage detected