| 629 | /************************************************************************/ |
| 630 | |
| 631 | GIntBig PythonPluginLayer::GetFeatureCount(int bForce) |
| 632 | { |
| 633 | GIL_Holder oHolder(false); |
| 634 | |
| 635 | if (PyObject_HasAttrString(m_poLayer, "feature_count") && |
| 636 | (m_bFeatureCountHonourAttributeFilter || m_poAttrQuery == nullptr) && |
| 637 | (m_bFeatureCountHonourSpatialFilter || m_poFilterGeom == nullptr)) |
| 638 | { |
| 639 | auto poMethod = PyObject_GetAttrString(m_poLayer, "feature_count"); |
| 640 | PyObject *poRet = CallPython(poMethod, bForce); |
| 641 | if (ErrOccurredEmitCPLError()) |
| 642 | { |
| 643 | Py_DecRef(poRet); |
| 644 | return OGRLayer::GetFeatureCount(bForce); |
| 645 | } |
| 646 | |
| 647 | GIntBig nRet = PyLong_AsLongLong(poRet); |
| 648 | if (ErrOccurredEmitCPLError()) |
| 649 | { |
| 650 | Py_DecRef(poRet); |
| 651 | return OGRLayer::GetFeatureCount(bForce); |
| 652 | } |
| 653 | |
| 654 | Py_DecRef(poRet); |
| 655 | return nRet; |
| 656 | } |
| 657 | return OGRLayer::GetFeatureCount(bForce); |
| 658 | } |
| 659 | |
| 660 | /************************************************************************/ |
| 661 | /* IGetExtent() */ |
no test coverage detected