LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/s101 - ogrs101layermultipoint.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 24 24 100.0 %
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 OGRS101MultiLayerMultiPoint
       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             : /*                       OGRS101LayerMultiPoint()                       */
      17             : /************************************************************************/
      18             : 
      19          56 : OGRS101LayerMultiPoint::OGRS101LayerMultiPoint(
      20             :     OGRS101Dataset &oDS, const DDFRecordIndex &oIndex,
      21             :     const std::vector<int> &anRecordIndices,
      22          56 :     OGRFeatureDefnRefCountedPtr poFeatureDefn)
      23          56 :     : OGRS101Layer(oDS, oIndex, std::move(poFeatureDefn)),
      24          56 :       m_anRecordIndices(anRecordIndices)
      25             : {
      26          56 : }
      27             : 
      28             : /************************************************************************/
      29             : /*             OGRS101LayerMultiPoint::GetNextRawFeature()              */
      30             : /************************************************************************/
      31             : 
      32         362 : OGRFeature *OGRS101LayerMultiPoint::GetNextRawFeature()
      33             : {
      34         362 :     if (m_nRecordIdx >= static_cast<int>(m_anRecordIndices.size()))
      35         147 :         return nullptr;
      36         215 :     ++m_nRecordIdx;
      37         215 :     return GetFeature(m_nRecordIdx);
      38             : }
      39             : 
      40             : /************************************************************************/
      41             : /*              OGRS101LayerMultiPoint::GetFeatureCount()               */
      42             : /************************************************************************/
      43             : 
      44          60 : GIntBig OGRS101LayerMultiPoint::GetFeatureCount(int bForce)
      45             : {
      46          60 :     if (m_poAttrQuery || m_poFilterGeom)
      47          24 :         return OGRLayer::GetFeatureCount(bForce);
      48          36 :     return static_cast<GIntBig>(m_anRecordIndices.size());
      49             : }
      50             : 
      51             : /************************************************************************/
      52             : /*                 OGRS101LayerMultiPoint::GetFeature()                 */
      53             : /************************************************************************/
      54             : 
      55         235 : OGRFeature *OGRS101LayerMultiPoint::GetFeature(GIntBig nFID)
      56             : {
      57         235 :     if (nFID < 1 || nFID > static_cast<GIntBig>(m_anRecordIndices.size()))
      58          12 :         return nullptr;
      59         446 :     auto poFeature = std::make_unique<OGRFeature>(m_poFeatureDefn.get());
      60         446 :     if (!m_oDS.GetReader().FillFeatureMultiPoint(
      61         223 :             m_oIndex, m_anRecordIndices[static_cast<int>(nFID) - 1],
      62         223 :             *poFeature))
      63             :     {
      64           2 :         return nullptr;
      65             :     }
      66         221 :     poFeature->SetFID(nFID);
      67             : 
      68         221 :     return poFeature.release();
      69             : }

Generated by: LCOV version 1.14