ImagingTools Core SDK
CGroupComp.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// ACF includes
6#include <iprm/IOptionsList.h>
7#include <iprm/ISelectionParam.h>
8#include <imod/TSingleModelObserverBase.h>
9#include <icomp/CComponentBase.h>
10
11// ImtCore includes
12#include <imtbase/ITimeRangeProvider.h>
13#include <imtbase/CStaticObjectCollection.h>
14
15
16namespace imtloggui
17{
18
19
20class CGroupComp:
21 public icomp::CComponentBase,
23 protected imod::TSingleModelObserverBase<imtbase::ITimeRangeProvider>,
24 virtual public iprm::IOptionsList,
25 virtual public iprm::ISelectionParam
26{
27public:
28 typedef icomp::CComponentBase BaseClass;
29 typedef imtbase::CStaticObjectCollection BaseClass2;
30
31 I_BEGIN_COMPONENT(CGroupComp)
32 I_REGISTER_INTERFACE(imtbase::IObjectCollection);
33 I_REGISTER_INTERFACE(iprm::IOptionsList);
34 I_REGISTER_INTERFACE(iprm::ISelectionParam);
35 I_ASSIGN_MULTI_0(m_idAttrPtr, "LayerIds", "Layer ids", false);
36 I_ASSIGN_MULTI_0(m_nameAttrPtr, "LayerNames", "Layer names", false);
37 I_ASSIGN_MULTI_0(m_minTimespanAttrPtr, "LayerMinTimespan", "Minimum timespan for layer", false);
38 I_ASSIGN_MULTI_0(m_layerCompPtr, "Layers", "Layers", false);
39 I_ASSIGN(m_timeRangeProviderCompPtr, "TimeRangeProvider", "TimeRangeProvider", true, "TimeRangeProvider");
40 I_ASSIGN_TO(m_timeRangeProviderModelCompPtr, m_timeRangeProviderCompPtr, true);
41 I_END_COMPONENT
42
43 // reimplemented (iprm::ISelectionParam)
44 virtual const IOptionsList* GetSelectionConstraints() const override;
45 virtual int GetSelectedOptionIndex() const override;
46 virtual bool SetSelectedOptionIndex(int index) override;
47 virtual ISelectionParam* GetSubselection(int index) const override;
48
49 // reimplemented (iprm::IOptionsList)
50 virtual int GetOptionsFlags() const override;
51 virtual int GetOptionsCount() const override;
52 virtual QString GetOptionName(int index) const override;
53 virtual QString GetOptionDescription(int index) const override;
54 virtual QByteArray GetOptionId(int index) const override;
55 virtual bool IsOptionEnabled(int index) const override;
56
57protected:
58 // reimplemented (imod::CSingleModelObserverBase)
59 virtual void OnUpdate(const istd::IChangeable::ChangeSet& changeSet) override;
60
61 // reimplemented (icomp::CComponentBase)
62 virtual void OnComponentCreated() override;
63 virtual void OnComponentDestroyed() override;
64
65private:
66 void SetActiveLayer(const QByteArray& layerId);
67
68private:
69 I_MULTIATTR(QByteArray, m_idAttrPtr);
70 I_MULTIATTR(QString, m_nameAttrPtr);
71 I_MULTIATTR(double, m_minTimespanAttrPtr);
72 I_MULTIREF(imtbase::IObjectCollection, m_layerCompPtr);
73 I_REF(imtbase::ITimeRangeProvider, m_timeRangeProviderCompPtr);
74 I_REF(imod::IModel, m_timeRangeProviderModelCompPtr);
75
76 QMap<uint64_t, QByteArray> m_arrangedIds;
77
78 QByteArray m_activeLayerId;
79};
80
81
82} // namespace imtloggui
83
84