录井剖面道,新增8个右键菜单,7个属性配置。

This commit is contained in:
jiayulong 2026-03-06 16:17:57 +08:00
parent d21ed1aae5
commit 6dd71911fa
13 changed files with 1653 additions and 766 deletions

View File

@ -208,6 +208,9 @@ signals:
//改变固井曲线名 //改变固井曲线名
void sig_changeGujingLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName); void sig_changeGujingLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName);
//改变录井剖面属性
void sig_changeGeoLithLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double dOilZhan);
// //
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath); //void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);

View File

@ -273,6 +273,21 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
//先处理通用属性 //先处理通用属性
CommonPropertyChanged(pProperty, variant); CommonPropertyChanged(pProperty, variant);
} }
else if (m_strCurrentProperty == GeoLith_Property)//录井剖面
{
//先处理通用属性
CommonPropertyChanged(pProperty, variant);
if("含油占比(1~8)" == m_propertyData[pProperty])
{
//qDebug() << "含油占比(1~8)->改变";
double dOilZhan = variant.value<double>();
m_formInfo->m_dOilZhan = dOilZhan;
//改变录井剖面属性,含油占比
emit CallManage::getInstance()->sig_changeGeoLithLine(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, dOilZhan);
}
}
else if (m_strCurrentProperty == GujingItem_Property) else if (m_strCurrentProperty == GujingItem_Property)
{ {
//固井结论item //固井结论item
@ -402,6 +417,74 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
} }
} }
} }
else if (m_strCurrentProperty == GeoLithItem_Property)
{
//录井剖面item
if("顶深(m)" == m_propertyData[pProperty])
{
//qDebug() << "顶深(m)->改变";
if(m_tdGeoLith)
{
double upper = variant.value<double>();
m_tdGeoLith->setUpper(-upper);
//保存
m_tdGeoLith->mPlot->SaveToSLF_GeoLith();
}
}
else if("底深(m)" == m_propertyData[pProperty])
{
//qDebug() << "底深(m)->改变";
if(m_tdGeoLith)
{
double lower = variant.value<double>();
m_tdGeoLith->setLower(-lower);
//保存
m_tdGeoLith->mPlot->SaveToSLF_GeoLith();
}
}
else if("岩性" == m_propertyData[pProperty])
{
//qDebug() << "岩性->改变";
if(m_tdGeoLith)
{
QString newResult = variant.value<QString>();
m_tdGeoLith->setLith(newResult, m_tdGeoLith->m_Color);
//
QCPRange currentRange = m_tdGeoLith->getRange();
m_tdGeoLith->setRange(currentRange.lower, currentRange.upper);
//保存
m_tdGeoLith->mPlot->SaveToSLF_GeoLith();
}
}
else if("油气" == m_propertyData[pProperty])
{
//qDebug() << "油气->改变";
if(m_tdGeoLith)
{
QString newResult = variant.value<QString>();
m_tdGeoLith->setOil(newResult);
//
QCPRange currentRange = m_tdGeoLith->getRange();
m_tdGeoLith->setRange(currentRange.lower, currentRange.upper);
//保存
m_tdGeoLith->mPlot->SaveToSLF_GeoLith();
}
}
else if("颜色" == m_propertyData[pProperty])
{
//qDebug() << "颜色->改变";
if(m_tdGeoLith)
{
QString newResult = variant.value<QString>();
m_tdGeoLith->setLith(m_tdGeoLith->m_Lith, newResult);
//
QCPRange currentRange = m_tdGeoLith->getRange();
m_tdGeoLith->setRange(currentRange.lower, currentRange.upper);
//保存
m_tdGeoLith->mPlot->SaveToSLF_GeoLith();
}
}
}
if("深度比例尺" == m_propertyData[pProperty]) if("深度比例尺" == m_propertyData[pProperty])
{ {
@ -1519,6 +1602,11 @@ void PropertyWidget::initProperty(FormInfo *formInfo)
//井壁取心 //井壁取心
this->initSwallCoreProperty(formInfo); this->initSwallCoreProperty(formInfo);
} }
else if (m_strLineName == "GEO_LITH")
{
//录井剖面
this->initGeoLithProperty(formInfo);
}
else{ else{
this->initTableProperty(formInfo); this->initTableProperty(formInfo);
} }
@ -1708,3 +1796,33 @@ void PropertyWidget::initGujingItemProperty(TransparentDraggableGujing* tdGujing
_CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double);
_CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId()); _CreateVariantPropertyItem("当前项", "固井结论", strResult, VariantManager::filePathTypeId());
} }
void PropertyWidget::initGeoLithProperty(FormInfo *formInfo)
{
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color);
_CreateVariantPropertyItem("显示", "含油占比(1~8)", formInfo->m_dOilZhan, QVariant::Double, 1, 8);
m_strCurrentProperty = GeoLith_Property;
}
void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, const QString myLith, const QString myOil, const QString myColor)
{
//初始化,清空
InitCurrentViewInfo();
//当前属性类型
m_strCurrentProperty = GeoLithItem_Property;
m_tdGeoLith = tdGeoLith;
//
_CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double);
_CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double);
_CreateVariantPropertyItem("当前项", "岩性", myLith, VariantManager::filePathTypeId());
_CreateVariantPropertyItem("当前项", "油气", myOil, VariantManager::filePathTypeId());
_CreateVariantPropertyItem("当前项", "颜色", myColor, VariantManager::filePathTypeId());
}

View File

