Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tile_key.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9818728d4e761e753925cc2e0572ba3bb2eab515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include "geometry/rect2d.hpp"
#include "geometry/screenbase.hpp"

#include "base/matrix.hpp"

namespace df
{

struct TileKey
{
  TileKey();
  TileKey(int x, int y, int zoomLevel);
  TileKey(TileKey const & key, uint64_t generation);

  // Operators < and == do not consider parameter m_generation.
  // m_generation is used to determine a generation of geometry for this tile key.
  // Geometry with different generations must be able to group by (x, y, zoomlevel).
  bool operator < (TileKey const & other) const;
  bool operator == (TileKey const & other) const;

  // These methods implement strict comparison of tile keys. It's necessary to merger of
  // batches which must not merge batches with different m_generation.
  bool LessStrict(TileKey const & other) const;
  bool EqualStrict(TileKey const & other) const;

  m2::RectD GetGlobalRect(bool clipByDataMaxZoom = true) const;

  math::Matrix<float, 4, 4> GetTileBasedModelView(ScreenBase const & screen) const;

  int m_x;
  int m_y;
  int m_zoomLevel;

  uint64_t m_generation;
};

struct TileKeyStrictComparator
{
  bool operator() (TileKey const & lhs, TileKey const & rhs) const
  {
    return lhs.LessStrict(rhs);
  }
};

string DebugPrint(TileKey const & key);

} // namespace df