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.

74 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 TILEMAPADAPTER_H
  26. #define TILEMAPADAPTER_H
  27. #include "qmapcontrol_global.h"
  28. #include "mapadapter.h"
  29. //! MapAdapter for servers with image tiles
  30. /*!
  31. * Use this derived MapAdapter to display maps from OpenStreetMap
  32. * @author Kai Winter <kaiwinter@gmx.de>
  33. */
  34. class TileMapAdapter : public MapAdapter {
  35. // Q_OBJECT
  36. public:
  37. //! constructor
  38. /*!
  39. * Sample of a correct initialization of a MapAdapter:<br/>
  40. * TileMapAdapter* ta = new TileMapAdapter("192.168.8.1", "/img/img_cache.php/%1/%2/%3.png", 256, 0,17);<br/>
  41. * The placeholders %1, %2, %3 stands for x, y, z<br/>
  42. * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max)
  43. * @param host The servers URL
  44. * @param serverPath The path to the tiles with placeholders
  45. * @param tilesize the size of the tiles
  46. * @param minZoom the minimum zoom level
  47. * @param maxZoom the maximum zoom level
  48. */
  49. TileMapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom = 0, int maxZoom = 17);
  50. virtual ~TileMapAdapter();
  51. virtual QPoint coordinateToDisplay(const QPointF&) const;
  52. virtual QPointF displayToCoordinate(const QPoint&) const;
  53. qreal PI;
  54. protected:
  55. qreal rad_deg(qreal) const;
  56. qreal deg_rad(qreal) const;
  57. virtual bool isTileValid(int x, int y, int z) const;
  58. virtual void zoom_in();
  59. virtual void zoom_out();
  60. virtual QString query(int x, int y, int z) const;
  61. virtual int tilesonzoomlevel(int zoomlevel) const;
  62. virtual int xoffset(int x) const;
  63. virtual int yoffset(int y) const;
  64. };
  65. #endif