LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/idrisi - ogridrisidriver.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 19 20 95.0 %
Date: 2024-11-21 22:18:42 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $I$
       3             :  *
       4             :  * Project:  Idrisi Translator
       5             :  * Purpose:  Implements OGRIdrisiDriver.
       6             :  * Author:   Even Rouault, even dot rouault at spatialys.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2011, Even Rouault <even dot rouault at spatialys.com>
      10             :  *
      11             :  * SPDX-License-Identifier: MIT
      12             :  ****************************************************************************/
      13             : 
      14             : #include "cpl_conv.h"
      15             : #include "ogr_idrisi.h"
      16             : #include "ogrsf_frmts.h"
      17             : 
      18             : /************************************************************************/
      19             : /*                                Open()                                */
      20             : /************************************************************************/
      21             : 
      22       24511 : static GDALDataset *OGRIdrisiOpen(GDALOpenInfo *poOpenInfo)
      23             : 
      24             : {
      25       24511 :     if (poOpenInfo->eAccess == GA_Update)
      26             :     {
      27         239 :         return nullptr;
      28             :     }
      29             : 
      30             :     // --------------------------------------------------------------------
      31             :     //      Does this appear to be a .vct file?
      32             :     // --------------------------------------------------------------------
      33       24272 :     if (!EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "vct"))
      34       24269 :         return nullptr;
      35             : 
      36           6 :     auto poDS = std::make_unique<OGRIdrisiDataSource>();
      37             : 
      38           3 :     if (!poDS->Open(poOpenInfo->pszFilename))
      39             :     {
      40           0 :         return nullptr;
      41             :     }
      42             : 
      43           3 :     return poDS.release();
      44             : }
      45             : 
      46             : /************************************************************************/
      47             : /*                        RegisterOGRIdrisi()                           */
      48             : /************************************************************************/
      49             : 
      50        1595 : void RegisterOGRIdrisi()
      51             : 
      52             : {
      53        1595 :     if (GDALGetDriverByName("Idrisi") != nullptr)
      54         302 :         return;
      55             : 
      56        1293 :     GDALDriver *poDriver = new GDALDriver();
      57        1293 :     poDriver->SetDescription("Idrisi");
      58        1293 :     poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "Idrisi Vector (.vct)");
      59        1293 :     poDriver->SetMetadataItem(GDAL_DMD_EXTENSION, "vct");
      60        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES");
      61        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_VIRTUALIO, "YES");
      62        1293 :     poDriver->pfnOpen = OGRIdrisiOpen;
      63        1293 :     GetGDALDriverManager()->RegisterDriver(poDriver);
      64             : }

Generated by: LCOV version 1.14