ACF $AcfVersion:0$
CDistanceToolShape.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// ACF includes
6#include <iview/CShapeBase.h>
8
9
10namespace iview
11{
12
13
15 public CShapeBase,
16 virtual public iview::IInteractiveShape
17{
18public:
20
22
23 // reimplemented (iview::IMouseActionObserver)
24 virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag) override;
25 virtual bool OnMouseMove(istd::CIndex2d position) override;
26
27 // reimplemented (iview::IInteractiveShape)
28 virtual bool IsSelected() const override;
29 virtual void SetSelected(bool selectFlag = true) override;
30
31 // reimplemented (imod::IObserver)
32 virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask) override;
33
34 // reimplemented (iview::ITouchable)
35 virtual TouchState IsTouched(istd::CIndex2d position) const override;
36
37protected:
39
40 virtual void DrawLabel(QPainter& drawContext) const;
41
42 // reimplemented (iview::IVisualizable)
43 virtual void Draw(QPainter& drawContext) const override;
44
45 // reimplemented (iview::CShapeBase)
46 virtual i2d::CRect CalcBoundingBox() const override;
47
48private:
49 enum MeasureState
50 {
51 MS_NONE = 0,
52 MS_START,
53 MS_DONE
54 };
55
56 bool IsDistanceMeasureToolActive() const;
57 void BeginDrag();
58 void EndDrag();
59
60private:
61 istd::CIndex2d m_screenPos;
62 MeasureState m_measureState;
63 int m_dragNodeIndex;
64 bool m_isSelected;
65};
66
67
68} // namespace iview
69
Simple rectangle with integer bounds.
Definition CRect.h:22
Interface for 2D calibration and coordinate transformation with unit information.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:21
Set of change flags (its IDs).
Definition IChangeable.h:36
virtual void Draw(QPainter &drawContext) const override
Draw this shape using draw context.
virtual void DrawLabel(QPainter &drawContext) const
const i2d::ICalibration2d * GetCalibration() const
virtual bool OnMouseMove(istd::CIndex2d position) override
It is called, when mouse is moved.
virtual void SetSelected(bool selectFlag=true) override
Inform that this object was selected or deselected.
virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag) override
It is called, when mouse button is pushed down or up on this object.
virtual bool OnModelAttached(imod::IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask) override
Callback invoked when an observable model is about to be attached to this observer.
virtual bool IsSelected() const override
Check, if this shape is selected.
virtual TouchState IsTouched(istd::CIndex2d position) const override
Check, if any shape is touched.
virtual i2d::CRect CalcBoundingBox() const override
Calculate bounding box.
Common interface for all display console shapes which can interacts with user.
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:25
In this library is defined 2D view concept and standard visualisation objects.