QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_arrowmarker.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_PLOT_ARROWMARKER_H
28#define QWT_PLOT_ARROWMARKER_H
29
30#include "qwt_global.h"
31#include "qwt_plot_item.h"
32
33class QString;
34class QRectF;
35class QwtText;
36class QPainterPath;
37class QPen;
38class QBrush;
39
73class QWT_EXPORT QwtPlotArrowMarker : public QwtPlotItem
74{
75public:
88 {
98 NoEndpoint = 0,
99
110
121
132
143
154
164 CustomPath
165 };
166
179 {
195
209 StartLengthAngle
210 };
211
212 // Constructor
213 explicit QwtPlotArrowMarker();
214
215 // Constructor with title
216 explicit QwtPlotArrowMarker(const QString& title);
217
218 // Constructor with QwtText title
219 explicit QwtPlotArrowMarker(const QwtText& title);
220
221 // Destructor
222 virtual ~QwtPlotArrowMarker();
223
224 // Get the runtime type information
225 virtual int rtti() const override;
226
227 // Position and geometry methods
228
229 // Get the start point
230 QPointF startPoint() const;
231
232 // Get the end point
233 QPointF endPoint() const;
234
235 // Set the start point
236 void setStartPoint(const QPointF& point);
237
238 // Set the end point
239 void setEndPoint(const QPointF& point);
240
241 // Set both start and end points
242 void setPoints(const QPointF& start, const QPointF& end);
243
244 // Get the arrow length in pixels
245 double length() const;
246
247 // Set the arrow length in pixels
248 void setLength(double length);
249
250 // Get the rotation angle in degrees
251 double angle() const;
252
253 // Set the rotation angle in degrees
254 void setAngle(double angle);
255
256 // Get the positioning mode
257 PositionMode positionMode() const;
258
259 // Set the positioning mode
260 void setPositionMode(PositionMode mode);
261
262 // Style and appearance methods
263
264 // Get the arrow line pen
265 const QPen& linePen() const;
266
267 // Set the arrow line pen
268 void setLinePen(const QPen& pen);
269
270 // Convenience method to set line color and width
271 void setLinePen(const QColor& color, qreal width = 1.0, Qt::PenStyle style = Qt::SolidLine);
272
273 // Get the head style
274 EndpointStyle headStyle() const;
275
276 // Set the head style
277 void setHeadStyle(EndpointStyle style);
278
279 // Get the tail style
280 EndpointStyle tailStyle() const;
281
282 // Set the tail style
283 void setTailStyle(EndpointStyle style);
284
285 // Get the head size in pixels
286 QSizeF headSize() const;
287
288 // Set the head size in pixels
289 void setHeadSize(const QSizeF& size);
290
291 // Convenience method to set head size with equal width and height
292 void setHeadSize(qreal size);
293
294 // Get the tail size in pixels
295 QSizeF tailSize() const;
296
297 // Set the tail size in pixels
298 void setTailSize(const QSizeF& size);
299
300 // Convenience method to set tail size with equal width and height
301 void setTailSize(qreal size);
302
303 // Get the head brush
304 const QBrush& headBrush() const;
305
306 // Set the head brush
307 void setHeadBrush(const QBrush& brush);
308
309 // Get the tail brush
310 const QBrush& tailBrush() const;
311
312 // Set the tail brush
313 void setTailBrush(const QBrush& brush);
314
315 // Get the head pen
316 const QPen& headPen() const;
317
318 // Set the head pen
319 void setHeadPen(const QPen& pen);
320
321 // Get the tail pen
322 const QPen& tailPen() const;
323
324 // Set the tail pen
325 void setTailPen(const QPen& pen);
326
327 // Set a custom path for head endpoint
328 void setHeadCustomPath(const QPainterPath& path);
329
330 // Get the custom head path
331 QPainterPath headCustomPath() const;
332
333 // Set a custom path for tail endpoint
334 void setTailCustomPath(const QPainterPath& path);
335
336 // Get the custom tail path
337 QPainterPath tailCustomPath() const;
338
339 // Drawing methods
340
341 // Draw the arrow marker
342 virtual void
343 draw(QPainter* painter, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const override;
344
345 // Get the bounding rectangle
346 virtual QRectF boundingRect() const override;
347
348 // Get the legend icon
349 virtual QwtGraphic legendIcon(int index, const QSizeF& size) const override;
350
351protected:
353 virtual void drawArrowLine(QPainter* painter, const QPointF& canvasStart, const QPointF& canvasEnd) const;
355 virtual void drawCachedEndpoint(QPainter* painter,
356 const QPointF& position,
357 const QPainterPath& cachedPath,
358 const QSizeF& size,
359 const QPen& pen,
360 const QBrush& brush,
361 double rotation = 0.0) const;
362
364 virtual QPointF toCanvasPoint(const QPointF& plotPoint, const QwtScaleMap& xMap, const QwtScaleMap& yMap) const;
365
367 virtual QPointF calculateEndPoint() const;
368
369private:
370 // Disable copy constructor and assignment operator
372 QwtPlotArrowMarker& operator=(const QwtPlotArrowMarker&);
373
374 class PrivateData;
375 PrivateData* m_data;
376};
377
378#endif // QWT_PLOT_ARROWMARKER_H
可缩放图形的绘制设备
Definition qwt_graphic.h:128
用于在绘图上绘制箭头标记的类
Definition qwt_plot_arrowmarker.h:74
EndpointStyle
箭头端点样式类型
Definition qwt_plot_arrowmarker.h:88
@ Diamond
菱形端点
Definition qwt_plot_arrowmarker.h:142
@ Square
方形端点
Definition qwt_plot_arrowmarker.h:131
@ ArrowHead
箭头头部样式
Definition qwt_plot_arrowmarker.h:109
@ Triangle
三角形端点
Definition qwt_plot_arrowmarker.h:153
@ Circle
圆形端点
Definition qwt_plot_arrowmarker.h:120
PositionMode
箭头定位模式
Definition qwt_plot_arrowmarker.h:179
@ ExplicitPoints
使用显式起点和终点
Definition qwt_plot_arrowmarker.h:194
绘图画布上项目的基类
Definition qwt_plot_item.h:119
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
绘制项目
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:621
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:215
virtual QRectF boundingRect() const
Get the bounding rectangle
Definition qwt_plot_item.cpp:883
刻度映射
Definition qwt_scale_map.h:52
表示文本的类
Definition qwt_text.h:93