Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: S-101 driver 4 : * Purpose: Implements OGRS101LayerInformationType 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 : /* OGRS101LayerInformationType() */ 17 : /************************************************************************/ 18 : 19 156 : OGRS101LayerInformationType::OGRS101LayerInformationType( 20 : OGRS101Dataset &oDS, const DDFRecordIndex &oIndex, 21 156 : OGRFeatureDefnRefCountedPtr poFeatureDefn) 22 156 : : OGRS101Layer(oDS, oIndex, std::move(poFeatureDefn)) 23 : { 24 156 : } 25 : 26 : /************************************************************************/ 27 : /* OGRS101LayerInformationType::GetNextRawFeature() */ 28 : /************************************************************************/ 29 : 30 641 : OGRFeature *OGRS101LayerInformationType::GetNextRawFeature() 31 : { 32 641 : if (m_nRecordIdx >= m_oIndex.GetCount()) 33 252 : return nullptr; 34 389 : ++m_nRecordIdx; 35 389 : return GetFeature(m_nRecordIdx); 36 : } 37 : 38 : /************************************************************************/ 39 : /* OGRS101LayerInformationType::GetFeature() */ 40 : /************************************************************************/ 41 : 42 429 : OGRFeature *OGRS101LayerInformationType::GetFeature(GIntBig nFID) 43 : { 44 429 : if (nFID < 1 || nFID > m_oIndex.GetCount()) 45 30 : return nullptr; 46 798 : auto poFeature = std::make_unique<OGRFeature>(m_poFeatureDefn.get()); 47 798 : if (!m_oDS.GetReader().FillFeatureInformationType( 48 399 : m_oIndex, static_cast<int>(nFID) - 1, *poFeature)) 49 : { 50 0 : return nullptr; 51 : } 52 : 53 399 : poFeature->SetFID(nFID); 54 : 55 399 : return poFeature.release(); 56 : }