You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmPlot/nmObjToolBase.h

54 lines
1.4 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "nmDefines.h"
#include "ZxObjToolBase.h"
#include "nmPlot_global.h"
// 数值试井绘图对象之工具(基类)
class NM_PLOT_EXPORT nmObjToolBase : public ZxObjToolBase
{
Q_OBJECT
public:
nmObjToolBase();
public:
// 鼠标各种响应
virtual bool onLeftDown(const QPointF& pt) override;
virtual bool onLeftUp(const QPointF& pt) override;
virtual bool onMouseMove(const QPointF& pt) override;
virtual bool onMouseWheel(const QPointF& pt, int delta) override;
virtual bool onLeftDoubleClick(const QPointF& pt) override;
// 绘制
virtual void onPaint(QPainter* painter, const ZxPaintParam& param) override;
signals:
// 鼠标交互完成(双击)
void sigPtsFinished(QVector<QPointF>& vec);
public:
NM_Obj_Type getNOT();
protected:
// 已选中图元双击线段时添加节点;bClosed 指定是否包含末点到首点的闭合边。
// 新节点取鼠标在线段上的投影,靠近已有节点时只消费事件,不重复添加。
// 返回 true 表示已处理双击,并接管随后的松手事件,避免误触发拖动或吸附。
bool insertPointOnDoubleClick(const QPointF& pt, bool bClosed);
NM_Obj_Type m_oNot; //内部类型标识,不涉及序列化
private:
bool m_bConsumeInsertPointRelease; // 双击加点后,消费第二次点击的松手事件。
};