QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_picker_machine.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner -> QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PICKER_MACHINE
28#define QWT_PICKER_MACHINE
29
30#include "qwt_global.h"
31
32class QwtEventPattern;
33class QEvent;
34template< typename T >
35class QList;
36
44class QWT_EXPORT QwtPickerMachine
45{
46public:
52 {
54 NoSelection = -1,
55
58
61
63 PolygonSelection
64 };
65
68 {
69 Begin,
70 Append,
71 Move,
72 Remove,
73 End
74 };
75
76 // Constructor with selection type
77 explicit QwtPickerMachine(SelectionType);
78 // Destructor
79 virtual ~QwtPickerMachine();
80
81 // Transition function that processes events and returns commands
82 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) = 0;
83 // Reset the state machine to initial state
84 void reset();
85
86 // Return the current state
87 int state() const;
88 // Set the current state
89 void setState(int);
90
91 // Return the selection type
92 SelectionType selectionType() const;
93
94private:
95 const SelectionType m_selectionType;
96 int m_state { 0 };
97};
98
106{
107public:
108 // Constructor
110
111 // Transition function for tracking mouse movements
112 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
113};
114
122{
123public:
124 // Constructor
126
127 // Transition function for click point selection
128 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
129};
130
138{
139public:
140 // Constructor
142
143 // Transition function for drag point selection
144 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
145};
146
159{
160public:
161 // Constructor
163
164 // Transition function for click rectangle selection
165 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
166};
167
178{
179public:
180 // Constructor
182
183 // Transition function for drag rectangle selection
184 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
185};
186
199{
200public:
201 // Constructor
203
204 // Transition function for drag line selection
205 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
206};
207
218{
219public:
220 // Constructor
222
223 // Transition function for polygon selection
224 virtual QList< Command > transition(const QwtEventPattern&, const QEvent*) override;
225};
226
227#endif
Definition qwt_raster_data.h:38
A collection of event patterns
Definition qwt_event_pattern.h:46
A state machine for point selections
Definition qwt_picker_machine.h:122
A state machine for rectangle selections
Definition qwt_picker_machine.h:159
A state machine for line selections
Definition qwt_picker_machine.h:199
A state machine for point selections
Definition qwt_picker_machine.h:138
A state machine for rectangle selections
Definition qwt_picker_machine.h:178
A state machine for QwtPicker selections
Definition qwt_picker_machine.h:45
SelectionType
Type of a selection.
Definition qwt_picker_machine.h:52
@ RectSelection
The state machine is for selecting a rectangle (2 points).
Definition qwt_picker_machine.h:60
@ PointSelection
The state machine is for selecting a single point.
Definition qwt_picker_machine.h:57
Command
Commands - the output of a state machine
Definition qwt_picker_machine.h:68
A state machine for polygon selections
Definition qwt_picker_machine.h:218
A state machine for indicating mouse movements
Definition qwt_picker_machine.h:106