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.
nmWATI/Include/iPlot/iPlotCurveT/ZxPlot.h

169 lines
4.5 KiB
C

#pragma once
#include "ZxPlotBase.h"
class ZxObjBase;
// 绘图载体再次封装,其实大部分绘图都是基于本类来实现
class I_PLOTCURVE_T_EXPORT ZxPlot : public ZxPlotBase
{
Q_OBJECT
ZX_DECLARE_DYNAMIC
public:
ZxPlot();
ZxPlot(ZxRenderView* pView);
~ZxPlot();
public:
virtual void paintBack(QPainter* painter,
const ZxPaintParam& param);
virtual void paintBounds(QPainter* painter);
// 布局
virtual void onLayout();
// 上下文菜单
virtual void onPrepareContextMenu(QMenu *pMenu, const QPointF &pos);
public:
// 鼠标
virtual bool onLeftDown(const QPointF& pt);
virtual bool onLeftUp(const QPointF& pt);
virtual bool onMouseMove(const QPointF& pt);
virtual void onLeftDoubleClick(const QPointF& pt);
// Tips
virtual void onShowTips(const QPointF& pt);
// 删除这是响应键盘Delete键
virtual void onDeleteItem();
virtual void deleteCurvePtsWithin(QRectF rt);
// 属性填充
virtual void fillPtyPano(IxPtyPano* sheet);
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
virtual void onDeserialized();
// 模版序列化
virtual void onLoadTempl(ZxSerializer* ser);
virtual void onSaveTempl(ZxSerializer* ser);
// 重新绑定相互关联的
virtual void onDeserializedReBounds();
public:
// 布局
virtual bool checkNeedLayout();
virtual QRectF getNetBounds(); //去除Margin
virtual QRectF getInnerChartArea(QRectF rt); //内部绘图区,不包括坐标轴和标题区
double getTitleHeight(); //获取标题的高度
double getNaviBarHeight(); //获取NaviBar高度
virtual double getAxisDisOf(AxisPos oPos);
virtual QVector<ZxSubAxisBase*> getVisibleAxisOf(AxisPos oPos);
protected:
// 布局Title,并且返回其Bound
virtual QRectF layoutTitle(QRectF rtLast, int nPos);
// NaviBar
virtual QRectF layoutNaviBar(QRectF rtLast);
// 上下左右侧坐标轴
virtual QRectF layoutAxisOf(QRectF rtLast, AxisPos oPos);
virtual void _layoutAxisOf(QMap<ZxSubAxisBase*, QPointF>& map, \
QRectF rt, AxisPos oPos);
public:
// 是否以正方形网格化显示,对于双对数有效
bool isSquareGrid() const;
void setSquareGrid(bool b);
// 只有m_bSquareGrid为true且xy为双对数
bool checkSquareGridMode(double& w, double& h);
// 是否正在执行插入新对象的操作
bool isInserting();
// 特征线斜率 Special line ratio权宜之计
double getLineSlope() const;
void setLineSlope(double f);
// 统一的增加接口,调用下面的创建和添加
virtual ZxObjBase* addOneObj(const PlotObjectType& oType,
QString& sName,
bool bAppend = true,
ZxSubAxisX* pAxisX = NULL,
ZxSubAxisY* pAxisY = NULL,
bool bY2 = false);
virtual bool addOneObj(ZxObjBase* pObj,
bool bAppend = true,
ZxSubAxisX* pAxisX = NULL,
ZxSubAxisY* pAxisY = NULL,
bool bY2 = false);
virtual bool zoomPlot(QRectF rtTracker);
protected:
virtual ZxObjBase* _createObjOf(const PlotObjectType& oType, \
QString& sName);
// 添加
virtual void _appendObjOf(ZxObjBase* pObj);
public:
// 响应从ZxCmdTool过来的鼠标处理
virtual bool runCmdSelect(PlotOperationMode o, \
const QPointF& ptStart, \
const QPointF& ptEnd);
virtual bool runCmdHitPoint(PlotOperationMode o, \
const QPointF& pt);
public slots:
virtual void slotShowCurveData();
virtual void slotClearPointsSelection();
signals:
// 触发信号允许外界处理鼠标HitPoint
void sigCmdHitPoint(PlotOperationMode o, \
const QPointF& pt, \
bool& b);
void sigUpdate();
void sigShowCurveData(ZxObjCurveBase*);
protected:
// 是否以正方形网格化显示,对于双对数有效
bool m_bSquareGrid;
// 临时标示,左键按下
bool m_bLButtonDown;
// 权宜之计
QPainter* m_pPainter;
// 权宜之计,其实不应该这么处理,不涉及序列化
// 这是针对特征线时后的斜率值
double m_fLineSlope;
};