------------------------------------------------------------------------------
| 423 | |
| 424 | //------------------------------------------------------------------------------ |
| 425 | PyObject* vtkPythonUtil::GetObjectFromPointer(vtkObjectBase* ptr) |
| 426 | { |
| 427 | PyObject* obj = vtkPythonUtil::FindObject(ptr); |
| 428 | |
| 429 | if (obj == nullptr) |
| 430 | { |
| 431 | // create a new object |
| 432 | PyVTKClass* vtkclass = nullptr; |
| 433 | vtkPythonClassMap::iterator k = vtkPythonMap->ClassMap->find(ptr->GetClassName()); |
| 434 | if (k != vtkPythonMap->ClassMap->end()) |
| 435 | { |
| 436 | vtkclass = &k->second; |
| 437 | } |
| 438 | |
| 439 | // if the class was not in the map, then find the nearest base class |
| 440 | // that is, and associate ptr->GetClassName() with that base class |
| 441 | if (vtkclass == nullptr) |
| 442 | { |
| 443 | const char* classname = ptr->GetClassName(); |
| 444 | vtkclass = vtkPythonUtil::FindNearestBaseClass(ptr); |
| 445 | vtkPythonClassMap::iterator i = vtkPythonMap->ClassMap->find(classname); |
| 446 | if (i == vtkPythonMap->ClassMap->end()) |
| 447 | { |
| 448 | vtkPythonMap->ClassMap->insert(i, vtkPythonClassMap::value_type(classname, *vtkclass)); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | obj = PyVTKObject_FromPointer(vtkclass->py_type, nullptr, ptr); |
| 453 | } |
| 454 | |
| 455 | return obj; |
| 456 | } |
| 457 | |
| 458 | //------------------------------------------------------------------------------ |
| 459 | const char* vtkPythonUtil::PythonicClassName(const char* classname) |
nothing calls this directly
no test coverage detected