ICF 3.1.1.10
Technical documentation of ICF Libraries
CMultiBitmapViewComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QtGlobal>
11#include <QtWidgets/QGroupBox>
12#include <QtWidgets/QBoxLayout>
13#include <QtWidgets/QLabel>
14
15// ICF includes
16#include <istd/TPointerVector.h>
26#include <iview/CConsoleGui.h>
28#include <iimg/CBitmap.h>
29
30
31namespace i2dgui
32{
33
34
36 public istdgui::TGuiObserverWrap<istdgui::TGuiComponentBase<QWidget>, imod::TSingleModelObserverBase<iimg::IMultiBitmapProvider>>,
38{
39public:
42
43 I_BEGIN_COMPONENT(CMultiBitmapViewComp);
44 I_REGISTER_SUBELEMENT(ActiveViewIndex);
45 I_REGISTER_SUBELEMENT_INTERFACE(ActiveViewIndex, iprm::ISelectionParam, ExtractActiveViewIndex);
46 I_ASSIGN(m_horizontalViewsAttrPtr, "HorizontalViewsCount", "Number of horizontal views", false, 1);
47 I_ASSIGN(m_verticalViewsAttrPtr, "VerticalViewsCount", "Number of vertical views", false, 1);
48 I_ASSIGN(m_verticalViewLayoutAttrPtr, "UseVerticalLayout", "Layout of the single view", true, true);
49 I_ASSIGN(m_viewExtenderCompPtr, "ViewExtender", "View extender", false, "ViewExtender");
50 I_ASSIGN(m_generalInformationProviderCompPtr, "GeneralInformationProvider", "General information provider", false, "GeneralInformationProvider");
51 I_ASSIGN_TO(m_generalInformationModelCompPtr, m_generalInformationProviderCompPtr, true);
52 I_ASSIGN(m_viewBackgroundColorAttrPtr, "BackgroundColor", "Background color of the console", false, "black");
53 I_END_COMPONENT;
54
55protected:
56 static const int GeneralStatusModelId = -1;
57
59
60 class CSingleView: public QGroupBox, public i2dgui::IViewProvider
61 {
62 public:
63 typedef QGroupBox BaseClass;
64
65 CSingleView(QWidget* parentPtr, int id, const QString& title, const QByteArray& bitmapId);
66
67 void UpdateImage(const iimg::IBitmap* bitmapPtr);
68
69 void SetBackgroundColor(const QColor& color);
70
71 // called once at initialization stage, at this moment the model should be connected already.
72 virtual void Init(bool hasStatusLabel, bool hasStatusBackground, bool useVerticalLayout);
73 virtual void SetInspectionResult(int result);
74
75 // reimplemented (i2dgui::IViewProvider)
76 virtual int GetViewId() const;
77 virtual iview::IShapeView* GetView() const;
78
79 protected:
80 // called from Init() to add status labels etc. to the main widget layout (layoutPtr).
81 virtual void AddStatusItems(QBoxLayout* layoutPtr);
82
85
87 int m_id;
90
91 QByteArray m_bitmapId;
92 };
93
95
96 virtual std::unique_ptr<CMultiBitmapViewComp::CSingleView> CreateView(QWidget* parentPtr, int id, const QString& title, const QByteArray& bitmapId);
97 virtual void EnsureViewsCreated();
98 virtual QString GetTitleByIndex(int index) const;
99 virtual void UpdateStatusIcon();
100 virtual void UpdateInspectionCategory(int index);
101 virtual void ResetAllViews();
102 virtual void ConnectModels();
103 virtual void OnViewCreated(int index, CSingleView* viewPtr);
104
105 // reimplemented (imod::CMultiModelDispatcherBase)
106 void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
107
108 // reimplemented (istdgui::TGuiObserverWrap)
109 void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
110 void OnGuiModelAttached() override;
111
112 // reimplemented (istdgui::CGuiComponentBase)
113 void OnGuiCreated() override;
114
115 // reimplemented (icomp::CComponentBase)
116 void OnComponentDestroyed() override;
117
118 I_ATTR(int, m_horizontalViewsAttrPtr);
119 I_ATTR(int, m_verticalViewsAttrPtr);
120 I_ATTR(bool, m_verticalViewLayoutAttrPtr);
121 I_REF(istd::IInformationProvider, m_generalInformationProviderCompPtr);
122 I_REF(imod::IModel, m_generalInformationModelCompPtr);
123 I_REF(i2dgui::IViewExtender, m_viewExtenderCompPtr);
124 I_ATTR(QByteArray, m_viewBackgroundColorAttrPtr);
125
129
131
132private:
133 // static template methods for subelement access
134 template <class InterfaceType>
135 static InterfaceType* ExtractActiveViewIndex(CMultiBitmapViewComp& component)
136 {
137 return &component.m_activeViewIndex;
138 }
139};
140
141
142} // namespace i2dgui
143
144
CSingleView(QWidget *parentPtr, int id, const QString &title, const QByteArray &bitmapId)
virtual void Init(bool hasStatusLabel, bool hasStatusBackground, bool useVerticalLayout)
virtual int GetViewId() const
Get ID indentifing this view.
virtual iview::IShapeView * GetView() const
Called when items should be removed from specified view.
void SetBackgroundColor(const QColor &color)
imod::TModelWrap< iimg::CBitmap > m_backgroundModel
virtual void SetInspectionResult(int result)
virtual void AddStatusItems(QBoxLayout *layoutPtr)
void UpdateImage(const iimg::IBitmap *bitmapPtr)
void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
Do update of the GUI to reflect the state of model.
istdgui::TGuiObserverWrap< istdgui::TGuiComponentBase< QWidget >, imod::TSingleModelObserverBase< iimg::IMultiBitmapProvider > > BaseClass
virtual std::unique_ptr< CMultiBitmapViewComp::CSingleView > CreateView(QWidget *parentPtr, int id, const QString &title, const QByteArray &bitmapId)
void OnGuiCreated() override
Called just after GUI is initialized.
virtual void UpdateStatusIcon()
void OnComponentDestroyed() override
static QIcon GetCategoryIcon(istd::IInformationProvider::InformationCategory category)
virtual void UpdateInspectionCategory(int index)
void OnGuiModelAttached() override
Called when model is attached and GUI is created.
virtual QString GetTitleByIndex(int index) const
imod::CMultiModelDispatcherBase BaseClass2
istd::TPointerVector< CSingleView > m_views
iprm::CSelectionParam m_activeViewIndex
virtual void EnsureViewsCreated()
void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet) override
Called when some model observed by dispatcher will be changed.
virtual void OnViewCreated(int index, CSingleView *viewPtr)
Interface for GUI objects presenting its results using extern view objects.
Interface for GUI objects managing view.
Definition of single plane bitmap.
Definition IBitmap.h:24
Generic implementation of a data model changes notifier.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:28
Basic implementation for a single model observer with binding to concrete data object interface.
Basic implementation of selection parameter.
Interface allowing to select single option from list of options.
Set of change flags (its IDs).
Definition IChangeable.h:38
Common interface for class providing some basic information object.
InformationCategory
Category of information.
Implementation of a pointer container, which controls the live cycle of the pointer object.
Join functionality of istdgui::IGuiObject interface and imod::IObserver.
Implementation of 2D display console with overlays and scale control functionality.
Definition CConsoleGui.h:38
Common interface for a general shape view implementations.
Definition IShapeView.h:32
This package contains Qt based implementations for 2D graphic objects.

© Witold Gantzke and Kirill Lepskiy