logplus/logPlus/formdraw.h

153 lines
5.2 KiB
C++

#ifndef FORMDRAW_H
#define FORMDRAW_H
#include <QWidget>
#include <QPainter>
#include <QPaintEvent>
#include "qmycustomplot.h"
#include "formtitle.h"
#include "formtrack.h"
#include "LogIO.h"
#include "MemRdWt.h"
#pragma execution_character_set("utf-8")
const int iFracType=15;
//蝌蚪图
typedef struct FRACDEF
{
int iCode; //代码
QString csName; // 名称
int iType; //形状代码(1:正弦曲线 2:连线 3:封闭区域)
QColor crColor; //颜色(红 绿 蓝)
int nLineWidth; //线宽度
int bDraw; // 是否显示
}FRAC_DEF;
typedef struct FRACTABLE
{
float DEP; //深度
float AorX;
float XETAorH;
float W;
float DIPorS; //倾角
float DIR; //方位
float ID; //裂缝代码/可信度
float NUM;
float X[16],Y[16];//X0,Y0,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9;
}FRAC_TABLE;
namespace Ui {
class FormDraw;
}
class FormDraw : public QWidget
{
Q_OBJECT
public:
explicit FormDraw(QWidget *parent = nullptr, QString m_strWellName="", QString strTrackName="");
~FormDraw();
private:
Ui::FormDraw *ui;
protected:
void paintEvent(QPaintEvent *event);
public slots:
void dragEnterEvent(QDragEnterEvent* event);
void dragMoveEvent(QDragMoveEvent* event);
void dropEvent(QDropEvent* event);
//
void s_mouseWheel(QWheelEvent *event);
void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit);
public:
QString m_strUuid;
QString m_strWellName;
QString m_strTrackName;
FormTrack *m_formTrack;
QStringList m_listLineName;
QStringList m_listWaveName;
QStringList m_listTableName;
//X坐标
float m_vmax;
float m_vmin;
public:
void initForm(QMyCustomPlot *widget, QString strSlfName, QString strLineName,
double newLeftScale=-9999, double newRightScale=-9999, QString strScaleType="线性", QColor lineColor=QColor(0,0,0), double width=1, Qt::PenStyle lineStyle=Qt::SolidLine);
void addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
double newLeftScale=-9999, double newRightScale=-9999, QString strScaleType="线性", QColor lineColor=QColor(0,0,0), double width=1, Qt::PenStyle lineStyle=Qt::SolidLine);
void setupLineStyleDemo(QMyCustomPlot *customPlot);
void setupSelectionDemo(QMyCustomPlot *customPlot);
//波列
void initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
void initWave2(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
//表格曲线
void initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
void ReadFracDef();
void ReadData(QString strSlfName, QString strLineName);
void DrawTabDip(QMyCustomPlot *widget);
int m_PointNum;
//
int FracNum;
float *m_pflTab_Frac;
bool m_bFracIsOK;
//CString m_csUnit;
//
Slf_CURVE m_Curve,m_Curve2,m_Curve3;
char *m_Value2,*m_Value3;
// 以下变量需保存在模板里
// 绘制时,方位/倾角/可信度曲线的深度、采样间隔应该一致
//CString m_csCurveDDIR,m_csCurveDANG,m_csCurveGrad; // 方位/倾角/可信度 曲线名
float m_LeftVal2,m_RightVal2;
float m_flGrad1,m_flGrad2; // 可信度
int m_bTableData;
QRectF m_Rect;
float m_nRadius,m_nCircleWidth; // 半径,圆线宽度
float m_nTailWidth,m_nTailLen; // 尾宽度、尾长
QColor m_crPointFill,m_crTail,m_crCircle;
//TabDip
QString m_qsWellName,m_qsTable; //
QString m_qsDepth,m_qsDIP,m_qsDIR,m_qsID,m_qsProperty; // 控制曲线
QList<FRAC_DEF> m_FracDefList;
QList<FRAC_TABLE> m_FracTabList;
bool m_bTypeDraw[iFracType];
bool m_bDrawValue;
int m_iPrecision;//小数位数
signals:
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
public slots:
void s_addLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
void s_AddLine_Property(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle);//新建曲线,带属性
void s_delLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
void s_MouseMove(QString strUuid, QString strWellName, QString strTrackName, float dep);
void s_handleRectRangeChange(QCPRange newRange);
void s_selectionRectAccepted(const QRect &rect, QMouseEvent *event);
//
void s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
void s_delWave(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
//
void s_addTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
void s_delTableLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
};
#endif // FORMDRAW_H