You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. *
  3. * This file is part of QMapControl,
  4. * an open-source cross-platform map widget
  5. *
  6. * Copyright (C) 2007 - 2008 Kai Winter
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with QMapControl. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * Contact e-mail: kaiwinter@gmx.de
  22. * Program URL : http://qmapcontrol.sourceforge.net/
  23. *
  24. */
  25. #ifndef WMSMAPADAPTER_H
  26. #define WMSMAPADAPTER_H
  27. #include "qmapcontrol_global.h"
  28. #include "mapadapter.h"
  29. //! MapAdapter for WMS servers
  30. /*!
  31. * Use this derived MapAdapter to display maps from WMS servers
  32. * @author Kai Winter <kaiwinter@gmx.de>
  33. */
  34. class WMSMapAdapter : public MapAdapter {
  35. public:
  36. //! constructor
  37. /*!
  38. * Sample of a correct initialization of a MapAdapter:<br/>
  39. * MapAdapter* mapadapter = new WMSMapAdapter("www2.demis.nl", "/wms/wms.asp?wms=WorldMap[...]&BBOX=%1,%2,%3,%4&WIDTH=%5&HEIGHT=%5&TRANSPARENT=TRUE", 256);<br/>
  40. * The placeholders %1, %2, %3, %4 creates the bounding box, %5 is for the tilesize
  41. * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max)
  42. * @param host The servers URL
  43. * @param serverPath The path to the tiles with placeholders
  44. * @param tilesize the size of the tiles
  45. */
  46. WMSMapAdapter(QString host, QString serverPath, int tilesize = 256);
  47. virtual ~WMSMapAdapter();
  48. virtual QString serverPath() const;
  49. virtual QPoint coordinateToDisplay(const QPointF&) const;
  50. virtual QPointF displayToCoordinate(const QPoint&) const;
  51. virtual void changeHostAddress( const QString qHost, const QString qServerPath = QString() );
  52. protected:
  53. virtual void zoom_in();
  54. virtual void zoom_out();
  55. virtual QString query(int x, int y, int z) const;
  56. virtual bool isTileValid(int x, int y, int z) const;
  57. private:
  58. virtual QString getQ(qreal ux, qreal uy, qreal ox, qreal oy) const;
  59. qreal coord_per_x_tile;
  60. qreal coord_per_y_tile;
  61. QHash<QString,QString> mServerOptions;
  62. QHash<int,qreal> mResolutions;
  63. };
  64. #endif