1.优化json模板加载逻辑。针对已经打开的视图上“加载图文件”按钮也做了处理。2.参照老版本逻辑处理多井的模板加载

This commit is contained in:
jiayulong 2026-05-29 16:47:49 +08:00
parent 167968f78a
commit 86a57052ef
9 changed files with 526 additions and 404 deletions

View File

@ -34,6 +34,10 @@ extern QString g_prjname;
extern int g_iSupport3D;
//左侧树图选中井次
extern QString g_strSlfName;
extern QString g_strWellName;
// extern void AppendConsole(Priority priority, const QString &output);
//曲线绘制(多个)
@ -565,38 +569,41 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
void FormDraw::displayCorePhysics(QJsonObject jsonObject)
{
QStringList listOtherProperty;
QString strSlfName;
QString strWellName;
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strType = jsonObject.value("Type").toString();
QString strLineName = jsonObject.value("LineName").toString();
if (jsonObject.contains("SlfName"))
{
QJsonValue value = jsonObject.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
// if (jsonObject.contains("SlfName"))
// {
// QJsonValue value = jsonObject.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
}
}
if (jsonObject.contains("WellName"))
{
QJsonValue value = jsonObject.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// }
// }
// if (jsonObject.contains("WellName"))
// {
// QJsonValue value = jsonObject.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
//此处改为直接使用左侧树图的值
listOtherProperty.append(strSlfName);
// 例区高度
@ -788,39 +795,39 @@ void FormDraw::displayCorePhysics(QJsonObject jsonObject)
void FormDraw::displayImageData(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -880,9 +887,9 @@ void FormDraw::displayImageData(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
QStringList listOtherProperty;
listOtherProperty.append(strAliasName);//别名
@ -905,39 +912,39 @@ void FormDraw::displayImageData(QJsonObject lineObjInfo)
//表格
void FormDraw::DisplayTable_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1054,9 +1061,9 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1135,39 +1142,39 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo)
//固井结论
void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1227,9 +1234,9 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1258,39 +1265,39 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo)
//蝌蚪图
void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1317,9 +1324,9 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1331,39 +1338,39 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo)
//多臂井径
void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1390,9 +1397,9 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1404,39 +1411,39 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo)
//气测/FMT/射孔/文本
void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1478,9 +1485,9 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1498,39 +1505,39 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo)
//沉积相
void FormDraw::DisplayFac_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1599,9 +1606,9 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1645,40 +1652,40 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo)
//套管組件
void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strUnit = "";//单位
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1841,9 +1848,9 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{
@ -1922,39 +1929,39 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo)
//斜井三图一表
void FormDraw::DisplayTvd_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
QString strLineName = "";
QString strAliasName = "";//显示名称
QFont curveNameFont("微软雅黑", 10); // 名称字体
QColor lineColor = QColor(0, 0, 0);//颜色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
if (lineObjInfo.contains("LineName"))
{
QJsonValue value = lineObjInfo.value("LineName");
@ -1997,9 +2004,9 @@ void FormDraw::DisplayTvd_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
QStringList listOtherProperty;
//FormInfo高度
@ -2626,8 +2633,8 @@ void FormDraw::GetTvdProperty(CDrawTvd *drawTvd, QJsonObject lineObjInfo)
void FormDraw::DisplayLine_One(QJsonObject lineObjInfo)
{
QString strSlfName = "";
QString strWellName = "";
QString strSlfName = g_strSlfName;
QString strWellName = g_strWellName;
// QString strTrackName = "";
QString strLineName = "";
QString strAliasName = "";//显示名称
@ -2654,32 +2661,32 @@ void FormDraw::DisplayLine_One(QJsonObject lineObjInfo)
QColor frontColor(0, 0, 0);//岩性前景色
QColor backColor(255, 255, 255);//岩性背景色
if (lineObjInfo.contains("SlfName"))
{
QJsonValue value = lineObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
//qDebug() << "SlfName:" << strSlfName;
// if (lineObjInfo.contains("SlfName"))
// {
// QJsonValue value = lineObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// //qDebug() << "SlfName:" << strSlfName;
//
QString slffilename = QString("");
int ind = strSlfName.lastIndexOf('\\');
int ind2 = strSlfName.lastIndexOf('/');
if (ind2 > ind) ind = ind2;
if (ind > -1) {
slffilename = strSlfName.mid(ind + 1);
strSlfName = slffilename;
}
}
}
if (lineObjInfo.contains("WellName"))
{
QJsonValue value = lineObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
//qDebug() << "WellName:" << strWellName;
}
}
// //
// QString slffilename = QString("");
// int ind = strSlfName.lastIndexOf('\\');
// int ind2 = strSlfName.lastIndexOf('/');
// if (ind2 > ind) ind = ind2;
// if (ind > -1) {
// slffilename = strSlfName.mid(ind + 1);
// strSlfName = slffilename;
// }
// }
// }
// if (lineObjInfo.contains("WellName"))
// {
// QJsonValue value = lineObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// //qDebug() << "WellName:" << strWellName;
// }
// }
// if (lineObjInfo.contains("TrackName"))
// {
// QJsonValue value = lineObjInfo.value("TrackName");
@ -2825,9 +2832,9 @@ void FormDraw::DisplayLine_One(QJsonObject lineObjInfo)
}
}
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
// QString folderPath = GetLogdataPath();
// folderPath = folderPath + g_prjname;
// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
if (strLineName != "")
{

View File

@ -18,6 +18,10 @@ extern int g_iShow; //显示刻度
extern int g_iHeight_MyCustom;
extern int g_WorkSpace_Height;
//左侧树图选中井次
extern QString g_strSlfName;
extern QString g_strWellName;
//井+道名
FormWell::FormWell(QWidget *parent, QString strWellName) :
QWidget(parent),
@ -581,16 +585,16 @@ void FormWell::s_NewTrack_No_Line(QString strUuid, QString strWellName, QString
void FormWell::slot_NewTrack_No_Line(QString strUuid, QJsonObject topObj, QJsonObject infoObj)
{
QString strWellName="";
QString strWellName=g_strWellName;
QString strTrackName="";
if (topObj.contains("WellName"))
{
QJsonValue value = topObj.value("WellName");
if (value.isString()) {
strWellName = value.toString();
qDebug() << "WellName:" << strWellName;
}
}
// if (topObj.contains("WellName"))
// {
// QJsonValue value = topObj.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// qDebug() << "WellName:" << strWellName;
// }
// }
if (topObj.contains("TrackName"))
{
QJsonValue value = topObj.value("TrackName");

View File

@ -61,6 +61,10 @@ int g_iSmallPrint = 0;
int g_iStep = 300;
int g_iPageStep = 1500;
//左侧树图选中井次
QString g_strSlfName = "";
QString g_strWellName = "";
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
@ -623,23 +627,31 @@ void MainWindow::s_showView()
return;
}
QString strSlfName = "";
QString strWellName = "";
QString strLeft = m_projectWidgets->getLeftTreeString();
if (strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
QFileInfo finfo(list[0]);
strSlfName = finfo.fileName();
strWellName = list[1];
}
}
else {
QMessageBox::warning(this, "提示", "请先选中待处理井次!");
return;
}
//---------------------------------
//左侧树图选中井次
g_strSlfName = "";
g_strWellName = "";
QString strLeft = m_projectWidgets->getLeftTreeString();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
g_strSlfName = list[0];
g_strWellName = list[1];
}
}
else {
QMessageBox::warning(this, "提示", "请先选中待处理井次!");
return;
}
if(g_strSlfName=="" || g_strWellName=="")
{
QMessageBox::warning(this, "提示", "请先选中待处理井次!");
return;
}
//---------------------------------
//Logdata
QString folderPath;
@ -680,8 +692,7 @@ void MainWindow::s_showView()
m_centerWidgets->addTab(mainSplitter, fileName);
MainWindowCurve *mainWindowCurve = mainSplitter->getMainWindowCurve();
mainWindowCurve->m_strSlfName = strSlfName;
mainWindowCurve->m_strWellName = strWellName;
mainWindowCurve->Open(fileFull);
//QFuture<void> future = QtConcurrent::run(std::bind(&MainWindowCurve::s_Open, mainWindowCurve, fileFull));

