blob: ce34bdc5f4a6f6d1b3eab318e2f116baa6ba1706 (
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
50
51
52
53
54
55
|
#pragma once
#include "indexer/point_to_int64.hpp"
#include "geometry/rect2d.hpp"
#include "std/utility.hpp"
#include "std/vector.hpp"
class FeatureType;
namespace covering
{
typedef pair<int64_t, int64_t> IntervalT;
typedef vector<IntervalT> IntervalsT;
// Cover feature with RectIds and return their integer representations.
vector<int64_t> CoverFeature(FeatureType const & feature,
int cellDepth,
uint64_t cellPenaltyArea);
void AppendLowerLevels(RectId id, int cellDepth, IntervalsT & intervals);
// Cover viewport with RectIds and append their RectIds as well.
void CoverViewportAndAppendLowerLevels(m2::RectD const & rect, int cellDepth,
IntervalsT & intervals);
// Given a vector of intervals [a, b), sort them and merge overlapping intervals.
IntervalsT SortAndMergeIntervals(IntervalsT const & intervals);
RectId GetRectIdAsIs(m2::RectD const & r);
// Calculate cell coding depth according to max visual scale for mwm.
int GetCodingDepth(int scale);
enum CoveringMode
{
ViewportWithLowLevels = 0,
LowLevelsOnly,
FullCover
};
class CoveringGetter
{
IntervalsT m_res[2];
m2::RectD const & m_rect;
CoveringMode m_mode;
public:
CoveringGetter(m2::RectD const & r, CoveringMode mode) : m_rect(r), m_mode(mode) {}
IntervalsT const & Get(int scale);
};
}
|