156 lines
3.7 KiB
C++
156 lines
3.7 KiB
C++
#ifndef DRAWCURVEVIEW_H
|
|
#define DRAWCURVEVIEW_H
|
|
|
|
#include <QWidget>
|
|
#include <QPaintEvent>
|
|
#include "qpushbutton.h"
|
|
#include "DataManagger.h"
|
|
#include "SmoothTool.h"
|
|
#include "AngleAdjTool.h"
|
|
#include "editEnd.h"
|
|
|
|
//视图边距
|
|
#define D_VIEW_MARGIN_LEFT 80//左、下边界
|
|
#define D_VIEW_MARGIN_BOTTOM 30//左、下边界
|
|
#define D_VIEW_MARGIN_RIGHT 40//右、上边界
|
|
#define D_VIEW_MARGIN_TOP 25//上边界
|
|
|
|
|
|
class DrawCurveView : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DrawCurveView(QWidget *parent = nullptr);
|
|
~DrawCurveView();
|
|
void initView();
|
|
void setValues(float *values);
|
|
void setCount(int count);
|
|
|
|
signals:
|
|
void enableEditButtons();
|
|
void unableEditButtons();
|
|
void R2L();
|
|
void verticalSliderUP();
|
|
void verticalSliderDOWN();
|
|
void editModeTips();
|
|
|
|
public slots:
|
|
void editIfBegin_Slot();
|
|
void smoothWin_Slot();
|
|
void finishEdit_SLOT();
|
|
void AngAdjWin_SLOT();
|
|
void overEditSave();
|
|
|
|
private slots:
|
|
void receiveSmoothData(float sd, float ed, int mode, int cal, int count);
|
|
void cancelSmoothEdit();
|
|
void saveSmooth_SLOT(int);
|
|
void receiveAngleData(float,float,float,float,float);
|
|
void cancelAngleEdit();
|
|
|
|
void continueEditNoSave_SLOT();
|
|
protected:
|
|
virtual void paintEvent(QPaintEvent *evt);
|
|
virtual void mouseMoveEvent(QMouseEvent *event);
|
|
virtual void mousePressEvent(QMouseEvent *event);
|
|
virtual void mouseReleaseEvent(QMouseEvent *event);
|
|
virtual void wheelEvent(QWheelEvent *event);
|
|
private:
|
|
//绘制坐标
|
|
void drawCoord(QPainter *painter);
|
|
|
|
//波列数据转换为图像坐标
|
|
QPointF coordCurvePoint(int ix,float value);
|
|
|
|
//绘制波列数据点
|
|
void drawDataPoints(QPainter *painter);
|
|
|
|
//绘制鼠标位置线
|
|
void drawMousePosLine(QPainter *painter);
|
|
|
|
//绘制鼠标单点
|
|
void usevalueDrawPoint(QPainter *painter);
|
|
|
|
//曲线操作
|
|
void initCurveViewQMenu();
|
|
void initCurveEditQMenu();
|
|
|
|
//获取当前鼠标位置的曲线下标
|
|
int calMousePoint();
|
|
|
|
//绘制编辑模式提示字符
|
|
void drawEditTishi(QPainter *painter);
|
|
|
|
void editIfBegin();
|
|
void initEditPart();//初始化编辑块
|
|
void initeditIndex();
|
|
void oriCur2Edit();//载入原有曲线
|
|
void drawEditLine(QPainter *painter);//绘制编辑曲线
|
|
void genEditLine();//生成编辑曲线
|
|
void changeEditStrValue(int temp);//单回合编辑中更新起始编辑点
|
|
void sortEdit();//顺序
|
|
bool saveEdit(int Smooth);//保存编辑
|
|
void overEdit();//结束编辑
|
|
|
|
void AngAdjWin();
|
|
void smoothWin();
|
|
|
|
bool isIneditRange(int);
|
|
private:
|
|
bool press_noRelease_mode; //点下未抬起状态
|
|
int press_noRelease_point; //点下未抬起状态下鼠标位置
|
|
|
|
float *m_values;
|
|
int m_count;
|
|
bool isInit;
|
|
|
|
float m_width;
|
|
float m_height;
|
|
QPoint lastPos;
|
|
QPoint frontPos;
|
|
QList<float> underBarHeight;
|
|
|
|
editEnd *msgBox2;
|
|
bool editLock;
|
|
bool ifContinue;//继续编辑标
|
|
int pressPoint, releasePoint;//记录修改上下界
|
|
int pressEdit,releaseEdit,curEdit,tempCurEdit; //编辑范围
|
|
int lastEditPos,editIndexNum;
|
|
int tempPEdit,tempREdit;//备份
|
|
float *editValue, *tempEditValue;//编辑值
|
|
int *editIndex;//有编辑过的index
|
|
|
|
int editStrValue, onceEditNum;//编辑起始位置,单次编辑量
|
|
int *onceEditIndex;//单次修改index记录
|
|
|
|
bool hasSelect;//选中区域标识
|
|
int whichMode;
|
|
bool EditMode;
|
|
|
|
SmoothTool *sTool;
|
|
AngleAdjTool *angTool;
|
|
|
|
float mouseDrawDepth, mouseDrawValue;//实时记录鼠标所在深度及数值
|
|
|
|
QPoint tishiEdit;
|
|
float tishiEditTime;
|
|
public:
|
|
QString fileName, curveName;
|
|
|
|
int PageSize,CurrentPos,userPos;
|
|
|
|
float userCurrentPos;
|
|
float userCurrentValue;
|
|
|
|
QRect rthy,rthy1,rthyt;
|
|
float factor;
|
|
float m_Xmin,m_Xmax;
|
|
float sdep,edep,rlev;
|
|
public:
|
|
void button_editIfBegin();
|
|
void button_smoothWin();
|
|
void button_AngAdjWin();
|
|
};
|
|
|
|
#endif // DRAWCURVEVIEW_H
|