Compare commits

...

2 Commits

Author SHA1 Message Date
wangxiaolei
e6bef9af94 Merge branch 'main' of http://git.hivekion.com:3000/jiayulong/logplus 2026-03-13 17:42:37 +08:00
wangxiaolei
e2526349cc 岩心照片 图片保存 2026-03-13 17:34:02 +08:00
6 changed files with 255 additions and 15 deletions

View File

@ -1149,6 +1149,10 @@ QString GetGujingSymbolDir(QString cs)
{ {
return GetSymbolDir()+"固井结论符号"+cs; return GetSymbolDir()+"固井结论符号"+cs;
} }
QString GetImageSymbolDir(QString cs)
{
return GetSymbolDir()+"岩心照片符号"+cs;
}
QString GetLithSymbolDir(QString cs) QString GetLithSymbolDir(QString cs)
{ {
return GetSymbolDir()+"岩性符号"+cs; return GetSymbolDir()+"岩性符号"+cs;

View File

@ -235,6 +235,7 @@ QString GetMudSymbolDir(QString cs=QDir::separator());
QString GetOilSymbolDir(QString cs=QDir::separator()); QString GetOilSymbolDir(QString cs=QDir::separator());
QString GetLithSymbolDir(QString cs=QDir::separator()); QString GetLithSymbolDir(QString cs=QDir::separator());
QString GetGujingSymbolDir(QString cs=QDir::separator()); QString GetGujingSymbolDir(QString cs=QDir::separator());
QString GetImageSymbolDir(QString cs=QDir::separator());
int GetLineWidth(QPainter * painter,int flWidth); int GetLineWidth(QPainter * painter,int flWidth);
QString GBKToUTF8(const QByteArray& gbkData); QString GBKToUTF8(const QByteArray& gbkData);

View File

@ -1102,9 +1102,9 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑岩心图片", this, &QMyCustomPlot::onEditImage); menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑岩心图片", this, &QMyCustomPlot::onEditImage);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItemsImage); menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItemsImage);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems); menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItemsImage); menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::deleteItemsImage);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItemsImage); menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::refreshItemsImage);
menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::MegResultImage); menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::megResultImage);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }
@ -1482,6 +1482,7 @@ void QMyCustomPlot::onEditGujing()
} }
} }
// 岩心图片
void QMyCustomPlot::onEditImage() void QMyCustomPlot::onEditImage()
{ {
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式 this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
@ -1555,7 +1556,7 @@ void QMyCustomPlot::onEditImage()
this->addImageToPlot(left_Low, right_Hight, imagePath); this->addImageToPlot(left_Low, right_Hight, imagePath);
//保存 //保存
this->SaveToSLF_Gujing(); this->SaveToSLFImage(imagePath);
//属性清空 //属性清空
PropertyService()->InitCurrentViewInfo(); PropertyService()->InitCurrentViewInfo();
@ -1570,10 +1571,99 @@ void QMyCustomPlot::onEditImage()
} }
} }
void QMyCustomPlot::addItemsImage(){} // 岩心图片
void QMyCustomPlot::DeleteItemsImage(){} void QMyCustomPlot::addItemsImage(){
void QMyCustomPlot::RefreshItemsImage(){} QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
void QMyCustomPlot::MegResultImage(){} QString originalText = clipboard->text(); //获取剪贴板上文本信息
int isspace=originalText.indexOf(" ");
int istab=originalText.indexOf("\t");
int isd=originalText.indexOf(",");
if((istab>-1|isd>-1)&&isspace>-1)
{
QMessageBox::information(NULL,"提示", "\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!");
}
originalText.replace(","," ");
originalText.replace("\t"," ");
originalText.replace("\r\n","\n");
originalText.replace("\r","\n");
QStringList line=originalText.split("\n");
QStringList old;
for(int i=0;i<line.size();i++) {
QStringList coredat=line[i].split(" ");
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
if(coredat.size()<1) continue;
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
if(coredat.size()<3) {
if(old.size()<1) {
old=coredat;
continue;
}
else {
QStringList cs;
cs.append(old[0]);
cs.append(old[1]);
cs.append(coredat[1]);
// cs.append(old[2]);
old=coredat;
coredat=cs;
}
}
//添加固井结论
int NO = coredat[0].toInt();
float SDEP = coredat[1].toDouble();
float EDEP = coredat[2].toDouble();
int iRESULT = 0;
QString result = "";
if(coredat.size()>3) {
if(coredat[3].at(0).isDigit()) {
iRESULT = coredat[3].toInt();
QString iconshotname=zoneOrderImage.key(QString::number(iRESULT));
if(iconshotname!="")
result=::GetImageSymbolDir()+iconshotname+".svg";
}
else
{
QStringList vals=zoneOrderImage.keys();
coredat[3].trimmed();
int j=vals.indexOf(coredat[3]);
if(j>-1) {
result=::GetImageSymbolDir()+vals[j]+".svg";
}
}
}
//
int len=2;
int pos=result.indexOf(".//");
if(pos<0) pos=result.indexOf("./");
else len=3;
QString svg;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=result.mid(len-1);
}
else svg=result;
QDir ss;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
result=QDir::toNativeSeparators(svg);
//显示固井
addImageToPlot(-EDEP, -SDEP, result);
}
//保存
//this->SaveToSLFImage();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
void QMyCustomPlot::deleteItemsImage(){}
void QMyCustomPlot::refreshItemsImage(){}
void QMyCustomPlot::megResultImage(){}
//右键--添加录井剖面 //右键--添加录井剖面
void QMyCustomPlot::onEditGeoLith() void QMyCustomPlot::onEditGeoLith()
@ -2384,6 +2474,108 @@ bool QMyCustomPlot::SaveToSLF_Gujing()
return true; return true;
} }
//保存岩心图片
bool QMyCustomPlot::SaveToSLFImage(QString imagePath)
{
static int isrun=false;
if(isrun) return false;
QString ss=m_strSlfName;
if(ss=="") return false;
isrun=true;
IMAGE_DATA m_Result;
CMemRdWt *logio=new CMemRdWt();
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
{
delete logio;
QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
isrun=false;
return false;
}
//QString ssss = m_strLineName.toStdString().c_str();
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
bool isfirst=false;
if (iIndex < 0)
{
if(!m_mapDraggable_Image.size()) {
delete logio;
isrun=false;
return false;
}
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4,
"NO,SDEP,EDEP,RESULT",
"4,4,4,4",//字段长度
"1,4,4,1",//字段类型
"0,0,0,2");//字段备注
isfirst=true;
}
logio->SetTableRecordCount(iIndex,m_mapDraggable_Image.size());
//int j=0;
if(!m_mapDraggable_Image.size()) {
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return false;
}
TransparentDraggableImage *pDraggableRect =NULL;
//排序
QList<float> listSDepth;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
{
pDraggableRect = (TransparentDraggableImage*)iter.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
//
float fSDepth = -tmpRange.upper;
listSDepth.append(fSDepth);
}
qSort(listSDepth);
//
for(int i=0; i<listSDepth.size(); i++)
{
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
{
pDraggableRect = (TransparentDraggableImage*)iter.value();
QString aaa = pDraggableRect->getMResult();
//
QCPRange tmpRange = pDraggableRect->getRange();
float fSDepth = -tmpRange.upper;
if(fSDepth == listSDepth[i])//按顺序写入
{
memset(&m_Result,0,sizeof(GUJING_DATA));
m_Result.StartDepth = -tmpRange.upper;
m_Result.EndDepth = -tmpRange.lower;
m_Result.Order=i+1;
// m_Result.Image = imagePath;
// 拷贝字符串到数组,长度为数组长度-1留1位存'\0'结束符)
strncpy(m_Result.Image, pDraggableRect->getMResult().toLocal8Bit().constData(), sizeof(m_Result.Image) - 1);
// 手动添加结束符(确保字符串合法)
m_Result.Image[sizeof(m_Result.Image) - 1] = '\0';
//m_Result.RESULT=0;
//QString innerresult=GetIntResult_Gujing(pDraggableRect->m_Result);
// if(innerresult!="")
// m_Result.RESULT=innerresult.toInt();
// if(m_Result.RESULT<0) m_Result.RESULT=0;
//写入
logio->WriteTable(iIndex,i+1,&m_Result);
break;
}
}
}
logio->CloseTable(iIndex);
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
// 写到slf文件
return true;
}
QString QMyCustomPlot::GetIntResult_Gujing(QString result) QString QMyCustomPlot::GetIntResult_Gujing(QString result)
{ {
if(result=="") return ""; if(result=="") return "";

View File

@ -183,6 +183,10 @@ public:
bool CopyToSLFFile(QString targetSLFFileName, bool deleteFromSrc, char*newCurveName); bool CopyToSLFFile(QString targetSLFFileName, bool deleteFromSrc, char*newCurveName);
bool LoadFromSLF_Gujing(QString strSlfName, QString strLineName); bool LoadFromSLF_Gujing(QString strSlfName, QString strLineName);
// 岩心图片
QMap<QString,QString> zoneOrderImage;
bool SaveToSLFImage(QString imagePath);
//井壁取心 //井壁取心
QStringList liths_SWallCore; QStringList liths_SWallCore;
QStringList oils_SWallCore; QStringList oils_SWallCore;
@ -231,6 +235,40 @@ public:
public slots: public slots:
void slot_time(); void slot_time();
public:
void init(QString strName, QVector<double> x, QVector<double> y);
//岩心照片
void addImageToPlot(double left_Low, double right_Hight, const QString imagePath);
//曲线
void addRandomGraph(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);
//文字结论
void addTextToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80));
//地质分层
void addLayerToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80));
//解释结论
TransparentGroupResult* addResultGroup(double left_Low, double right_Hight, QString &strUuid, QString strText = "");
void addResultToPlot(double left_Low, double right_Hight, QString myResult, QString &strUuid, QString strText="");
//录井剖面
void addGeoLithToPlot(double left_Low, double right_Hight, const QString myLith, const QString myOil, const QString myColor, bool bRefresh=true);
//井壁取心
void addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor);
//固井结论
void addGujingToPlot(double left_Low, double right_Hight, const QString strResult);
//气测/FMT/射孔/文本
public slots:
void slot_time();
public: public:
void init(QString strName, QVector<double> x, QVector<double> y); void init(QString strName, QVector<double> x, QVector<double> y);
@ -349,6 +387,13 @@ public slots:
void RefreshItems_Gujing(); //刷新数据 void RefreshItems_Gujing(); //刷新数据
void MegResult_Gujing(); //合并结论 void MegResult_Gujing(); //合并结论
//右键--编辑岩心照片
void onEditImage();
void addItemsImage(); //从剪切板文本数据粘贴
void deleteItemsImage(); //全部清空
void refreshItemsImage(); //刷新数据
void megResultImage(); //合并结论
//右键--编辑井壁取心 //右键--编辑井壁取心
void addItem_SWallCore(); //增加井壁取心 void addItem_SWallCore(); //增加井壁取心
void moveItems_SWallCore(); //平移水平位置 void moveItems_SWallCore(); //平移水平位置
@ -382,13 +427,6 @@ public slots:
void addItems_Jiegutext(); //从剪切板文本数据粘贴 void addItems_Jiegutext(); //从剪切板文本数据粘贴
void DeleteItems_Jiegutext(); //全部清空 void DeleteItems_Jiegutext(); //全部清空
void RefreshItems_Jiegutext(); //刷新数据 void RefreshItems_Jiegutext(); //刷新数据
//右键--编辑岩心照片
void onEditImage();
void addItemsImage(); //从剪切板文本数据粘贴
void DeleteItemsImage(); //全部清空
void RefreshItemsImage(); //刷新数据
void MegResultImage(); //合并结论
// //
void addItems_Core(); void addItems_Core();

View File

@ -203,6 +203,10 @@ QCPRange TransparentDraggableImage::getRange()
return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x()); return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x());
} }
QString TransparentDraggableImage::getMResult(){
return this->m_Result;
}
// 设置矩形颜色 // 设置矩形颜色
void TransparentDraggableImage::setColor(const QColor &color) void TransparentDraggableImage::setColor(const QColor &color)
{ {

View File

@ -38,6 +38,7 @@ public:
void setRange(double left_Low, double right_Hight); void setRange(double left_Low, double right_Hight);
// 获取当前范围 // 获取当前范围
QCPRange getRange(); QCPRange getRange();
QString getMResult();
// 设置矩形颜色 // 设置矩形颜色
void setColor(const QColor &color); void setColor(const QColor &color);