------------------------------------------------------------------------------
| 182 | |
| 183 | //------------------------------------------------------------------------------ |
| 184 | void vtkPolyData::CopyCells(vtkPolyData* pd, vtkIdList* idList, vtkIncrementalPointLocator* locator) |
| 185 | { |
| 186 | vtkIdType cellId, ptId, newId, newCellId, locatorPtId; |
| 187 | vtkIdType numPts, numCellPts, i; |
| 188 | vtkPoints* newPoints; |
| 189 | vtkIdList* pointMap = vtkIdList::New(); // maps old pt ids into new |
| 190 | vtkIdList *cellPts, *newCellPts = vtkIdList::New(); |
| 191 | vtkGenericCell* cell = vtkGenericCell::New(); |
| 192 | double x[3]; |
| 193 | vtkPointData* outPD = this->GetPointData(); |
| 194 | vtkCellData* outCD = this->GetCellData(); |
| 195 | |
| 196 | numPts = pd->GetNumberOfPoints(); |
| 197 | |
| 198 | if (this->GetPoints() == nullptr) |
| 199 | { |
| 200 | this->Points = vtkPoints::New(); |
| 201 | } |
| 202 | |
| 203 | newPoints = this->GetPoints(); |
| 204 | |
| 205 | pointMap->SetNumberOfIds(numPts); |
| 206 | for (i = 0; i < numPts; i++) |
| 207 | { |
| 208 | pointMap->SetId(i, -1); |
| 209 | } |
| 210 | |
| 211 | // Filter the cells |
| 212 | for (cellId = 0; cellId < idList->GetNumberOfIds(); cellId++) |
| 213 | { |
| 214 | pd->GetCell(idList->GetId(cellId), cell); |
| 215 | cellPts = cell->GetPointIds(); |
| 216 | numCellPts = cell->GetNumberOfPoints(); |
| 217 | |
| 218 | for (i = 0; i < numCellPts; i++) |
| 219 | { |
| 220 | ptId = cellPts->GetId(i); |
| 221 | if ((newId = pointMap->GetId(ptId)) < 0) |
| 222 | { |
| 223 | pd->GetPoint(ptId, x); |
| 224 | if (locator != nullptr) |
| 225 | { |
| 226 | if ((locatorPtId = locator->IsInsertedPoint(x)) == -1) |
| 227 | { |
| 228 | newId = newPoints->InsertNextPoint(x); |
| 229 | locator->InsertNextPoint(x); |
| 230 | pointMap->SetId(ptId, newId); |
| 231 | outPD->CopyData(pd->GetPointData(), ptId, newId); |
| 232 | } |
| 233 | else |
| 234 | { |
| 235 | newId = locatorPtId; |
| 236 | } |
| 237 | } |
| 238 | else |
| 239 | { |
| 240 | newId = newPoints->InsertNextPoint(x); |
| 241 | pointMap->SetId(ptId, newId); |
nothing calls this directly
no test coverage detected