LCOV - code coverage report
Current view: directory - frmts/wms - minidriver_tileservice.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 39 26 66.7 %
Date: 2011-12-18 Functions: 16 7 43.8 %

       1                 : /******************************************************************************
       2                 :  * $Id: minidriver_tileservice.cpp 18020 2009-11-14 14:33:20Z rouault $
       3                 :  *
       4                 :  * Project:  WMS Client Driver
       5                 :  * Purpose:  Implementation of Dataset and RasterBand classes for WMS
       6                 :  *           and other similar services.
       7                 :  * Author:   Adam Nowacki, nowak@xpam.de
       8                 :  *
       9                 :  ******************************************************************************
      10                 :  * Copyright (c) 2007, Adam Nowacki
      11                 :  *
      12                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      13                 :  * copy of this software and associated documentation files (the "Software"),
      14                 :  * to deal in the Software without restriction, including without limitation
      15                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16                 :  * and/or sell copies of the Software, and to permit persons to whom the
      17                 :  * Software is furnished to do so, subject to the following conditions:
      18                 :  *
      19                 :  * The above copyright notice and this permission notice shall be included
      20                 :  * in all copies or substantial portions of the Software.
      21                 :  *
      22                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      23                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      25                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      27                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      28                 :  * DEALINGS IN THE SOFTWARE.
      29                 :  ****************************************************************************/
      30                 : 
      31                 : #include "stdinc.h"
      32                 : 
      33            1060 : CPP_GDALWMSMiniDriverFactory(TileService)
      34                 : 
      35               1 : GDALWMSMiniDriver_TileService::GDALWMSMiniDriver_TileService() {
      36               1 : }
      37                 : 
      38               1 : GDALWMSMiniDriver_TileService::~GDALWMSMiniDriver_TileService() {
      39               1 : }
      40                 : 
      41               1 : CPLErr GDALWMSMiniDriver_TileService::Initialize(CPLXMLNode *config) {
      42               1 :     CPLErr ret = CE_None;
      43                 : 
      44               1 :     if (ret == CE_None) {
      45               1 :         const char *version = CPLGetXMLValue(config, "Version", "1");
      46               1 :         if (version[0] != '\0') {
      47               1 :             m_version = version;
      48                 :         }
      49                 :     }
      50                 : 
      51               1 :     if (ret == CE_None) {
      52               1 :         const char *base_url = CPLGetXMLValue(config, "ServerURL", "");
      53               1 :         if (base_url[0] != '\0') {
      54                 :             /* Try the old name */
      55               1 :             base_url = CPLGetXMLValue(config, "ServerUrl", "");
      56                 :         }
      57               1 :         if (base_url[0] != '\0') {
      58               1 :             m_base_url = base_url;
      59                 :         } else {
      60               0 :             CPLError(CE_Failure, CPLE_AppDefined, "GDALWMS, TileService mini-driver: ServerURL missing.");
      61               0 :             ret = CE_Failure;
      62                 :         }
      63                 :     }
      64                 : 
      65               1 :     m_dataset = CPLGetXMLValue(config, "Dataset", "");
      66                 : 
      67               1 :     return ret;
      68                 : }
      69                 : 
      70               1 : void GDALWMSMiniDriver_TileService::GetCapabilities(GDALWMSMiniDriverCapabilities *caps) {
      71               1 :     caps->m_capabilities_version = 1;
      72               1 :     caps->m_has_arb_overviews = 0;
      73               1 :     caps->m_has_image_request = 0;
      74               1 :     caps->m_has_tiled_image_requeset = 1;
      75               1 :     caps->m_max_overview_count = 32;
      76               1 : }
      77                 : 
      78               0 : void GDALWMSMiniDriver_TileService::ImageRequest(CPLString *url, const GDALWMSImageRequestInfo &iri) {
      79               0 : }
      80                 : 
      81               0 : void GDALWMSMiniDriver_TileService::TiledImageRequest(CPLString *url, const GDALWMSImageRequestInfo &iri, const GDALWMSTiledImageRequestInfo &tiri) {
      82                 :     // http://s0.tileservice.worldwindcentral.com/getTile?interface=map&version=1&dataset=bmng.topo.bathy.200401&level=5&x=18&y=6
      83               0 :     *url = m_base_url;
      84               0 :     URLAppend(url, "&interface=map");
      85               0 :     URLAppendF(url, "&version=%s", m_version.c_str());
      86               0 :     URLAppendF(url, "&dataset=%s", m_dataset.c_str());
      87               0 :     URLAppendF(url, "&level=%d", tiri.m_level);
      88               0 :     URLAppendF(url, "&x=%d", tiri.m_x);
      89               0 :     URLAppendF(url, "&y=%d", tiri.m_y);
      90               0 : }

Generated by: LCOV version 1.7