------------------------------------------------------------------------------
| 58 | |
| 59 | //------------------------------------------------------------------------------ |
| 60 | int vtkClosestPointStrategy::Initialize(vtkPointSet* ps) |
| 61 | { |
| 62 | // See whether anything has changed. If not, just return. |
| 63 | if (this->PointSet != nullptr && ps == this->PointSet && this->MTime < this->InitializeTime) |
| 64 | { |
| 65 | return 1; |
| 66 | } |
| 67 | |
| 68 | // Set up the point set; return on failure. |
| 69 | if (this->Superclass::Initialize(ps) == 0) |
| 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | // Use the point set's point locator preferentially. If no point locator, |
| 75 | // then we need to create one. If one is specified here in the strategy, |
| 76 | // use that. If not, then used the point set's default build point locator |
| 77 | // method. |
| 78 | vtkAbstractPointLocator* psPL = ps->GetPointLocator(); |
| 79 | if (psPL == nullptr) |
| 80 | { |
| 81 | if (this->PointLocator != nullptr) |
| 82 | { |
| 83 | // only the owner of the locator can change it |
| 84 | if (this->OwnsLocator) |
| 85 | { |
| 86 | this->PointLocator->SetDataSet(ps); |
| 87 | this->PointLocator->BuildLocator(); |
| 88 | } |
| 89 | } |
| 90 | else |
| 91 | { |
| 92 | ps->BuildPointLocator(); |
| 93 | psPL = ps->GetPointLocator(); |
| 94 | this->PointLocator = psPL; |
| 95 | this->OwnsLocator = false; |
| 96 | } |
| 97 | } |
| 98 | else |
| 99 | { |
| 100 | if (psPL != this->PointLocator) |
| 101 | { |
| 102 | this->PointLocator = psPL; |
| 103 | this->OwnsLocator = false; |
| 104 | } |
| 105 | // ensure that the point-set's locator is up-to-date |
| 106 | // this should be done only by one thread |
| 107 | if (!this->IsACopy) |
| 108 | { |
| 109 | this->PointLocator->BuildLocator(); |
| 110 | } |
| 111 | } |
| 112 | this->VisitedCells.resize(static_cast<size_t>(ps->GetNumberOfCells())); |
| 113 | this->Weights.resize(8); |
| 114 | |
| 115 | this->InitializeTime.Modified(); |
| 116 | |
| 117 | return 1; |
nothing calls this directly
no test coverage detected