1393 lines
55 KiB
C++
1393 lines
55 KiB
C++
#include "forminfo.h"
|
||
#include "ui_forminfo.h"
|
||
|
||
#include "CallManage.h"
|
||
#include <QDebug>
|
||
#include <QMimeData>
|
||
#include <QPushButton>
|
||
#include <QVBoxLayout>
|
||
#include <QMenu>
|
||
#include <QPainterPath>
|
||
#include "geometryutils.h"
|
||
#include "qtColorSchemeComboBox.h"
|
||
#include "DrawTvd.h"
|
||
|
||
//曲线名称(单个)
|
||
FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor) :
|
||
QWidget(parent),
|
||
ui(new Ui::FormInfo)
|
||
{
|
||
ui->setupUi(this);
|
||
//
|
||
setAcceptDrops(true);
|
||
|
||
m_pTvd = NULL;
|
||
m_strSlfName = strSlfName;
|
||
m_strWellName = strWellName;
|
||
m_strTrackName = strTrackName;
|
||
m_strLineName = strLineName;
|
||
m_lineColor = lineColor;
|
||
//
|
||
m_dWidth = 3;
|
||
m_lineStyle = Qt::SolidLine;
|
||
m_newFillMode = "无填充";
|
||
m_newHeadFill = "不绘制";
|
||
// //
|
||
// QPushButton *button = new QPushButton("Drag Me", this);
|
||
// QVBoxLayout *layout = new QVBoxLayout(this);
|
||
// layout->addWidget(button);
|
||
// setLayout(layout);
|
||
// // 设置拖拽功能
|
||
// setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
||
// setAttribute(Qt::WA_TranslucentBackground);
|
||
|
||
//左刻度
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLeftScale(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeLeftScale(QString, QString, QString, QString, QString, double)));
|
||
//右刻度
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeRightScale(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeRightScale(QString, QString, QString, QString, QString, double)));
|
||
//刻度类型
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeScaleType(QString, QString, QString, QString, QString, QString)), this, SLOT(s_ChangeScaleType(QString, QString, QString, QString, QString, QString)));
|
||
|
||
//颜色
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineColor(QString, QString, QString, QString, QString, QColor)), this, SLOT(s_ChangeLineColor(QString, QString, QString, QString, QString, QColor)));
|
||
//线宽
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineWidth(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeLineWidth(QString, QString, QString, QString, QString, double)));
|
||
//线型
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineStyle(QString, QString, QString, QString, QString, Qt::PenStyle)), this, SLOT(s_ChangeLineStyle(QString, QString, QString, QString, QString, Qt::PenStyle)));
|
||
|
||
//绘制方式
|
||
//曲线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawLine(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawLine(QString, QString, QString, QString, QString, bool)));
|
||
//杆状
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawGan(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawGan(QString, QString, QString, QString, QString, bool)));
|
||
//点状
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawPoint(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawPoint(QString, QString, QString, QString, QString, bool)));
|
||
//绘制对称曲线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeDrawSymmetry(QString, QString, QString, QString, QString, bool)), this, SLOT(s_ChangeDrawSymmetry(QString, QString, QString, QString, QString, bool)));
|
||
//数据点 符号类型
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangePointStyle(QString, QString, QString, QString, QString, QCPScatterStyle::ScatterShape)), this, SLOT(s_ChangePointStyle(QString, QString, QString, QString, QString, QCPScatterStyle::ScatterShape)));
|
||
|
||
//斜井三图一表
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeTvdProperty(QString, QString, QString, QString, QString, QObject *)),
|
||
this, SLOT(s_ChangeTvdProperty(QString, QString, QString, QString, QString, QObject *)));
|
||
|
||
//岩性填充-不填充
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString, QString)));
|
||
//岩性填充-填充
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)),
|
||
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)));
|
||
|
||
|
||
//修改曲线选择状态 iSelect=0未知,1标准曲线,2主曲线,3从曲线
|
||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineStatus(QString, QString, QString, QString, QString, int, bool)), this, SLOT(s_ChangeLineStatus(QString, QString, QString, QString, QString, int, bool)));
|
||
|
||
QFont font1("微软雅黑", 10);
|
||
QFont font2("微软雅黑", 8);
|
||
m_curveNameFont = font1; // 曲线名称
|
||
m_curveUnitFont = font2; // 曲线单位
|
||
m_curveScaleFont = font2; // 曲线刻度
|
||
m_layerFont = font1;
|
||
m_bShowScale = true;
|
||
}
|
||
|
||
FormInfo::~FormInfo()
|
||
{
|
||
delete ui;
|
||
}
|
||
|
||
void FormInfo::initProperty(QJsonObject obj)
|
||
{
|
||
m_vmin = obj.value("vmin").toDouble();
|
||
m_vmax = obj.value("vmax").toDouble();
|
||
m_strUnit = obj.value("Unit").toString();
|
||
|
||
QString strType = obj.value("Type").toString();
|
||
if ("waveObject" == strType)
|
||
{
|
||
m_nDrawType = obj.value("DrawType").toInt();
|
||
m_nFillType = obj.value("FillType").toInt();
|
||
m_strAmp = obj.value("Amp").toString();
|
||
m_fMaxAmp = obj.value("MaxAmp").toDouble();
|
||
m_nSchemeIndex = obj.value("SchemeIndex").toInt();
|
||
m_nColorNum = obj.value("ColorNum").toInt();
|
||
|
||
m_bDrawDepth = obj.value("DrawDepth").toBool();
|
||
m_bDrawBase = obj.value("DrawBase").toBool();
|
||
m_bOddEven = obj.value("OddEven").toBool();
|
||
|
||
m_nWaveJg = obj.value("WaveJg").toInt();
|
||
m_fWaveHei = obj.value("WaveHei").toDouble();
|
||
}
|
||
else if ("depthObject" == strType)
|
||
{
|
||
m_bVerticaDrawing = obj["bVerticaDrawing"].toBool(); // 垂向绘制
|
||
m_nRotationAngle = obj["nRotationAngle"].toInt(); // 旋转角度
|
||
m_headHeight = obj["headHeight"].toInt();
|
||
m_strUnit = obj["strUnit"].toString(); // 单位
|
||
{
|
||
QStringList fontParts = obj["curveNameFont"].toString().split(","); // 按逗号拆分
|
||
if (fontParts.size() >= 2) {
|
||
m_curveNameFont.setFamily(fontParts[0]); // 设置字体名称
|
||
m_curveNameFont.setPointSize(fontParts[1].toInt()); // 设置字号
|
||
}
|
||
}
|
||
{
|
||
QStringList fontParts = obj["strUnitFont"].toString().split(","); // 按逗号拆分
|
||
if (fontParts.size() >= 2) {
|
||
m_strUnitFont.setFamily(fontParts[0]); // 设置字体名称
|
||
m_strUnitFont.setPointSize(fontParts[1].toInt()); // 设置字号
|
||
}
|
||
}
|
||
m_headHeight = obj["headHeight"].toInt();
|
||
m_sdRulerColor = obj["sdRulerColor"].toString(); // 标尺颜色
|
||
m_sdInterval = obj["sdInterval"].toDouble(); // 间隔
|
||
// 标注字体
|
||
{
|
||
QStringList fontParts = obj["sdLabelFont"].toString().split(","); // 按逗号拆分
|
||
if (fontParts.size() >= 2) {
|
||
m_sdLabelFont.setFamily(fontParts[0]); // 设置字体名称
|
||
m_sdLabelFont.setPointSize(fontParts[1].toInt()); // 设置字号
|
||
}
|
||
}
|
||
m_sdRotationAngle = obj["sdRotationAngle"].toDouble(); // 旋转(°)
|
||
m_sdDrawStartDepth = obj["sdDrawStartDepth"].toBool(); // 绘制起点深度
|
||
m_sdDrawEndDepth = obj["sdDrawEndDepth"].toBool(); // 绘制终点深度
|
||
m_sdMeasuredDepth = obj["sdMeasuredDepth"].toBool(); // 斜深
|
||
m_sdElevationVerticalDepth = obj["sdElevationVerticalDepth"].toBool(); // 海拔垂深
|
||
m_sdVerticalDepth = obj["sdVerticalDepth"].toBool(); // 垂深
|
||
m_sdMeasuredDepthPosition = obj["sdMeasuredDepthPosition"].toInt(); // 斜深位置
|
||
m_sdVerticalDepthPosition = obj["sdVerticalDepthPosition"].toInt(); // 垂深位置
|
||
m_sdElevationVerticalDepthPosition = obj["sdElevationVerticalDepthPosition"].toInt(); // 海拔垂深位置
|
||
m_sdMajorTickLineLength = obj["sdMajorTickLineLength"].toInt(); // 主刻度线长度
|
||
m_sdMajorTickLineWidth = obj["sdMajorTickLineWidth"].toInt(); // 主刻度线宽度
|
||
m_sdMinorTickLineLength = obj["sdMinorTickLineLength"].toInt(); // 次刻度线长度
|
||
m_sdMinorTickLineWidth = obj["sdMinorTickLineWidth"].toInt(); // 次刻度线宽度
|
||
}
|
||
|
||
}
|
||
|
||
QJsonObject FormInfo::makeJson()
|
||
{
|
||
// 创建根对象
|
||
QJsonObject rootObj;
|
||
//
|
||
QString slffilename=QString("");
|
||
int ind=m_strSlfName.lastIndexOf('\\');
|
||
int ind2=m_strSlfName.lastIndexOf('/');
|
||
if(ind2>ind) ind=ind2;
|
||
if(ind>-1) {
|
||
slffilename=m_strSlfName.mid(ind+1);
|
||
}
|
||
rootObj["SlfName"] = slffilename;
|
||
rootObj["WellName"] = m_strWellName;
|
||
// rootObj["TrackName"] = m_strTrackName;
|
||
rootObj["LineName"] = m_strLineName;
|
||
rootObj["AliasName"] = m_strAliasName;
|
||
//
|
||
rootObj["Type"] = m_strType;
|
||
rootObj["curveNameFont"] = m_curveNameFont.toString();
|
||
rootObj["lineColor"] = m_lineColor.name();
|
||
|
||
if (m_strType == "tableObject")
|
||
{
|
||
//垂向绘制
|
||
rootObj["VerticaDrawing"] = m_bVerticaDrawing;
|
||
rootObj["RotationAngle"] = m_nRotationAngle;
|
||
|
||
if (m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT"
|
||
|| m_strLineName == "SWALL_CORE" || m_strLineName == "WORDS_RELUST" || m_strLineName == "LAYER_DATA")
|
||
{
|
||
//固井结论/井壁取心/文字结论/地质分层
|
||
//item属性写入slf文件,不需要此次记录
|
||
return rootObj;
|
||
}
|
||
else if (m_strLineName == "GEO_LITH")
|
||
{
|
||
//录井剖面
|
||
rootObj["OilZhan"] = m_dOilZhan;//含油占比
|
||
rootObj["LithColor"] = m_bLithColor;
|
||
rootObj["LithOne"] = m_bLithOne;
|
||
rootObj["ShowOil"] = m_bShowOil;
|
||
rootObj["CenterOil"] = m_bCenterOil;
|
||
rootObj["ShowColor"] = m_bShowColor;
|
||
rootObj["ShowColorNum"] = m_bShowColorNum;
|
||
//item属性写入slf文件,不需要此次记录
|
||
return rootObj;
|
||
}
|
||
}
|
||
else if (m_strType == "JiegutextObject")
|
||
{
|
||
//气测/FMT/射孔/文本
|
||
|
||
//item属性写入slf文件,不需要此次记录
|
||
return rootObj;
|
||
}
|
||
else if (m_strType == "LogfaceObject")
|
||
{
|
||
//沉积相
|
||
rootObj["DrawFac"] = m_bDrawFac;
|
||
rootObj["DrawPhase"] = m_bDrawPhase;
|
||
rootObj["DrawMFacName"] = m_bDrawMFacName;
|
||
//item属性写入slf文件,不需要此次记录
|
||
return rootObj;
|
||
}
|
||
else if (m_strType == "TubingstringObject")
|
||
{
|
||
//套管组件
|
||
//垂向绘制
|
||
rootObj["VerticaDrawing"] = m_bVerticaDrawing;
|
||
rootObj["RotationAngle"] = m_nRotationAngle;
|
||
//
|
||
rootObj["DrawStruct"] = m_bDrawStruct_Tubing;
|
||
rootObj["DrawTubing"] = m_bDrawTubing_Tubing;
|
||
rootObj["DrawTools"] = m_bDrawTools_Tubing;
|
||
rootObj["DrawSPTool"] = m_bDrawSPTool_Tubing;
|
||
rootObj["DrawCCL"] = m_bDrawCCL_Tubing;
|
||
//
|
||
rootObj["Oguan"] = m_Oguan_Tubing;
|
||
rootObj["inD"] = m_inD_Tubing;
|
||
rootObj["OutD"] = m_OutD_Tubing;
|
||
//
|
||
rootObj["vmax"] = m_vmax;//右刻度
|
||
rootObj["vmin"] = m_vmin;//左刻度
|
||
//item属性写入slf文件,不需要此次记录
|
||
return rootObj;
|
||
}
|
||
|
||
rootObj["Unit"] = m_strUnit;
|
||
rootObj["Width"] = m_dWidth;
|
||
rootObj["lineStyle"] = m_lineStyle;
|
||
rootObj["vmax"] = m_vmax;//右刻度
|
||
rootObj["vmin"] = m_vmin;//左刻度
|
||
rootObj["ScaleType"] = m_strScaleType;
|
||
rootObj["ShowScale"] = m_bShowScale;
|
||
|
||
if (m_strType == "curveObject")
|
||
{
|
||
rootObj["DrawLine"] = m_bDrawLine; // 曲线
|
||
rootObj["DrawGan"] = m_bDrawGan; // 杆状
|
||
rootObj["DrawPoint"] = m_bDrawPoint; // 点状
|
||
rootObj["DrawSymmetry"] = m_bDrawSymmetry; // 绘制对称曲线
|
||
rootObj["pointStyle"] = m_pointStyle;
|
||
|
||
//岩性填充
|
||
rootObj["newFillMode"] = m_newFillMode;
|
||
rootObj["newHeadFill"] = m_newHeadFill;
|
||
rootObj["newTargetLine"] = m_newTargetLine;
|
||
rootObj["newFillType"] = m_newFillType;
|
||
//填充颜色
|
||
rootObj["newColor"] = m_newColor.name();
|
||
rootObj["newLithosImage"] = m_newLithosImage;
|
||
rootObj["new_vMax"] = m_new_vMax;
|
||
rootObj["new_vMin"] = m_new_vMin;
|
||
//岩性前景色
|
||
rootObj["frontColor"] = m_frontColor.name();
|
||
//岩性背景色
|
||
rootObj["backColor"] = m_backColor.name();
|
||
}
|
||
else if (m_strType == "waveObject")
|
||
{
|
||
rootObj["DrawType"] = m_nDrawType;
|
||
rootObj["FillType"] = m_nFillType;
|
||
rootObj["Amp"] = m_strAmp;
|
||
rootObj["MaxAmp"] = m_fMaxAmp;
|
||
|
||
rootObj["DrawDepth"] = m_bDrawDepth; // 绘制波深度
|
||
rootObj["DrawBase"] = m_bDrawBase; // 绘制波基线
|
||
rootObj["OddEven"] = m_bOddEven; // 奇偶配色
|
||
|
||
rootObj["WaveJg"] = m_nWaveJg; // 波形间隔
|
||
rootObj["WaveHei"] = m_fWaveHei; // 波形高度
|
||
|
||
rootObj["SchemeIndex"] = m_nSchemeIndex;
|
||
rootObj["ColorNum"] = m_nColorNum;
|
||
}
|
||
else if(m_strType == "SantuyibiaoObject")
|
||
{
|
||
makeTvdJson(rootObj);
|
||
}
|
||
else if (m_strType == "depthObject")
|
||
{
|
||
rootObj["bVerticaDrawing"] = m_bVerticaDrawing; // 垂向绘制
|
||
rootObj["nRotationAngle"] = m_nRotationAngle; // 旋转角度
|
||
rootObj["strUnit"] = m_strUnit; // 单位
|
||
rootObj["curveNameFont"] = m_curveNameFont.toString();
|
||
rootObj["strUnitFont"] = m_strUnitFont.toString(); //单位字体
|
||
rootObj["headHeight"] = m_headHeight;
|
||
rootObj["sdRulerColor"] = m_sdRulerColor.name(); // 标尺颜色
|
||
rootObj["sdInterval"] = m_sdInterval; // 间隔
|
||
rootObj["sdLabelFont"] = m_sdLabelFont.toString(); // 标注字体
|
||
rootObj["sdRotationAngle"] = m_sdRotationAngle; // 旋转(°)
|
||
rootObj["sdDrawStartDepth"] = m_sdDrawStartDepth; // 绘制起点深度
|
||
rootObj["sdDrawEndDepth"] = m_sdDrawEndDepth; // 绘制终点深度
|
||
rootObj["sdMeasuredDepth"] = m_sdMeasuredDepth; // 斜深
|
||
rootObj["sdElevationVerticalDepth"] = m_sdElevationVerticalDepth; // 海拔垂深
|
||
rootObj["sdVerticalDepth"] = m_sdVerticalDepth; // 垂深
|
||
rootObj["sdMeasuredDepthPosition"] = m_sdMeasuredDepthPosition; // 斜深位置
|
||
rootObj["sdVerticalDepthPosition"] = m_sdVerticalDepthPosition; // 垂深位置
|
||
rootObj["sdElevationVerticalDepthPosition"] = m_sdElevationVerticalDepthPosition; // 海拔垂深位置
|
||
rootObj["sdMajorTickLineLength"] = m_sdMajorTickLineLength; // 主刻度线长度
|
||
rootObj["sdMajorTickLineWidth"] = m_sdMajorTickLineWidth; // 主刻度线宽度
|
||
rootObj["sdMinorTickLineLength"] = m_sdMinorTickLineLength; // 次刻度线长度
|
||
rootObj["sdMinorTickLineWidth"] = m_sdMinorTickLineWidth; // 次刻度线宽度
|
||
}
|
||
else if (m_strLineName == "CORE_PHYSICS")
|
||
{
|
||
rootObj["headHeight"] = m_headHeight; // 例区高度
|
||
rootObj["lineWidth"] = m_cp_lineWidth; // 线宽
|
||
rootObj["lineColor"] = m_cp_lineColor.name(); // 线条颜色
|
||
rootObj["lineStyle"] = m_cp_lineStyle; // 线型
|
||
rootObj["leftScale"] = m_cp_leftScale; // 左刻度
|
||
rootObj["rightScale"] = m_cp_rightScale; // 右刻度
|
||
rootObj["scaleDivisionsOrCustom"] = m_cp_scaleDivisionsOrCustom; // 等分刻度数或自定序列
|
||
rootObj["scaleType"] = m_cp_scaleType; // 刻度类型
|
||
rootObj["curveNameFont"] = m_curveNameFont.toString(); // 字体
|
||
rootObj["strUnitFont"] = m_strUnitFont.toString(); // 曲线单位
|
||
rootObj["curveScale"] = m_cp_curveScale.toString(); // 曲线刻度
|
||
rootObj["drawAsBar"] = m_cp_drawAsBar; // 杆状
|
||
rootObj["leftBoundary"] = m_cp_leftBoundary; // 左界
|
||
rootObj["skipZeroInvalidValues"] = m_cp_skipZeroInvalidValues; // 不绘零等无效值
|
||
rootObj["drawEnvelope"] = m_cp_drawEnvelope; // 绘制包络线
|
||
rootObj["drawAsDot"] = m_cp_drawAsDot; // 点状
|
||
rootObj["symbolType"] = m_cp_symbolType; // 符号类型
|
||
rootObj["symbolBorderColor"] = m_cp_symbolBorderColor.name(); // 边框颜色
|
||
rootObj["symbolSize"] = m_cp_symbolSize; // 大小
|
||
rootObj["symbolFillColor"] = m_cp_symbolFillColor.name(); // 填充颜色
|
||
rootObj["fieldName"] = m_cp_fieldName; // 字段名称
|
||
}
|
||
else if (m_strLineName == "IMAGE_DATA")
|
||
{
|
||
rootObj["headHeight"] = m_headHeight; // 例区高度
|
||
// 标注字体
|
||
rootObj["yxzpLabelFont"] = m_yxzpLabelFont.toString();
|
||
// 标注旋转
|
||
rootObj["yxzpLabelFont"] = m_yxzpLabelRotation;
|
||
// 两端绘制
|
||
rootObj["yxzpLabelFont"] = m_yxzpTwoEndDrawing;
|
||
// 绘制颜色
|
||
rootObj["yxzpLabelFont"] = m_yxzpDrawColor;
|
||
}
|
||
|
||
return rootObj;
|
||
}
|
||
|
||
void FormInfo::makeTvdJson(QJsonObject& rootObj)
|
||
{
|
||
if(!m_pTvd)
|
||
{
|
||
return;
|
||
}
|
||
|
||
rootObj["AliasWellName"] = m_pTvd->m_AliasWellName;;// 通常-显示井名
|
||
|
||
// 绘制图形对象
|
||
rootObj["IsDrawBX"] = m_pTvd->objViewInfo->m_IsDrawBX; // 绘制图形对象-靶心
|
||
rootObj["IsDrawBxcs"] = m_pTvd->objViewInfo->m_IsDrawBxcs; // 绘制图形对象-靶心参数表
|
||
rootObj["IsDrawTable"] = m_pTvd->objViewInfo->m_IsDrawTable; // 绘制图形对象-井斜数据表
|
||
rootObj["IsDrawFst"] = m_pTvd->objViewInfo->m_IsDrawFst; // 绘制图形对象-俯视图
|
||
rootObj["DepthLeft"] = m_pTvd->objViewInfo->m_DepthLeft; // 绘制图形对象-侧视图深度在左边
|
||
rootObj["IsDrawCst1"] = m_pTvd->objViewInfo->m_IsDrawCst1; // 绘制图形对象-侧视图(水平位移)
|
||
rootObj["IsDrawCst2"] = m_pTvd->objViewInfo->m_IsDrawCst2; // 绘制图形对象-侧视图(向东)
|
||
rootObj["IsDrawCst3"] = m_pTvd->objViewInfo->m_IsDrawCst3; // 绘制图形对象-侧视图(向北)
|
||
rootObj["IsDrawCst"] = m_pTvd->objViewInfo->m_IsDrawCst; // 绘制图形对象-侧视图(侧视角)
|
||
rootObj["IsDrawLtgjt"] = m_pTvd->objViewInfo->m_IsDrawLtgjt; // 绘制图形对象-立体轨迹图
|
||
rootObj["isDrawNote"] = m_pTvd->objViewInfo->m_isDrawNote; // 绘制图形对象-绘制标注信息
|
||
|
||
// 边框线型
|
||
rootObj["FrameWidth"] = m_pTvd->m_FrameWidth; // 边框线型-线宽
|
||
rootObj["FrameColor"] = m_pTvd->m_FrameColor.name(); // 边框线型-颜色
|
||
// 格线线型
|
||
rootObj["GridWidth"] = m_pTvd->m_GridWidth; // 格线线型-线宽
|
||
rootObj["GridColor"] = m_pTvd->m_GridColor.name();// 格线线型-颜色
|
||
// 轨迹线型
|
||
rootObj["GuijiWidth"] = m_pTvd->m_GuijiWidth;// 轨迹线型-线宽
|
||
rootObj["GuijiColor"] = m_pTvd->m_GuijiColor.name();// 轨迹线型-颜色
|
||
// 靶心半径线型
|
||
rootObj["BxbjWidth"] = m_pTvd->m_BxbjWidth; // 靶心半径线型-线宽
|
||
rootObj["BxbjColor"] = m_pTvd->m_BxbjColor.name(); // 靶心半径线型-颜色
|
||
// 靶心连线线型
|
||
rootObj["BxlxWidth"] = m_pTvd->m_BxlxWidth; // 靶心连线线型-线宽
|
||
rootObj["BxlxColor"] = m_pTvd->m_BxlxColor.name(); // 靶心连线线型-颜色
|
||
// 字体
|
||
rootObj["HeadFont"] = m_pTvd->objViewInfo->m_HeadFont.toString(); // 字体-道头字体
|
||
rootObj["HeadColor"] = m_pTvd->objViewInfo->m_HeadColor.name(); // 字体-道头颜色
|
||
rootObj["TitleFont"] = m_pTvd->objViewInfo->m_TitleFont.toString(); // 字体-标题字体
|
||
rootObj["TitleColor"] = m_pTvd->objViewInfo->m_TitleColor.name(); // 字体-标题颜色
|
||
rootObj["TableFont"] = m_pTvd->objViewInfo->m_TableFont.toString(); // 字体-数据表字体
|
||
rootObj["TableColor"] = m_pTvd->objViewInfo->m_TableColor.name(); // 字体-数据表颜色
|
||
rootObj["ScaleFont"] = m_pTvd->objViewInfo->m_ScaleFont.toString(); // 字体-刻度字体
|
||
rootObj["ScaleColor"] = m_pTvd->objViewInfo->m_ScaleColor.name(); // 字体-刻度颜色
|
||
rootObj["NoteFont"] = m_pTvd->objViewInfo->m_NoteFont.toString(); // 字体-注释字体
|
||
rootObj["NoteColor"] = m_pTvd->objViewInfo->m_NoteColor.name(); // 字体-注释颜色
|
||
// 井斜数据表参数
|
||
rootObj["Title_table"] = m_pTvd->m_Title_table;// 井斜数据表参数-标题名
|
||
rootObj["Head_Height"] = m_pTvd->objViewInfo->m_Head_Height;// 井斜数据表参数-头记录高度(cm)
|
||
rootObj["Rec_Height"] = m_pTvd->objViewInfo->m_Rec_Height;// 井斜数据表参数-数据记录高度(cm)
|
||
// 俯视图参数
|
||
rootObj["Title_fst"] = m_pTvd->objViewInfo->m_Title_fst;// 俯视图参数-标题名
|
||
rootObj["MinXe"] = m_pTvd->objViewInfo->m_MinXe; // 俯视图参数-东西位移最小刻度
|
||
rootObj["MaxXe"] = m_pTvd->objViewInfo->m_MaxXe; // 俯视图参数-东西位移最大刻度
|
||
rootObj["MinYn"] = m_pTvd->objViewInfo->m_MinYn; // 俯视图参数-南北位移最小刻度
|
||
rootObj["MaxYn"] = m_pTvd->objViewInfo->m_MaxYn; // 俯视图参数-南北位移最大刻度
|
||
rootObj["bPlotBhx"] = m_pTvd->objViewInfo->m_bPlotBhx; // 俯视图参数-是否绘制闭合线
|
||
|
||
// 侧视图参数
|
||
rootObj["Title_cst"] = m_pTvd->objViewInfo->m_Title_cst; // 侧视图参数-标题名
|
||
rootObj["heqw"] = m_pTvd->objViewInfo->m_heqw; // 侧视图参数-高宽相同
|
||
|
||
// 侧视图(水平位移)
|
||
rootObj["MaxWy_HOFF"] = m_pTvd->objViewInfo->m_MaxWy_HOFF; // 侧视图(水平位移)-最大侧视位移(m)
|
||
rootObj["MinWy_HOFF"] = m_pTvd->objViewInfo->m_MinWy_HOFF; // 侧视图(水平位移)-最小侧视位移(m)
|
||
rootObj["MaxTVD_HOFF"] = m_pTvd->objViewInfo->m_MaxTVD_HOFF;// 侧视图(水平位移)-最大垂深(m)
|
||
rootObj["MinTVD_HOFF"] = m_pTvd->objViewInfo->m_MinTVD_HOFF;// 侧视图(水平位移)-最小垂深(m)
|
||
// 侧视图(向东)
|
||
rootObj["MaxWy_XE"] = m_pTvd->objViewInfo->m_MaxWy_XE; // 侧视图(向东)-最大侧视位移(m)
|
||
rootObj["MinWy_XE"] = m_pTvd->objViewInfo->m_MinWy_XE; // 侧视图(向东)-最小侧视位移(m)
|
||
rootObj["MaxTVD_XE"] = m_pTvd->objViewInfo->m_MaxTVD_XE; // 侧视图(向东)-最大垂深(m)
|
||
rootObj["MinTVD_XE"] = m_pTvd->objViewInfo->m_MinTVD_XE; // 侧视图(向东)-最小垂深(m)
|
||
// 侧视图(向北)
|
||
rootObj["MaxWy_YN"] = m_pTvd->objViewInfo->m_MaxWy_YN; // 侧视图(向北)-最大侧视位移(m)
|
||
rootObj["MinWy_YN"] = m_pTvd->objViewInfo->m_MinWy_YN; // 侧视图(向北)-最小侧视位移(m)
|
||
rootObj["MaxTVD_YN"] = m_pTvd->objViewInfo->m_MaxTVD_YN; // 侧视图(向北)-最大垂深(m)
|
||
rootObj["MinTVD_YN"] = m_pTvd->objViewInfo->m_MinTVD_YN; // 侧视图(向北)-最小垂深(m)
|
||
// 侧视图(侧视角)
|
||
rootObj["MaxWy"] = m_pTvd->objViewInfo->m_MaxWy; // 侧视图(侧视角)-最大侧视位移(m)
|
||
rootObj["MinWy"] = m_pTvd->objViewInfo->m_MinWy; // 侧视图(侧视角)-最小侧视位移(m)
|
||
rootObj["MaxTVD"] = m_pTvd->objViewInfo->m_MaxTVD; // 侧视图(侧视角)-最大垂深(m)
|
||
rootObj["MinTVD"] = m_pTvd->objViewInfo->m_MinTVD; // 侧视图(侧视角)-最小垂深(m)
|
||
rootObj["DepSpace"] = m_pTvd->objViewInfo->m_DepSpace; // 侧视图(侧视角)-深度间隔(m)
|
||
rootObj["DepSpaceN"] = m_pTvd->objViewInfo->m_DepSpaceN; // 侧视图(侧视角)-等分个数(=0按深度间隔)
|
||
rootObj["CsAngle"] = m_pTvd->objViewInfo->m_CsAngle; // 侧视图(侧视角)-侧视角(度)
|
||
|
||
// 立体轨迹图参数
|
||
rootObj["Title_ltgj"] = m_pTvd->m_Title_ltgj; // 立体轨迹图参数-标题名
|
||
rootObj["MaxWy1"] = m_pTvd->objViewInfo->m_MaxWy1; // 立体轨迹图参数-最大位移(m)
|
||
rootObj["LTTTVD"] = m_pTvd->objViewInfo->m_LTTTVD; // 立体轨迹图参数-起始垂深(m)
|
||
rootObj["DepSpace1"] = m_pTvd->objViewInfo->m_DepSpace1; // 立体轨迹图参数-垂深间隔(m)
|
||
rootObj["is3DFrame"] = m_pTvd->objViewInfo->m_is3DFrame; // 立体轨迹图参数-是否绘制立体框
|
||
rootObj["LttAngle_X"] = m_pTvd->objViewInfo->m_LttAngle_X; // 立体轨迹图参数-俯视角(度)
|
||
rootObj["LttAngle"] = m_pTvd->objViewInfo->m_LttAngle; // 立体轨迹图参数-侧视角(度)
|
||
rootObj["LttAngle_Z"] = m_pTvd->objViewInfo->m_LttAngle_Z; // 立体轨迹图参数-倾斜角(度)
|
||
rootObj["LTTTVD"] = m_pTvd->objViewInfo->m_LTTTVD; // 立体轨迹图参数-竖线间隔
|
||
rootObj["YD"] = m_pTvd->objViewInfo->m_YD; // 立体轨迹图参数-俯视南北间隔数
|
||
rootObj["XD"] = m_pTvd->objViewInfo->m_XD; // 立体轨迹图参数-俯视东西间隔数
|
||
rootObj["IsDrawProperty"] = m_pTvd->objViewInfo->m_IsDrawProperty; // 立体轨迹图参数-附加属性类型
|
||
rootObj["CurveName1"] = m_pTvd->objViewInfo->m_CurveName1; // 立体轨迹图参数-选择井曲线1
|
||
rootObj["CurveName2"] = m_pTvd->objViewInfo->m_CurveName2; // 立体轨迹图参数-选择井曲线2
|
||
rootObj["ColorTableIndex"] = m_pTvd->objViewInfo->m_ColorTableIndex; // 立体轨迹图参数-调色板参数设置
|
||
rootObj["calscale"] = m_pTvd->objViewInfo->m_calscale; // 立体轨迹图参数-直径放大系数
|
||
rootObj["baseval"] = m_pTvd->objViewInfo->m_baseval; // 立体轨迹图参数-波形基值
|
||
rootObj["maxval"] = m_pTvd->objViewInfo->m_maxval; // 立体轨迹图参数-波形最大值
|
||
rootObj["isBlock"] = m_pTvd->objViewInfo->m_isBlock; // 立体轨迹图参数-连续填充
|
||
|
||
// 立体闭合方位线型
|
||
// rootObj["linewidth"] = m_pTvd->objViewInfo->m_linewidth; // 立体闭合方位线型-线宽
|
||
// rootObj["linecolor"] = m_pTvd->objViewInfo->m_linecolor; // 立体闭合方位线型-颜色
|
||
|
||
// 立体轨迹图参数
|
||
rootObj["Rlev"] = m_pTvd->objViewInfo->m_Rlev; // 立体轨迹图参数-最小深度间隔(m)
|
||
|
||
// 立体井径线型
|
||
// rootObj["linewidth"] = m_pTvd->objViewInfo->m_linewidth; // 立体井径线型-线宽
|
||
// rootObj["linecolor"] = m_pTvd->objViewInfo->m_linecolor; // 立体井径线型-颜色
|
||
}
|
||
|
||
void FormInfo::paintEvent(QPaintEvent* event)
|
||
{
|
||
QPainter painter(this);
|
||
QRect rect = this->rect();
|
||
//背景透明
|
||
painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(0, 0, 0, 0)); //QColor(67, 67, 67, 100)
|
||
|
||
if(m_newFillMode=="无填充" || m_newHeadFill == "不绘制")
|
||
{
|
||
painter.setBrush(Qt::NoBrush);
|
||
}
|
||
else //if(m_newFillMode=="填充" && m_newHeadFill == "绘制")
|
||
{
|
||
if(m_newFillType == "岩性模式")
|
||
{
|
||
QColor oldFrontColor(0, 0, 0); // 原始颜色
|
||
QColor oldBackColor(255, 255, 255); // 原始颜色
|
||
//
|
||
QImage image(m_newLithosImage);
|
||
for (int y = 0; y < image.height(); ++y) {
|
||
for (int x = 0; x < image.width(); ++x) {
|
||
QColor pixelColor = QColor(image.pixel(x, y));
|
||
if (pixelColor == oldFrontColor) {
|
||
image.setPixelColor(x, y, m_frontColor); // 使用 setPixelColor 来设置新颜色
|
||
}
|
||
if (pixelColor == oldBackColor) {
|
||
image.setPixelColor(x, y, m_backColor); // 使用 setPixelColor 来设置新颜色
|
||
}
|
||
}
|
||
}
|
||
//
|
||
painter.setBrush(QBrush(QPixmap::fromImage(image)));
|
||
|
||
//painter.setBrush(QBrush(QPixmap(m_newLithosImage)));
|
||
//graph(0)->setBrush(QBrush(QPixmap(":/image/file.png")));
|
||
}
|
||
else if(m_newFillType == "颜色模式")
|
||
{
|
||
painter.setBrush(QBrush(m_newColor));
|
||
}
|
||
else if(m_newFillType == "成像化")
|
||
{
|
||
|
||
}
|
||
}
|
||
//painter.setBrush(QBrush(Qt::red, Qt::SolidPattern));
|
||
QRect rectRound(rect.left()+2,rect.top()+4, rect.width()-4, rect.height()-8);
|
||
painter.setPen(QPen(m_lineColor, m_dWidth, m_lineStyle));
|
||
//painter.drawRoundRect(rectRound);//利用画刷(颜色/岩性图片),画框
|
||
painter.drawRect(rectRound);
|
||
|
||
QString strShowTxt = "";
|
||
painter.setBrush(Qt::NoBrush); // 确保文字不被填充色遮挡
|
||
painter.setFont(m_curveNameFont);
|
||
painter.setPen(m_lineColor); // fontColor QColor(220, 220, 220)
|
||
//painter.drawText(rect.left() + 20, 30, m_strAliasName); // titleBarText QStringLiteral("动画")
|
||
//painter.drawText(rect, Qt::AlignCenter, m_strAliasName);
|
||
if(m_strAliasName == "")
|
||
{
|
||
//painter.drawText(rect.left(), rect.top(), rect.width(), rect.height()/3, Qt::AlignCenter, m_strLineName);
|
||
}
|
||
else {
|
||
//气测/FMT/射孔/文本
|
||
if(m_strType=="JiegutextObject")
|
||
{
|
||
QStringList list = m_strAliasName.split("/");//QString字符串分割函数
|
||
int iMaxNum = list.size();
|
||
if (iMaxNum > 1)
|
||
{
|
||
float fSpace = rect.width()/(float)iMaxNum;
|
||
for(int i=0; i<iMaxNum; i++)
|
||
{
|
||
painter.save();
|
||
painter.rotate(90);
|
||
int x = rect.left() + i*fSpace + 0.5*fSpace;
|
||
int y = rect.top()+4;
|
||
|
||
//painter.drawText(rect.top()+4, rect.left() + i*fSpace + 0.5*fSpace, list[i]);
|
||
painter.drawText(y, -x, list[i]);
|
||
painter.restore(); // 恢复原始状态
|
||
//break;
|
||
}
|
||
for(int i=0; i<iMaxNum-1; i++)
|
||
{
|
||
QPointF p1 = QPointF(rect.left() + (i+1)*fSpace, rect.top()+4);
|
||
QPointF p2 = QPointF(rect.left() + (i+1)*fSpace, rect.bottom()-4);
|
||
painter.drawLine(p1, p2);
|
||
}
|
||
}
|
||
else {
|
||
painter.drawText(rect.left(), rect.top(), rect.width(), rect.height()/3, Qt::AlignCenter, m_strAliasName);
|
||
}
|
||
return;
|
||
}
|
||
|
||
//iSelect=0未知,1标准曲线,2主校曲线,3从校曲线
|
||
QString strAliasNameTmp = m_strAliasName;
|
||
if(m_iSelect==0)
|
||
{
|
||
strAliasNameTmp = strAliasNameTmp;
|
||
}
|
||
else if(m_iSelect==1)
|
||
{
|
||
if(m_bMerge)//是拼接状态
|
||
{
|
||
strAliasNameTmp = strAliasNameTmp + "-目";
|
||
}
|
||
else {
|
||
strAliasNameTmp = strAliasNameTmp + "-标";
|
||
}
|
||
}
|
||
else if(m_iSelect==2)
|
||
{
|
||
if(m_bMerge)//是拼接状态
|
||
{
|
||
strAliasNameTmp = strAliasNameTmp + "-源";
|
||
}
|
||
else {
|
||
strAliasNameTmp = strAliasNameTmp + "-主校";
|
||
}
|
||
}
|
||
else if(m_iSelect==3)
|
||
{
|
||
if(m_bMerge)//是拼接状态
|
||
{
|
||
strAliasNameTmp = strAliasNameTmp + "-从接";
|
||
}
|
||
else {
|
||
strAliasNameTmp = strAliasNameTmp + "-从校";
|
||
}
|
||
}
|
||
strShowTxt = strAliasNameTmp;
|
||
//painter.drawText(rect.left(), rect.top(), rect.width(), rect.height()/3, Qt::AlignCenter, strAliasNameTmp);
|
||
}
|
||
|
||
if(m_strType=="waveObject")
|
||
{
|
||
painter.drawText(rect.left(), rect.top(), rect.width(), 30, Qt::AlignCenter, m_strLineName);
|
||
|
||
if (m_nDrawType == 0 || m_nDrawType == 1)
|
||
{
|
||
int nbot = rect.bottom()- rect.height() / 3.0;
|
||
QVector<QPointF> pts;
|
||
int i = 0;
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 15.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 12.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 9.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 6.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 3.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 9.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot - rect.height() / 15.0));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0 + (i++)*rect.width() / 3.0 / 8.0, nbot));
|
||
pts.append(QPointF(rect.left() + rect.width() / 3.0, nbot));
|
||
|
||
if (m_nDrawType == 1) {
|
||
QPolygonF cRgn;
|
||
for (int j = 0; j < pts.size(); j++) {
|
||
cRgn.push_back(pts[j]);
|
||
}
|
||
QPainterPath path;
|
||
path.addPolygon(cRgn);
|
||
painter.fillPath(path, QBrush(m_lineColor));
|
||
}
|
||
else
|
||
{
|
||
painter.drawPolygon(pts);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
QtColorTableData::getInstance()->SetCurrentSchemeIndex(m_nSchemeIndex);
|
||
//ColorTableIndex = ind;
|
||
|
||
QtColorTableData::getInstance()->ChangeColorNum(m_nColorNum);
|
||
QList<QRgb> rgbList = QtColorTableData::getInstance()->GetRgb();
|
||
int iColorNum = rgbList.size();
|
||
|
||
//头部绘制调色板
|
||
float scale = (float)(rect.width() - 4) / (float)iColorNum;
|
||
QRectF rt7 = QRectF(rect.left() + 2, rect.top() + rect.height() / 3, rect.width() - 4, rect.height() / 3);
|
||
for (int i = 0; i < iColorNum; i++)
|
||
{
|
||
QColor acolor = rgbList.at(i);
|
||
float temp = (float)i * scale;
|
||
if (i)rt7.setLeft(rect.left() + 2 + temp);
|
||
else rt7.setLeft(rect.left() + 2 + temp + 1);
|
||
temp = (float)(i + 1) * scale;
|
||
rt7.setRight(rect.left() + 2 + temp);
|
||
QBrush HeadBrush = QBrush(acolor);
|
||
painter.fillRect(rt7, HeadBrush);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if(m_strLineName=="RESULT")
|
||
{
|
||
//解释结论,不绘制左右范围
|
||
strShowTxt = "解释结论";
|
||
}
|
||
else if(m_strLineName=="CORE_PHYSICS")
|
||
{
|
||
//岩心分析,不绘制左右范围
|
||
// strShowTxt = "岩心实验数据";
|
||
}
|
||
else if(m_strLineName=="FRAC_HOLE.TABLE" && m_strType=="tableObject")
|
||
{
|
||
//蝌蚪图,不绘制左右范围
|
||
strShowTxt = "蝌蚪图";
|
||
}
|
||
|
||
if (strShowTxt.length()>0)
|
||
{
|
||
QRect rt = rect;
|
||
QString text = "";
|
||
if (!m_bVerticaDrawing)
|
||
{
|
||
rt.setX(rect.left());
|
||
rt.setY(rect.top() + rect.height() / 3);
|
||
rt.setWidth(rect.width());
|
||
rt.setHeight(rect.height() / 3);
|
||
text = strShowTxt;
|
||
}
|
||
else
|
||
{
|
||
for (int i = 0; i < strShowTxt.size(); i++) {
|
||
if (!i)text += strShowTxt.at(i);
|
||
else {
|
||
text += "\n";
|
||
text += strShowTxt.at(i);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (m_nRotationAngle != 0)
|
||
{
|
||
// 获取文本的精确尺寸
|
||
QFontMetrics fm(m_curveUnitFont);
|
||
int textWidth = fm.horizontalAdvance(text);
|
||
int textHeight = fm.height();
|
||
|
||
painter.save();
|
||
painter.translate(rect.center()); // 将原点移到控件中心
|
||
painter.rotate(m_nRotationAngle); // 顺时针旋转90度
|
||
|
||
// 3. 绘制文本(相对于新原点居中)
|
||
painter.drawText(-textWidth / 2, // x偏移:向左一半宽度
|
||
-textHeight / 2, // y偏移:向上一半高度
|
||
text);
|
||
|
||
painter.restore();
|
||
}
|
||
else
|
||
{
|
||
painter.drawText(rt, Qt::AlignCenter, text);
|
||
}
|
||
}
|
||
|
||
//单位------------------------------
|
||
painter.setFont(m_curveUnitFont);
|
||
painter.setPen(m_lineColor);
|
||
//painter.drawText(rect.left() + 20, 55, m_strUnit);
|
||
//painter.drawText(rect.left() + 20, 80, QString::number(m_vmin)+" ~ "+QString::number(m_vmax));
|
||
|
||
//
|
||
if(m_strType=="tableObject" && (m_strLineName=="WORDS_RELUST" || m_strLineName == "RESULT"
|
||
|| m_strLineName == "GEO_LITH"|| m_strLineName == "SWALL_CORE"
|
||
|| m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT"
|
||
|| m_strLineName == "CORE_PHYSICS" || m_strLineName == "IMAGE_DATA"
|
||
|| m_strLineName == "LAYER_DATA") )
|
||
{
|
||
|
||
}
|
||
else {
|
||
if(m_strType=="waveObject"
|
||
|| m_strType=="curveObject")
|
||
{
|
||
QFont oldFont = painter.font();
|
||
painter.setFont(m_strUnitFont);
|
||
painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit);
|
||
painter.setFont(oldFont);
|
||
// 显示刻度
|
||
if (m_bShowScale)
|
||
{
|
||
painter.setFont(m_curveScaleFont);
|
||
QFontMetrics fm1(m_curveScaleFont);
|
||
QRect textRect = fm1.boundingRect(QString::number(m_vmax, 'f', 0));
|
||
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignLeft | Qt::AlignVCenter, QString::number(m_vmin));// +" ~ " + QString::number(m_vmax));
|
||
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width() - textRect.width(), rect.height() / 3, Qt::AlignRight | Qt::AlignVCenter, QString::number(m_vmax));
|
||
}
|
||
}
|
||
}
|
||
|
||
if(m_strLineName=="井眼垮塌矢量图"
|
||
|| m_strLineName=="井斜方位图")
|
||
{
|
||
painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3, Qt::AlignCenter, m_strUnit);
|
||
painter.drawText(rect.left(), rect.top()+rect.height()*2/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, QString::number(m_vmin)+" ~ "+QString::number(m_vmax));
|
||
}
|
||
|
||
if(m_strLineName == "深度")
|
||
{
|
||
painter.setFont(m_strUnitFont);
|
||
painter.drawText(rect.left(), rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, this->m_strUnit);
|
||
}
|
||
if(m_strType == "tableObject" && m_strLineName == "CORE_PHYSICS")
|
||
{
|
||
QFont oldFont = painter.font();
|
||
painter.setFont(m_strUnitFont);
|
||
painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit);
|
||
painter.setFont(oldFont);
|
||
// 显示刻度
|
||
if (m_bShowScale)
|
||
{
|
||
painter.setFont(m_curveScaleFont);
|
||
QFontMetrics fm1(m_curveScaleFont);
|
||
QRect textRect = fm1.boundingRect(QString::number(m_vmax, 'f', 0));
|
||
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignLeft | Qt::AlignVCenter, QString::number(m_vmin));// +" ~ " + QString::number(m_vmax));
|
||
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width() - textRect.width(), rect.height() / 3, Qt::AlignRight | Qt::AlignVCenter, QString::number(m_vmax));
|
||
}
|
||
}
|
||
QWidget::paintEvent(event);
|
||
}
|
||
|
||
void FormInfo::dragEnterEvent(QDragEnterEvent* event)
|
||
{
|
||
qDebug() << "FormInfo dragEnterEvent";
|
||
|
||
const QMimeData* mimeData = event->mimeData();
|
||
// 检查拖拽的数据类型,确定是否接受拖拽
|
||
if (event->mimeData()->hasFormat("text/plain")) {
|
||
event->acceptProposedAction();
|
||
//QApplication::setOverrideCursor(Qt::PointingHandCursor); // 设置鼠标为可添加状态
|
||
}
|
||
else
|
||
{
|
||
event->ignore();
|
||
//QApplication::setOverrideCursor(Qt::ForbiddenCursor); // 设置鼠标为不可添加状态
|
||
}
|
||
}
|
||
|
||
void FormInfo::dragMoveEvent(QDragMoveEvent* event)
|
||
{
|
||
qDebug() << "FormInfo dragMoveEvent";
|
||
|
||
// 可以在这里更新鼠标的位置,根据位置判断是否可以放置
|
||
// ...
|
||
//dragEnterEvent(event); // 可以使用相同的逻辑
|
||
//event->accept();
|
||
}
|
||
|
||
void FormInfo::dropEvent(QDropEvent* event)
|
||
{
|
||
qDebug() << "FormInfo dropEvent";
|
||
|
||
// 处理放置动作,更新UI或数据
|
||
if (event->mimeData()->hasFormat("text/plain")) {
|
||
// 获取拖拽的数据
|
||
QString strExtern = event->mimeData()->text();
|
||
qDebug() << strExtern;
|
||
//
|
||
QStringList list = strExtern.split("#@@#");//QString字符串分割函数
|
||
if (list.size() > 3)
|
||
{
|
||
QString strSlfName = list[0];
|
||
QString strWellName = list[1];
|
||
QString strLineName = list[2];
|
||
QString strType = list[3];
|
||
|
||
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strLineName:" << strLineName << " strType:" << strType;
|
||
|
||
if(m_strWellName == strWellName)
|
||
{
|
||
if(strType=="curveObject")
|
||
{
|
||
//新建曲线
|
||
emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||
}
|
||
else if(strType=="waveObject")
|
||
{
|
||
//新建波列
|
||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||
}
|
||
else if(strType=="tableObject")
|
||
{
|
||
//新建表格曲线
|
||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||
}
|
||
// 接受拖拽事件
|
||
event->setDropAction(Qt::MoveAction);
|
||
event->accept();
|
||
}
|
||
else
|
||
{
|
||
// 如果井名不正确,不接受拖拽事件
|
||
event->ignore();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// 如果数据格式不正确,不接受拖拽事件
|
||
event->ignore();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// 如果数据格式不正确,不接受拖拽事件
|
||
event->ignore();
|
||
}
|
||
// 恢复鼠标光标
|
||
//QApplication::restoreOverrideCursor();
|
||
}
|
||
|
||
// Get
|
||
int FormInfo::cpLineWidth() const
|
||
{
|
||
return m_cp_lineWidth;
|
||
}
|
||
|
||
// Set
|
||
void FormInfo::setCpLineWidth(int cpLineWidth)
|
||
{
|
||
m_cp_lineWidth = cpLineWidth;
|
||
|
||
}
|
||
|
||
//线宽
|
||
void FormInfo::setLineWidth(double dWidth)
|
||
{
|
||
m_dWidth = dWidth;
|
||
}
|
||
|
||
double FormInfo::getLineWidth()
|
||
{
|
||
return m_dWidth;
|
||
}
|
||
|
||
//线型
|
||
void FormInfo::setLineStyle(Qt::PenStyle lineStyle)
|
||
{
|
||
m_lineStyle = lineStyle;
|
||
}
|
||
|
||
Qt::PenStyle FormInfo::getLineStyle()
|
||
{
|
||
return m_lineStyle;
|
||
}
|
||
|
||
void FormInfo::setVMax(float vmax)
|
||
{
|
||
m_vmax = vmax;
|
||
}
|
||
|
||
float FormInfo::getVMax()
|
||
{
|
||
return m_vmax;
|
||
}
|
||
|
||
void FormInfo::setVMin(float vmin)
|
||
{
|
||
m_vmin = vmin;
|
||
}
|
||
|
||
float FormInfo::getVMin()
|
||
{
|
||
return m_vmin;
|
||
}
|
||
|
||
void FormInfo::setFrontColor(QColor frontColor)
|
||
{
|
||
m_frontColor = frontColor;
|
||
}
|
||
|
||
QColor FormInfo::getFrontColor()
|
||
{
|
||
return m_frontColor;
|
||
}
|
||
|
||
void FormInfo::setBackColor(QColor backColor)
|
||
{
|
||
m_backColor = backColor;
|
||
}
|
||
|
||
QColor FormInfo::getBackColor()
|
||
{
|
||
return m_backColor;
|
||
}
|
||
|
||
bool FormInfo::setInfoProperty(QString strProName, QVariant val)
|
||
{
|
||
bool bDraw = false;
|
||
if ("显示名称" == strProName)
|
||
{
|
||
this->m_strAliasName = val.toString();
|
||
}
|
||
else if ("显示单位" == strProName)
|
||
{
|
||
this->m_strUnit = val.toString();
|
||
}
|
||
else if ("曲线名称" == strProName || "字体" == strProName)
|
||
{
|
||
this->m_curveNameFont = val.value<QFont>();
|
||
}
|
||
else if ("曲线单位" == strProName)
|
||
{
|
||
this->m_curveUnitFont = val.value<QFont>();
|
||
}
|
||
else if ("曲线刻度" == strProName)
|
||
{
|
||
this->m_curveScaleFont = val.value<QFont>();
|
||
}
|
||
else if ("类型" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_nDrawType = val.toInt();
|
||
}
|
||
else if ("方式" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_nFillType = val.toInt();
|
||
}
|
||
else if ("左刻度" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_vmin = val.toDouble();
|
||
}
|
||
else if ("右刻度" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_vmax = val.toDouble();
|
||
}
|
||
else if ("幅度刻度" == strProName)
|
||
{
|
||
this->m_strAmp = val.toString();
|
||
}
|
||
else if ("最大振幅" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_fMaxAmp = val.toFloat();
|
||
}
|
||
else if ("显示刻度" == strProName)
|
||
{
|
||
this->m_bShowScale = val.toBool();
|
||
}
|
||
else if ("绘制波深度" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_bDrawDepth = val.toBool();
|
||
}
|
||
else if ("绘制波基线" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_bDrawBase = val.toBool();
|
||
}
|
||
else if ("奇偶配色" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_bOddEven = val.toBool();
|
||
}
|
||
else if ("波列基值" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_fWaveBase = val.toFloat();
|
||
}
|
||
else if ("波形间隔" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_nWaveJg = val.toInt();
|
||
}
|
||
else if ("波形高度" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_fWaveHei = val.toInt();
|
||
}
|
||
else if ("颜色" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_lineColor = val.value<QColor>();
|
||
}
|
||
else if ("线宽" == strProName)
|
||
{
|
||
this->m_dWidth = val.toInt();
|
||
}
|
||
else if ("色板" == strProName)
|
||
{
|
||
this->m_nSchemeIndex = val.toInt();
|
||
return true;
|
||
}
|
||
else if ("变密度颜色级数" == strProName)
|
||
{
|
||
this->m_nColorNum = val.toInt();
|
||
return true;
|
||
}
|
||
else if ("垂向绘制" == strProName)
|
||
{
|
||
this->m_bVerticaDrawing = val.toBool();
|
||
}
|
||
else if ("旋转角度(°)" == strProName)
|
||
{
|
||
this->m_nRotationAngle = val.toInt();
|
||
}
|
||
else if ("结论占比%" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_nConclusionProportion = val.toInt();
|
||
}
|
||
else if ("显示位置(cm)" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_nShowPos = val.toInt();
|
||
}
|
||
else if ("显示层号" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_bShowLayerNo = val.toBool();
|
||
}
|
||
else if ("层号字体" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_layerFont = val.value<QFont>();
|
||
}
|
||
else if ("层号旋转" == strProName)
|
||
{
|
||
bDraw = true;
|
||
this->m_fLayerRotate = val.toFloat();
|
||
}
|
||
|
||
this->update();
|
||
return bDraw;
|
||
}
|
||
|
||
int FormInfo::getFillTypeIndex()
|
||
{
|
||
return m_nFillType;
|
||
}
|
||
|
||
//修改曲线选择状态 iSelect=0未知,1标准曲线,2主曲线,3从曲线
|
||
void FormInfo::s_ChangeLineStatus(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iSelect, bool bMerge)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_iSelect = iSelect;
|
||
m_bMerge = bMerge;
|
||
update();
|
||
}
|
||
}
|
||
|
||
//属性-左刻度
|
||
void FormInfo::s_ChangeLeftScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_vmin = newLeftScale;
|
||
update();
|
||
}
|
||
}
|
||
|
||
//属性-右刻度
|
||
void FormInfo::s_ChangeRightScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_vmax = newRightScale;
|
||
update();
|
||
}
|
||
}
|
||
|
||
//属性-刻度类型
|
||
void FormInfo::s_ChangeScaleType(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_strScaleType = strScaleType;
|
||
}
|
||
}
|
||
|
||
//属性-颜色
|
||
void FormInfo::s_ChangeLineColor(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_lineColor = lineColor;
|
||
update();
|
||
}
|
||
}
|
||
|
||
//属性-线宽
|
||
void FormInfo::s_ChangeLineWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double width)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_dWidth = width;
|
||
update();
|
||
}
|
||
}
|
||
|
||
//属性-线型
|
||
void FormInfo::s_ChangeLineStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, Qt::PenStyle lineStyle)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_lineStyle = lineStyle;
|
||
update();
|
||
}
|
||
}
|
||
|
||
//数据点 符号类型
|
||
void FormInfo::s_ChangePointStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QCPScatterStyle::ScatterShape pointStyle)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_pointStyle = pointStyle;
|
||
//update();
|
||
}
|
||
}
|
||
|
||
//曲线
|
||
void FormInfo::s_ChangeDrawLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawLine)
|
||
{
|
||
m_bDrawLine = bDrawLine;
|
||
}
|
||
|
||
//杆状
|
||
void FormInfo::s_ChangeDrawGan(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawGan)
|
||
{
|
||
m_bDrawGan = bDrawGan;
|
||
}
|
||
|
||
//点状
|
||
void FormInfo::s_ChangeDrawPoint(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawPoint)
|
||
{
|
||
m_bDrawPoint = bDrawPoint;
|
||
}
|
||
|
||
//绘制对称曲线
|
||
void FormInfo::s_ChangeDrawSymmetry(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawSymmetry)
|
||
{
|
||
m_bDrawSymmetry = bDrawSymmetry;
|
||
}
|
||
|
||
void FormInfo::s_ChangeTvdProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||
QObject *pTvd)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_pTvd = dynamic_cast<CDrawTvd*>(pTvd);
|
||
if (m_pTvd)
|
||
{
|
||
m_pTvd->m_AliasWellName = m_strWellName;
|
||
}
|
||
}
|
||
}
|
||
|
||
//岩性填充-不填充
|
||
void FormInfo::s_ClearFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_newFillMode = "无填充";
|
||
update();
|
||
}
|
||
}
|
||
|
||
//岩性填充-填充
|
||
void FormInfo::s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow)
|
||
{
|
||
if(m_strUuid == strUuid &&
|
||
m_strSlfName == strSlfName &&
|
||
m_strWellName == strWellName &&
|
||
m_strTrackName == strTrackName &&
|
||
m_strLineName == strLineName)
|
||
{
|
||
m_newFillType = newFillType;
|
||
m_newTargetLine = newTargetLine;
|
||
m_newColor = newColor;
|
||
m_newLithosImage = newLithosImage;
|
||
m_newHeadFill = newHeadFill;
|
||
m_new_vMin = vMin;
|
||
m_new_vMax = vMax;
|
||
m_strOtherScaleType = strOtherScaleType;
|
||
m_frontColor = frontColor;
|
||
m_backColor = backColor;
|
||
m_newFillMode = newFillMode;//"填充";
|
||
|
||
update();
|
||
|
||
}
|
||
}
|
||
|
||
void FormInfo::contextMenuEvent(QContextMenuEvent *event)
|
||
{
|
||
//曲线
|
||
if(m_strType=="curveObject")
|
||
{
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), "数据对象查看", this, &FormInfo::onShowCurve);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteCurv);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if(m_strType=="tableObject")
|
||
{
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), "数据对象查看", this, &FormInfo::onShowTable);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteTable);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if(m_strType=="JiegutextObject")
|
||
{
|
||
//气测/FMT/射孔/文本
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), "数据对象查看", this, &FormInfo::onShowTable);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteTable);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if(m_strType=="LogfaceObject")
|
||
{
|
||
//沉积相
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), "数据对象查看", this, &FormInfo::onShowTable);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteTable);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
else if(m_strType=="TubingstringObject")
|
||
{
|
||
//套管组件
|
||
QMenu menu(this);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), "数据对象查看", this, &FormInfo::onShowTable);
|
||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除当前对象", this, &FormInfo::onDeleteTable);
|
||
menu.exec(event->globalPos());
|
||
}
|
||
}
|
||
|
||
//曲线数据查看
|
||
void FormInfo::onShowCurve()
|
||
{
|
||
emit CallManage::getInstance()->sig_ShowCurve(m_strSlfName, m_strLineName);
|
||
}
|
||
//删除曲线
|
||
void FormInfo::onDeleteCurv()
|
||
{
|
||
//删除曲线
|
||
emit CallManage::getInstance()->sig_delLine(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||
}
|
||
|
||
//表格查看
|
||
void FormInfo::onShowTable()
|
||
{
|
||
emit CallManage::getInstance()->sig_ShowTable(m_strSlfName, m_strLineName);
|
||
}
|
||
//删除表格
|
||
void FormInfo::onDeleteTable()
|
||
{
|
||
//删除表格
|
||
emit CallManage::getInstance()->sig_delTableLine(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||
}
|