@ -22,6 +22,7 @@
#include "formtracktop.h" #include "formtracktop.h"
#include "TransparentDraggableGujing.h" #include "TransparentDraggableGujing.h"
#include "TransparentDraggableSwallCore.h" #include "TransparentDraggableSwallCore.h"
#include "TransparentDraggableGeoLith.h"
//当前曲线类型 //当前曲线类型
#define Widget_Property "Widget_Property" #define Widget_Property "Widget_Property"
@ -38,6 +39,9 @@
#define SwallCore_Property "SwallCore_Property" //井壁取心 #define SwallCore_Property "SwallCore_Property" //井壁取心
#define SwallCoreItem_Property "SwallCoreItem_Property" //井壁取心item #define SwallCoreItem_Property "SwallCoreItem_Property" //井壁取心item
#define GeoLith_Property "GeoLith_Property" //录井剖面
#define GeoLithItem_Property "GeoLithItem_Property" //录井剖面item
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
/** /**
@ -104,6 +108,7 @@ public:
// //
TransparentDraggableGujing* m_tdGujing; TransparentDraggableGujing* m_tdGujing;
TransparentDraggableSwallCore* m_tdSwallCore; TransparentDraggableSwallCore* m_tdSwallCore;
TransparentDraggableGeoLith* m_tdGeoLith;
public: public:
QWidget* GetPropertyWidget(); QWidget* GetPropertyWidget();
@ -134,6 +139,7 @@ public:
void initRoseProperty(FormInfo *formInfo); void initRoseProperty(FormInfo *formInfo);
// 波列属性 // 波列属性
void initWaveProperty(FormInfo *formInfo, int nType = 3); void initWaveProperty(FormInfo *formInfo, int nType = 3);
// 固井结论属性 // 固井结论属性
void initGujingProperty(FormInfo *formInfo); void initGujingProperty(FormInfo *formInfo);
void initGujingItemProperty(TransparentDraggableGujing* tdGujing, double lower, double upper, QString strResult); void initGujingItemProperty(TransparentDraggableGujing* tdGujing, double lower, double upper, QString strResult);
@ -142,8 +148,11 @@ public:
void initSwallCoreProperty(FormInfo *formInfo); void initSwallCoreProperty(FormInfo *formInfo);
void initSwallCoreItemProperty(TransparentDraggableSwallCore* tdSwallCore, double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor); void initSwallCoreItemProperty(TransparentDraggableSwallCore* tdSwallCore, double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor);
void ChangFillProperty();//填充属性改变 // 固井结论属性
void initGeoLithProperty(FormInfo *formInfo);
void initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoLith, double lower, double upper, const QString myLith, const QString myOil, const QString myColor);
void ChangFillProperty();//填充属性改变
void ChangHeadItemProperty();//图头项改变 void ChangHeadItemProperty();//图头项改变
//处理通用属性 //处理通用属性

View File

@ -1,27 +1,29 @@
#include "TransparentDraggableGeoLith.h" #include "TransparentDraggableGeoLith.h"
#include "PropertyWidget.h"
#include "CallManage.h"
extern double g_dPixelPerCm;//每厘米像素数 extern double g_dPixelPerCm;//每厘米像素数
//static GeoIndicatorGenerator m_drawGeo; //static GeoIndicatorGenerator m_drawGeo;
TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle) TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle)
: QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth) : QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth)
{ {
m_strUuid = strUuid; m_strUuid = strUuid;
// //
initRect(); initRect();
} }
TransparentDraggableGeoLith::~TransparentDraggableGeoLith() TransparentDraggableGeoLith::~TransparentDraggableGeoLith()
{ {
if(mPlot) { if(mPlot) {
// mPlot->removeItem(mRect); // mPlot->removeItem(mRect);
// mPlot->removeItem(mLeftHandle); // mPlot->removeItem(mLeftHandle);
// mPlot->removeItem(mRightHandle); // mPlot->removeItem(mRightHandle);
} }
} }
void TransparentDraggableGeoLith::DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout) void TransparentDraggableGeoLith::DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
{ {
QString svg=svgFileName; QString svg=svgFileName;
QRectF boundingRect = painter->transform().mapRect(borderRect); QRectF boundingRect = painter->transform().mapRect(borderRect);
painter->save(); painter->save();
@ -38,18 +40,18 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
QRect border(boundingRect.left(),boundingRect.top(),boundingRect.width(),boundingRect.height()); QRect border(boundingRect.left(),boundingRect.top(),boundingRect.width(),boundingRect.height());
painter->drawPixmap(border,tiledmap); painter->drawPixmap(border,tiledmap);
painter->restore(); painter->restore();
} }
//拉伸 //拉伸
void TransparentDraggableGeoLith::DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout) void TransparentDraggableGeoLith::DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
{ {
QString svg=svgFileName; QString svg=svgFileName;
QSvgRenderer m_SvgRenderer; QSvgRenderer m_SvgRenderer;
m_SvgRenderer.load(svg); m_SvgRenderer.load(svg);
m_SvgRenderer.render(painter,borderRect); m_SvgRenderer.render(painter,borderRect);
} }
//平铺 //平铺
void TransparentDraggableGeoLith::DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout) void TransparentDraggableGeoLith::DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
{ {
QString svg=svgFileName; QString svg=svgFileName;
QRectF boundingRect = painter->transform().mapRect(borderRect); QRectF boundingRect = painter->transform().mapRect(borderRect);
painter->save(); painter->save();
@ -65,32 +67,32 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
QPixmap tiledmap(svg); QPixmap tiledmap(svg);
painter->drawTiledPixmap(boundingRect,tiledmap); painter->drawTiledPixmap(boundingRect,tiledmap);
painter->restore(); painter->restore();
} }
//设置最小宽度 //设置最小宽度
void TransparentDraggableGeoLith::setMinWidth(double minWidth) void TransparentDraggableGeoLith::setMinWidth(double minWidth)
{ {
mMinWidth = minWidth; mMinWidth = minWidth;
} }
//设置标题 //设置标题
void TransparentDraggableGeoLith::setTitle(QString strTitle) void TransparentDraggableGeoLith::setTitle(QString strTitle)
{ {
mstrTitle = strTitle; mstrTitle = strTitle;
mItemTitle->setText(mstrTitle); mItemTitle->setText(mstrTitle);
//mPlot->replot(); //mPlot->replot();
} }
//设置解释结论 //设置解释结论
void TransparentDraggableGeoLith::setLith(QString filePath, QString colorPath) void TransparentDraggableGeoLith::setLith(QString filePath, QString colorPath)
{ {
m_Lith = filePath; m_Lith = filePath;
m_Color = colorPath; m_Color = colorPath;
} }
void TransparentDraggableGeoLith::drawLith(double left_Low, double right_Hight, double lY1, double lY2) void TransparentDraggableGeoLith::drawLith(double left_Low, double right_Hight, double lY1, double lY2)
{ {
if(m_Lith=="") if(m_Lith=="")
{ {
return; return;
@ -98,7 +100,7 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
double x1 = mPlot->xAxis->coordToPixel(left_Low); double x1 = mPlot->xAxis->coordToPixel(left_Low);
double x2 = mPlot->xAxis->coordToPixel(right_Hight); double x2 = mPlot->xAxis->coordToPixel(right_Hight);
double y1 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/4); double y1 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/mPlot->m_dOilZhan);
double y2 = mPlot->yAxis->coordToPixel(lY2); double y2 = mPlot->yAxis->coordToPixel(lY2);
double newWidth = y2-y1; double newWidth = y2-y1;
double newHeight = x1-x2; double newHeight = x1-x2;
@ -127,19 +129,6 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
DrawSVGSteched(&painter,m_Color,fillRect,0); DrawSVGSteched(&painter,m_Color,fillRect,0);
} }
// bool isStrech=false;
// QSvgRenderer m_SvgRenderer;
// m_SvgRenderer.load(filePath);
// if(!isStrech){
// float oil_h = fillRect.width();
// oil_h = (oil_h / 2 >= fillRect.height() / 2) ? fillRect.height() : oil_h;
// float rect_y = fillRect.y() + fillRect.height() / 2 - oil_h / 2;
// fillRect.setY(rect_y);
// fillRect.setHeight(oil_h);
// }
// fillRect.setX(fillRect.x() + 1);
// m_SvgRenderer.render(&painter, fillRect);
//拉伸 //拉伸
DrawSVGSteched(&painter,filePath,fillRect,0); DrawSVGSteched(&painter,filePath,fillRect,0);
//平铺 //平铺
@ -158,35 +147,9 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
// //
mPixmap_Lith->setPixmap(QPixmap(val)); // 设置图片 mPixmap_Lith->setPixmap(QPixmap(val)); // 设置图片
// QSvgRenderer* svgRender = new QSvgRenderer();
// svgRender->load(result);
// //
// QPixmap* pixmap = new QPixmap(10, 10);
// pixmap->fill(Qt::transparent);//设置背景透明
// QPainter p(pixmap);
// svgRender->render(&p);
// //
// mPixmap->setPixmap(*pixmap); // 设置图片
} }
else else
{ {
// QString val=filePath;
// QImage image(47,16,QImage::Format_RGB32);
// QPainter painter(&image);
// QRectF fillRect(0,0,47,16);
// painter.fillRect(fillRect, QColor(0, 0, 0, 0));
// //
// painter.setBrush(QBrush(QPixmap(colorPath)));
// QPixmap* pixmap = new QPixmap(filePath);
// pixmap->fill(Qt::transparent);//设置背景透明
// mPixmap_Lith->setPixmap(*pixmap); // 设置图片
//mPixmap_Lith->setPixmap(QPixmap(filePath)); // 设置图片
QString path,filename; QString path,filename;
GetWellNameAndPath(filePath, filename, path); GetWellNameAndPath(filePath, filename, path);
QString basename = filename; QString basename = filename;
@ -227,20 +190,16 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
mPixmap_Lith->topLeft->setCoords(mPlot->xAxis->pixelToCoord(x2+1), mPlot->yAxis->pixelToCoord(y1+1));//right_Hight mPixmap_Lith->topLeft->setCoords(mPlot->xAxis->pixelToCoord(x2+1), mPlot->yAxis->pixelToCoord(y1+1));//right_Hight
mPixmap_Lith->bottomRight->setCoords(mPlot->xAxis->pixelToCoord(x1-1), mPlot->yAxis->pixelToCoord(y2-1));//left_Low mPixmap_Lith->bottomRight->setCoords(mPlot->xAxis->pixelToCoord(x1-1), mPlot->yAxis->pixelToCoord(y2-1));//left_Low
// mPixmap_Lith->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4); }
// mPixmap_Lith->bottomRight->setCoords(left_Low, lY2);
//mPlot->replot(); //设置m_Oil
} void TransparentDraggableGeoLith::setOil(QString filePath)
{
//设置m_Oil
void TransparentDraggableGeoLith::setOil(QString filePath)
{
m_Oil = filePath; m_Oil = filePath;
} }
void TransparentDraggableGeoLith::drawOil(double left_Low, double right_Hight, double lY1, double lY2) void TransparentDraggableGeoLith::drawOil(double left_Low, double right_Hight, double lY1, double lY2)
{ {
if(m_Oil=="") if(m_Oil=="")
{ {
return; return;
@ -249,7 +208,7 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
double x1 = mPlot->xAxis->coordToPixel(left_Low); double x1 = mPlot->xAxis->coordToPixel(left_Low);
double x2 = mPlot->xAxis->coordToPixel(right_Hight); double x2 = mPlot->xAxis->coordToPixel(right_Hight);
double y1 = mPlot->yAxis->coordToPixel(lY1); double y1 = mPlot->yAxis->coordToPixel(lY1);
double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/4); double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/mPlot->m_dOilZhan);
bool bWidthBig = false; bool bWidthBig = false;
double newWidth = y2-y1; double newWidth = y2-y1;
@ -310,55 +269,55 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(y2-1)); //left_Low mPixmap_Oil->bottomRight->setCoords(xNewLeft, mPlot->yAxis->pixelToCoord(y2-1)); //left_Low
//mPlot->replot(); //mPlot->replot();
} }
//设置Color ////设置Color
void TransparentDraggableGeoLith::setColor(QString filePath) //void TransparentDraggableGeoLith::setColor(QString filePath)
{ //{
m_Color = filePath; // m_Color = filePath;
// // //
QString strLast = filePath.right(4); // QString strLast = filePath.right(4);
if(strLast.toLower()==".svg") // if(strLast.toLower()==".svg")
{ // {
QString path,filename; // QString path,filename;
GetWellNameAndPath(filePath, filename, path); // GetWellNameAndPath(filePath, filename, path);
QString basename = filename; // QString basename = filename;
QString val=filePath; // QString val=filePath;
QImage image(320,160,QImage::Format_RGB32); // QImage image(320,160,QImage::Format_RGB32);
QPainter painter(&image); // QPainter painter(&image);
QRectF fillRect(0,0,320,160); // QRectF fillRect(0,0,320,160);
painter.fillRect(fillRect,Qt::white); // painter.fillRect(fillRect,Qt::white);
//拉伸 // //拉伸
DrawSVGSteched(&painter,filePath,fillRect,0); // DrawSVGSteched(&painter,filePath,fillRect,0);
//平铺 // //平铺
//DrawSVGTiled(&painter,filePath,fillRect,0); // //DrawSVGTiled(&painter,filePath,fillRect,0);
//正常 // //正常
//DrawSVGNormal(&painter,filePath,fillRect,0); // //DrawSVGNormal(&painter,filePath,fillRect,0);
val=GetImagePath()+"TempNew"; // val=GetImagePath()+"TempNew";
QDir ss; // QDir ss;
if(!ss.exists(val)) { // if(!ss.exists(val)) {
ss.mkdir(val); // ss.mkdir(val);
} // }
val+=QDir::separator(); // val+=QDir::separator();
val+=basename+".png"; // val+=basename+".png";
image.save(val); // image.save(val);
// // //
mPixmap_Color->setPixmap(QPixmap(val)); // 设置图片 // mPixmap_Color->setPixmap(QPixmap(val)); // 设置图片
} // }
else // else
{ // {
mPixmap_Color->setPixmap(QPixmap(filePath)); // 设置图片 // mPixmap_Color->setPixmap(QPixmap(filePath)); // 设置图片
} // }
//mPlot->replot(); // //mPlot->replot();
} //}
// 设置矩形范围 // 设置矩形范围
void TransparentDraggableGeoLith::setRange(double left_Low, double right_Hight) void TransparentDraggableGeoLith::setRange(double left_Low, double right_Hight, bool bRefresh)
{ {
if(left_Low >= right_Hight) return; if(left_Low >= right_Hight) return;
double lY1 = mPlot->yAxis->range().lower;//+10 double lY1 = mPlot->yAxis->range().lower;//+10
@ -368,48 +327,43 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
mRect->bottomRight->setCoords(right_Hight, lY2); mRect->bottomRight->setCoords(right_Hight, lY2);
//位置与rect不一样否则图像反转 //位置与rect不一样否则图像反转
mPixmap_Color->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4); mPixmap_Color->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/mPlot->m_dOilZhan);
mPixmap_Color->bottomRight->setCoords(left_Low, lY2); mPixmap_Color->bottomRight->setCoords(left_Low, lY2);
// //
//mPixmap_Lith->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4);
//mPixmap_Lith->bottomRight->setCoords(left_Low, lY2);
drawLith(left_Low, right_Hight, lY1, lY2); drawLith(left_Low, right_Hight, lY1, lY2);
//位置与rect不一样否则图像反转 //位置与rect不一样否则图像反转
//mPixmap_Oil->topLeft->setCoords(right_Hight, lY1);
//mPixmap_Oil->bottomRight->setCoords(left_Low, lY1+(lY2-lY1)/4);
drawOil(left_Low, right_Hight, lY1, lY2); drawOil(left_Low, right_Hight, lY1, lY2);
//mItemTitle->position->setCoords(0.5, 0.5);
// 设置父锚点,定位点 // 设置父锚点,定位点
//mItemTitle->position->setParentAnchor(mRect->bottom);
mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2, mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置 (mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置
//mRect->topLeft->setCoords(left, mPlot->yAxis->range().upper);
//mRect->bottomRight->setCoords(right, mPlot->yAxis->range().lower);
updateHandles(); updateHandles();
if(bRefresh)
{
mPlot->replot(); mPlot->replot();
} }
}
// 获取当前范围 // 获取当前范围
QCPRange TransparentDraggableGeoLith::getRange() QCPRange TransparentDraggableGeoLith::getRange()
{ {
return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x()); return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x());
} }
// 设置矩形颜色 // 设置矩形颜色
void TransparentDraggableGeoLith::setColor(const QColor &color) void TransparentDraggableGeoLith::setColor(const QColor &color)
{ {
mRect->setBrush(QBrush(color)); mRect->setBrush(QBrush(color));
mRect->setPen(QPen(color.darker())); mRect->setPen(QPen(color.darker()));
//mPlot->replot(); //mPlot->replot();
} }
// 删除框图 // 删除框图
void TransparentDraggableGeoLith::deleteRect() void TransparentDraggableGeoLith::deleteRect()
{ {
if(mPlot) { if(mPlot) {
// mRect->deleteLater(); // mRect->deleteLater();
@ -439,11 +393,11 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
// mPlot->replot(); // mPlot->replot();
// mPlot->selectionRect()->mActive=true; // mPlot->selectionRect()->mActive=true;
} }
} }
void TransparentDraggableGeoLith::initRect() void TransparentDraggableGeoLith::initRect()
{ {
// 创建透明矩形 // 创建透明矩形
mRect = new QCPItemRect(mPlot); mRect = new QCPItemRect(mPlot);
mRect->setLayer("overlay"); // 确保在最上层 mRect->setLayer("overlay"); // 确保在最上层
@ -495,10 +449,10 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
//mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio); //mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio);
mItemTitle->position->setCoords(0.5, 0); mItemTitle->position->setCoords(0.5, 0);
mItemTitle->setLayer("overlay"); mItemTitle->setLayer("overlay");
} }
void TransparentDraggableGeoLith::updateHandles() void TransparentDraggableGeoLith::updateHandles()
{ {
// 左边界矩形控制点 // 左边界矩形控制点
mLeftHandle->topLeft->setParentAnchor(mRect->topLeft); mLeftHandle->topLeft->setParentAnchor(mRect->topLeft);
mLeftHandle->bottomRight->setParentAnchor(mRect->topRight);//(mRect->bottomLeft); mLeftHandle->bottomRight->setParentAnchor(mRect->topRight);//(mRect->bottomLeft);
@ -510,52 +464,163 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
mRightHandle->bottomRight->setParentAnchor(mRect->bottomRight); mRightHandle->bottomRight->setParentAnchor(mRect->bottomRight);
mRightHandle->topLeft->setCoords(-0.5, 0.5); // 矩形大小 mRightHandle->topLeft->setCoords(-0.5, 0.5); // 矩形大小
mRightHandle->bottomRight->setCoords(0.5, -0.5); // 矩形大小 mRightHandle->bottomRight->setCoords(0.5, -0.5); // 矩形大小
}
} //分割
void TransparentDraggableGeoLith::onSplitRect()
{
QCPRange currentRange = getRange();
//分割后显示上半部分
setRange((currentRange.lower+currentRange.upper)/2.0, currentRange.upper);
void TransparentDraggableGeoLith::onDelRect() //添加下半部分
{ mPlot->addGeoLithToPlot(currentRange.lower, (currentRange.lower+currentRange.upper)/2.0, m_Lith, m_Oil, m_Color);
//保存
mPlot->SaveToSLF_GeoLith();
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
}
void TransparentDraggableGeoLith::onDelRect()
{
//mDragMode = DragNone; //mDragMode = DragNone;
//删除框图 //删除框图
deleteRect(); deleteRect();
//保存
mPlot->SaveToSLF_GeoLith();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//设置深度移动量
void TransparentDraggableGeoLith::setItemDepthOffset()
{
bool ok=0;
double depthshift=QInputDialog::getDouble(NULL,"深度移动","请输入移动的深度量(上移-,下移+)",0.0,-2147483647, 2147483647,4,&ok);
if(!ok) return;
QCPRange currentRange = getRange();
QCPRange newRange = currentRange;
newRange.lower = currentRange.lower-depthshift;
newRange.upper = currentRange.upper-depthshift;
//
double width = currentRange.size();
// //double center = mDragStartRange.center() + dx;
// double center = currentRange.center() - depthshift;
// newRange.lower = center - width/2;
// newRange.upper = center + width/2;
// 检查是否超出轴范围
if(newRange.lower < getMyLower()) {
return;
}
else if(newRange.upper > getMyUpper()) {
return;
}
//
setRange(newRange.lower, newRange.upper);
{
// double low = mRect->topLeft->coords().x();
// double hight = mRect->bottomRight->coords().x();
// PropertyService()->initGeoLithItemProperty(this, low, hight, m_Lith, m_Oil, m_Color);
//保存
mPlot->SaveToSLF_GeoLith();
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
}
}
//设置顶深
void TransparentDraggableGeoLith::setUpper(double upper)
{
QCPRange currentRange = getRange();
QCPRange newRange = currentRange;
double proposedRight = upper;
// 确保不超出轴范围且不使宽度小于最小值
newRange.upper = qBound(
currentRange.lower + mMinWidth,
proposedRight,
getMyUpper());
// 最终确保宽度不小于最小值(针对整体拖动的情况)
if(newRange.size() < mMinWidth) {
newRange.upper = newRange.lower + mMinWidth;
} }
void TransparentDraggableGeoLith::onMousePress(QMouseEvent *event) setRange(newRange.lower, newRange.upper);
}
//设置底深
void TransparentDraggableGeoLith::setLower(double lower)
{
QCPRange currentRange = getRange();
QCPRange newRange = currentRange;
double proposedLeft = lower;
// 确保不超出轴范围且不使宽度小于最小值
newRange.lower = qBound(
getMyLower(),
proposedLeft,
currentRange.upper - mMinWidth);
// 最终确保宽度不小于最小值(针对整体拖动的情况)
if(newRange.size() < mMinWidth) {
// 如果是边界拖动,强制设置最小宽度
newRange.lower = newRange.upper - mMinWidth;
}
setRange(newRange.lower, newRange.upper);
}
void TransparentDraggableGeoLith::onMousePress(QMouseEvent *event)
{
if(event->button() != Qt::LeftButton)//右键
{ {
// //右键 double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
// if(event->button() != Qt::LeftButton) QCPRange currentRange = getRange();
// { if(mLeftHandle->selectTest(event->pos(), false) < 5) {
// double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度 mDragMode = DragNone;
// QCPRange currentRange = getRange(); }
// if(mLeftHandle->selectTest(event->pos(), false) < 5) { else if(mRightHandle->selectTest(event->pos(), false) < 5) {
// mDragMode = DragNone; mDragMode = DragNone;
// } }
// else if(mRightHandle->selectTest(event->pos(), false) < 5) { //else if(x >= currentRange.lower && x <= currentRange.upper) {
// mDragMode = DragNone; else if(y >= currentRange.lower && y <= currentRange.upper) {
// } mDragMode = DragNone;
// //else if(x >= currentRange.lower && x <= currentRange.upper) { }
// else if(y >= currentRange.lower && y <= currentRange.upper) { else {
// mDragMode = DragNone; mDragMode = DragNone;
// } return;
// else { }
// mDragMode = DragNone;
// return; //event->accept();
// }
// //event->accept(); double low = mRect->topLeft->coords().x();
// QMenu menu(nullptr); double hight = mRect->bottomRight->coords().x();
// QAction *delAction = menu.addAction("删除框图"); PropertyService()->initGeoLithItemProperty(this, low, hight, m_Lith, m_Oil, m_Color);
// //delAction->installEventFilter(this);
// connect(delAction, &QAction::triggered, this, &TransparentDraggableResult::onDelRect); QMenu menu(nullptr);
// QAction* pItem = menu.exec(event->globalPos()); menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割", this, &TransparentDraggableGeoLith::onSplitRect);
// if(pItem == delAction) menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableGeoLith::onDelRect);
// { menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableGeoLith::setItemDepthOffset);
// //event->accept(); menu.exec(event->globalPos());
// int ii=0;
// ii++; return;
// } }
// menu.exec(event->globalPos());
// return;
// }
event->accept(); event->accept();
@ -586,10 +651,10 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
mDragStartY = y; mDragStartY = y;
mDragStartRange = currentRange; mDragStartRange = currentRange;
} }
void TransparentDraggableGeoLith::onMouseMove(QMouseEvent *event) void TransparentDraggableGeoLith::onMouseMove(QMouseEvent *event)
{ {
if(mDragMode == DragNone) return; if(mDragMode == DragNone) return;
event->accept(); event->accept();
@ -684,12 +749,25 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
setRange(newRange.lower, newRange.upper); setRange(newRange.lower, newRange.upper);
} }
void TransparentDraggableGeoLith::onMouseRelease(QMouseEvent *event) void TransparentDraggableGeoLith::onMouseRelease(QMouseEvent *event)
{ {
if(event->button() == Qt::LeftButton && mDragMode != DragNone) { if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
event->accept(); event->accept();
//属性
//if(mDragMode == DragRect)
{
double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x();
PropertyService()->initGeoLithItemProperty(this, low, hight, m_Lith, m_Oil, m_Color);
//保存
mPlot->SaveToSLF_GeoLith();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
}
//避免二次绘制框图 //避免二次绘制框图
mPlot->m_bDrawRect = false; mPlot->m_bDrawRect = false;
//emit rangeChanged(getRange()); //emit rangeChanged(getRange());
@ -704,10 +782,10 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
mPlot->replot(); mPlot->replot();
mPlot->selectionRect()->mActive=true; mPlot->selectionRect()->mActive=true;
} }
} }
double TransparentDraggableGeoLith::getMyLower() double TransparentDraggableGeoLith::getMyLower()
{ {
double dLower = mPlot->xAxis->range().lower; double dLower = mPlot->xAxis->range().lower;
double proposedLeft = mDragStartRange.lower; double proposedLeft = mDragStartRange.lower;
@ -733,10 +811,10 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
} }
return dLower; return dLower;
} }
double TransparentDraggableGeoLith::getMyUpper() double TransparentDraggableGeoLith::getMyUpper()
{ {
double dUpper = mPlot->xAxis->range().upper; double dUpper = mPlot->xAxis->range().upper;
double proposedRight = mDragStartRange.upper; double proposedRight = mDragStartRange.upper;
@ -762,5 +840,5 @@ TransparentDraggableGeoLith::TransparentDraggableGeoLith(QMyCustomPlot *parentPl
} }
return dUpper; return dUpper;
} }

View File

@ -34,14 +34,14 @@ public:
void setLith(QString filePath, QString colorPath); void setLith(QString filePath, QString colorPath);
void drawLith(double left_Low, double right_Hight, double lY1, double lY2); void drawLith(double left_Low, double right_Hight, double lY1, double lY2);
void setColor(QString filePath); // void setColor(QString filePath);
//设置m_Oil //设置m_Oil
void setOil(QString filePath); void setOil(QString filePath);
void drawOil(double left_Low, double right_Hight, double lY1, double lY2); void drawOil(double left_Low, double right_Hight, double lY1, double lY2);
// 设置矩形范围 // 设置矩形范围
void setRange(double left_Low, double right_Hight); void setRange(double left_Low, double right_Hight, bool bRefresh=true);
// 获取当前范围 // 获取当前范围
QCPRange getRange(); QCPRange getRange();
@ -51,6 +51,11 @@ public:
// 删除框图 // 删除框图
void deleteRect(); void deleteRect();
//设置顶深
void setUpper(double upper);
//设置底深
void setLower(double lower);
signals: signals:
void rangeChanged(QCPRange newRange); void rangeChanged(QCPRange newRange);
@ -59,14 +64,16 @@ private:
void updateHandles() ; void updateHandles() ;
private slots: private slots:
void onDelRect(); void onSplitRect(); //分割
void onDelRect(); //删除
void setItemDepthOffset(); //设置深度移动量
void onMousePress(QMouseEvent *event); void onMousePress(QMouseEvent *event);
void onMouseMove(QMouseEvent *event); void onMouseMove(QMouseEvent *event);
void onMouseRelease(QMouseEvent *event); void onMouseRelease(QMouseEvent *event);
double getMyLower(); double getMyLower();
double getMyUpper(); double getMyUpper();
private: public:
QMyCustomPlot *mPlot; QMyCustomPlot *mPlot;
QCPItemRect *mRect; QCPItemRect *mRect;
QCPItemRect *mLeftHandle; QCPItemRect *mLeftHandle;
@ -83,6 +90,8 @@ private:
QString m_Oil; QString m_Oil;
QString m_Color; QString m_Color;
//double m_dOilZhan=8; //含油占比
GeoIndicatorGenerator m_drawGeo; GeoIndicatorGenerator m_drawGeo;
enum DragMode { DragNone, DragLeft, DragRight, DragRect }; enum DragMode { DragNone, DragLeft, DragRight, DragRect };

View File

@ -316,12 +316,16 @@ void TransparentDraggableGujing::onSplitRect()
//添加下半部分 //添加下半部分
mPlot->addGujingToPlot(currentRange.lower, (currentRange.lower+currentRange.upper)/2.0, m_Result); mPlot->addGujingToPlot(currentRange.lower, (currentRange.lower+currentRange.upper)/2.0, m_Result);
double low = mRect->topLeft->coords().x(); // double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x(); // double hight = mRect->bottomRight->coords().x();
PropertyService()->initGujingItemProperty(this, low, hight, m_Result); // PropertyService()->initGujingItemProperty(this, low, hight, m_Result);
//保存 //保存
mPlot->SaveToSLF_Gujing(); mPlot->SaveToSLF_Gujing();
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消所有选中单元格 //取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
} }

View File

@ -295,14 +295,10 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
//qDebug() << "LineName:" << strLineName; //qDebug() << "LineName:" << strLineName;
} }
} }
if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT") if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT"
|| strLineName == "GEO_LITH" || strLineName == "SWALL_CORE")
{ {
//固井结论 //固井结论/井壁取心/录井剖面
DisplayTable_One(lineObjInfo);
}
else if (strLineName == "SWALL_CORE")
{
//井壁取心
DisplayTable_One(lineObjInfo); DisplayTable_One(lineObjInfo);
} }
} }
@ -393,6 +389,12 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo)
listOtherProperty.append(strAliasName);//别名 listOtherProperty.append(strAliasName);//别名
listOtherProperty.append(lineColor.name());//名称颜色 listOtherProperty.append(lineColor.name());//名称颜色
listOtherProperty.append(curveNameFont.toString());//名称字体 listOtherProperty.append(curveNameFont.toString());//名称字体
//
if (lineObjInfo.contains("OilZhan"))//含油占比
{
listOtherProperty.append(QString::number(lineObjInfo.value("OilZhan").toInt()));
}
//结论 //结论
this->addTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, listOtherProperty); this->addTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, listOtherProperty);
} }
@ -820,8 +822,18 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri
else if (strLineName == "GEO_LITH") else if (strLineName == "GEO_LITH")
{ {
//录井剖面 //录井剖面
if(listOtherProperty.size()>=3)
{
QString strAliasName = listOtherProperty[0];
QColor newlineColor=QColor(0,0,0);
newlineColor.setNamedColor(listOtherProperty[1]);
initGeoLith(curv, strSlfName, strLineName, strAliasName, newlineColor, listOtherProperty);
}
else
{
initGeoLith(curv, strSlfName, strLineName); initGeoLith(curv, strSlfName, strLineName);
} }
}
else if (strLineName == "SWALL_CORE") else if (strLineName == "SWALL_CORE")
{ {
//井壁取心 //井壁取心
@ -3960,9 +3972,8 @@ bool FormDraw::LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QSt
} }
//录井剖面 //录井剖面
void FormDraw::initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName) void FormDraw::initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty)
{ {
int iMyWidth = widget->axisRect(0)->width(); int iMyWidth = widget->axisRect(0)->width();
float vmax = iMyWidth; float vmax = iMyWidth;
float vmin = 0; float vmin = 0;
@ -3992,125 +4003,28 @@ void FormDraw::initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString st
widget->yAxis->setTicks(false); widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false); widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false); widget->yAxis2->setTicks(false);
//
LoadFromSLF_GeoLith(widget, strSlfName, strLineName);
QString strAliasName = ""; //含油占比
if(listOtherProperty.size()>=4)
{
widget->m_dOilZhan = listOtherProperty[3].toDouble();
}
//加载
widget->LoadFromSLF_GeoLith(strSlfName, strLineName);
if(listOtherProperty.size()>=3)
{
strAliasName = listOtherProperty[0];
newlineColor.setNamedColor(listOtherProperty[1]);
}
QString strUnit = ""; QString strUnit = "";
QColor newlineColor=QColor(0,0,0);
double width=2; double width=2;
QString strScaleType = ""; QString strScaleType = "";
//道-对象 //道-对象
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject"); m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty);
} }
bool FormDraw::LoadFromSLF_GeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
{
CMemRdWt *logio=new CMemRdWt();
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
return false;
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
if(iIndex>-1) {
int len=logio->GetTableRecordLength(iIndex);
int sl=sizeof(GeoLith_DATA);
if(sl>len) len=sl;
GeoLith_DATA *m_Result;
m_Result=(GeoLith_DATA *)new char[len+1];
int count=logio->GetTableRecordCount(iIndex);
for(int i=0;i<count;i++) {
memset(m_Result,0,len);
logio->ReadTable(iIndex,i+1,m_Result);
//
QMap<QString,QString> OilOrder;
QMap<QString,QString> LithOrder;
QMap<QString,QString> ColorOrder;
QMap<QString,QString> ColorInds;
//
LithOrder=GetZoneOrder(QString("GeoLith"));
OilOrder=GetZoneOrder(QString("CoreOil"));
ColorOrder=GetZoneOrder(QString("CoreColor"));
ColorInds=GetZoneOrder(QString("ColorInd"));
QString iconshotname="";
QString IntLith = QString::number(m_Result->Lith);
if(IntLith=="0") {
iconshotname="";
}
else
{
iconshotname=LithOrder.key(IntLith);
}
//
QString Lith = "";
if(iconshotname!="")
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
int len=2;
int pos=Lith.indexOf(".//");
if(pos<0) pos=Lith.indexOf("./");
else len=3;
QString svg;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Lith.mid(len-1);
}
else svg=Lith;
QDir ss;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Lith=svg;
//
QString Oil = "";
iconshotname=OilOrder.key(QString::number(m_Result->Oil));
if(iconshotname!="")
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
len=2;
pos=Oil.indexOf(".//");
if(pos<0) pos=Oil.indexOf("./");
else len=3;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Oil.mid(len-1);
}
else svg=Oil;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Oil=svg;
//
QString Color = "";
int ind=ColorInds.value(QString::number(m_Result->Color)).toInt();
if (ind>-1&&ind<ColorOrder.size())
{
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
}
else {
Color=::GetColorSymbolDir()+"空白.svg";
}
//
widget->addGeoLithToPlot(-m_Result->EDEP, -m_Result->SDEP, Lith, Oil, Color);
}
logio->CloseTable(iIndex);
delete m_Result;
}
delete logio;
return true;
}
//井壁取心 //井壁取心
void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty) void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty)
{ {

View File

@ -181,8 +181,7 @@ public:
bool LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QString strLineName); bool LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
//录井剖面 //录井剖面
void initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName); void initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "录井剖面", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={});
bool LoadFromSLF_GeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
//井壁取心 //井壁取心
void initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "井壁取心", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); void initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "井壁取心", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={});

View File

@ -150,6 +150,17 @@ QJsonObject FormInfo::makeJson()
//item属性写入slf文件不需要此次记录 //item属性写入slf文件不需要此次记录
return rootObj; return rootObj;
} }
else if (m_strLineName == "GEO_LITH")
{
//录井剖面
rootObj["Type"] = m_strType;
rootObj["curveNameFont"] = m_curveNameFont.toString();
rootObj["lineColor"] = m_lineColor.name();
rootObj["OilZhan"] = m_dOilZhan;//含油占比
//item属性写入slf文件不需要此次记录
return rootObj;
}
} }
rootObj["Unit"] = m_strUnit; rootObj["Unit"] = m_strUnit;
@ -420,7 +431,7 @@ void FormInfo::paintEvent(QPaintEvent* event)
else if(m_strLineName=="GEO_LITH") else if(m_strLineName=="GEO_LITH")
{ {
//录井剖面,不绘制左右范围 //录井剖面,不绘制左右范围
painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "录井剖面"); //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "录井剖面");
} }
else if(m_strLineName=="SWALL_CORE") else if(m_strLineName=="SWALL_CORE")
{ {

View File

@ -142,6 +142,8 @@ public:
QFont m_layerFont; // 层号字体 QFont m_layerFont; // 层号字体
float m_fLayerRotate = 0.0f; // 层号旋转 float m_fLayerRotate = 0.0f; // 层号旋转
//录井剖面
double m_dOilZhan=8; //含油占比
public: public:
void setLineWidth(double dWidth); void setLineWidth(double dWidth);

View File

@ -534,15 +534,24 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString
formInfo->setFrontColor(QColor(0,0,0)); formInfo->setFrontColor(QColor(0,0,0));
formInfo->setBackColor(QColor(255,255,255)); formInfo->setBackColor(QColor(255,255,255));
if(strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT" if(strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT"
|| strLineName == "SWALL_CORE") || strLineName == "GEO_LITH" || strLineName == "SWALL_CORE")
{ {
//固井结论/ 井壁取心 //固井结论 / 井壁取心 / 录井剖面
if(listOtherProperty.size()>=3) if(listOtherProperty.size()>=3)
{ {
QFont curveNameFont("微软雅黑", 10); // 名称字体 QFont curveNameFont("微软雅黑", 10); // 名称字体
curveNameFont.fromString(listOtherProperty[2]); curveNameFont.fromString(listOtherProperty[2]);
formInfo->m_curveNameFont = curveNameFont; formInfo->m_curveNameFont = curveNameFont;
} }
//录井剖面
if(strLineName == "GEO_LITH")
{
if(listOtherProperty.size()>=4)
{
formInfo->m_dOilZhan = listOtherProperty[3].toDouble();
}
}
} }
//设置高度 //设置高度
ui->tableWidget->setRowHeight(row, 100); ui->tableWidget->setRowHeight(row, 100);

View File

@ -123,6 +123,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList))); connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList)));
//改变固井曲线名 //改变固井曲线名
connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString)));
//改变录井剖面属性
connect(CallManage::getInstance(), SIGNAL(sig_changeGeoLithLine(QString, QString, QString, QString, QString, double)), this, SLOT(s_changeGeoLithLine(QString, QString, QString, QString, QString, double)));
} }
void QMyCustomPlot::initGeometry(QString strUuid, int nscale, int nW) void QMyCustomPlot::initGeometry(QString strUuid, int nscale, int nW)
@ -956,8 +958,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::MegResult_Gujing); menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::MegResult_Gujing);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }
else if (m_strLineName == "SWALL_CORE")
if (m_strLineName == "SWALL_CORE")
{ {
QMenu menu(this); QMenu menu(this);
//井壁取心 //井壁取心
@ -969,6 +970,17 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_SWallCore); menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_SWallCore);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }
else if (m_strLineName == "GEO_LITH")
{
QMenu menu(this);
//录井剖面
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑录井剖面", this, &QMyCustomPlot::onEditGeoLith);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_GeoLith);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_GeoLith);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_GeoLith);
menu.exec(event->globalPos());
}
// QAction *resetAction = menu.addAction("添加框图"); // QAction *resetAction = menu.addAction("添加框图");
// connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect); // connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect);
@ -1174,6 +1186,167 @@ void QMyCustomPlot::onEditGujing()
} }
} }
//右键--添加录井剖面
void QMyCustomPlot::onEditGeoLith()
{
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
if(m_bFirstTimeConnect)
{
//信号槽只绑定一次,避免重复绑定
m_bFirstTimeConnect = false;
for (int i=0; i < this->graphCount(); ++i) {
QCPGraph *graph = this->graph(i);
graph->setSelectable(QCP::stDataRange);
break;
}
connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){
if(this->m_bDrawRect == false)
{
this->m_bDrawRect = true;
return;
}
// 当选择完成时,获取矩形范围并放大
QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标)
m_bEditRect=true;//当前是否正在编辑曲线。
// 转换为坐标轴范围
double top = rect.top();
double bottom = rect.bottom();
double right_Hight = this->xAxis->pixelToCoord(top);
double left_Low = this->xAxis->pixelToCoord(bottom);
//追加判断,避免框选重叠
TransparentDraggableGeoLith *pDraggableRect =NULL;
{
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
while( it != m_mapDraggable_GeoLith.end() )
{
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight)
{
return;
}
if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight)
{
return;
}
if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight)
{
return;
}
it++;
}
}
{
//
QMap<QString,QString> OilOrder;
QMap<QString,QString> LithOrder;
QMap<QString,QString> ColorOrder;
QMap<QString,QString> ColorInds;
//
LithOrder=GetZoneOrder(QString("GeoLith"));
OilOrder=GetZoneOrder(QString("CoreOil"));
ColorOrder=GetZoneOrder(QString("CoreColor"));
ColorInds=GetZoneOrder(QString("ColorInd"));
int iOil=1;//含油性
int iLith=50;//岩性
int iColor=0;//颜色
QString iconshotname="";
QString IntLith = QString::number(iLith);
if(IntLith=="0") {
iconshotname="";
}
else
{
iconshotname=LithOrder.key(IntLith);
}
//
QString Lith = "";
if(iconshotname!="")
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
int len=2;
int pos=Lith.indexOf(".//");
if(pos<0) pos=Lith.indexOf("./");
else len=3;
QString svg;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Lith.mid(len-1);
}
else svg=Lith;
QDir ss;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Lith=svg;
//
QString Oil = "";
iconshotname=OilOrder.key(QString::number(iOil));
if(iconshotname!="")
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
len=2;
pos=Oil.indexOf(".//");
if(pos<0) pos=Oil.indexOf("./");
else len=3;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Oil.mid(len-1);
}
else svg=Oil;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Oil=svg;
//
QString Color = "";
int ind=ColorInds.value(QString::number(iColor)).toInt();
if (ind>-1&&ind<ColorOrder.size())
{
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
}
else {
Color=::GetColorSymbolDir()+"空白.svg";
}
//添加录井剖面
this->addGeoLithToPlot(left_Low, right_Hight, Lith, Oil, Color);
//保存
this->SaveToSLF_GeoLith();
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消框选
this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
this->setSelectionRectMode(QCP::srmNone);
}
});
}
}
bool QMyCustomPlot::SaveToSLF_SwallCore() bool QMyCustomPlot::SaveToSLF_SwallCore()
{ {
static int isrun=false; static int isrun=false;
@ -1350,6 +1523,151 @@ bool QMyCustomPlot::SaveToSLF_SwallCore()
return true; return true;
} }
//
QString QMyCustomPlot::GetIntLith(QString Lith)
{
if(Lith=="") return "";
QFileInfo afile(Lith);
return LithOrder.value(afile.completeBaseName());
}
QString QMyCustomPlot::GetIntOil(QString Oil)
{
if(Oil=="") return "";
QFileInfo afile(Oil);
return OilOrder.value(afile.completeBaseName());
}
QString QMyCustomPlot::GetIntColor(QString Color)
{
if(Color=="") return "";
QFileInfo afile(Color);
return ColorOrder.value(afile.completeBaseName());
}
//保存录井剖面
bool QMyCustomPlot::SaveToSLF_GeoLith()
{
static int isrun=false;
if(isrun) return false;
QString ss=m_strSlfName;
if(ss=="") return false;
isrun=true;
GeoLith_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;
}
bool isfirst=false;
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
if (iIndex < 0)
{
if(!m_mapDraggable_GeoLith.size()) {
delete logio;
isrun=false;
return false;
}
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,7,
"NO,SDEP,EDEP,OIL,LITH,COLOR,DEST",
"4,4,4,4,4,4,64",//字段长度
"1,4,4,1,1,1,6",//字段类型
"0,0,0,3,7,5,0");//字段备注
isfirst=true;
}
logio->SetTableRecordCount(iIndex,m_mapDraggable_GeoLith.size());
if(!m_mapDraggable_GeoLith.size()) {
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return false;
}
//-----
LithOrder.clear();
OilOrder.clear();
ColorOrder.clear();
ColorInds.clear();
LithOrder=GetZoneOrder(QString("GeoLith"));
OilOrder=GetZoneOrder(QString("CoreOil"));
ColorOrder=GetZoneOrder(QString("CoreColor"));
ColorInds=GetZoneOrder(QString("ColorInd"));
TransparentDraggableGeoLith *pDraggableRect =NULL;
//排序
QList<float> listSDepth;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_GeoLith.begin(); iter != m_mapDraggable_GeoLith.end(); iter++)
{
pDraggableRect = (TransparentDraggableGeoLith*)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_GeoLith.begin(); iter != m_mapDraggable_GeoLith.end(); iter++)
{
pDraggableRect = (TransparentDraggableGeoLith*)iter.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
float fSDepth = -tmpRange.upper;
if(fSDepth == listSDepth[i])//按顺序写入
{
memset(&m_Result,0,sizeof(GeoLith_DATA));
m_Result.SDEP = -tmpRange.upper;
m_Result.EDEP = -tmpRange.lower;
m_Result.NO=i+1;
m_Result.Lith=325;
QString innerresult=GetIntLith(pDraggableRect->m_Lith);
if(innerresult!="")
m_Result.Lith=innerresult.toInt();
if(m_Result.Lith<1) m_Result.Lith=325;
m_Result.Oil=1;
innerresult=GetIntOil(pDraggableRect->m_Oil);
if(innerresult!="")
m_Result.Oil=innerresult.toInt();
if(m_Result.Oil<1) m_Result.Oil=1;
QString name,path;
GetWellNameAndPath(pDraggableRect->m_Color,name,path);
if(name!="空白"&&name!=""&&name!="白色") strcpy(m_Result.Dest,name.toStdString().c_str());
int ind=ColorOrder.value(name).toInt();
if(ind<0||ind>=ColorInds.size()) m_Result.Color=0;
else m_Result.Color=ColorInds.key(QString::number(ind)).toInt();
name="";
GetWellNameAndPath(pDraggableRect->m_Oil,name,path);
if(name!="空白"&&name!="") strcat(m_Result.Dest,name.toStdString().c_str());
name="";
GetWellNameAndPath(pDraggableRect->m_Lith,name,path);
if(name!="空白"&&name!="") strcat(m_Result.Dest,name.toStdString().c_str());
name=m_Result.Dest;
name.remove("空白");
//此处统一转换
int n=strlen(name.toStdString().c_str());
if(n>sizeof(m_Result.Dest)) n=sizeof(m_Result.Dest);
strncpy(m_Result.Dest,name.toLocal8Bit().data(),n);
//
logio->WriteTable(iIndex,i+1,&m_Result);
}
}
}
logio->CloseTable(iIndex);
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return true;
}
//保存固井结论道 //保存固井结论道
bool QMyCustomPlot::SaveToSLF_Gujing() bool QMyCustomPlot::SaveToSLF_Gujing()
{ {
@ -1712,6 +2030,342 @@ void QMyCustomPlot::DeleteItems_SWallCore()
PropertyService()->InitCurrentViewInfo(); PropertyService()->InitCurrentViewInfo();
} }
//全部清空
void QMyCustomPlot::DeleteItems_GeoLith()
{
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
QString obj=m_strLineName + "BAK";
CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str());
AddTableToWellRound();
//删除对象
TransparentDraggableGeoLith *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
while( it != m_mapDraggable_GeoLith.end() )
{
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
it++;
pDraggableRect->deleteRect();
}
//保存
this->SaveToSLF_GeoLith();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//从剪切板文本数据粘贴
void QMyCustomPlot::addItems_GeoLith()
{
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
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("\t"," ");
originalText.replace(","," ");
originalText.replace("\r\n","\n");
originalText.replace("\r","\n");
QStringList line=originalText.split("\n");
line.removeAll("");
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;
//录井剖面
AddItem_GeoLith(coredat);
}
//保存
this->SaveToSLF_GeoLith();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
void QMyCustomPlot::AddItem_GeoLith(QStringList lists)
{
//初始化LithOrder
if(LithOrder.size()<=0)
{
LithOrder=GetZoneOrder(QString("GeoLith"));
}
if(OilOrder.size()<=0)
{
OilOrder=GetZoneOrder(QString("CoreOil"));
}
if(ColorOrder.size()<=0)
{
ColorOrder=GetZoneOrder(QString("CoreColor"));
}
if(ColorInds.size()<=0)
{
ColorInds=GetZoneOrder(QString("ColorInd"));
}
if(LithWidth.size()<=0)
{
QString configfile=::GetConfPath()+GetOilFieldName()+"LithWidth";
QDir ss1;
if(!ss1.exists(configfile+".txt")) configfile+=".ini";
else configfile+=".txt";
QStringList lines;
QFile file( configfile );
if ( file.open( QIODevice::ReadOnly ) ) {
QTextStream stream( &file );
QString line;
while ( !stream.atEnd() ) {
line = stream.readLine(); // 不包括“\n”的一行文本
lines += line;
}
file.close();
}
LithWidth=lines;
}
if(lists.size()<3) return;
if(lists.size()<4) lists.insert(0,"0");
GeoLith_DATA m_Result;
memset(&m_Result,0,sizeof(GeoLith_DATA));
double top=-9999.0;
double bottom=-9999.0;
m_Result.NO=lists[0].toInt();
top=(int)(lists[1].toDouble()*1000+0.5)/1000.0;
bottom=(int)(lists[2].toDouble()*1000+0.5)/1000.0;
m_Result.SDEP=top;
m_Result.EDEP=bottom;
m_Result.Oil=-1;
m_Result.Lith=325;
if(lists.size()>2) {
if(!lists[3].isEmpty()) {
if(lists[3].at(0).isDigit()||lists[3].at(0)=='.') {
m_Result.Oil=lists[3].toDouble();
if(lists.size()>4) m_Result.Lith=lists[4].toDouble();
}
else {
for(int j=0;j<3;j++) {
QMap<QString,QString> ss;
if(j==0) ss=LithOrder;
else if(j==1)ss=OilOrder;
else ss=ColorOrder;
int len=0;
int len1=0;
int iid=-1;
QString key,value;
for(int i=0;i<ss.size();i++) {
key=ss.key(QString::number(i+1));
value=lists[3];
if(!key.isEmpty()&&value.indexOf(key)>-1) {
len1=strlen(key.toStdString().c_str());
if(len<len1) {
len=len1;
iid=i;
}
}
}
if(len) {
if(j==0) m_Result.Lith=iid+1;
else if(j==1) m_Result.Oil=iid+1;
else {
if(iid>=0&&iid<ColorInds.size()) m_Result.Color=ColorInds.key(QString::number(iid+1)).toInt();
else m_Result.Color=0;
}
}
}
}
}
}
if(top==0&&bottom==0) return;
if(bottom<top) {
return;
}
//----------
QString iconshotname="";
QString IntLith = QString::number(m_Result.Lith);
if(IntLith=="0") {
iconshotname="";
}
else
{
iconshotname=LithOrder.key(IntLith);
}
//
QString Lith = "";
if(iconshotname!="")
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
int len=2;
int pos=Lith.indexOf(".//");
if(pos<0) pos=Lith.indexOf("./");
else len=3;
QString svg;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Lith.mid(len-1);
}
else svg=Lith;
QDir ss;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Lith=svg;
//
QString Oil = "";
iconshotname=OilOrder.key(QString::number(m_Result.Oil));
if(iconshotname!="")
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
len=2;
pos=Oil.indexOf(".//");
if(pos<0) pos=Oil.indexOf("./");
else len=3;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Oil.mid(len-1);
}
else svg=Oil;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Oil=svg;
//
QString Color = "";
int ind=ColorInds.value(QString::number(m_Result.Color)).toInt();
if (ind>-1&&ind<ColorOrder.size())
{
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
}
else {
Color=::GetColorSymbolDir()+"空白.svg";
}
//
this->addGeoLithToPlot(-m_Result.EDEP, -m_Result.SDEP, Lith, Oil, Color);
}
bool QMyCustomPlot::LoadFromSLF_GeoLith(QString strSlfName, QString strLineName)
{
//
LithOrder.clear();
OilOrder.clear();
ColorOrder.clear();
ColorInds.clear();
LithOrder=GetZoneOrder(QString("GeoLith"));
OilOrder=GetZoneOrder(QString("CoreOil"));
ColorOrder=GetZoneOrder(QString("CoreColor"));
ColorInds=GetZoneOrder(QString("ColorInd"));
CMemRdWt *logio=new CMemRdWt();
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
return false;
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
if(iIndex>-1) {
int len=logio->GetTableRecordLength(iIndex);
int sl=sizeof(GeoLith_DATA);
if(sl>len) len=sl;
GeoLith_DATA *m_Result;
m_Result=(GeoLith_DATA *)new char[len+1];
int count=logio->GetTableRecordCount(iIndex);
for(int i=0;i<count;i++) {
memset(m_Result,0,len);
logio->ReadTable(iIndex,i+1,m_Result);
QString iconshotname="";
QString IntLith = QString::number(m_Result->Lith);
if(IntLith=="0") {
iconshotname="";
}
else
{
iconshotname=LithOrder.key(IntLith);
}
//
QString Lith = "";
if(iconshotname!="")
Lith=::GetMudSymbolDir()+""+iconshotname+".svg";
int len=2;
int pos=Lith.indexOf(".//");
if(pos<0) pos=Lith.indexOf("./");
else len=3;
QString svg;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Lith.mid(len-1);
}
else svg=Lith;
QDir ss;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Lith=svg;
//
QString Oil = "";
iconshotname=OilOrder.key(QString::number(m_Result->Oil));
if(iconshotname!="")
Oil=::GetGasSymbolDir()+""+iconshotname+".svg";
len=2;
pos=Oil.indexOf(".//");
if(pos<0) pos=Oil.indexOf("./");
else len=3;
if(pos==0)
{
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
svg+=Oil.mid(len-1);
}
else svg=Oil;
if(!ss.exists(svg))
{
QString path=svg.left(svg.lastIndexOf('.')+1);
svg=path+"png";
}
Oil=svg;
//
QString Color = "";
int ind=ColorInds.value(QString::number(m_Result->Color)).toInt();
if (ind>-1&&ind<ColorOrder.size())
{
Color=::GetColorSymbolDir()+""+ColorOrder.key(QString::number(ind))+".svg";
}
else {
Color=::GetColorSymbolDir()+"空白.svg";
}
//不单独刷新
bool bRefresh = true;
this->addGeoLithToPlot(-m_Result->EDEP, -m_Result->SDEP, Lith, Oil, Color, bRefresh);
}
//最后统一刷新
//widget->replot();
logio->CloseTable(iIndex);
delete m_Result;
}
delete logio;
return true;
}
//刷新数据 //刷新数据
void QMyCustomPlot::RefreshItems_SWallCore() void QMyCustomPlot::RefreshItems_SWallCore()
{ {
@ -1731,6 +2385,25 @@ void QMyCustomPlot::RefreshItems_SWallCore()
PropertyService()->InitCurrentViewInfo(); PropertyService()->InitCurrentViewInfo();
} }
//刷新数据
void QMyCustomPlot::RefreshItems_GeoLith()
{
//删除对象
TransparentDraggableGeoLith *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
while( it != m_mapDraggable_GeoLith.end() )
{
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
it++;
pDraggableRect->deleteRect();
}
//重新加载
LoadFromSLF_GeoLith(m_strSlfName, m_strLineName);
//属性清空
PropertyService()->InitCurrentViewInfo();
}
bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName) bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName)
{ {
WALLCORE_DATA m_Result; WALLCORE_DATA m_Result;
@ -2859,7 +3532,7 @@ void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QSt
//this->replot(); //this->replot();
} }
void QMyCustomPlot::addGeoLithToPlot(double left_Low, double right_Hight, const QString myLith, const QString myOil, const QString myColor) void QMyCustomPlot::addGeoLithToPlot(double left_Low, double right_Hight, const QString myLith, const QString myOil, const QString myColor, bool bRefresh)
{ {
QtCommonClass *qtCommon = new QtCommonClass(this); QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid(); QString strUuid = qtCommon->getUUid();
@ -2871,7 +3544,7 @@ void QMyCustomPlot::addGeoLithToPlot(double left_Low, double right_Hight, const
dragRect->setLith(myLith, myColor); dragRect->setLith(myLith, myColor);
// 设置初始范围 // 设置初始范围
dragRect->setRange(left_Low, right_Hight); dragRect->setRange(left_Low, right_Hight, bRefresh);
// 可选:设置颜色 // 可选:设置颜色
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色255, 100, 100, 80 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色255, 100, 100, 80
//最小宽度 //最小宽度
@ -4234,3 +4907,36 @@ void QMyCustomPlot::s_changeGujingLine(QString strUuid, QString strSlfName, QStr
//刷新数据 //刷新数据
RefreshItems_Gujing(); RefreshItems_Gujing();
} }
//改变录井剖面属性
void QMyCustomPlot::s_changeGeoLithLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double dOilZhan)
{
if(m_strUuid == strUuid &&
m_strSlfName == strSlfName &&
m_strWellName == strWellName &&
m_strTrackName == strTrackName &&
m_strLineName == strLineName)
{
}
else
{
return;
}
m_dOilZhan = dOilZhan;
//删除对象
TransparentDraggableGeoLith *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_GeoLith.begin();
while( it != m_mapDraggable_GeoLith.end() )
{
pDraggableRect = (TransparentDraggableGeoLith*)it.value();
it++;
pDraggableRect->deleteRect();
}
//重新加载
LoadFromSLF_GeoLith(m_strSlfName, m_strLineName);
//不清空属性窗口
}

View File

@ -169,10 +169,23 @@ public:
QStringList oils_SWallCore; QStringList oils_SWallCore;
QStringList colors_SWallCore; QStringList colors_SWallCore;
QStringList colorinds_SWallCore; QStringList colorinds_SWallCore;
//
bool SaveToSLF_SwallCore(); bool SaveToSLF_SwallCore();
bool LoadFromSLF_SwallCore(QString strSlfName, QString strLineName); bool LoadFromSLF_SwallCore(QString strSlfName, QString strLineName);
//录井剖面
QMap<QString,QString> OilOrder;
QMap<QString,QString> LithOrder;
QMap<QString,QString> ColorOrder;
QMap<QString,QString> ColorInds;
QStringList LithWidth;
QString GetIntLith(QString Lith);
QString GetIntOil(QString Oil);
QString GetIntColor(QString Color);
bool SaveToSLF_GeoLith();
bool LoadFromSLF_GeoLith(QString strSlfName, QString strLineName);
//录井剖面
double m_dOilZhan=8; //含油占比
public slots: public slots:
void slot_time(); void slot_time();
@ -188,7 +201,7 @@ public:
void addResultToPlot(double left_Low, double right_Hight, QString myResult, 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); 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 addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor);
@ -270,10 +283,12 @@ public slots:
//右键--编辑曲线 //右键--编辑曲线
void onEditLine(); void onEditLine();
//通用
void ClearSelectItems(); //取消选中
//右键--编辑固井 //右键--编辑固井
void onEditGujing(); void onEditGujing();
void addItems_Gujing(); //从剪切板文本数据粘贴 void addItems_Gujing(); //从剪切板文本数据粘贴
void ClearSelectItems(); //取消选中
void DeleteItems_Gujing(); //全部清空 void DeleteItems_Gujing(); //全部清空
void RefreshItems_Gujing(); //刷新数据 void RefreshItems_Gujing(); //刷新数据
void MegResult_Gujing(); //合并结论 void MegResult_Gujing(); //合并结论
@ -286,6 +301,13 @@ public slots:
void RefreshItems_SWallCore(); //刷新数据 void RefreshItems_SWallCore(); //刷新数据
void AddItem_SWallCore(QStringList lists); void AddItem_SWallCore(QStringList lists);
//右键--编辑录井剖面
void onEditGeoLith();
void addItems_GeoLith(); //从剪切板文本数据粘贴
void DeleteItems_GeoLith(); //全部清空
void RefreshItems_GeoLith(); //刷新数据
void AddItem_GeoLith(QStringList lists);
// //
void addItems_Core(); void addItems_Core();
@ -314,6 +336,9 @@ public slots:
//改变固井曲线名 //改变固井曲线名
void s_changeGujingLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName); void s_changeGujingLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName);
//改变录井剖面属性
void s_changeGeoLithLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double dOilZhan);
public: public:
//蝌蚪图重绘网格线 //蝌蚪图重绘网格线
bool mKedou = false; bool mKedou = false;