LCOV - code coverage report
Current view: top level - frmts/wms - minidriver_iip.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 24 26 92.3 %
Date: 2024-11-21 22:18:42 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  WMS Client Driver
       4             :  * Purpose:  Mini driver for Internet Imaging Protocol (IIP)
       5             :  * Author:   Even Rouault <even.rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2015, Even Rouault <even.rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include "wmsdriver.h"
      14             : #include "minidriver_iip.h"
      15             : 
      16           1 : WMSMiniDriver_IIP::WMSMiniDriver_IIP()
      17             : {
      18           1 : }
      19             : 
      20           2 : WMSMiniDriver_IIP::~WMSMiniDriver_IIP()
      21             : {
      22           2 : }
      23             : 
      24           1 : CPLErr WMSMiniDriver_IIP::Initialize(CPLXMLNode *config,
      25             :                                      CPL_UNUSED char **papszOpenOptions)
      26             : {
      27           1 :     CPLErr ret = CE_None;
      28             : 
      29           1 :     m_base_url = CPLGetXMLValue(config, "ServerURL", "");
      30           1 :     if (m_base_url.empty())
      31             :     {
      32           0 :         CPLError(CE_Failure, CPLE_AppDefined,
      33             :                  "GDALWMS, IIP mini-driver: ServerURL missing.");
      34           0 :         return CE_Failure;
      35             :     }
      36             : 
      37           1 :     return ret;
      38             : }
      39             : 
      40           1 : void WMSMiniDriver_IIP::GetCapabilities(WMSMiniDriverCapabilities *caps)
      41             : {
      42           1 :     caps->m_overview_dim_computation_method = OVERVIEW_FLOOR;
      43           1 :     caps->m_has_geotransform = false;
      44           1 : }
      45             : 
      46             : CPLErr
      47           1 : WMSMiniDriver_IIP::TiledImageRequest(WMSHTTPRequest &request,
      48             :                                      const GDALWMSImageRequestInfo & /* iri */,
      49             :                                      const GDALWMSTiledImageRequestInfo &tiri)
      50             : {
      51           1 :     CPLString &url = request.URL;
      52           1 :     url = m_base_url;
      53           1 :     URLPrepare(url);
      54             : 
      55             :     int nTileXCount =
      56           1 :         ((m_parent_dataset->GetRasterXSize() >>
      57           1 :           (m_parent_dataset->GetRasterBand(1)->GetOverviewCount() -
      58           1 :            tiri.m_level)) +
      59             :          255) /
      60           1 :         256;
      61           1 :     int numTile = tiri.m_x + tiri.m_y * nTileXCount;
      62           1 :     url += CPLOPrintf("jtl=%d,%d", tiri.m_level, numTile);
      63           1 :     return CE_None;
      64             : }

Generated by: LCOV version 1.14