支持从模板加载岩性填充属性

This commit is contained in:
jiayulong 2025-11-06 17:34:31 +08:00
parent e956a8d469
commit 34ac38e5b7
10 changed files with 240 additions and 34 deletions

View File

@ -782,3 +782,39 @@ bool getAllSlf(QString prjname, QVector<QString> &vecSlfList, QVector<QString> &
return true;
}
bool getAliasNameFromIni(QString CurveName, QString &strAliasName, QString &strUnit)
{
QString curveFamilyFilePath = ::GetConfPath() + "CurveFamily_New.ini";
QFile curveFamilyFile(curveFamilyFilePath);
if(!curveFamilyFile.open(QIODevice::ReadOnly | QIODevice::Text)) return false;
bool finished = false;
while(!curveFamilyFile.atEnd())
{
QByteArray line = curveFamilyFile.readLine();
QString str(line);
QStringList strList = str.split("=");
if(strList[0] == CurveName && strList.size()>1)
{
QStringList strListSub = strList[1].split(",");
if(strListSub.size()>3)
{
strAliasName = strListSub[0]; //显示名
strUnit = strListSub[3]; //单位
}
// float minValue = strList[1].toFloat();
// float maxValue = strList[2].toFloat();
// if(minValue < -9999 || minValue > 9999) return false;
// if(maxValue < -9999 || maxValue > 9999) return false;
// if(maxValue <= minValue) return false;
finished = true;
break;
}
}
curveFamilyFile.close();
return finished;
}

View File

@ -82,6 +82,7 @@ QString DoubleToString(double dValue, int nDecimal,int *pReallyDecimal);
void SetSystemExisting(bool exiting);
bool SystemExiting();
bool getAllSlf(QString prjname, QVector<QString> &vecSlfList, QVector<QString> &vecWellList);//直方图获取当前工程下的slf
bool getAliasNameFromIni(QString CurveName, QString &strAliasName, QString &strUnit);//曲线别名,单位
struct WellHead
{

View File

@ -557,8 +557,8 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
//
_CreateVariantPropertyItem("通常", "井曲线", m_strLineName + "@"+m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", "", QVariant::String);
_CreateVariantPropertyItem("通常", "显示单位", "", QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String);
//
_CreateVariantPropertyItem("刻度设置", "左刻度", formInfo->m_vmin, QVariant::Double);
_CreateVariantPropertyItem("刻度设置", "右刻度", formInfo->m_vmax, QVariant::Double);

View File

@ -485,15 +485,17 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
logio->CloseCurve(index);
delete logio;
QString strAliasName="";
QString strUnit="";
bool bFind = getAliasNameFromIni(strLineName, strAliasName, strUnit);//曲线别名
if(!bFind)
{
strAliasName=strLineName;
}
//最大值,最小值
vmax=vmin=val[0];
//vmax=vmin=log(val[0]);
// for(int i=1;i<count;i++)
// {
// if(vmax<val[i])vmax=val[i];
// if(vmin>val[i])vmin=val[i];
// }
//slf文件读取曲线
QVector<double> x, y;
for(int i=0; i<count; i++)
@ -506,15 +508,6 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
//
x.append(-(sdep+ rlev*i));
y.append(val[i]);
/*if(newLeftScale==-9999)
{
if(vmax<log(val[i]))vmax=log(val[i]);
if(vmin>log(val[i]))vmin=log(val[i]);
}
//
x.append(-(sdep+ rlev*i));
y.append(log(val[i]));*/
}
if(newLeftScale!=-9999)
@ -592,11 +585,11 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
if(newLeftScale!=-9999)
{
addRandomGraph(widget, x, y, strSlfName, strLineName,
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit,
newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle);
}
else {
addRandomGraph(widget, x, y, strSlfName, strLineName);
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit);
}
//支持框选
@ -608,7 +601,7 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
//AppendConsole(PAI_INFO, "FormDraw initForm end");
}
void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName,
void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
double newLeftScale, double newRightScale, QString strScaleType, QColor newlineColor, double width, Qt::PenStyle lineStyle)
{
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
@ -659,7 +652,7 @@ void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<
//widget->replot();
}
//道-对象
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, newlineColor, width, m_vmax, m_vmin, strScaleType);
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType);
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph end");
}

View File

@ -52,7 +52,7 @@ public:
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,
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);

