All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ILabelAnchorFilter.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Labels.h"
6 #include "LabelLayer.h"
7 #include "ICallback.h"
8 #include "IModelObserver.h"
9 
10 
11 #include <string>
12 #include <vector>
13 
14 namespace Eegeo
15 {
16  namespace Labels
17  {
19  {
20  public:
21  virtual ~ILabelAnchorFilter() {;}
22  virtual bool operator()(const IAnchoredLabel& anchoredLabel) const = 0;
23  };
24 
25  template <typename TContext>
27  {
28  public:
29  typedef bool (TContext::*TPredicate)(const IAnchoredLabel& anchoredLabel) const;
30 
31  TLabelAnchorFilter(TContext* context, TPredicate predicate)
32  : m_predicate(predicate)
33  , m_pContext(context)
34  {
35  }
36 
37  virtual bool operator()(const IAnchoredLabel& anchoredLabel) const
38  {
39  return (*m_pContext.*m_predicate)(anchoredLabel);
40  }
41  private:
42  TPredicate m_predicate;
43  TContext* m_pContext;
44  };
45 
46 
48  {
49  public:
50  virtual ~ILabelAnchorFilterModel() {}
51 
52  virtual void SetFilter(LabelLayer::IdType labelLayerId, const ILabelAnchorFilter* pFilter) = 0;
53 
54  virtual const ILabelAnchorFilter* GetFilter(LabelLayer::IdType labelLayerId) const = 0;
55  };
56 
57 
58  bool LabelAnchorFilterPredicate(const ILabelAnchorFilterModel& labelAnchorFilterModel, const IAnchoredLabel& anchoredLabel);
59 
60 
62  {
63  public:
65 
66  };
67  }
68 }