logplus/logPlus/PropertyWidget.cpp

1259 lines
44 KiB
C++
Raw Normal View History

2025-10-29 17:23:30 +08:00
#include "PropertyWidget.h"
#include <QScrollBar>
#include <QDateTime>
#include <QDebug>
#include <QSvgRenderer>
#include <QLabel>
2025-10-29 17:23:30 +08:00
#include "CallManage.h"
#include "geometryutils.h"
2025-10-29 17:23:30 +08:00
extern double g_dPixelPerCm;//每厘米像素数
2026-01-23 18:20:18 +08:00
//extern int m_iY1;
//extern int m_iY2;
2025-10-29 17:23:30 +08:00
PropertyWidget::PropertyWidget(const QString &title, QWidget *parent , Qt::WindowFlags flags )
:QDockWidget(title,parent,flags)
2025-10-29 17:23:30 +08:00
{
//
m_pPropertyBrowser = new QtTreePropertyBrowser();
2025-10-29 17:23:30 +08:00
this->setWidget(m_pPropertyBrowser);
//
2025-10-29 17:23:30 +08:00
m_pVariantManager = new VariantManager();//new QtVariantPropertyManager();
QtVariantEditorFactory *variantFactory = new VariantFactory();//new QtVariantEditorFactory();
m_pPropertyBrowser->setFactoryForManager(m_pVariantManager, variantFactory);
//
m_pPropertyBrowser->setPropertiesWithoutValueMarked(true);
m_pPropertyBrowser->setRootIsDecorated(true);
m_pPropertyBrowser->setIndentation(8);
connect( m_pVariantManager,SIGNAL(valueChanged(QtProperty *, const QVariant &)),
this,SLOT(SlotPropertyChanged(QtProperty *, const QVariant &)) );
2025-10-29 17:23:30 +08:00
QtColorSchemeComboBoxFactory * colorSchemeComboBoxFactory = new QtColorSchemeComboBoxFactory();
m_pColorSchemeManager = new QtColorSchemeComboBoxPropertyManager();
m_pPropertyBrowser->setFactoryForManager(m_pColorSchemeManager, colorSchemeComboBoxFactory);
connect(m_pColorSchemeManager, SIGNAL(valueChanged(QtProperty *, const int &, bool)), this,
SLOT(SlotPropertyChanged(QtProperty *, const int &, bool)));
2025-10-29 17:23:30 +08:00
}
PropertyWidget::~PropertyWidget()
{
QVector<QtTreePropertyBrowser*> aa;
aa.append(m_pPropertyBrowser);
qDeleteAll(aa);
2025-10-29 17:23:30 +08:00
}
PropertyWidget* PropertyService()
{
static PropertyWidget* singleInstance= new PropertyWidget("", nullptr, 0);
return singleInstance;
2025-10-29 17:23:30 +08:00
}
QWidget* PropertyWidget::GetPropertyWidget()
{
return m_pPropertyBrowser;
}
//初始化,清空
void PropertyWidget::InitCurrentViewInfo()
{
QList<QtProperty*> propertyList = m_pPropertyBrowser->properties();
m_pPropertyBrowser->clear();
foreach(QtProperty *property, propertyList)
{
if (property)
{
delete property;
}
}
//map清空
m_propertyData.clear();
m_mapGroupItem.clear();
m_fromTop = NULL;
m_formInfo = NULL;
m_item = NULL;
m_strUuid = "";
2025-10-29 17:23:30 +08:00
m_strSlfName = "";
m_strWellName = "";
m_strTrackName = "";
m_strLineName = "";
//
m_strCurrentProperty = "";
}
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
{
if(m_strCurrentProperty == "")
return;
if(m_strCurrentProperty == Track_Property)
{
if(m_fromTop == NULL)
return;
if("道名称" == m_propertyData[pProperty])
{
m_fromTop->m_strTrackName = variant.toString();
}
else if("道头字体" == m_propertyData[pProperty])
{
QFont newFont = variant.value<QFont>();
// 设置字体
m_fromTop->m_font = newFont;
}
else if("道头字颜色" == m_propertyData[pProperty])
{
QColor newColor = variant.value<QColor>();
m_fromTop->m_fontColor = newColor;
}
else
{
QVariantList listCond;
listCond << m_strUuid;
listCond << m_strSlfName;
listCond << m_strWellName;
listCond << m_iCurrentCol;
listCond << m_propertyData[pProperty];
listCond << variant;
emit CallManage::getInstance()->sig_changeTrackProperty(listCond);
}
return;
}
else if (m_strCurrentProperty == Wave_Property)
{
bool bDraw = false;
QStringList slist;
slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度"
<< "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "显示刻度" << "色板" << "变密度颜色级数";
for (int i = 0; i < slist.length(); i++)
{
if (slist.at(i) == m_propertyData[pProperty])
{
bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant);
break;
}
}
if(!slist.contains(m_propertyData[pProperty]))
bDraw = true;
if (bDraw)
{
QVariantList listCond;
listCond << m_strUuid;
listCond << m_strSlfName;
listCond << m_strWellName;
listCond << m_strTrackName;
listCond << m_strLineName;
listCond << m_propertyData[pProperty];
listCond << variant;
emit CallManage::getInstance()->sig_changeDrawProperty(listCond);
}
return;
}
2025-10-29 17:23:30 +08:00
if("深度比例尺" == m_propertyData[pProperty])
{
//qDebug() << "深度比例尺->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Widget_Property)
{
int iScale = 200;
QString newScale = pProperty->valueText();
//qDebug() << "深度比例尺->" << newScale;
2025-10-29 17:23:30 +08:00
//
int pos = newScale.indexOf(":");
if(pos>-1)
{
newScale = newScale.mid(pos+1);
iScale = atoi(newScale.toStdString().c_str());
2025-10-29 17:23:30 +08:00
}
else
{
iScale = 200;
}
//
2026-01-23 18:20:18 +08:00
m_iScale = iScale;
//清空自定义比例尺,防止混淆
for (auto it = m_propertyData.constBegin(); it != m_propertyData.constEnd(); ++it)
{
if(it.value()=="自定义比例尺")
{
m_bSelfChange=true;
QtVariantProperty *tempProperty = (QtVariantProperty*)it.key();
tempProperty->setValue("");
}
}
//通知界面缩放
2026-01-23 18:20:18 +08:00
emit CallManage::getInstance()->sig_changeScale(m_strUuid, iScale);
}
}
else if("自定义比例尺" == m_propertyData[pProperty])
{
if(m_bSelfChange==true)
{
m_bSelfChange=false;
return;
}
//qDebug() << "自定义比例尺->改变";
//当前属性类型
if(m_strCurrentProperty == Widget_Property)
{
int iScale = 200;
QString newScale = variant.value<QString>();
//qDebug() << "自定义比例尺->" << newScale;
newScale.replace("",":");
//
int pos = newScale.indexOf(":");
if(pos>-1)
{
QString leftScale = newScale.mid(0, pos);
double ileftScale = atof(leftScale.toStdString().c_str());
if(ileftScale<=0)
{
//不合规
return;
}
//
QString rightScale = newScale.mid(pos+1);
double iRightScale = atof(rightScale.toStdString().c_str());
if(iRightScale<=0)
{
//不合规
return;
}
iScale = iRightScale/ileftScale;
}
else
{
//不合规
return;
}
//
2026-01-23 18:20:18 +08:00
m_iScale = iScale;
//通知界面缩放
2026-01-23 18:20:18 +08:00
emit CallManage::getInstance()->sig_changeScale(m_strUuid, iScale);
2025-10-29 17:23:30 +08:00
}
}
else if("开始深度(m)" == m_propertyData[pProperty])
{
//qDebug() << "开始深度(m)->改变";
//当前属性类型
if(m_strCurrentProperty == Well_Property)
{
double newStartDepth = variant.value<double>();
2026-01-23 18:20:18 +08:00
m_iY2 = 0 - newStartDepth;
if(m_iY2 < m_iY1)
{
return;
}
2026-01-23 18:20:18 +08:00
//通知界面
emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2);
}
}
else if("终止深度(m)" == m_propertyData[pProperty])
{
//qDebug() << "终止深度(m)->改变";
//当前属性类型
if(m_strCurrentProperty == Well_Property)
{
double newEndDepth = variant.value<double>();
2026-01-23 18:20:18 +08:00
m_iY1 = 0 - newEndDepth;
if(m_iY2 < m_iY1)
{
return;
}
2026-01-23 18:20:18 +08:00
//通知界面
emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2);
}
}
2025-10-29 17:23:30 +08:00
else if("左刻度" == m_propertyData[pProperty])
{
//qDebug() << "左刻度->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
double newLeftScale = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newLeftScale);
2025-10-29 17:23:30 +08:00
//更新填充
ChangFillProperty();
}
}
else if("右刻度" == m_propertyData[pProperty])
{
//qDebug() << "右刻度->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
double newRightScale = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeRightScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newRightScale);
2025-10-29 17:23:30 +08:00
//更新填充
ChangFillProperty();
}
}
else if("刻度类型" == m_propertyData[pProperty])
{
//qDebug() << "刻度类型->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
QString newScaleType = pProperty->valueText();
emit CallManage::getInstance()->sig_ChangeScaleType(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newScaleType);
2025-11-05 18:15:33 +08:00
//更新填充
ChangFillProperty();
}
}
2025-10-29 17:23:30 +08:00
else if("颜色" == m_propertyData[pProperty])
{
//qDebug() << "颜色->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
//曲线颜色
// 假设variant已经被设置为包含QColor
QColor newColor = variant.value<QColor>();
emit CallManage::getInstance()->sig_ChangeLineColor(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newColor);
2025-10-29 17:23:30 +08:00
}
}
else if("线宽" == m_propertyData[pProperty])
{
//qDebug() << "线宽->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
double newWidth = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeLineWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newWidth);
2025-10-29 17:23:30 +08:00
}
}
else if("线型" == m_propertyData[pProperty])
{
//qDebug() << "线型->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
Qt::PenStyle newStyle = Qt::SolidLine;
int iStyle = variant.value<int>();
switch(iStyle)
{
case 0:
2025-12-25 15:10:14 +08:00
//无
newStyle = Qt::NoPen;
break;
case 1:
2025-10-29 17:23:30 +08:00
//实线
newStyle = Qt::SolidLine;
break;
2025-12-25 15:10:14 +08:00
case 2:
2025-10-29 17:23:30 +08:00
//虚线
newStyle = Qt::DashLine;
break;
2025-12-25 15:10:14 +08:00
case 3:
2025-10-29 17:23:30 +08:00
//点线
newStyle = Qt::DotLine;
break;
2025-12-25 15:10:14 +08:00
case 4:
2025-10-29 17:23:30 +08:00
//虚点线
newStyle = Qt::DashDotLine;
break;
2025-12-25 15:10:14 +08:00
case 5:
2025-10-29 17:23:30 +08:00
//虚点点线
newStyle = Qt::DashDotDotLine;
break;
default:
break;
}
emit CallManage::getInstance()->sig_ChangeLineStyle(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newStyle);
2025-10-29 17:23:30 +08:00
}
}
else if("填充模式" == m_propertyData[pProperty])
{
//qDebug() << "填充模式->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("填充类型" == m_propertyData[pProperty])
{
//qDebug() << "填充类型->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("目标曲线" == m_propertyData[pProperty])
{
//qDebug() << "目标曲线->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("填充颜色" == m_propertyData[pProperty])
{
//qDebug() << "填充颜色->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("填充岩性" == m_propertyData[pProperty])
{
//qDebug() << "填充岩性->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("岩性前景色" == m_propertyData[pProperty])
{
//qDebug() << "岩性前景色->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
else if("岩性背景色" == m_propertyData[pProperty])
{
//qDebug() << "岩性背景色->改变";
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
2025-10-29 17:23:30 +08:00
else if("头部图例" == m_propertyData[pProperty])
{
//qDebug() << "头部图例->改变";
2025-10-29 17:23:30 +08:00
//当前属性类型
if(m_strCurrentProperty == Curve_Property)
{
ChangFillProperty();
}
}
//图头---------------------------
else if("图例" == m_propertyData[pProperty])
{
//qDebug() << "图例->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
QString newSvg = variant.value<QString>();
m_item->setData(Qt::UserRole+1, newSvg); // 图片路径
//图头项改变
ChangHeadItemProperty();
}
}
else if("图例宽(cm)" == m_propertyData[pProperty])
{
//qDebug() << "图例宽(cm)->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
double newWidth = variant.value<double>();
m_item->setData(Qt::UserRole+2, newWidth); // 图片路径
m_colWidth_Img = newWidth;
//图头项改变
ChangHeadItemProperty();
}
}
else if("图例高(cm)" == m_propertyData[pProperty])
{
//qDebug() << "图例高(cm)->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
double newHight = variant.value<double>();
m_item->setData(Qt::UserRole+3, newHight); // 图片路径
m_rowHeight_Img = newHight;
//图头项改变
ChangHeadItemProperty();
}
}
else if("列宽(cm)" == m_propertyData[pProperty])
{
//qDebug() << "列宽(cm)->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
double newWidth = variant.value<double>();
m_colWidth = newWidth;
m_formHead->m_bRefresh=false;
//图头项改变
m_tableWidget->setColumnWidth(m_iCol, m_colWidth*g_dPixelPerCm);
m_tableWidget->update();
m_formHead->resizeWindow();
}
}
else if("行高(cm)" == m_propertyData[pProperty])
{
//qDebug() << "行高(cm)->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
double newHight = variant.value<double>();
m_rowHeight = newHight;
m_formHead->m_bRefresh=false;
//图头项改变
m_tableWidget->setRowHeight(m_iRow, m_rowHeight*g_dPixelPerCm);
m_tableWidget->update();
m_formHead->resizeWindow();
}
}
else if("内容" == m_propertyData[pProperty])
{
//qDebug() << "内容->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
QString newText = variant.value<QString>();
m_formHead->m_bRefresh=false;
m_item->setText(newText);
}
}
else if("方向" == m_propertyData[pProperty])
{
//qDebug() << "方向->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
QString newDirection = pProperty->valueText();
if(newDirection=="垂直")
{
}
else{
//m_item->
}
}
}
else if("字体颜色" == m_propertyData[pProperty])
{
//qDebug() << "字体颜色->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
//字体颜色
// 假设variant已经被设置为包含QColor
QColor newColor = variant.value<QColor>();
// 设置字体颜色
QBrush brush(newColor); // 使用Qt::red预定义颜色
m_formHead->m_bRefresh=false;
m_item->setForeground(brush);
}
}
else if("字体" == m_propertyData[pProperty])
{
//qDebug() << "字体->改变";
//当前属性类型
if(m_strCurrentProperty == Head_Property)
{
//字体
// 假设variant已经被设置为包含QColor
QFont newFont = variant.value<QFont>();
// 设置字体
m_formHead->m_bRefresh=false;
m_item->setFont(newFont);
}
}
else if("间隔" == m_propertyData[pProperty])
{
}
}
void PropertyWidget::SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle)
{
QString str = m_propertyData[property];
if (m_strCurrentProperty == Wave_Property)
{
m_formInfo->setInfoProperty(str, val);
QVariantList listCond;
listCond << m_strUuid;
listCond << m_strSlfName;
listCond << m_strWellName;
listCond << m_strTrackName;
listCond << m_strLineName;
listCond << str;
listCond << val;
emit CallManage::getInstance()->sig_changeDrawProperty(listCond);
}
return;
}
void PropertyWidget::ChangHeadItemProperty()
{
//清空
m_tableWidget->setCellWidget(m_iRow, m_iCol, nullptr);
//---------------------------
QString imagePath = ""; //"./image/胜利符号库/解释结论符号/油层.svg"
QVariant bgData = m_item->data(Qt::UserRole+1); // 我们约定用这个角色存储图片路径
if (bgData.isValid()) {
imagePath = bgData.toString();
}
if(imagePath=="")
{
return;
}
if(imagePath!="")
{
if(imagePath.size()>4)
{
int colWidth = m_colWidth_Img*g_dPixelPerCm;
int rowHeight = m_rowHeight_Img*g_dPixelPerCm;
//
QString strLast = imagePath.right(4);
if(strLast.toLower()==".svg")
{
//
QSvgRenderer* svgRender = new QSvgRenderer();
svgRender->load(imagePath);
//
QPixmap* pixmap = new QPixmap(colWidth-1, rowHeight-1);
pixmap->fill(Qt::transparent);//设置背景透明
QPainter p(pixmap);
svgRender->render(&p);
//1.直接采用控件显示
QLabel* label = new QLabel;
label->setPixmap(*pixmap);
label->setAlignment(Qt::AlignHCenter);
label->show();
//
m_formHead->m_bRefresh=false;
m_tableWidget->setCellWidget(m_iRow, m_iCol, label);
//m_item->setIcon(QIcon(*pixmap));
// 设置背景刷
//QBrush brush(*pixmap);
//m_item->setBackground(brush);
//m_tableWidget->setItem(m_iRow, m_iCol, new QTableWidgetItem(QIcon(*pixmap),tr("")));
}
else if(strLast.toLower()==".png")
{
// 加载图片
QPixmap pixmap(imagePath);
//pixmap.scaled(colWidth-1, rowHeight-1, Qt::KeepAspectRatio, Qt::SmoothTransformation);//缩放
//1.直接采用控件显示
QLabel* label = new QLabel;
label->setPixmap(pixmap.scaled(colWidth-1, rowHeight-1, Qt::KeepAspectRatio, Qt::SmoothTransformation));//图片保持比例缩放
label->setAlignment(Qt::AlignHCenter);
label->show();
//
m_formHead->m_bRefresh=false;
m_tableWidget->setCellWidget(m_iRow, m_iCol, label);
}
}
}
2025-10-29 17:23:30 +08:00
}
void PropertyWidget::ChangFillProperty()
{
QString newFillMode = "无填充";
QString newFillType = "岩性模式";
QString newTargetLine = "左界道";
QColor newColor;//填充颜色
QString newLithosImage = "";//岩性图片
QString newHeadFill = "不绘制";
float vMax = 0.0;
float vMin = 0.0;
2025-11-05 18:15:33 +08:00
QString strOtherScaleType = "线性";
QColor frontColor;//岩性前景色
QColor backColor;//岩性背景色
2025-10-29 17:23:30 +08:00
for (auto it = m_propertyData.constBegin(); it != m_propertyData.constEnd(); ++it)
{
if(it.value()=="填充模式")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newFillMode = pProperty->valueText();
//qDebug() << "填充模式->" << newFillMode;
2025-10-29 17:23:30 +08:00
}
}
else if(it.value()=="填充类型")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newFillType = pProperty->valueText();
//qDebug() << "填充类型->" << newFillType;
2025-10-29 17:23:30 +08:00
}
}
else if(it.value()=="目标曲线")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newTargetLine = pProperty->valueText();
//qDebug() << "目标曲线->" << newTargetLine;
2025-10-29 17:23:30 +08:00
//
if(newTargetLine=="左界道" || newTargetLine=="右界道" || newTargetLine=="对称线")
{
}
else
{
for(int i=0; i<m_strListOtherLine.size(); i++)
{
QString strTmp = m_strListOtherLine[i];
if(strTmp==newTargetLine)
{
vMax = m_listMax[i];
vMin = m_listMin[i];
2025-11-05 18:15:33 +08:00
strOtherScaleType = m_strListOtherScaleType[i];
2025-10-29 17:23:30 +08:00
}
}
}
}
}
else if(it.value()=="填充颜色")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newColor = pProperty->value().value<QColor>();
}
//qDebug() << "填充颜色->";
2025-10-29 17:23:30 +08:00
}
else if(it.value()=="填充岩性")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newLithosImage = pProperty->valueText();
}
//qDebug() << "填充岩性->" << newLithosImage;
2025-10-29 17:23:30 +08:00
}
else if(it.value()=="岩性前景色")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
frontColor = pProperty->value().value<QColor>();
}
//qDebug() << "岩性前景色->";
}
else if(it.value()=="岩性背景色")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
backColor = pProperty->value().value<QColor>();
}
//qDebug() << "岩性背景色->";
}
2025-10-29 17:23:30 +08:00
else if(it.value()=="头部图例")
{
QtVariantProperty *pProperty = (QtVariantProperty*)it.key();
if(pProperty->hasValue())
{
newHeadFill = pProperty->valueText();
//qDebug() << "头部图例->" << newHeadFill;
2025-10-29 17:23:30 +08:00
}
}
}
//
if(newFillMode=="无填充")
{
emit CallManage::getInstance()->sig_ClearFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName);
2025-10-29 17:23:30 +08:00
}
else //if(newFillMode=="填充")
2025-10-29 17:23:30 +08:00
{
emit CallManage::getInstance()->sig_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
newFillType, newTargetLine, newColor, newLithosImage, newHeadFill,
vMin, vMax, strOtherScaleType, frontColor, backColor, newFillMode, true);
2025-10-29 17:23:30 +08:00
}
}
void PropertyWidget::_CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType)
{
QtProperty *pGroupItem =NULL;
{
QMap<QString,QtProperty *>::Iterator it = m_mapGroupItem.find( strGroup );
if( it != m_mapGroupItem.end() )
{
pGroupItem = it.value();
}else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem ;
m_pPropertyBrowser->addProperty( pGroupItem );
}
}
QtVariantProperty *item = m_pVariantManager->addProperty(propertyType, strPropertyCaption);
item->setValue(vtPropertyValue);
m_propertyData[item] = strPropertyCaption;
pGroupItem->addSubProperty(item);
}
void PropertyWidget::_CreateVariantPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, int propertyType, double dMin, double dMax)
{
QtProperty *pGroupItem =NULL;
{
QMap<QString,QtProperty *>::Iterator it = m_mapGroupItem.find( strGroup );
if( it != m_mapGroupItem.end() )
{
pGroupItem = it.value();
}else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem ;
m_pPropertyBrowser->addProperty( pGroupItem );
}
}
QtVariantProperty *item = m_pVariantManager->addProperty(propertyType, strPropertyCaption);
item->setValue(vtPropertyValue);
item->setAttribute("minimum", dMin);
item->setAttribute("maximum", dMax);
m_propertyData[item] = strPropertyCaption;
pGroupItem->addSubProperty(item);
}
void PropertyWidget::_CreateEnumPropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue, QStringList listValue)
{
QtProperty *pGroupItem =NULL;
{
QMap<QString,QtProperty *>::Iterator it = m_mapGroupItem.find( strGroup );
if( it != m_mapGroupItem.end() )
{
pGroupItem = it.value();
}else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem ;
m_pPropertyBrowser->addProperty( pGroupItem );
}
}
QtVariantProperty *item = m_pVariantManager->addProperty(QtVariantPropertyManager::enumTypeId(), strPropertyCaption);
m_pVariantManager->setAttribute(item, "enumNames", listValue);
item->setValue(vtPropertyValue);
m_propertyData[item] = strPropertyCaption;
pGroupItem->addSubProperty(item);
}
void PropertyWidget::_CreateColorSchemePropertyItem(QString strGroup, QString strPropertyCaption, QVariant vtPropertyValue)
{
QtProperty *pGroupItem = NULL;
{
QMap<QString, QtProperty *>::Iterator it = m_mapGroupItem.find(strGroup);
if (it != m_mapGroupItem.end())
{
pGroupItem = it.value();
}
else
{
pGroupItem = m_pVariantManager->addProperty(QtVariantPropertyManager::groupTypeId(), strGroup);
m_mapGroupItem[strGroup] = pGroupItem;
m_pPropertyBrowser->addProperty(pGroupItem);
}
}
QtProperty *colorSchemeProperty = m_pColorSchemeManager->addProperty(strPropertyCaption);
m_pColorSchemeManager->setLinear(colorSchemeProperty);
if (colorSchemeProperty)
{
m_propertyData[colorSchemeProperty] = strPropertyCaption;
pGroupItem->addSubProperty(colorSchemeProperty);
m_pColorSchemeManager->setValue(colorSchemeProperty, vtPropertyValue.toInt(), false);
//if (pMetaProperty)
//{
// m_mapProperty[colorSchemeProperty] = pMetaProperty;
//}
}
}
2026-01-23 18:20:18 +08:00
void PropertyWidget::initWidgetProperty(QString strUuid, int iScale)
2025-10-29 17:23:30 +08:00
{
//初始化,清空
InitCurrentViewInfo();
2026-01-23 18:20:18 +08:00
m_iScale = iScale;
m_strUuid = strUuid;
2025-10-29 17:23:30 +08:00
//当前属性类型
m_strCurrentProperty = Widget_Property;
QStringList listSize;
listSize.append("1:10");
listSize.append("1:20");
listSize.append("1:50");
listSize.append("1:100");
listSize.append("1:200");
listSize.append("1:500");
listSize.append("1:1000");
listSize.append("1:2000");
listSize.append("1:3000");
listSize.append("1:4000");
listSize.append("1:5000");
listSize.append("1:10000");
listSize.append("1:20000");
listSize.append("1:1");
2026-01-23 18:20:18 +08:00
QString strScale = "1:" + QString::number(m_iScale);
int iIndex = listSize.indexOf(strScale);
if(iIndex<0)
{
_CreateEnumPropertyItem("通常", "深度比例尺", 0, listSize);
//
_CreateVariantPropertyItem("通常", "自定义比例尺", strScale, QVariant::String);
}
else {
_CreateEnumPropertyItem("通常", "深度比例尺", iIndex, listSize);
_CreateVariantPropertyItem("通常", "自定义比例尺", "", QVariant::String);
}
2025-10-29 17:23:30 +08:00
//
_CreateVariantPropertyItem("水平格线", "粗格线间隔(m)", 10.0, QVariant::Double);
_CreateVariantPropertyItem("水平格线", "中格线间隔(m)", 2.0, QVariant::Double);
}
2026-01-23 18:20:18 +08:00
void PropertyWidget::initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2)
{
//初始化,清空
InitCurrentViewInfo();
2026-01-23 18:20:18 +08:00
m_strUuid = strUuid;
m_strSlfName = strSlfName;
m_strWellName = strWellName;
m_iY1 = iY1;
m_iY2 = iY2;
//当前属性类型
m_strCurrentProperty = Well_Property;
//
2026-01-23 18:20:18 +08:00
_CreateVariantPropertyItem("通常", "开始深度(m)", 0-m_iY2, QVariant::Double);
_CreateVariantPropertyItem("通常", "终止深度(m)", 0-m_iY1, QVariant::Double);
}
void PropertyWidget::initTrackProperty(FormTrackTop *fromTop, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol)
2026-01-23 14:53:34 +08:00
{
//初始化,清空
InitCurrentViewInfo();
//
m_myTableWidget = myTableWidget;
m_iCurrentCol = iCurrentCol;
m_fromTop = fromTop;
//
m_strTrackName = fromTop->m_strTrackName;
m_strUuid = fromTop->m_strUuid;
m_strWellName = fromTop->m_strWellName;
m_strSlfName = fromTop->m_strSlfName;
2026-01-23 14:53:34 +08:00
//
double cmWidth = (double)iWidth/(double)g_dPixelPerCm;
_CreateVariantPropertyItem("通常", "道宽(cm)", cmWidth, QVariant::Double);
_CreateVariantPropertyItem("通常", "道名称", m_strTrackName, QVariant::String);
_CreateVariantPropertyItem("通常", "道头字体", fromTop->m_font, QVariant::Font);
_CreateVariantPropertyItem("通常", "道头字颜色", fromTop->m_fontColor, QVariant::Color);
//当前属性类型
m_strCurrentProperty = Track_Property;
2026-01-23 14:53:34 +08:00
}
2025-11-05 18:15:33 +08:00
void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType)
2025-10-29 17:23:30 +08:00
{
//初始化,清空
InitCurrentViewInfo();
m_strUuid = formInfo->m_strUuid;
2025-10-29 17:23:30 +08:00
//
m_strSlfName = formInfo->m_strSlfName;
m_strWellName = formInfo->m_strWellName;
m_strTrackName = formInfo->m_strTrackName;
m_strLineName = formInfo->m_strLineName;
2025-10-29 17:23:30 +08:00
//其他曲线
m_strListOtherLine.clear();
m_listMin.clear();
m_listMax.clear();
2025-11-05 18:15:33 +08:00
m_strListOtherScaleType.clear();
2025-10-29 17:23:30 +08:00
//
m_strListOtherLine.append(strListOtherLine);
m_listMin.append(listMin);
m_listMax.append(listMax);
2025-11-05 18:15:33 +08:00
m_strListOtherScaleType.append(strListOtherScaleType);
2025-10-29 17:23:30 +08:00
QStringList listStyle;
listStyle.append("");
2025-10-29 17:23:30 +08:00
listStyle.append("实线");
listStyle.append("虚线");
listStyle.append("点线");
listStyle.append("虚点线");
listStyle.append("虚点点线");
//
QStringList listHeadFill;
listHeadFill.append("不绘制");
listHeadFill.append("绘制");
//
QStringList listTargetLine;
listTargetLine.append("左界道");
listTargetLine.append("右界道");
listTargetLine.append("对称线");
listTargetLine.append(strListOtherLine);//其他曲线
//
QStringList listFillType;
listFillType.append("岩性模式");
listFillType.append("颜色模式");
//listFillType.append("成像化");
2025-10-29 17:23:30 +08:00
//
QStringList listFillMode;
listFillMode.append("无填充");
listFillMode.append("左填充");
listFillMode.append("右填充");
listFillMode.append("左右填充");
//
QStringList listScaleType;
listScaleType.append("线性");
listScaleType.append("对数");
2025-10-29 17:23:30 +08:00
//
_CreateVariantPropertyItem("通常", "井曲线", m_strLineName + "@"+m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String);
2025-10-29 17:23:30 +08:00
//
_CreateVariantPropertyItem("刻度设置", "左刻度", formInfo->m_vmin, QVariant::Double);
_CreateVariantPropertyItem("刻度设置", "右刻度", formInfo->m_vmax, QVariant::Double);
_CreateEnumPropertyItem("刻度设置", "刻度类型", listScaleType.indexOf(formInfo->m_strScaleType), listScaleType);
2025-10-29 17:23:30 +08:00
//
_CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_dWidth, QVariant::Double, 1, 20);
_CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_lineColor, QVariant::Color);
_CreateEnumPropertyItem("曲线线型", "线型", (int)formInfo->m_lineStyle, listStyle);
2025-10-29 17:23:30 +08:00
//
_CreateEnumPropertyItem("岩性填充", "头部图例", listHeadFill.indexOf(formInfo->m_newHeadFill), listHeadFill);
_CreateEnumPropertyItem("岩性填充", "目标曲线", listTargetLine.indexOf(formInfo->m_newTargetLine), listTargetLine);
_CreateEnumPropertyItem("岩性填充", "填充类型", listFillType.indexOf(formInfo->m_newFillType), listFillType);
_CreateEnumPropertyItem("岩性填充", "填充模式", listFillMode.indexOf(formInfo->m_newFillMode), listFillMode);
_CreateVariantPropertyItem("岩性填充", "填充颜色", formInfo->m_newColor, QVariant::Color);
if(formInfo->m_newLithosImage=="")
{
_CreateVariantPropertyItem("岩性填充", "填充岩性", ::GetLithSymbolDir(), VariantManager::filePathTypeId());
}
else {
_CreateVariantPropertyItem("岩性填充", "填充岩性", formInfo->m_newLithosImage, VariantManager::filePathTypeId()); //"./image/胜利符号库/岩性符号/砂岩.png"
}
_CreateVariantPropertyItem("岩性填充", "岩性前景色", formInfo->m_frontColor, QVariant::Color);
_CreateVariantPropertyItem("岩性填充", "岩性背景色", formInfo->m_backColor, QVariant::Color);
//当前属性类型
m_strCurrentProperty = Curve_Property;
2025-10-29 17:23:30 +08:00
}
void PropertyWidget::initHeadProperty(FormHead *formHead, QTableWidget *tableWidget, QTableWidgetItem* item, int row, int col)
{
//初始化,清空
InitCurrentViewInfo();
m_formHead = formHead;
m_tableWidget = tableWidget;
m_item = item;
m_iRow = row;
m_iCol = col;
//当前属性类型
m_strCurrentProperty = Head_Property;
QStringList listDirection;
listDirection.append("水平");
listDirection.append("垂直");
QString imagePath = ""; //"./image/胜利符号库/解释结论符号/油层.svg"
QVariant bgData = m_item->data(Qt::UserRole+1); // 我们约定用这个角色存储图片路径
if (bgData.isValid()) {
imagePath = bgData.toString();
}
//图例宽
QVariant colWidth_Img = m_item->data(Qt::UserRole+2);
if (colWidth_Img.isValid()) {
m_colWidth_Img = colWidth_Img.toDouble();
}
//图例高
QVariant rowHeight_Img = m_item->data(Qt::UserRole+3);
if (rowHeight_Img.isValid()) {
m_rowHeight_Img = rowHeight_Img.toDouble();
}
m_colWidth = tableWidget->columnWidth(col)/g_dPixelPerCm;
m_rowHeight = tableWidget->rowHeight(row)/g_dPixelPerCm;
_CreateVariantPropertyItem("单元格", "图例", imagePath, VariantManager::filePathTypeId()); //"./image/胜利符号库/岩性符号/砂岩.png"
_CreateVariantPropertyItem("单元格", "图例宽(cm)", m_colWidth_Img, QVariant::Double, 0, 100);
_CreateVariantPropertyItem("单元格", "图例高(cm)", m_rowHeight_Img, QVariant::Double, 0, 100);
_CreateVariantPropertyItem("文本", "内容", item->text(), QVariant::String);
_CreateVariantPropertyItem("文本", "字体", m_item->font(), QVariant::Font);
_CreateEnumPropertyItem("文本", "方向", 0, listDirection);
_CreateVariantPropertyItem("文本", "字体颜色", m_item->foreground().color(), QVariant::Color);
_CreateVariantPropertyItem("表格", "行高(cm)", m_rowHeight, QVariant::Double, 0, 100);
_CreateVariantPropertyItem("表格", "列宽(cm)", m_colWidth, QVariant::Double, 0, 100);
}
void PropertyWidget::initDepthProperty(FormInfo *formInfo)
{
//
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
//
_CreateVariantPropertyItem("深度标注", "间隔", formInfo->m_nJg, QVariant::String);
}
void PropertyWidget::initProperty(FormInfo *formInfo)
{
if (formInfo == NULL)
return;
//初始化,清空
InitCurrentViewInfo();
m_formInfo = formInfo;
m_strUuid = formInfo->m_strUuid;
//
m_strSlfName = formInfo->m_strSlfName;
m_strWellName = formInfo->m_strWellName;
m_strTrackName = formInfo->m_strTrackName;
m_strLineName = formInfo->m_strLineName;
if (formInfo->m_strType == "depthObject")
{
this->initDepthProperty(formInfo);
}
else if (formInfo->m_strType == "roseObject")
{
this->initRoseProperty(formInfo);
}
else if (formInfo->m_strType == "waveObject")
{
this->initWaveProperty(formInfo);
}
}
void PropertyWidget::initRoseProperty(FormInfo *formInfo)
{
//
_CreateVariantPropertyItem("数据", "名称", formInfo->m_strAliasName, QVariant::String);
QStringList listType;
listType.append("曲线型数据");
listType.append("表格型数据");
_CreateEnumPropertyItem("数据", "数据类型", listType.indexOf("曲线型数据"), listType);
_CreateVariantPropertyItem("数据", "显示单位", "°", QVariant::String);
_CreateVariantPropertyItem("数据", "井文件名称", m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("数据", "方位曲线", "STRDIR", QVariant::String);
_CreateVariantPropertyItem("数据", "倾角曲线", "CALM", QVariant::String);
//
_CreateVariantPropertyItem("玫瑰图", "扇形", 36, QVariant::Int);
_CreateVariantPropertyItem("玫瑰图", "圆半径(cm)", 1, QVariant::Int);
_CreateVariantPropertyItem("玫瑰图", "辐射圈", 9, QVariant::Int);
_CreateVariantPropertyItem("玫瑰图", "方位打印间隔", 3, QVariant::Int);
_CreateVariantPropertyItem("玫瑰图", "圆线颜色", QColor(0,0,0), QVariant::Color);
_CreateVariantPropertyItem("玫瑰图", "圆线宽度", 2, QVariant::Int);
_CreateVariantPropertyItem("玫瑰图", "应力线颜色", QColor(255, 170, 0), QVariant::Color);
_CreateVariantPropertyItem("玫瑰图", "垮塌线颜色", QColor(0, 0, 255), QVariant::Color);
_CreateVariantPropertyItem("玫瑰图", "绘制辐射线?", true, QVariant::Bool);
_CreateVariantPropertyItem("玫瑰图", "绘制井眼垮塌", true, QVariant::Bool);
_CreateVariantPropertyItem("玫瑰图", "是否填充", true, QVariant::Bool);
_CreateVariantPropertyItem("玫瑰图", "是否绘制标注?", true, QVariant::Bool);
// _CreateVariantPropertyItem("玫瑰图", "道头字体", fromTop->m_font, QVariant::Font);
// _CreateVariantPropertyItem("玫瑰图", "道头字颜色", fromTop->m_fontColor, QVariant::Color);
}
void PropertyWidget::initWaveProperty(FormInfo *formInfo)
{
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strLineName, QVariant::String);
//_CreateVariantPropertyItem("通常", "例区高度(cm)", formInfo->m_strUnit, QVariant::Double);
QStringList lineType;
lineType.append("线性");
lineType.append("对数");
lineType.append("核磁对数");
lineType.append("二维核磁");
lineType.append("色级图");
lineType.append("时间对数");
lineType.append("时间指数");
_CreateEnumPropertyItem("通常", "曲线类型", lineType.indexOf("线性"), lineType);
_CreateVariantPropertyItem("曲线单位", "显示单位", formInfo->m_strUnit, QVariant::String);
_CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_curveUnitFont, QVariant::Font);
_CreateVariantPropertyItem("字体", "曲线刻度", formInfo->m_curveScaleFont, QVariant::Font);
QStringList drawType;
drawType.append("波形");
drawType.append("填充");
drawType.append("变密度(成像)");
drawType.append("全阵列");
drawType.append("奇数阵列");
drawType.append("偶数阵列");
drawType.append("变密度(镜像)");
drawType.append("自选阵列");
drawType.append("三维图像");
drawType.append("多臂井径");
_CreateEnumPropertyItem("绘图类型", "类型", drawType.indexOf(formInfo->m_strDrawType), drawType);
QStringList fillType;
fillType.append("全周");
fillType.append("正半周");
fillType.append("负半周");
_CreateEnumPropertyItem("填充方式", "方式", formInfo->m_strFillType.toInt(), fillType);
//_CreateVariantPropertyItem("波形绘制参数", "自动平滑", true, QVariant::Bool);
_CreateVariantPropertyItem("波形绘制参数", "左刻度", formInfo->m_vmin, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "右刻度", formInfo->m_vmax, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "幅度刻度", formInfo->m_strAmp, QVariant::String);
_CreateVariantPropertyItem("波形绘制参数", "最大振幅", formInfo->m_fMaxAmp, QVariant::Double);
_CreateVariantPropertyItem("波形绘制参数", "显示刻度", formInfo->m_bShowScale, QVariant::Bool);
//_CreateVariantPropertyItem("波形绘制参数", "波列基值", 0, QVariant::Double);
//_CreateVariantPropertyItem("波形绘制参数", "波形间隔", 1, QVariant::Int);
//_CreateVariantPropertyItem("波形绘制参数", "波形高度", 1, QVariant::Double);
//_CreateVariantPropertyItem("成像显示", "RGBA数据", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "绘制阵列数", 1, QVariant::Int);
//_CreateVariantPropertyItem("成像显示", "是否顶底倒置", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "是否行列互换", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "无效值跳过", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "是否方位校正", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "是否深度校正", false, QVariant::Bool);
//_CreateVariantPropertyItem("成像显示", "是否自动计算波参数", "", QVariant::String);
_CreateColorSchemePropertyItem("调色板参数设置", "色板", formInfo->m_nSchemeIndex);
_CreateVariantPropertyItem("调色板参数设置", "变密度颜色级数", formInfo->m_nColorNum, QVariant::Int);
// _CreateVariantPropertyItem("调色板参数设置", "图例置顶", false, QVariant::Bool);
// _CreateVariantPropertyItem("调色板参数设置", "反转显示", false, QVariant::Bool);
m_strCurrentProperty = Wave_Property;
}