------------------------------------------------------------------------------
| 224 | |
| 225 | //------------------------------------------------------------------------------ |
| 226 | void vtkDendrogramItem::RebuildBuffers() |
| 227 | { |
| 228 | if (this->Tree->GetNumberOfVertices() == 0) |
| 229 | { |
| 230 | return; |
| 231 | } |
| 232 | |
| 233 | // Special case where our input tree has been modified. Refresh PrunedTree |
| 234 | // to be an up-to-date full copy of it. |
| 235 | if (this->Tree->GetMTime() > this->PrunedTree->GetMTime()) |
| 236 | { |
| 237 | this->PrunedTree->DeepCopy(this->Tree); |
| 238 | } |
| 239 | |
| 240 | int orientation = this->GetOrientation(); |
| 241 | |
| 242 | vtkNew<vtkTreeLayoutStrategy> strategy; |
| 243 | |
| 244 | if (this->PrunedTree->GetVertexData()->GetAbstractArray(this->DistanceArrayName.c_str()) != |
| 245 | nullptr) |
| 246 | { |
| 247 | strategy->SetDistanceArrayName(this->DistanceArrayName.c_str()); |
| 248 | } |
| 249 | |
| 250 | strategy->SetLeafSpacing(1.0); |
| 251 | |
| 252 | strategy->SetRotation(this->GetAngleForOrientation(orientation)); |
| 253 | |
| 254 | this->Layout->SetLayoutStrategy(strategy); |
| 255 | this->Layout->SetInputData(this->PrunedTree); |
| 256 | this->Layout->Update(); |
| 257 | this->LayoutTree = vtkTree::SafeDownCast(this->Layout->GetOutput()); |
| 258 | |
| 259 | this->CountLeafNodes(); |
| 260 | this->ComputeMultipliers(); |
| 261 | this->ComputeBounds(); |
| 262 | |
| 263 | if (this->ColorTree && !this->LegendPositionSet) |
| 264 | { |
| 265 | this->PositionColorLegend(); |
| 266 | } |
| 267 | |
| 268 | if (this->PrunedTree->GetMTime() > this->MTime) |
| 269 | { |
| 270 | this->DendrogramBuildTime = this->PrunedTree->GetMTime(); |
| 271 | } |
| 272 | else |
| 273 | { |
| 274 | this->DendrogramBuildTime = this->MTime; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | //------------------------------------------------------------------------------ |
| 279 | void vtkDendrogramItem::ComputeMultipliers() |
no test coverage detected