------------------------------------------------------------------------------ Insert the edge (p1,p2) into the table. It is the user's responsibility to check if the edge has already been inserted.
| 278 | // Insert the edge (p1,p2) into the table. It is the user's responsibility to |
| 279 | // check if the edge has already been inserted. |
| 280 | vtkIdType vtkEdgeTable::InsertEdge(vtkIdType p1, vtkIdType p2) |
| 281 | { |
| 282 | vtkIdType index, search; |
| 283 | |
| 284 | if (p1 < p2) |
| 285 | { |
| 286 | index = p1; |
| 287 | search = p2; |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | index = p2; |
| 292 | search = p1; |
| 293 | } |
| 294 | |
| 295 | if (index >= this->TableSize) |
| 296 | { |
| 297 | this->Resize(index + 1); |
| 298 | } |
| 299 | |
| 300 | this->TableMaxId = std::max(index, this->TableMaxId); |
| 301 | |
| 302 | if (this->Table[index] == nullptr) |
| 303 | { |
| 304 | this->Table[index] = vtkIdList::New(); |
| 305 | this->Table[index]->Allocate(6, 12); |
| 306 | if (this->StoreAttributes == 1) |
| 307 | { |
| 308 | if (this->Attributes[index]) |
| 309 | { |
| 310 | this->Attributes[index]->Delete(); |
| 311 | } |
| 312 | this->Attributes[index] = vtkIdList::New(); |
| 313 | this->Attributes[index]->Allocate(6, 12); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | this->Table[index]->InsertNextId(search); |
| 318 | if (this->StoreAttributes == 1) |
| 319 | { |
| 320 | this->Attributes[index]->InsertNextId(this->NumberOfEdges); |
| 321 | } |
| 322 | this->NumberOfEdges++; |
| 323 | |
| 324 | return (this->NumberOfEdges - 1); |
| 325 | } |
| 326 | |
| 327 | //------------------------------------------------------------------------------ |
| 328 | void vtkEdgeTable::InsertEdge(vtkIdType p1, vtkIdType p2, vtkIdType attributeId) |
no test coverage detected