ICF 3.1.1.10
Technical documentation of ICF Libraries
CPolygonShape.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_CPolygonShape_included
7#define iview_CPolygonShape_included
8
9
10// Qt includes
11#include <QtCore/QVector>
12#include <QtGui/QPolygon>
13
14// ICF includes
15#include <i2d/CVector2d.h>
16
17
19
20
21namespace iview
22{
23
24
26{
27public:
30
32
37 virtual bool IsFirstVisible() const;
38 virtual void SetFirstVisible(bool state = true);
39
44 virtual bool IsAlwaysMovable() const;
45
50 virtual void SetAlwaysMovable(bool state = true);
51
52 // reimplemented (iview::ITouchable)
53 virtual TouchState IsTouched(istd::CIndex2d position) const;
54 virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const;
55
56 // reimplemented (iview::IVisualizable)
57 virtual void Draw(QPainter& drawContext) const;
58
59 // reimplemented (imod::IObserver)
60 virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask);
61
62 // reimplemented (iview::IMouseActionObserver)
63 virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag);
64 virtual bool OnMouseMove(istd::CIndex2d position);
65
66 // reimplemented (iview::IDraggable)
67 virtual bool IsDraggable() const;
68
69protected:
72
73 virtual i2d::CVector2d GetSegmentMiddle(int index) const;
74 virtual void DrawCurve(QPainter& drawContext) const;
75 virtual void DrawArea(QPainter& drawContext) const;
76 virtual void DrawSelectionElements(QPainter& drawContext) const;
77
78 // reimplemented (iview::CRectControlledShapeBase)
79 virtual void EnsureValidNodes() const;
80 virtual bool IsCurveTouched(istd::CIndex2d position) const;
81
82 // reimplemented (iview::CInteractiveShapeBase)
83 virtual void BeginLogDrag(const i2d::CVector2d& reference);
84 virtual void SetLogDragPosition(const i2d::CVector2d& position);
85
86 // reimplemented (iview::CShapeBase)
87 virtual i2d::CRect CalcBoundingBox() const;
88
89protected:
91 QVector<i2d::CVector2d> m_references;
92
95 mutable QPolygonF m_screenPoints;
96
97private:
98 bool m_isFirstVisible;
99 bool m_isAlwaysDraggable;
100};
101
102
104{
105 return m_isFirstVisible;
106}
107
108
109inline void CPolygonShape::SetFirstVisible(bool state)
110{
111 m_isFirstVisible = state;
112}
113
114
116{
117 return m_isAlwaysDraggable;
118}
119
120
121inline void CPolygonShape::SetAlwaysMovable(bool state)
122{
123 m_isAlwaysDraggable = state;
124}
125
126
127} // namespace iview
128
129
130#endif // !iview_CPolygonShape_included
131
132
This class defines an affine 2D-transformation.
Definition CAffine2d.h:22
Simple rectangle with integer bounds.
Definition CRect.h:26
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
Set of change flags (its IDs).
Definition IChangeable.h:38
Base class of shape implementation with user interaction.
i2d::CAffine2d m_castTransform
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box.
virtual void EnsureValidNodes() const
virtual bool OnMouseMove(istd::CIndex2d position)
It is called, when mouse is moved.
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const
Get description to shape at specified position.
virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag)
It is called, when mouse button is pushed down or up on this object.
virtual bool OnModelAttached(imod::IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask)
This call back function will be called, if an observable object is about to be attached.
virtual bool IsFirstVisible() const
Check if first point is always visible as ticker.
virtual void SetLogDragPosition(const i2d::CVector2d &position)
static const istd::IChangeable::ChangeSet & GetMoveAllChangeSet()
virtual i2d::CVector2d GetSegmentMiddle(int index) const
CInteractiveShapeBase ShapeBaseClass
virtual void DrawArea(QPainter &drawContext) const
virtual void SetAlwaysMovable(bool state=true)
Set flag if in all edit modes is this shape draggable.
virtual bool IsCurveTouched(istd::CIndex2d position) const
virtual void SetFirstVisible(bool state=true)
virtual bool IsAlwaysMovable() const
Check if in all edit modes is this shape draggable.
virtual void DrawCurve(QPainter &drawContext) const
i2d::CVector2d m_castAxis
virtual void DrawSelectionElements(QPainter &drawContext) const
virtual void BeginLogDrag(const i2d::CVector2d &reference)
CRectControlledShapeBase BaseClass
static const istd::IChangeable::ChangeSet & GetMoveChangeSet()
virtual bool IsDraggable() const
Check if drag is enabled.
virtual void Draw(QPainter &drawContext) const
Draw this shape using draw context.
QVector< i2d::CVector2d > m_references
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:30
In this library is defined 2D view concept and standard visualisation objects.

© Witold Gantzke and Kirill Lepskiy