LCOV - code coverage report
Current view: top level - frmts/wms - minidriver_ogcapicoverage.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 16 18 88.9 %
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 coverage
       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_ogcapicoverage.h"
      14             : 
      15             : CPLErr
      16           1 : WMSMiniDriver_OGCAPICoverage::Initialize(CPLXMLNode *config,
      17             :                                          CPL_UNUSED char **papszOpenOptions)
      18             : {
      19           1 :     CPLErr ret = CE_None;
      20             : 
      21             :     {
      22           1 :         const char *base_url = CPLGetXMLValue(config, "ServerURL", "");
      23           1 :         if (base_url[0] != '\0')
      24             :         {
      25           1 :             m_base_url = base_url;
      26             :         }
      27             :         else
      28             :         {
      29           0 :             CPLError(CE_Failure, CPLE_AppDefined,
      30             :                      "GDALWMS, OGCAPICoverage mini-driver: ServerURL missing.");
      31           0 :             ret = CE_Failure;
      32             :         }
      33             :     }
      34             : 
      35           1 :     return ret;
      36             : }
      37             : 
      38           2 : CPLErr WMSMiniDriver_OGCAPICoverage::TiledImageRequest(
      39             :     WMSHTTPRequest &request, const GDALWMSImageRequestInfo &iri,
      40             :     const GDALWMSTiledImageRequestInfo &)
      41             : {
      42           2 :     CPLString &url = request.URL;
      43             : 
      44           2 :     url = m_base_url;
      45             : 
      46           2 :     URLSearchAndReplace(&url, "${width}", "%d", iri.m_sx);
      47           2 :     URLSearchAndReplace(&url, "${height}", "%d", iri.m_sy);
      48           2 :     URLSearchAndReplace(&url, "${minx}", "%.17g", iri.m_x0);
      49           2 :     URLSearchAndReplace(&url, "${miny}", "%.17g", iri.m_y1);
      50           2 :     URLSearchAndReplace(&url, "${maxx}", "%.17g", iri.m_x1);
      51           2 :     URLSearchAndReplace(&url, "${maxy}", "%.17g", iri.m_y0);
      52             :     /*URLSearchAndReplace(&url, "${minx_centerpixel}", "%.17g", iri.m_x0 + 0.5 *
      53             :     (iri.m_x1 - iri.m_x0) / iri.m_sx); URLSearchAndReplace(&url,
      54             :     "${miny_centerpixel}", "%.17g", iri.m_y1 - 0.5 * (iri.m_y1 - iri.m_y0) /
      55             :     iri.m_sy); URLSearchAndReplace(&url, "${maxx_centerpixel}", "%.17g",
      56             :     iri.m_x1 - 0.5 * (iri.m_x1 - iri.m_x0) / iri.m_sx);
      57             :     URLSearchAndReplace(&url, "${maxy_centerpixel}", "%.17g", iri.m_y0 + 0.5 *
      58             :     (iri.m_y1 - iri.m_y0) / iri.m_sy);*/
      59             : 
      60           2 :     return CE_None;
      61             : }

Generated by: LCOV version 1.14