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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#pragma once
#include "drape/drape_global.hpp"
#include "drape/binding_info.hpp"
#include "drape/index_buffer_mutator.hpp"
#include "drape/attribute_buffer_mutator.hpp"
#include "indexer/feature_decl.hpp"
#include "geometry/screenbase.hpp"
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
#include "base/buffer_vector.hpp"
namespace dp
{
class OverlayHandle
{
public:
typedef vector<m2::RectF> Rects;
OverlayHandle(FeatureID const & id,
dp::Anchor anchor,
double priority);
virtual ~OverlayHandle() {}
bool IsVisible() const;
void SetIsVisible(bool isVisible);
bool IsValid() const { return m_isValid; }
virtual void Update(ScreenBase const & /*screen*/) {}
virtual m2::RectD GetPixelRect(ScreenBase const & screen) const = 0;
virtual void GetPixelShape(ScreenBase const & screen, Rects & rects) const = 0;
bool IsIntersect(ScreenBase const & screen, OverlayHandle const & h) const;
uint16_t * IndexStorage(uint16_t size);
size_t GetIndexCount() const;
void GetElementIndexes(RefPointer<IndexBufferMutator> mutator) const;
virtual void GetAttributeMutation(RefPointer<AttributeBufferMutator> mutator, ScreenBase const & screen) const;
bool HasDynamicAttributes() const;
void AddDynamicAttribute(BindingInfo const & binding, uint16_t offset, uint16_t count);
FeatureID const & GetFeatureID() const;
double const & GetPriority() const;
protected:
void SetIsValid(bool isValid) { m_isValid = isValid; }
protected:
FeatureID const m_id;
dp::Anchor const m_anchor;
double const m_priority;
typedef pair<BindingInfo, MutateRegion> TOffsetNode;
TOffsetNode const & GetOffsetNode(uint8_t bufferID) const;
private:
bool m_isVisible;
bool m_isValid;
vector<uint16_t> m_indexes;
struct LessOffsetNode
{
bool operator()(TOffsetNode const & node1, TOffsetNode const & node2) const
{
return node1.first.GetID() < node2.first.GetID();
}
};
struct OffsetNodeFinder;
set<TOffsetNode, LessOffsetNode> m_offsets;
};
class SquareHandle : public OverlayHandle
{
typedef OverlayHandle base_t;
public:
SquareHandle(FeatureID const & id,
dp::Anchor anchor,
m2::PointD const & gbPivot,
m2::PointD const & pxSize,
double priority);
virtual m2::RectD GetPixelRect(ScreenBase const & screen) const;
virtual void GetPixelShape(ScreenBase const & screen, Rects & rects) const;
private:
m2::PointD m_gbPivot;
m2::PointD m_pxHalfSize;
};
} // namespace dp
|