MapViewModel.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * MapViewModel.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../lib/Rect.h"
  12. class MapViewModel
  13. {
  14. Point tileSize;
  15. Point viewCenter;
  16. Point viewDimensions;
  17. int mapLevel = 0;
  18. public:
  19. void setTileSize(const Point & newValue);
  20. void setViewCenter(const Point & newValue);
  21. void setViewDimensions(const Point & newValue);
  22. void setLevel(int newLevel);
  23. /// returns current size of map tile in pixels
  24. Point getSingleTileSize() const;
  25. /// returns center point of map view, in Map coordinates
  26. Point getMapViewCenter() const;
  27. /// returns total number of visible tiles
  28. Point getTilesVisibleDimensions() const;
  29. /// returns rect encompassing all visible tiles
  30. Rect getTilesTotalRect() const;
  31. /// returns required area in pixels of cache canvas
  32. Point getCacheDimensionsPixels() const;
  33. /// returns actual player-visible area
  34. Point getPixelsVisibleDimensions() const;
  35. /// returns area covered by specified tile in map cache
  36. Rect getCacheTileArea(const int3 & coordinates) const;
  37. /// returns area covered by specified tile in target view
  38. Rect getTargetTileArea(const int3 & coordinates) const;
  39. /// returns tile under specified position in target view
  40. int3 getTileAtPoint(const Point & position) const;
  41. /// returns currently visible map level
  42. int getLevel() const;
  43. };