View File

@ -91,6 +91,8 @@ QJsonObject FormInfo::makeJson()
rootObj["newColorBlue"] = m_newColor.blue();
rootObj["newColorAlpha"] = m_newColor.alpha();
rootObj["newLithosImage"] = m_newLithosImage;
rootObj["new_vMax"] = m_new_vMax;
rootObj["new_vMin"] = m_new_vMin;
//岩性前景色
rootObj["frontColorRed"] = m_frontColor.red();
rootObj["frontColorGreen"] = m_frontColor.green();
@ -160,12 +162,17 @@ void FormInfo::paintEvent(QPaintEvent* event)
QFont font1("微软雅黑", 10, false, false); //fontSize 10
painter.setFont(font1);
painter.setPen(m_lineColor); // fontColor QColor(220, 220, 220)
painter.drawText(rect.left() + 20, 30, m_strLineName); // titleBarText QStringLiteral("动画")
//painter.drawText(rect.left() + 20, 30, m_strAliasName); // titleBarText QStringLiteral("动画")
//painter.drawText(rect, Qt::AlignCenter, m_strAliasName);
painter.drawText(rect.left(), rect.top(), rect.width(), rect.height()/3, Qt::AlignCenter, m_strAliasName);
QFont font2("微软雅黑", 8, false, false);
painter.setFont(font2);
painter.setPen(m_lineColor);
painter.drawText(rect.left() + 20, 80, QString::number(m_vmin)+" ~ "+QString::number(m_vmax));
//painter.drawText(rect.left() + 20, 55, m_strUnit);
//painter.drawText(rect.left() + 20, 80, QString::number(m_vmin)+" ~ "+QString::number(m_vmax));
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));
QWidget::paintEvent(event);
}

View File

@ -60,6 +60,8 @@ public:
QString m_strWellName;
QString m_strTrackName;
QString m_strLineName;
QString m_strAliasName;//显示名称
QString m_strUnit;//单位
//
double m_dWidth;//线宽
QColor m_lineColor;//颜色

View File

@ -39,8 +39,8 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName)
header->setSectionResizeMode(i, QHeaderView::Stretch);
}
connect(this, SIGNAL(sig_AddLine(QString, QString, QString, QString, QColor, double, float, float, QString)),
this, SLOT(s_addLine(QString, QString, QString, QString, QColor, double, float, float, QString)));
connect(this, SIGNAL(sig_AddLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
this, SLOT(s_addLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
//曲线选中,置顶
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString)));
@ -66,15 +66,15 @@ FormTrack::~FormTrack()
delete ui;
}
void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
{
qDebug()<< "Add";
emit sig_AddLine(strSlfName, strWellName, m_strTrackName, strLineName, lineColor, dWidth, vmax, vmin, strScaleType);
emit sig_AddLine(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
}
void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
{
qDebug() << "FormTrack s_addLine";
@ -85,6 +85,8 @@ void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTr
//曲线信息栏
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor);
formInfo->m_strUuid = m_strUuid;
formInfo->m_strAliasName = strAliasName;
formInfo->m_strUnit = strUnit;
formInfo->m_strScaleType = strScaleType;
formInfo->setLineWidth(dWidth);
formInfo->setVMax(vmax);

View File

@ -60,15 +60,15 @@ public:
//NoLRBorderDelegate *m_delegate;
public:
void Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
void Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
QJsonObject makeJson();
signals:
void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
public slots:
void s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
void s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
};

View File

