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

          Line data    Source code
       1             : /******************************************************************************
       2             :  * Project:  WMS Client Driver
       3             :  * Purpose:  OGC API maps
       4             :  * Author:   Even Rouault
       5             :  *
       6             :  ******************************************************************************
       7             :  * Copyright (c) 2020, Even Rouault
       8             :  *
       9             :  * SPDX-License-Identifier: MIT
      10             :  ****************************************************************************/
      11             : 
      12             : #include "wmsdriver.h"
      13             : #include "minidriver_ogcapimaps.h"
      14             : 
      15           1 : CPLErr WMSMiniDriver_OGCAPIMaps::Initialize(CPLXMLNode *config,
      16             :                                             CPL_UNUSED char **papszOpenOptions)
      17             : {
      18           1 :     CPLErr ret = CE_None;
      19             : 
      20             :     {
      21           1 :         const char *base_url = CPLGetXMLValue(config, "ServerURL", "");
      22           1 :         if (base_url[0] != '\0')
      23             :         {
      24           1 :             m_base_url = base_url;
      25             :         }
      26             :         else
      27             :         {
      28           0 :             CPLError(CE_Failure, CPLE_AppDefined,
      29             :                      "GDALWMS, OGCAPIMaps mini-driver: ServerURL missing.");
      30           0 :             ret = CE_Failure;
      31             :         }
      32             :     }
      33             : 
      34           1 :     return ret;
      35             : }
      36             : 
      37           1 : CPLErr WMSMiniDriver_OGCAPIMaps::TiledImageRequest(
      38             :     WMSHTTPRequest &request, const GDALWMSImageRequestInfo &iri,
      39             :     const GDALWMSTiledImageRequestInfo &)
      40             : {
      41           1 :     CPLString &url = request.URL;
      42             : 
      43           1 :     url = m_base_url;
      44             : 
      45           1 :     URLPrepare(url);
      46             :     url +=
      47           1 :         CPLOPrintf("width=%d&height=%d&bbox=%.17g,%.17g,%.17g,%.17g", iri.m_sx,
      48           1 :                    iri.m_sy, iri.m_x0, iri.m_y1, iri.m_x1, iri.m_y0);
      49             : 
      50           1 :     return CE_None;
      51             : }

Generated by: LCOV version 1.14