ICF 3.1.1.10
Technical documentation of ICF Libraries
CParallelogramShape.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_CParallelogramShape_included
7#define iview_CParallelogramShape_included
8
9
10// ICF includes
11#include <i2d/CParallelogram.h>
12#include <i2d/CVector2d.h>
14
15
16namespace iview
17{
18
19
21{
22public:
24
26
30 virtual bool IsEditableRotation();
31 virtual void SetEditableRotation(bool state = true);
32
36 virtual bool IsEditableWidth();
37 virtual void SetEditableWidth(bool state = true);
38
42 virtual bool IsEditableHeight();
43 virtual void SetEditableHeight(bool state = true);
44
48 virtual bool IsEditableAngle();
49 virtual void SetEditableAngle(bool state = true);
50
54 virtual bool IsProportionalScaled() const;
55 virtual void SetProportionalScaled(bool state = true);
56
60 virtual bool AreAxesEqual() const;
61 virtual void SetAxesEqual(bool state = true);
62
66 virtual bool AreAxesOrthogonal() const;
67 virtual void SetAxesOrthogonal(bool state = true);
68
69 // reimplemented (iview::CInteractiveShapeBase)
70 virtual void InvalidateBoundingBox();
71
72 // reimplemented (iview::IInteractiveShape)
73 virtual TouchState IsTouched(istd::CIndex2d position) const;
74
75 // reimplemented (iview::IShape)
76 virtual void Draw(QPainter& drawContext) const;
77
78 // reimplemented (imod::IObserver)
79 virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask);
80
81 // reimplemented (iview::IMouseActionObserver)
82 virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag);
83 virtual bool OnMouseMove(istd::CIndex2d position);
84
85protected:
95
98
99 void CalcNodes(const i2d::CAffine2d& parallTransform) const;
100 void ResetNodes() const;
101 bool AreNodesValid() const;
102 const i2d::CVector2d* GetNodes() const;
103
104 virtual void EnsureValidNodes() const;
105
106 virtual bool IsTickerTouched(istd::CIndex2d position) const;
107 virtual bool IsCurveTouched(istd::CIndex2d position) const;
108 virtual void DrawTickers(QPainter& drawContext) const;
109 virtual void DrawFigure(QPainter& drawContext) const;
110
111 // reimplemented (iview::CShapeBase)
113
114 // reimplemented (iview::CInteractiveShapeBase)
115 virtual void BeginLogDrag(const i2d::CVector2d& reference);
116 virtual void SetLogDragPosition(const i2d::CVector2d& position);
117
118private:
119 bool m_isEditableRotation;
120 bool m_isEditableWidth;
121 bool m_isEditableHeight;
122 bool m_isEditableAngle;
123 bool m_isProportionalScaled;
124 bool m_areAxesEqual;
125 bool m_areAxesOrthogonal;
126
127 mutable i2d::CVector2d m_nodes[EN_LAST + 1];
128 mutable bool m_areNodesValid;
129};
130
131
132// inline methods
133
135{
136 return m_isEditableRotation;
137}
138
139
141{
142 m_isEditableRotation = state;
143}
144
145
147{
148 return m_isEditableWidth;
149}
150
151
153{
154 m_isEditableWidth = state;
155}
156
157
159{
160 return m_isEditableHeight;
161}
162
163
165{
166 m_isEditableHeight = state;
167}
168
169
171{
172 return m_isEditableAngle;
173}
174
175
177{
178 m_isEditableAngle = state;
179}
180
181
183{
184 return m_isProportionalScaled;
185}
186
187
189{
190 m_isProportionalScaled = state;
191}
192
193
195{
196 return m_areAxesEqual;
197}
198
199
201{
202 m_areAxesEqual = state;
203}
204
205
207{
208 return m_areAxesOrthogonal;
209}
210
211
213{
214 m_areAxesOrthogonal = state;
215}
216
217
218// protected methods
219
221{
222 return m_areNodesValid;
223}
224
225
227{
228 return m_nodes;
229}
230
231
232} // namespace iview
233
234
235#endif // !iview_CParallelogramShape_included
236
237
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.
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual bool IsProportionalScaled() const
Check, if both axis will be scaled proportional.
virtual bool IsTickerTouched(istd::CIndex2d position) const
virtual bool AreAxesEqual() const
Check, if it is forced to keep length of both axes equal.
virtual bool OnMouseMove(istd::CIndex2d position)
It is called, when mouse is moved.
virtual void SetEditableWidth(bool state=true)
virtual bool IsEditableRotation()
Check, if rotation is editable.
virtual bool AreAxesOrthogonal() const
Check, if it is forced to keep both axes orthogonal.
CInteractiveShapeBase BaseClass
const i2d::CVector2d * GetNodes() const
virtual void SetProportionalScaled(bool state=true)
virtual void BeginLogDrag(const i2d::CVector2d &reference)
virtual void SetEditableAngle(bool state=true)
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 IsCurveTouched(istd::CIndex2d position) const
virtual void SetAxesOrthogonal(bool state=true)
void CalcNodes(const i2d::CAffine2d &parallTransform) const
virtual void EnsureValidNodes() const
virtual void SetAxesEqual(bool state=true)
virtual void Draw(QPainter &drawContext) const
Draw this shape using draw context.
virtual void SetEditableHeight(bool state=true)
virtual void InvalidateBoundingBox()
Invalidate bounding box.
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box.
virtual bool IsEditableWidth()
Check, if width is editable.
virtual void DrawTickers(QPainter &drawContext) const
virtual bool IsEditableAngle()
Check, if internal angle is editable.
virtual bool IsEditableHeight()
Check, if size is editable.
virtual void SetLogDragPosition(const i2d::CVector2d &position)
virtual void SetEditableRotation(bool state=true)
virtual void DrawFigure(QPainter &drawContext) const
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.
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