@ -1147,8 +1147,8 @@ void MainWindowCurve::DisplayLine_One(QJsonObject lineObjInfo)
float new_vMin;//其他目标曲线
float new_vMax;//其他目标曲线
QString strOtherScaleType;//其他目标曲线,刻度类型(线性,对数)
QColor frontColor;//岩性前景色
QColor backColor;//岩性背景色
QColor frontColor(0, 0, 0);//岩性前景色
QColor backColor(255, 255, 255);//岩性背景色
if (lineObjInfo.contains("SlfName"))
{
@ -1269,6 +1269,171 @@ void MainWindowCurve::DisplayLine_One(QJsonObject lineObjInfo)
}
//---------------
if (lineObjInfo.contains("newHeadFill"))
{
QJsonValue value = lineObjInfo.value("newHeadFill");
if (value.isString()) {
newHeadFill = value.toString();
qDebug() << "newHeadFill:" << newHeadFill;
}
}
if (lineObjInfo.contains("newTargetLine"))
{
QJsonValue value = lineObjInfo.value("newTargetLine");
if (value.isString()) {
newTargetLine = value.toString();
qDebug() << "newTargetLine:" << newTargetLine;
}
}
if (lineObjInfo.contains("newFillType"))
{
QJsonValue value = lineObjInfo.value("newFillType");
if (value.isString()) {
newFillType = value.toString();
qDebug() << "newFillType:" << newFillType;
}
}
if (lineObjInfo.contains("newFillMode"))
{
QJsonValue value = lineObjInfo.value("newFillMode");
if (value.isString()) {
newFillMode = value.toString();
qDebug() << "newFillMode:" << newFillMode;
}
}
//
if (lineObjInfo.contains("newColorRed"))
{
QJsonValue value = lineObjInfo.value("newColorRed");
if (value.isDouble()) {
newColor.setRed(value.toInt());
qDebug() << "newColorRed:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("newColorGreen"))
{
QJsonValue value = lineObjInfo.value("newColorGreen");
if (value.isDouble()) {
newColor.setGreen(value.toInt());
qDebug() << "newColorGreen:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("newColorBlue"))
{
QJsonValue value = lineObjInfo.value("newColorBlue");
if (value.isDouble()) {
newColor.setBlue(value.toInt());
qDebug() << "newColorBlue:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("newColorAlpha"))
{
QJsonValue value = lineObjInfo.value("newColorAlpha");
if (value.isDouble()) {
newColor.setAlpha(value.toInt());
qDebug() << "newColorAlpha:" << QString::number(value.toInt());
}
}
if (lineObjInfo.contains("newLithosImage"))
{
QJsonValue value = lineObjInfo.value("newLithosImage");
if (value.isString()) {
newLithosImage = value.toString();
qDebug() << "newLithosImage:" << newLithosImage;
}
}
if (lineObjInfo.contains("new_vMin"))
{
QJsonValue value = lineObjInfo.value("new_vMin");
if (value.isDouble()) {
new_vMin = value.toDouble();
qDebug() << "new_vMin:" << QString::number(new_vMin);
}
}
if (lineObjInfo.contains("new_vMax"))
{
QJsonValue value = lineObjInfo.value("new_vMax");
if (value.isDouble()) {
new_vMax = value.toDouble();
qDebug() << "new_vMax:" << QString::number(new_vMax);
}
}
//
if (lineObjInfo.contains("frontColorRed"))
{
QJsonValue value = lineObjInfo.value("frontColorRed");
if (value.isDouble()) {
frontColor.setRed(value.toInt());
qDebug() << "frontColorRed:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("frontColorGreen"))
{
QJsonValue value = lineObjInfo.value("frontColorGreen");
if (value.isDouble()) {
frontColor.setGreen(value.toInt());
qDebug() << "frontColorGreen:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("frontColorBlue"))
{
QJsonValue value = lineObjInfo.value("frontColorBlue");
if (value.isDouble()) {
frontColor.setBlue(value.toInt());
qDebug() << "frontColorBlue:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("frontColorAlpha"))
{
QJsonValue value = lineObjInfo.value("frontColorAlpha");
if (value.isDouble()) {
frontColor.setAlpha(value.toInt());
qDebug() << "frontColorAlpha:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("backColorRed"))
{
QJsonValue value = lineObjInfo.value("backColorRed");
if (value.isDouble()) {
backColor.setRed(value.toInt());
qDebug() << "backColorRed:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("backColorGreen"))
{
QJsonValue value = lineObjInfo.value("backColorGreen");
if (value.isDouble()) {
backColor.setGreen(value.toInt());
qDebug() << "backColorGreen:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("backColorBlue"))
{
QJsonValue value = lineObjInfo.value("backColorBlue");
if (value.isDouble()) {
backColor.setBlue(value.toInt());
qDebug() << "backColorBlue:" << QString::number(value.toInt());
}
}
//
if (lineObjInfo.contains("backColorAlpha"))
{
QJsonValue value = lineObjInfo.value("backColorAlpha");
if (value.isDouble()) {
backColor.setAlpha(value.toInt());
qDebug() << "backColorAlpha:" << QString::number(value.toInt());
}
}
//
if(newFillMode=="无填充")