CMessageBasedViewExtenderComp.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 // ACF includes
5 #include <istd/TPointerVector.h>
6 #include <icomp/CComponentBase.h>
7 #include <iprm/ISelectionParam.h>
9 #include <iview/IShapeView.h>
10 #include <iview/IShapeFactory.h>
11 #include <iqt2d/IViewExtender.h>
12 #include <iqt2d/IViewProvider.h>
13 #include <iinsp/ISupplier.h>
15 
16 
17 namespace iqtinsp
18 {
19 
20 
27  public iqtinsp::TResultShapeCreatorWrap<icomp::CComponentBase>,
28  virtual public iqt2d::IViewExtender
29 {
30 public:
32 
33  I_BEGIN_COMPONENT(CMessageBasedViewExtenderComp);
34  I_REGISTER_INTERFACE(iqt2d::IViewExtender);
35  I_ASSIGN(m_resultShapeFactoryCompPtr, "ResultShapeFactory", "Creates shapes to display", true, "ResultShapeFactory");
36  I_ASSIGN(m_messageContainerCompPtr, "MessageContainer", "Shape messages provider", true, "MessageContainer");
37  I_ASSIGN(m_slaveViewExtenderCompPtr, "SlaveViewExtender", "Slave view extender", false, "ViewExtender");
38  I_ASSIGN(m_shapeSelectorCompPtr, "ShapeSelector", "Optional selector of the shapes. Only shapes with source-ID corresponding to the given selection will be processed", false, "ShapeSelector");
39  I_END_COMPONENT;
40 
41  // reimplemented (iqt2d::IViewExtender)
42  virtual void AddItemsToScene(iqt2d::IViewProvider* providerPtr, int flags);
43  virtual void RemoveItemsFromScene(iqt2d::IViewProvider* providerPtr);
44 
45  // reimplemented (icomp::CComponentBase)
46  virtual void OnComponentCreated();
47  virtual void OnComponentDestroyed();
48 
49 protected:
50  virtual bool IsMessageAccepted(const istd::IInformationProvider& message) const;
51 
52 private:
53  I_REF(iview::IShapeFactory, m_resultShapeFactoryCompPtr);
54  I_REF(ilog::IMessageContainer, m_messageContainerCompPtr);
55  I_REF(iqt2d::IViewExtender, m_slaveViewExtenderCompPtr);
56  I_REF(iprm::ISelectionParam, m_shapeSelectorCompPtr);
57 
59  typedef QList<ShapePtr> ShapeList;
60  typedef QMap<iqt2d::IViewProvider*, ShapeList> ShapesMap;
61  typedef QMap<iqt2d::IViewProvider*, ilog::IMessageContainer::Messages> MessagesMap;
62 
63  ShapesMap m_shapes;
64  MessagesMap m_shapeMessages;
65 };
66 
67 
68 } // namespace iqtinsp
69 
70 
Basic view extender showing geometric messages as inactive shapes.
virtual void AddItemsToScene(iqt2d::IViewProvider *providerPtr, int flags)
virtual void RemoveItemsFromScene(iqt2d::IViewProvider *providerPtr)
virtual bool IsMessageAccepted(const istd::IInformationProvider &message) const
iqtinsp::TResultShapeCreatorWrap< icomp::CComponentBase > BaseClass

© 2007-2017 Witold Gantzke and Kirill Lepskiy