All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LabelSourceController.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Labels.h"
6 #include "Types.h"
7 #include "LabelAnchorCategory.h"
8 #include "LabelStyle.h"
9 #include "ICallback.h"
10 
11 #include <vector>
12 
13 
14 namespace Eegeo
15 {
16  namespace Labels
17  {
19  {
20  public:
21  LabelSourceController(const IAnchoredLabelSourceRepository& labelSourceRepository,
22  ILabelSourceRepositoryObserver& labelSourceRepositoryObserver,
23  ILabelModelSourceObserver& labelModelSourceObserver,
24  ILabelAnchorChangedEvent& labelAnchorChangedEvent,
25  ILabelViewFactory& labelViewFactory,
26  ILabelViewRepository& labelViewRepository,
27  const ILabelFilterModel& internallyModifiableLabelFilterModel,
28  ILabelFilterModelObserver& internallyModifiableLabelFilterModelObserver,
29  const ILabelStyleBindingRepository& labelStyleBindingRepository,
30  const LabelAnchorCategory::IdType& defaultLineId,
31  const LabelAnchorCategory::IdType& defaultPointId);
32 
34 
35  private:
36  void OnAnchoredLabelSourceAdded(const IAnchoredLabelSource& anchoredLabelSource);
37 
38  void OnAnchoredLabelSourceRemoved(const IAnchoredLabelSource& anchoredLabelSource);
39 
40  void OnLabelModelAdded(const IAnchoredLabel& anchoredLabel);
41 
42  void OnLabelModelRemoved(const IAnchoredLabel& anchoredLabel);
43 
44  void OnAnchoredLabelChanged(const IAnchoredLabel& anchoredLabel);
45 
46  bool ShouldAddViewFor(const IAnchoredLabel& anchoredLabel) const;
47 
48  bool ShouldRemoveViewFor(const IAnchoredLabel& anchoredLabel) const;
49 
50 
51  const LabelStyle::IdType& GetLabelStyleForAnchorCategory(const LabelAnchorCategory& labelAnchorCategory) const;
52 
53  const LabelAnchorCategory::IdType& GetLabelAnchorCategoryIdOrDefault(const LabelAnchorCategory& labelAnchorCategory) const;
54 
55  void OnInternallyModifiableLabelFilterModelChanged();
56 
57  LabelView* CreateAndAddViewFor(const IAnchoredLabel& anchoredLabel);
58  void RemoveAndDestroyViewFor(const IAnchoredLabel& anchoredLabel);
59 
60  const IAnchoredLabelSourceRepository& m_labelSourceRepository;
61  ILabelSourceRepositoryObserver& m_labelSourceRepositoryObserver;
62  ILabelModelSourceObserver& m_labelModelSourceObserver;
63  ILabelAnchorChangedEvent& m_labelAnchorChangedEvent;
64  ILabelViewFactory& m_labelViewFactory;
65  ILabelViewRepository& m_labelViewRepository;
66  const ILabelStyleBindingRepository& m_labelStyleBindingRepository;
67  const LabelAnchorCategory::IdType& m_defaultLineId;
68  const LabelAnchorCategory::IdType& m_defaultPointId;
69  std::vector<const IAnchoredLabel*> m_anchoredLabelBuffer;
70  const ILabelFilterModel& m_internallyModifiableLabelFilterModel;
71  ILabelFilterModelObserver& m_internallyModifiableLabelFilterModelObserver;
72 
78 
79  Helpers::TCallback0<LabelSourceController> m_internallyModifiableLabelFilterModelChanged;
80  };
81  }
82 }