------------------------------------------------------------------------------
| 623 | |
| 624 | //------------------------------------------------------------------------------ |
| 625 | void vtkAbstractArray::GetProminentComponentValues( |
| 626 | int comp, vtkVariantArray* values, double uncertainty, double minimumProminence) |
| 627 | { |
| 628 | if (!values || comp < -1 || comp >= this->NumberOfComponents) |
| 629 | { |
| 630 | return; |
| 631 | } |
| 632 | |
| 633 | values->Initialize(); |
| 634 | values->SetNumberOfComponents(comp < 0 ? this->NumberOfComponents : 1); |
| 635 | |
| 636 | bool justCreated = false; |
| 637 | vtkInformation* info = this->GetInformation(); |
| 638 | const double* lastParams = nullptr; |
| 639 | if (info && info->Has(DISCRETE_VALUE_SAMPLE_PARAMETERS())) |
| 640 | { |
| 641 | lastParams = info->Get(DISCRETE_VALUE_SAMPLE_PARAMETERS()); |
| 642 | } |
| 643 | if (comp >= 0 && info) |
| 644 | { |
| 645 | vtkInformationVector* infoVec = info->Get(PER_COMPONENT()); |
| 646 | if (!infoVec || infoVec->GetNumberOfInformationObjects() < this->NumberOfComponents) |
| 647 | { |
| 648 | infoVec = vtkInformationVector::New(); |
| 649 | infoVec->SetNumberOfInformationObjects(this->NumberOfComponents); |
| 650 | info->Set(PER_COMPONENT(), infoVec); |
| 651 | infoVec->FastDelete(); |
| 652 | justCreated = true; |
| 653 | } |
| 654 | info = infoVec->GetInformationObject(comp); |
| 655 | } |
| 656 | if (info) |
| 657 | { |
| 658 | // Any insane parameter values map to |
| 659 | // deterministic, exhaustive enumeration of all |
| 660 | // distinct values: |
| 661 | if (uncertainty < 0. || uncertainty > 1.) |
| 662 | { |
| 663 | uncertainty = 0.; |
| 664 | } |
| 665 | if (minimumProminence < 0. || minimumProminence > 1.) |
| 666 | { |
| 667 | minimumProminence = 0.; |
| 668 | } |
| 669 | // Are parameter values requesting more certainty in reporting or |
| 670 | // that less-prominent values be reported? If so, recompute. |
| 671 | bool tighterParams = |
| 672 | lastParams ? (lastParams[0] > uncertainty || lastParams[1] > minimumProminence) : true; |
| 673 | // Recompute discrete value set when the array has been |
| 674 | // modified since the information was written. |
| 675 | if (!info->Has(DISCRETE_VALUES()) || tighterParams || this->GetMTime() > info->GetMTime() || |
| 676 | justCreated) |
| 677 | { |
| 678 | this->UpdateDiscreteValueSet(uncertainty, minimumProminence); |
| 679 | } |
| 680 | } |
| 681 | else |
| 682 | { |