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.

88 lines
2.0 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. #include "mapadapter.h"
  26. MapAdapter::MapAdapter(const QString& qHost, const QString& qServerPath, int qTilesize, int qMinZoom, int qMaxZoom)
  27. :mTileSize(qTilesize), mMin_zoom(qMinZoom), mMax_zoom(qMaxZoom)
  28. {
  29. mCurrent_zoom = qMinZoom;
  30. changeHostAddress( qHost, qServerPath );
  31. }
  32. MapAdapter::~MapAdapter()
  33. {
  34. }
  35. void MapAdapter::changeHostAddress( const QString qHost, const QString qServerPath )
  36. {
  37. mServerHost = qHost;
  38. mServerPath = qServerPath;
  39. }
  40. QString MapAdapter::host() const
  41. {
  42. return mServerHost;
  43. }
  44. QString MapAdapter::serverPath() const
  45. {
  46. return mServerPath;
  47. }
  48. int MapAdapter::tilesize() const
  49. {
  50. return mTileSize;
  51. }
  52. int MapAdapter::minZoom() const
  53. {
  54. return mMin_zoom;
  55. }
  56. int MapAdapter::maxZoom() const
  57. {
  58. return mMax_zoom;
  59. }
  60. int MapAdapter::currentZoom() const
  61. {
  62. return mCurrent_zoom;
  63. }
  64. int MapAdapter::adaptedZoom() const
  65. {
  66. return mMax_zoom < mMin_zoom ? mMin_zoom - mCurrent_zoom : mCurrent_zoom;
  67. }
  68. void MapAdapter::setBoundingBox(qreal qMinX, qreal qMinY, qreal qMaxX, qreal qMaxY )
  69. {
  70. mBoundingBox = QRectF( QPointF( qMinX, qMinY ), QPointF(qMaxX, qMaxY ) );
  71. }
  72. int MapAdapter::tileSize()
  73. {
  74. return mTileSize;
  75. }