12 #ifndef ROOT7_REveSelection
13 #define ROOT7_REveSelection
20 namespace Experimental {
27 class REveSelection :
public REveElement,
42 REveElement *f_primary{
nullptr};
44 std::set<int> f_sec_idcs;
47 Record(REveElement *el) :
55 Record(REveElement *el,
const std::set<int>& secondary_idcs) :
57 f_sec_idcs (secondary_idcs),
64 bool is_secondary()
const {
return f_is_sec; }
67 typedef std::map<REveElement*, Record> SelMap_t;
68 typedef SelMap_t::iterator SelMap_i;
71 REveSelection(
const REveSelection &);
72 REveSelection &operator=(
const REveSelection &);
75 Color_t fVisibleEdgeColor;
76 Color_t fHiddenEdgeColor;
78 std::vector<int> fPickToSelect;
79 Bool_t fActive{kFALSE};
80 Bool_t fIsMaster{kFALSE};
84 Record* find_record(REveElement *el)
86 auto i = fMap.find(el);
87 return i != fMap.end() ? & i->second :
nullptr;
90 void DoElementSelect (SelMap_i &entry);
91 void DoElementUnselect(SelMap_i &entry);
93 void RecheckImpliedSet(SelMap_i &entry);
96 REveSelection(
const std::string &n =
"REveSelection",
const std::string &t =
"",
97 Color_t col_visible = kViolet, Color_t col_hidden = kPink);
98 virtual ~REveSelection();
100 void SetVisibleEdgeColorRGB(UChar_t r, UChar_t g, UChar_t b);
101 void SetHiddenEdgeColorRGB(UChar_t r, UChar_t g, UChar_t b);
103 void SetHighlightMode();
105 const std::vector<int>& RefPickToSelect()
const {
return fPickToSelect; }
106 void ClearPickToSelect() { fPickToSelect.clear(); }
107 void AddPickToSelect(
int ps) { fPickToSelect.push_back(ps); }
109 Bool_t GetIsMaster()
const {
return fIsMaster; }
110 void SetIsMaster(Bool_t m) { fIsMaster = m; }
112 bool IsEmpty()
const {
return fMap.empty(); }
113 bool NotEmpty()
const {
return ! fMap.empty(); }
116 bool HasNiece(REveElement *el)
const override;
117 bool HasNieces()
const override;
118 bool AcceptNiece(REveElement *el)
override;
119 void AddNieceInternal(REveElement *el)
override;
120 void RemoveNieceInternal(REveElement *el)
override;
121 void RemoveNieces()
override;
123 void RemoveImpliedSelected(REveElement *el);
125 void RecheckImpliedSetForElement(REveElement *el);
127 void SelectionAdded(REveElement *el);
128 void SelectionRemoved(REveElement *el);
129 void SelectionCleared();
130 void SelectionRepeated(REveElement *el);
135 virtual void ActivateSelection();
136 virtual void DeactivateSelection();
141 REveElement *MapPickedToSelected(REveElement *el);
143 virtual void UserPickedElement(REveElement *el, Bool_t multi = kFALSE);
144 virtual void UserRePickedElement(REveElement *el);
145 virtual void UserUnPickedElement(REveElement *el);
147 void NewElementPicked(ElementId_t
id,
bool multi,
bool secondary,
const std::set<int>& secondary_idcs={});
148 void ClearSelection();
150 int RemoveImpliedSelectedReferencesTo(REveElement *el);
154 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
override;