ICF 3.1.1.10
Technical documentation of ICF Libraries
CViewLayer.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#ifndef iview_CLayerBase_included
7#define iview_CLayerBase_included
8
9
10// Qt includes
11#include <QtCore/QVector>
12
13// ICF includes
14#include <iview/IViewLayer.h>
15#include <iview/IShape.h>
16
17
18namespace iview
19{
20
21
26class CViewLayer: virtual public IViewLayer
27{
28public:
30 virtual ~CViewLayer();
31
32 // reimplemented (iview::IViewLayer)
33 virtual void OnConnectView(IShapeView* viewPtr);
34 virtual void OnDisconnectView(IShapeView* viewPtr);
35 virtual IShapeView* GetViewPtr() const;
36 virtual bool IsShapeConnected(IShape* shapePtr);
37 virtual bool ConnectShape(IShape* shapePtr);
38 virtual int GetShapesCount() const;
39 virtual Shapes GetShapes() const;
40 virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet& changeSet);
41 virtual void DisconnectAllShapes();
42 virtual void DrawShapes(QPainter& drawContext);
43 virtual bool IsVisible() const;
44 virtual void SetVisible(bool state = true);
45
46 // reimplemented (iview::IDisplay)
47 virtual IDisplay* GetParentDisplayPtr() const;
48 virtual const CScreenTransform& GetTransform() const;
49 virtual i2d::CRect GetBoundingBox() const;
50 virtual i2d::CRect GetClientRect() const;
51 virtual const IColorSchema& GetColorSchema() const;
52 virtual void OnAreaInvalidated(const i2d::CRect& prevArea, const i2d::CRect& newArea);
53
54 // reimplemented (iview::IShapeObserver)
55 virtual void OnChangeShape(IShape* shapePtr);
56 virtual bool DisconnectShape(IShape* shapePtr);
57
58 // reimplemented (iview::ITouchable)
59 virtual TouchState IsTouched(istd::CIndex2d position) const;
60 virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const;
61
62protected:
68 typedef QVector<ShapeWithBoundingBox> ShapeList;
69
74 bool OnChangeShapeElement(ShapeList::iterator elementIter);
75
80 void DisconnectShapeElement(ShapeList& map, ShapeList::iterator iter);
81
84 void SetBoundingBoxValid() const;
85
93 virtual i2d::CRect CalcBoundingBox() const;
94
96
97private:
98 IShapeView* m_viewPtr;
99 bool m_isVisible;
100
101 mutable i2d::CRect m_boundingBox;
102 mutable bool m_isBoundingBoxValid;
103};
104
105
106// inline methods
107
108inline bool CViewLayer::IsVisible() const
109{
110 return m_isVisible;
111}
112
113
114} // namespace iview
115
116
117#endif // !iview_CLayerBase_included
118
119
Simple rectangle with integer bounds.
Definition CRect.h:26
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
Set of change flags (its IDs).
Definition IChangeable.h:38
Standard implementation of view layer.
Definition CViewLayer.h:27
virtual i2d::CRect RecalcAllShapes(const istd::IChangeable::ChangeSet &changeSet)
Recalculate all shapes after view changes.
virtual bool IsVisible() const
Check, if this layer is visible.
Definition CViewLayer.h:108
virtual void OnConnectView(IShapeView *viewPtr)
Called after layer is connected to view.
virtual void OnAreaInvalidated(const i2d::CRect &prevArea, const i2d::CRect &newArea)
Invalidate display area.
virtual bool ConnectShape(IShape *shapePtr)
Connect shape object to view.
virtual void OnDisconnectView(IShapeView *viewPtr)
Called before layer is disconnected from view.
virtual ~CViewLayer()
virtual void OnChangeShape(IShape *shapePtr)
Invalidate a shape.
virtual i2d::CRect GetClientRect() const
Get bounding box of client area.
virtual i2d::CRect GetBoundingBox() const
Get bounding box of all object in this display.
virtual bool IsShapeConnected(IShape *shapePtr)
Check, if the shape is connected to the layer.
virtual int GetShapesCount() const
Get count of all shapes on this layer.
void SetBoundingBoxValid() const
virtual IDisplay * GetParentDisplayPtr() const
Get parent object of this display.
i2d::CRect & GetBoundingBoxRef() const
ShapeList m_shapes
Definition CViewLayer.h:95
void DisconnectShapeElement(ShapeList &map, ShapeList::iterator iter)
void InvalidateBoundingBox()
virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet &changeSet)
Send update to all shapes after view changes.
virtual Shapes GetShapes() const
Get all shapes on this layer.
virtual void SetVisible(bool state=true)
Make this layer visible.
virtual void DrawShapes(QPainter &drawContext)
Draw all shapes using specified draw context.
bool OnChangeShapeElement(ShapeList::iterator elementIter)
virtual const IColorSchema & GetColorSchema() const
Get color schema.
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual void DisconnectAllShapes()
Disconnect all shapes from this layer.
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const
Get description to shape at specified position.
virtual IShapeView * GetViewPtr() const
Get parent view of this layer.
virtual const CScreenTransform & GetTransform() const
Return a screen transformation.
virtual bool DisconnectShape(IShape *shapePtr)
Disconnect shape object from view.
QVector< ShapeWithBoundingBox > ShapeList
Definition CViewLayer.h:68
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:37
Common interface for a general shape view implementations.
Definition IShapeView.h:32
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:30
Interface for a logical layer in the console view.
Definition IViewLayer.h:32
QList< IShape * > Shapes
Definition IViewLayer.h:67
In this library is defined 2D view concept and standard visualisation objects.

© Witold Gantzke and Kirill Lepskiy