LCOV - code coverage report
Current view: top level - frmts/wcs - wcsdrivercore.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 21 25 84.0 %
Date: 2024-11-21 22:18:42 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  WCS Client Driver
       4             :  * Purpose:  Implementation of Dataset and RasterBand classes for WCS.
       5             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2006, Frank Warmerdam
       9             :  * Copyright (c) 2008-2013, Even Rouault <even dot rouault at spatialys.com>
      10             :  *
      11             :  * SPDX-License-Identifier: MIT
      12             :  ****************************************************************************/
      13             : 
      14             : #include "wcsdrivercore.h"
      15             : 
      16             : /************************************************************************/
      17             : /*                     WCSDriverIdentify()                              */
      18             : /************************************************************************/
      19             : 
      20       53493 : int WCSDriverIdentify(GDALOpenInfo *poOpenInfo)
      21             : 
      22             : {
      23             :     /* -------------------------------------------------------------------- */
      24             :     /*      Filename is WCS:URL                                             */
      25             :     /*                                                                      */
      26             :     /* -------------------------------------------------------------------- */
      27       53493 :     if (poOpenInfo->nHeaderBytes == 0 &&
      28       48759 :         STARTS_WITH_CI((const char *)poOpenInfo->pszFilename, "WCS:"))
      29         192 :         return TRUE;
      30             : 
      31             :     /* -------------------------------------------------------------------- */
      32             :     /*      Is this a WCS_GDAL service description file or "in url"         */
      33             :     /*      equivalent?                                                     */
      34             :     /* -------------------------------------------------------------------- */
      35       53301 :     if (poOpenInfo->nHeaderBytes == 0 &&
      36       48567 :         STARTS_WITH_CI((const char *)poOpenInfo->pszFilename, "<WCS_GDAL>"))
      37           0 :         return TRUE;
      38             : 
      39       53301 :     else if (poOpenInfo->nHeaderBytes >= 10 &&
      40        4557 :              STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "<WCS_GDAL>"))
      41           2 :         return TRUE;
      42             : 
      43             :     /* -------------------------------------------------------------------- */
      44             :     /*      Is this apparently a WCS subdataset reference?                  */
      45             :     /* -------------------------------------------------------------------- */
      46       53299 :     else if (STARTS_WITH_CI((const char *)poOpenInfo->pszFilename,
      47           0 :                             "WCS_SDS:") &&
      48           0 :              poOpenInfo->nHeaderBytes == 0)
      49           0 :         return TRUE;
      50             : 
      51             :     else
      52       53299 :         return FALSE;
      53             : }
      54             : 
      55             : /************************************************************************/
      56             : /*                      WCSDriverSetCommonMetadata()                    */
      57             : /************************************************************************/
      58             : 
      59        1293 : void WCSDriverSetCommonMetadata(GDALDriver *poDriver)
      60             : {
      61        1293 :     poDriver->SetDescription(DRIVER_NAME);
      62        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_RASTER, "YES");
      63        1293 :     poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "OGC Web Coverage Service");
      64        1293 :     poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC, "drivers/raster/wcs.html");
      65        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_VIRTUALIO, "YES");
      66        1293 :     poDriver->SetMetadataItem(GDAL_DMD_SUBDATASETS, "YES");
      67             : 
      68        1293 :     poDriver->pfnIdentify = WCSDriverIdentify;
      69        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");
      70        1293 : }
      71             : 
      72             : /************************************************************************/
      73             : /*                     DeclareDeferredWCSPlugin()                       */
      74             : /************************************************************************/
      75             : 
      76             : #ifdef PLUGIN_FILENAME
      77             : void DeclareDeferredWCSPlugin()
      78             : {
      79             :     if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
      80             :     {
      81             :         return;
      82             :     }
      83             :     auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME);
      84             : #ifdef PLUGIN_INSTALLATION_MESSAGE
      85             :     poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE,
      86             :                               PLUGIN_INSTALLATION_MESSAGE);
      87             : #endif
      88             :     WCSDriverSetCommonMetadata(poDriver);
      89             :     GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver);
      90             : }
      91             : #endif

Generated by: LCOV version 1.14