------------------------------------------------------------------------------
| 4227 | |
| 4228 | //------------------------------------------------------------------------------ |
| 4229 | void vtkOpenGLPolyDataMapper::AddCellIdsToSelectionPrimitives(vtkPolyData* poly, |
| 4230 | const char* arrayName, unsigned int processId, unsigned int compositeIndex, vtkIdType selectedId) |
| 4231 | { |
| 4232 | |
| 4233 | auto addCellId = [this, poly](vtkIdType id) |
| 4234 | { |
| 4235 | vtkIdType npts; |
| 4236 | const vtkIdType* pts; |
| 4237 | vtkIdType nbVerts = poly->GetVerts() ? poly->GetVerts()->GetNumberOfCells() : 0; |
| 4238 | vtkIdType nbLines = poly->GetLines() ? poly->GetLines()->GetNumberOfCells() : 0; |
| 4239 | vtkIdType nbPolys = poly->GetPolys() ? poly->GetPolys()->GetNumberOfCells() : 0; |
| 4240 | vtkIdType nbStrips = poly->GetStrips() ? poly->GetStrips()->GetNumberOfCells() : 0; |
| 4241 | |
| 4242 | if (poly->GetVerts() && id < nbVerts) |
| 4243 | { |
| 4244 | poly->GetVerts()->GetCellAtId(id, npts, pts); |
| 4245 | this->SelectionArrays[0]->InsertNextCell(npts, pts); |
| 4246 | } |
| 4247 | else if (poly->GetLines() && id < nbVerts + nbLines) |
| 4248 | { |
| 4249 | poly->GetLines()->GetCellAtId(id - nbVerts, npts, pts); |
| 4250 | this->SelectionArrays[1]->InsertNextCell(npts, pts); |
| 4251 | } |
| 4252 | else if (poly->GetPolys() && id < nbVerts + nbLines + nbPolys) |
| 4253 | { |
| 4254 | poly->GetPolys()->GetCellAtId(id - nbVerts - nbLines, npts, pts); |
| 4255 | this->SelectionArrays[2]->InsertNextCell(npts, pts); |
| 4256 | } |
| 4257 | else if (poly->GetStrips() && id < nbVerts + nbLines + nbPolys + nbStrips) |
| 4258 | { |
| 4259 | poly->GetStrips()->GetCellAtId(id - nbVerts - nbLines - nbPolys, npts, pts); |
| 4260 | this->SelectionArrays[3]->InsertNextCell(npts, pts); |
| 4261 | } |
| 4262 | }; |
| 4263 | |
| 4264 | if (arrayName) |
| 4265 | { |
| 4266 | // compute corresponding cell ids from selected id or value. |
| 4267 | this->BuildSelectionCache(arrayName, false, poly); |
| 4268 | for (vtkIdType idx : |
| 4269 | this->SelectionCache[std::make_tuple(processId, compositeIndex, selectedId)]) |
| 4270 | { |
| 4271 | addCellId(idx); |
| 4272 | } |
| 4273 | } |
| 4274 | else |
| 4275 | { |
| 4276 | addCellId(selectedId); |
| 4277 | } |
| 4278 | } |
| 4279 | |
| 4280 | //------------------------------------------------------------------------------ |
| 4281 | void vtkOpenGLPolyDataMapper::BuildSelectionIBO( |
no test coverage detected