View File

@ -59,6 +59,10 @@ extern int g_iSmallPrint;
int g_iLoadingJson = 0;
//左侧树图选中井次
extern QString g_strSlfName;
extern QString g_strWellName;
MainWindowCurve::MainWindowCurve(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindowCurve)
@ -2926,6 +2930,32 @@ void MainWindowCurve::loadStyle(const QString &qssFile)
void MainWindowCurve::s_Open()
{
//---------------------------------
//左侧树图选中井次
//针对“加载图文件”,支持井或井次
g_strSlfName = "";
g_strWellName = "";
QString strLeft = m_leftWidgets->getLeftTreeString_Import();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
g_strSlfName = list[0];
g_strWellName = list[1];
}
}
else {
QMessageBox::warning(this, "提示", "请先选中待处理井或井次!");
return;
}
if(g_strSlfName=="" || g_strWellName=="")
{
QMessageBox::warning(this, "提示", "请先选中待处理井次!");
return;
}
//---------------------------------
//Logdata
QString folderPath;
folderPath = GetLogdataPath();
@ -5132,21 +5162,21 @@ void MainWindowCurve::Open(QString fileFull)
{
QJsonObject object = document.object();
//
if (object.contains("prjname"))
{
QJsonValue value = object.value("prjname");
if (value.isString()) {
strPrjname = value.toString();
qDebug() << "prjname:" << strPrjname;
// if (object.contains("prjname"))
// {
// QJsonValue value = object.value("prjname");
// if (value.isString()) {
// strPrjname = value.toString();
// qDebug() << "prjname:" << strPrjname;
if(strPrjname != g_prjname)
{
file.close();
qDebug() << "JSON 模板文件项目名称与当前项目不一致!";
return;
}
}
}
// if(strPrjname != g_prjname)
// {
// file.close();
// qDebug() << "JSON 模板文件项目名称与当前项目不一致!";
// return;
// }
// }
// }
//
if (object.contains("iScale"))
{
@ -5655,6 +5685,11 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
int id = 0;
int iCount = wellsArray.size();
if(iCount>1)
{
int flag = QMessageBox::warning(NULL,"提示",QString("图文件或模板中存在多个井文件,\n是否用当前选中井替换原井文件?"),QMessageBox::Yes,QMessageBox::No);
if(flag!=QMessageBox::Yes) return;
}
for(int i=0; i<iCount; i++)
{
QJsonValue wellValue = wellsArray[i];
@ -5697,29 +5732,27 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
//展示其中一口井
void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
{
QString strWellName = m_strWellName;
QString strSlfName = m_strSlfName;
QString strWellName = g_strWellName;
QString strSlfName = g_strSlfName;
QJsonArray tracksArray;
if (strSlfName.length() <= 0)
{
if (wellObjInfo.contains("WellName"))
{
QJsonValue value = wellObjInfo.value("WellName");
if (value.isString()) {
strWellName = value.toString();
qDebug() << "WellName:" << strWellName;
}
}
if (wellObjInfo.contains("SlfName"))
{
QJsonValue value = wellObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
qDebug() << "strSlfName:" << strSlfName;
}
}
}
// if (wellObjInfo.contains("WellName"))
// {
// QJsonValue value = wellObjInfo.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// qDebug() << "WellName:" << strWellName;
// }
// }
// if (wellObjInfo.contains("SlfName"))
// {
// QJsonValue value = wellObjInfo.value("SlfName");
// if (value.isString()) {
// strSlfName = value.toString();
// qDebug() << "strSlfName:" << strSlfName;
// }
// }
if (wellObjInfo.contains("bShowTrackHead"))
{
@ -5792,8 +5825,6 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
if (topVal.isObject() && infoVal.isObject()) {
QJsonObject topObj = topVal.toObject();
QJsonObject infoObj = infoVal.toObject();
topObj["WellName"] = m_strWellName;
//展示其中一道
DisplayTrack_Top(id, topObj, infoObj);
@ -5820,15 +5851,15 @@ void MainWindowCurve::DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject
s_NewTrack_No_Line(trackTop, trackInfo);//新建空白道,没有曲线
//if(id>0)
{
QString strWellName = "";
if (trackTop.contains("WellName"))
{
QJsonValue value = trackTop.value("WellName");
if (value.isString()) {
strWellName = value.toString();
qDebug() << "WellName:" << strWellName;
}
}
QString strWellName = g_strWellName;
// if (trackTop.contains("WellName"))
// {
// QJsonValue value = trackTop.value("WellName");
// if (value.isString()) {
// strWellName = value.toString();
// qDebug() << "WellName:" << strWellName;
// }
// }
double nW = 0;
if (trackTop.contains("TrackW"))
{

View File

@ -74,8 +74,6 @@ public slots:
public:
MainWindowSplitter* m_pParentWin = NULL;
QString m_strSlfName = "";
QString m_strWellName = "";
QString m_strUuid;
QStringList m_listWell;

View File

@ -38,6 +38,54 @@ QString QMyTreeWidget::getCurrentItemString()
}
return sret;
}
//针对“加载图文件”,支持井或井次
QString QMyTreeWidget::getCurrentItemString_Import()
{
QString sret = "";
QTreeWidgetItem *item = currentItem();
if(!item)
return sret;
if(item->parent()==NULL)
{
return sret;
}
QString strTreeTag = item->data(0, Qt::UserRole).toString();
if (strTreeTag == "wellItem")//井次名称
{
//曲线
QString strSlfName = item->data(0, Qt::UserRole+1).toString();
//井名
QString strWellName = item->text(0);
sret = strSlfName + "#@@#"+ strWellName + "#@@#" +item->text(0)+ "#@@#" + strTreeTag;
}
else if (strTreeTag == "wellname" || //井 父节点
//
strTreeTag == "Sheet" || //表格数据
strTreeTag == "ParameterCard" || //参数卡
strTreeTag == "Curve" || //曲线
strTreeTag == "Wave" || //波列数据
strTreeTag == "TDT" || //TDT
//
strTreeTag == "tableObject" ||
strTreeTag == "curveObject" ||
strTreeTag == "cardObject" ||
strTreeTag == "waveObject" ||
strTreeTag == "TDTObject")//井名称
{
//曲线
QString strSlfName = item->data(0, Qt::UserRole+1).toString();
//井名
QString strWellName = item->data(0, Qt::UserRole+2).toString();
sret = strSlfName + "#@@#"+ strWellName + "#@@#" +item->text(0)+ "#@@#" + strTreeTag;
}
return sret;
}
void QMyTreeWidget::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint )
{
QTreeWidget::closeEditor(editor,hint);

View File

@ -18,6 +18,10 @@ public:
~QMyTreeWidget();
QString getCurrentItemString();
//针对“加载图文件”,支持井或井次
QString getCurrentItemString_Import();
Q_SIGNALS:
void closeTreeEditor();

View File

@ -94,6 +94,12 @@ QString QtProjectWidgets::getLeftTreeString()
return ui->treeWidget->getCurrentItemString();
}
//针对“加载图文件”,支持井或井次
QString QtProjectWidgets::getLeftTreeString_Import()
{
return ui->treeWidget->getCurrentItemString_Import();
}
void QtProjectWidgets::slotButtonCancel()
{
m_ReFlag=QDialogButtonBox::StandardButton::Cancel;
@ -415,6 +421,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
QTreeWidgetItem *itemSheet = new QTreeWidgetItem();
itemSheet->setText(0, "表格数据");
itemSheet->setData(0, Qt::UserRole, "Sheet"); // 存储额外数据如ID
itemSheet->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
itemSheet->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名
//itemSheet->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据如ID
//
QIcon iconSheet;
@ -427,6 +435,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
QTreeWidgetItem *itemParameterCard = new QTreeWidgetItem();
itemParameterCard->setText(0, "参数卡");
itemParameterCard->setData(0, Qt::UserRole, "ParameterCard"); // 存储额外数据如ID
itemParameterCard->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
itemParameterCard->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名
//itemParameterCard->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据如ID
//
QIcon iconParameterCard;
@ -438,6 +448,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
QTreeWidgetItem *itemCurve = new QTreeWidgetItem();
itemCurve->setText(0, "曲线");
itemCurve->setData(0, Qt::UserRole, "Curve"); // 存储额外数据如ID
itemCurve->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
itemCurve->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名
//itemAddLog->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据如ID
//
QIcon iconCurve;
@ -449,6 +461,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
QTreeWidgetItem *itemWave = new QTreeWidgetItem();
itemWave->setText(0, "波列数据");
itemWave->setData(0, Qt::UserRole, "Wave"); // 存储额外数据如ID
itemWave->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
itemWave->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名
//itemWave->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据如ID
//
QIcon iconWave;
@ -460,6 +474,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
QTreeWidgetItem *itemTDT = new QTreeWidgetItem();
itemTDT->setText(0, "TDT数据");
itemTDT->setData(0, Qt::UserRole, "TDT"); // 存储额外数据如ID
itemTDT->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
itemTDT->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名
//itemTDT->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据如ID
//
QIcon iconWTDT;

View File

@ -20,6 +20,9 @@ public:
QString getLeftTreeString();
//针对“加载图文件”,支持井或井次
QString getLeftTreeString_Import();
private:
Ui::QtProjectWidgetsClass *ui;