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/nmObjBase.h

50 lines
2.0 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 "ZxObjBase.h"
#include "nmPlot_global.h"
// 数值试井绘图对象(基类)
class NM_PLOT_EXPORT nmObjBase : public ZxObjBase
{
Q_OBJECT
ZX_DECLARE_DYNAMIC
public:
nmObjBase();
nmObjBase(const QString& sName, \
ZxSubAxisX* pAxisX, \
ZxSubAxisY* pAxisY);
~nmObjBase();
virtual void paintBack(QPainter* painter, \
const ZxPaintParam& param) override;
virtual void afterCreated();
// 删除图元数据对象
virtual void removeData();
// 绘制固定逻辑像素大小的节点框,供选中节点和吸附目标共用。
// pt 使用当前画笔坐标;nPixelSize 包含边框,borderColor 指定细边颜色。
// fillColor 无效时绘制空心框,传入有效颜色时绘制实心框。
// 函数只负责绘制,并恢复画笔状态,不改变节点坐标或交互状态。
static void paintNodeHandle(QPainter* painter, const QPointF& pt,
int nPixelSize, const QColor& borderColor,
const QColor& fillColor = QColor());
protected:
// 点集图元共用的纯命中查询:pt 为场景坐标,点集读取当前对象。
// 在所属视图内按逻辑像素判断:节点半径 5,线段距离 4,节点优先且取最近项。
// closed 决定是否包含末点到首点的闭合边;命中线段时返回其起点下标。
// includeSelectedInterior 仅供多边形启用,边线未命中后允许选中对象的内部整体拖动。
// 只填写输出参数,不修改点集或选中状态;未命中时类型和下标均为 -1。
bool hitTestPolylineInPixels(const QPointF& pt, bool closed,
int& nOption, int& nSubIndex,
bool includeSelectedInterior = false);
// 选中节点统一为 5 像素蓝色空心框;当前命中节点保留红色实心提示。
void paintSelectedNodeHandles(QPainter* painter, const QVector<QPointF>& points) const;
};