LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/s101 - ogrs101layer.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 21 22 95.5 %
Date: 2026-05-08 18:52:02 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  S-101 driver
       4             :  * Purpose:  Implements OGRS101Layer
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2026, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include "ogr_s101.h"
      14             : 
      15             : /************************************************************************/
      16             : /*                     OGRS101Layer::OGRS101Layer()                     */
      17             : /************************************************************************/
      18             : 
      19         894 : OGRS101Layer::OGRS101Layer(OGRS101Dataset &oDS, const DDFRecordIndex &oIndex,
      20         894 :                            OGRFeatureDefnRefCountedPtr poFeatureDefn)
      21         894 :     : m_oDS(oDS), m_oIndex(oIndex), m_poFeatureDefn(std::move(poFeatureDefn))
      22             : {
      23         894 :     SetDescription(m_poFeatureDefn->GetName());
      24         894 : }
      25             : 
      26             : /************************************************************************/
      27             : /*                    OGRS101Layer::~OGRS101Layer()                     */
      28             : /************************************************************************/
      29             : 
      30             : OGRS101Layer::~OGRS101Layer() = default;
      31             : 
      32             : /************************************************************************/
      33             : /*                     OGRS101Layer::ResetReading()                     */
      34             : /************************************************************************/
      35             : 
      36        4131 : void OGRS101Layer::ResetReading()
      37             : {
      38        4131 :     m_nRecordIdx = 0;
      39        4131 : }
      40             : 
      41             : /************************************************************************/
      42             : /*                    OGRS101Layer::TestCapability()                    */
      43             : /************************************************************************/
      44             : 
      45        1776 : int OGRS101Layer::TestCapability(const char *pszCap) const
      46             : {
      47        1776 :     if (EQUAL(pszCap, OLCFastFeatureCount))
      48           0 :         return m_poAttrQuery == nullptr && m_poFilterGeom == nullptr;
      49             : 
      50        1776 :     if (EQUAL(pszCap, OLCStringsAsUTF8))
      51         470 :         return true;
      52             : 
      53        1306 :     if (EQUAL(pszCap, OLCZGeometries))
      54             :     {
      55         447 :         const auto poSRS = GetSpatialRef();
      56         447 :         if (poSRS)
      57         350 :             return poSRS->IsCompound();
      58             :     }
      59             : 
      60         956 :     return false;
      61             : }
      62             : 
      63             : /************************************************************************/
      64             : /*                   OGRS101Layer::GetFeatureCount()                    */
      65             : /************************************************************************/
      66             : 
      67         252 : GIntBig OGRS101Layer::GetFeatureCount(int bForce)
      68             : {
      69         252 :     if (m_poAttrQuery || m_poFilterGeom)
      70          74 :         return OGRLayer::GetFeatureCount(bForce);
      71         178 :     return m_oIndex.GetCount();
      72             : }

Generated by: LCOV version 1.14