ACF $AcfVersion:0$
CViewLayer.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QVector>
7
8// ACF includes
9#include <iview/IViewLayer.h>
10#include <iview/IShape.h>
11
12
13namespace iview
14{
15
16
21class CViewLayer: virtual public IViewLayer
22{
23public:
25 virtual ~CViewLayer();
26
27 // reimplemented (iview::IViewLayer)
28 virtual void OnConnectView(IShapeView* viewPtr) override;
29 virtual void OnDisconnectView(IShapeView* viewPtr) override;
30 virtual IShapeView* GetViewPtr() const override;
31 virtual bool IsShapeConnected(IShape* shapePtr) override;
32 virtual bool ConnectShape(IShape* shapePtr) override;
33 virtual int GetShapesCount() const override;
34 virtual Shapes GetShapes() const override;
35 virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet& changeSet) override;
36 virtual void DisconnectAllShapes() override;
37 virtual void DrawShapes(QPainter& drawContext) override;
38 virtual bool IsVisible() const override;
39 virtual void SetVisible(bool state = true) override;
40
41 // reimplemented (iview::IDisplay)
42 virtual IDisplay* GetParentDisplayPtr() const override;
43 virtual const CScreenTransform& GetTransform() const override;
44 virtual i2d::CRect GetBoundingBox() const override;
45 virtual i2d::CRect GetClientRect() const override;
46 virtual const IColorSchema& GetColorSchema() const override;
47 virtual void OnAreaInvalidated(const i2d::CRect& prevArea, const i2d::CRect& newArea) override;
48
49 // reimplemented (iview::IShapeObserver)
50 virtual void OnChangeShape(IShape* shapePtr) override;
51 virtual bool DisconnectShape(IShape* shapePtr) override;
52
53 // reimplemented (iview::ITouchable)
54 virtual TouchState IsTouched(istd::CIndex2d position) const override;
55 virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const override;
56 virtual QString GetToolTipAt(istd::CIndex2d position) const override;
57
58protected:
67 typedef QVector<ShapeWithBoundingBox> ShapeList;
68
73 bool OnChangeShapeElement(ShapeList::Iterator elementIter);
74
79 void DisconnectShapeElement(ShapeList& map, ShapeList::iterator iter);
80
83 void SetBoundingBoxValid() const;
84
92 virtual i2d::CRect CalcBoundingBox() const;
93
95
96private:
97 IShapeView* m_viewPtr;
98 bool m_isVisible;
99
100 mutable i2d::CRect m_boundingBox;
101 mutable bool m_isBoundingBoxValid;
102};
103
104
105// inline methods
106
107inline bool CViewLayer::IsVisible() const
108{
109 return m_isVisible;
110}
111
112
113} // namespace iview
114
115
116
117
Simple rectangle with integer bounds.
Definition CRect.h:22
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:21
Set of change flags (its IDs).
Definition IChangeable.h:36
Standard implementation of view layer.
Definition CViewLayer.h:22
virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet &changeSet) override
Send update to all shapes after view changes.
virtual bool DisconnectShape(IShape *shapePtr) override
Disconnect shape object from view.
QVector< ShapeWithBoundingBox > ShapeList
Definition CViewLayer.h:67
virtual void OnAreaInvalidated(const i2d::CRect &prevArea, const i2d::CRect &newArea) override
Invalidate display area.
virtual i2d::CRect RecalcAllShapes(const istd::IChangeable::ChangeSet &changeSet)
Recalculate all shapes after view changes.
virtual const CScreenTransform & GetTransform() const override
Return a screen transformation.
virtual IShapeView * GetViewPtr() const override
Get parent view of this layer.
virtual bool ConnectShape(IShape *shapePtr) override
Connect shape object to view.
virtual Shapes GetShapes() const override
Get all shapes on this layer.
virtual void SetVisible(bool state=true) override
Make this layer visible.
virtual i2d::CRect GetClientRect() const override
Get bounding box of client area.
bool OnChangeShapeElement(ShapeList::Iterator elementIter)
virtual IDisplay * GetParentDisplayPtr() const override
Get parent object of this display.
virtual void DisconnectAllShapes() override
Disconnect all shapes from this layer.
virtual ~CViewLayer()
virtual i2d::CRect GetBoundingBox() const override
Get bounding box of all object in this display.
virtual int GetShapesCount() const override
Get count of all shapes on this layer.
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const override
Get description to shape at specified position.
void SetBoundingBoxValid() const
i2d::CRect & GetBoundingBoxRef() const
virtual bool IsVisible() const override
Check, if this layer is visible.
Definition CViewLayer.h:107
ShapeList m_shapes
Definition CViewLayer.h:94
void DisconnectShapeElement(ShapeList &map, ShapeList::iterator iter)
void InvalidateBoundingBox()
virtual bool IsShapeConnected(IShape *shapePtr) override
Check, if the shape is connected to the layer.
virtual TouchState IsTouched(istd::CIndex2d position) const override
Check, if any shape is touched.
virtual void OnDisconnectView(IShapeView *viewPtr) override
Called before layer is disconnected from view.
virtual const IColorSchema & GetColorSchema() const override
Get color schema.
virtual void OnChangeShape(IShape *shapePtr) override
Invalidate a shape.
virtual void DrawShapes(QPainter &drawContext) override
Draw all shapes using specified draw context.
virtual QString GetToolTipAt(istd::CIndex2d position) const override
Get tooltip at specified position.
virtual void OnConnectView(IShapeView *viewPtr) override
Called after layer is connected to view.
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box for all shapes.
Defines set of standard pens, brushes and simple management of unions.
Common interface for all display console shapes.
Definition IShape.h:32
Common interface for a general shape view implementations.
Definition IShapeView.h:30
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:25
Interface for a logical layer in the console view.
Definition IViewLayer.h:27
QList< IShape * > Shapes
Definition IViewLayer.h:62
In this library is defined 2D view concept and standard visualisation objects.
ShapeWithBoundingBox(IShape *shapePtr, const i2d::CRect &box)
Definition CViewLayer.h:62