This commit is contained in:
jiayulong 2026-03-25 09:29:08 +08:00
commit 52a1495d08
9 changed files with 570 additions and 17 deletions

View File

@ -3075,6 +3075,86 @@ void PropertyWidget::initGeoLithProperty(FormInfo *formInfo)
m_strCurrentProperty = GeoLith_Property; m_strCurrentProperty = GeoLith_Property;
} }
void PropertyWidget::initCorePhysicsProperty(FormInfo *formInfo)
{
}
void PropertyWidget::initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, QString strResult, double left)
{
//初始化,清空
InitCurrentViewInfo();
FormInfo* formInfo = tdImage->mPlot->m_formTrack->getFormInfoByParameters(tdImage->mPlot->m_strUuid, tdImage->mPlot->m_strWellName,
tdImage->mPlot->m_strTrackName, tdImage->mPlot->m_strLineName);
if (formInfo != NULL)
{
m_formInfo = formInfo;
m_strUuid = formInfo->m_strUuid;
m_strTrackUuid = formInfo->m_strTrackUuid;
//
m_strSlfName = formInfo->m_strSlfName;
m_strWellName = formInfo->m_strWellName;
m_strTrackName = formInfo->m_strTrackName;
m_strLineName = formInfo->m_strLineName;
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "例区高度", formInfo->m_headHeight, QVariant::Int);
_CreateVariantPropertyItem("通常", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
_CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_bVerticaDrawing, QVariant::Bool);
_CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("曲线线型", "线型", formInfo->m_lineColor, QVariant::Color);
_CreateVariantPropertyItem("显示设置", "左刻度", formInfo->m_yxzpLabelFont, QVariant::Font);
_CreateVariantPropertyItem("显示设置", "右刻度", formInfo->m_yxzpLabelRotation, QVariant::Int);
_CreateVariantPropertyItem("显示设置", "等分刻度数或自定义序列", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("显示设置", "刻度类型", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("显示设置", "显示单位", -upper, QVariant::Double);
_CreateVariantPropertyItem("字体", "曲线名称", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("字体", "曲线单位", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("字体", "曲线刻度", -upper, QVariant::Double);
_CreateVariantPropertyItem("绘制方式", "杆状", formInfo->m_yxzpLabelFont, QVariant::Font);
_CreateVariantPropertyItem("绘制方式", "左界", formInfo->m_yxzpLabelRotation, QVariant::Int);
_CreateVariantPropertyItem("绘制方式", "不绘零等无效值", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("绘制方式", "绘制包络线", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("绘制方式", "点状", -upper, QVariant::Double);
_CreateVariantPropertyItem("数据点", "符号类型", formInfo->m_yxzpLabelRotation, QVariant::Int);
_CreateVariantPropertyItem("数据点", "边框颜色", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("数据点", "大小", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("数据点", "填充颜色", -upper, QVariant::Double);
_CreateVariantPropertyItem("表格数据", "字段名称", -upper, QVariant::Double);
_CreateVariantPropertyItem("当前项", "序号", formInfo->m_yxzpLabelRotation, QVariant::Int);
_CreateVariantPropertyItem("当前项", "深度", formInfo->m_yxzpTwoEndDrawing, QVariant::Bool);
_CreateVariantPropertyItem("当前项", "校正深度", formInfo->m_yxzpDrawColor, QVariant::Bool);
_CreateVariantPropertyItem("当前项", "数值", -upper, QVariant::Double);
QStringList listStyle;
listStyle.append("");
listStyle.append("实线");
listStyle.append("虚线");
listStyle.append("点线");
listStyle.append("虚点线");
listStyle.append("虚点点线");
// _CreateEnumPropertyItem("边框属性", "线型", (int)borderStyle, listStyle);
}
//当前属性类型
m_strCurrentProperty = CORE_PHYSICS_ITEM_PROPERTY;
m_tdCorePhysics = tdImage;
}
// 斜井三图一表属性 // 斜井三图一表属性
void PropertyWidget::initTvdProperty(FormInfo *formInfo) void PropertyWidget::initTvdProperty(FormInfo *formInfo)
{ {

View File

@ -28,7 +28,7 @@
#include "TransparentDraggableLayer.h" #include "TransparentDraggableLayer.h"
#include "TransparentDraggableJiegutext.h" #include "TransparentDraggableJiegutext.h"
#include "transparentdraggableGuan.h" #include "transparentdraggableGuan.h"
#include "TransparentDraggableCorePhysics.h"
#include "TransparentGroupResult.h" #include "TransparentGroupResult.h"
//当前曲线类型 //当前曲线类型
@ -48,6 +48,9 @@
#define Image_Property "Image_Property" // 岩心图片 #define Image_Property "Image_Property" // 岩心图片
#define ImageItem_Property "ImageItem_Property" // 岩心图片item #define ImageItem_Property "ImageItem_Property" // 岩心图片item
#define CORE_PHYSICS_PROPERTY "CORE_PHYSICS_PROPERTY" // 岩心分析
#define CORE_PHYSICS_ITEM_PROPERTY "CORE_PHYSICS_ITEM_PROPERTY" // 岩心分析item
#define Depth_Property "Depth_Property" // 深度 #define Depth_Property "Depth_Property" // 深度
#define SwallCore_Property "SwallCore_Property" //井壁取心 #define SwallCore_Property "SwallCore_Property" //井壁取心
@ -147,6 +150,7 @@ public:
TransparentDraggableLayer* m_tdLayer; TransparentDraggableLayer* m_tdLayer;
TransparentDraggableJiegutext* m_tdJiegutext; TransparentDraggableJiegutext* m_tdJiegutext;
TransparentDraggableGuan* m_tdGuan; TransparentDraggableGuan* m_tdGuan;
TransparentDraggableCorePhysics* m_tdCorePhysics;
public: public:
QWidget* GetPropertyWidget(); QWidget* GetPropertyWidget();
@ -189,6 +193,10 @@ public:
void initImageProperty(FormInfo *formInfo); void initImageProperty(FormInfo *formInfo);
void initImageItemProperty(TransparentDraggableImage* tdImage, double lower, double upper, QString strResult, double left, double width, QColor borderColor, Qt::PenStyle borderStyle, int borderWidth); void initImageItemProperty(TransparentDraggableImage* tdImage, double lower, double upper, QString strResult, double left, double width, QColor borderColor, Qt::PenStyle borderStyle, int borderWidth);
// 岩心分析属性
void initCorePhysicsProperty(FormInfo *formInfo);
void initCorePhysicsItemProperty(TransparentDraggableCorePhysics* tdImage, double lower, double upper, QString strResult, double left);
// 井壁取心属性 // 井壁取心属性
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);

View File

@ -0,0 +1,243 @@
#include "TransparentDraggableCorePhysics.h"
extern double g_dPixelPerCm;//每厘米像素数
//static GeoIndicatorGenerator m_drawGeo;
TransparentDraggableCorePhysics::TransparentDraggableCorePhysics(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle)
: QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth)
{
m_strUuid = strUuid;
//
initRect();
}
TransparentDraggableCorePhysics::~TransparentDraggableCorePhysics()
{
if(mPlot)
{
}
}
//设置最小宽度
void TransparentDraggableCorePhysics::setMinWidth(double minWidth)
{
mMinWidth = minWidth;
}
//设置标题
void TransparentDraggableCorePhysics::setTitle(QString strTitle)
{
mstrTitle = strTitle;
//mPlot->replot();
}
// 设置矩形范围
void TransparentDraggableCorePhysics::setRange(double left_Low, double right_Hight, bool bReplot)
{
m_left_Low = left_Low;
m_right_Hight = right_Hight;
double lY1 = mPlot->yAxis->range().lower;//+10
double lY2 = mPlot->yAxis->range().upper;
for(int i =0; i<mPlot->m_x.size(); i++)
{
if(abs(mPlot->m_x[i]-left_Low) < 0.1)
{
lY1 = mPlot->m_y[i];
break;
}
}
m_lY1 = lY1;
qcpItemLine->start->setCoords(left_Low, lY1);//圆心位置
qcpItemLine->end->setCoords(right_Hight, 30);//圆心位置
//updateHandles();
//刷新,针对批量修改不在此处刷新,后面统一刷新
if(bReplot)
{
mPlot->replot();
}
}
// 获取当前范围
//void TransparentDraggableCorePhysics::getRange()
//{
// m_left_Low = qcpItemLine->start->coords().x();
// m_right_Hight = qcpItemLine->end->coords().x();
//}
QCPRange TransparentDraggableCorePhysics::getRange()
{
// 获取线段起点和终点的 X 坐标
double startX = qcpItemLine->start->coords().x();
double endX = qcpItemLine->end->coords().x();
// 自动处理左右顺序,确保最小值 <= 最大值
double lower = qMin(startX, endX);
double upper = qMax(startX, endX);
// 返回构造好的 QCPRange
return QCPRange(lower, upper);
}
// 设置矩形颜色
void TransparentDraggableCorePhysics::setColor(const QColor &color)
{
}
// 删除框图
void TransparentDraggableCorePhysics::deleteRect()
{
if(mPlot) {
mPlot->m_mapDraggable_CorePhysics.remove(m_strUuid);
mPlot->removeItem(qcpItemLine);
//mPlot->replot();
this->deleteLater();
}
}
void TransparentDraggableCorePhysics::initRect()
{
// 连接鼠标事件
connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableCorePhysics::onMousePress);
connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableCorePhysics::onMouseMove);
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableCorePhysics::onMouseRelease);
qcpItemLine = new QCPItemLine(mPlot);
qcpItemLine->setPen(QPen(Qt::black, 10));
qcpItemLine->setLayer("overlay"); // 确保在最上层
//上下边界
updateHandles();
}
void TransparentDraggableCorePhysics::updateHandles()
{
}
void TransparentDraggableCorePhysics::onDelRect()
{
//mDragMode = DragNone;
//删除框图
deleteRect();
mPlot->replot();
}
void TransparentDraggableCorePhysics::onMousePress(QMouseEvent *event)
{
if(event->button() != Qt::LeftButton)//右键
{
// QMenu menu(nullptr);
// QAction *delAction = menu.addAction("删除框图");
// connect(delAction, &QAction::triggered, this, &TransparentDraggableCorePhysics::onDelRect);
// menu.exec(event->globalPos());
// return;
}
event->accept();
// 检查点击了哪个部分
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
double x = mPlot->yAxis->pixelToCoord(event->pos().x());
//double lY1 = mPlot->yAxis->range().lower;//+10
double lY2 = mPlot->yAxis->range().upper;
if(qcpItemLine->selectTest(event->pos(), false) < 5)
{
if(mPlot->m_SelectShiftLine)
{
//之前的选中线段,恢复黑色
TransparentDraggableCorePhysics *tmpLine = (TransparentDraggableCorePhysics*)mPlot->m_SelectShiftLine;
tmpLine->qcpItemLine->setPen(QPen(Qt::blue));
}
//重新设置选中线段
mPlot->m_SelectShiftLine = this;
qcpItemLine->setPen(QPen(Qt::red));
double delta = (lY2-m_lY1)/10.0;
if(x < m_lY1+delta)
{
mDragMode = DragLeft;
}
else if(x > lY2-delta)
{
mDragMode = DragRight;
}
else
{
mDragMode = DragRect;
}
}
else {
mDragMode = DragNone;
return;
}
getRange();
mDragStartY = y;
}
void TransparentDraggableCorePhysics::onMouseMove(QMouseEvent *event)
{
if(mDragMode == DragNone) return;
event->accept();
//double x = mPlot->xAxis->pixelToCoord(event->pos().x());
//double dx = x - mDragStartX;
double y = mPlot->xAxis->pixelToCoord(event->pos().y());
double dy = y - mDragStartY;
mDragStartY = y;
switch(mDragMode) {
case DragLeft: {
m_left_Low = m_left_Low + dy;
break;
}
case DragRight: {
m_right_Hight = m_right_Hight + dy;
break;
}
case DragRect: {
m_left_Low = m_left_Low + dy;
m_right_Hight = m_right_Hight + dy;
break;
}
default:
break;
}
setRange(m_left_Low, m_right_Hight);
}
void TransparentDraggableCorePhysics::onMouseRelease(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
event->accept();
//避免二次绘制框图
mPlot->m_bDrawRect = false;
//emit rangeChanged(getRange());
mDragMode = DragNone;
//取消选中状态
// QCPDataSelection emptySelection;
// mPlot->graph(0)->setSelection(emptySelection);
// mPlot->replot();
//取消选中框
mPlot->selectionRect()->cancel();
mPlot->replot();
mPlot->selectionRect()->mActive=true;
}
}

View File

@ -0,0 +1,70 @@
#ifndef TRANSPARENTDRAGGABLECOREPHYSICS_H
#define TRANSPARENTDRAGGABLECOREPHYSICS_H
#include <QObject>
#include "qmycustomplot.h"
#include <QString>
#include <QMenu>
#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8
//曲线校深--线段
class TransparentDraggableCorePhysics : public QObject
{
Q_OBJECT
public:
explicit TransparentDraggableCorePhysics(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 5.0, QString strTitle = "");
~TransparentDraggableCorePhysics();
//设置最小宽度
void setMinWidth(double minWidth);
//设置标题
void setTitle(QString strTitle);
// 设置矩形范围
void setRange(double left_Low, double right_Hight, bool bReplot=true);
// 获取当前范围
QCPRange getRange();
// 设置矩形颜色
void setColor(const QColor &color);
// 删除框图
void deleteRect();
signals:
void rangeChanged(QCPRange newRange);
private:
void initRect();
void updateHandles() ;
private slots:
void onDelRect();
void onMousePress(QMouseEvent *event);
void onMouseMove(QMouseEvent *event);
void onMouseRelease(QMouseEvent *event);
public:
QMyCustomPlot *mPlot;
QCPItemLine *qcpItemLine;
QString mstrTitle="";
QString m_strUuid = "";
enum DragMode { DragNone, DragLeft, DragRight, DragRect };
DragMode mDragMode = DragNone;
//double mDragStartX = 0;
double mDragStartY = 0;
double m_left_Low = 0;
double m_right_Hight = 0;
double m_lY1 = 0;
// 添加最小宽度成员变量
double mMinWidth;
};
#endif // TRANSPARENTDRAGGABLECOREPHYSICS_H

View File

@ -1,4 +1,4 @@
#include "TransparentDraggableLine.h" #include "TransparentDraggableLine.h"
extern double g_dPixelPerCm;//每厘米像素数 extern double g_dPixelPerCm;//每厘米像素数
//static GeoIndicatorGenerator m_drawGeo; //static GeoIndicatorGenerator m_drawGeo;
@ -95,7 +95,7 @@ void TransparentDraggableLine::initRect()
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLine::onMouseRelease); connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLine::onMouseRelease);
qcpItemLine = new QCPItemLine(mPlot); qcpItemLine = new QCPItemLine(mPlot);
qcpItemLine->setPen(QPen(Qt::blue)); qcpItemLine->setPen(QPen(Qt::blue, 20));
qcpItemLine->setLayer("overlay"); // 确保在最上层 qcpItemLine->setLayer("overlay"); // 确保在最上层
//上下边界 //上下边界

View File

@ -6644,11 +6644,11 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
// //
QString strAliasName = ""; QString strAliasName = "";
QString strUnit = ""; QString strUnit = "";
widget->m_bDrawCore_PHYSICS = true; // widget->m_bDrawCore_PHYSICS = true;
addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit); addRandomGraph(widget, x, y, strSlfName, strLineName, strAliasName, strUnit);
//支持框选------------------ //支持框选------------------
widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); // widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect);
widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData
widget->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式 widget->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式

View File

@ -43,6 +43,7 @@ SOURCES += \
PropertyWidget.cpp \ PropertyWidget.cpp \
QCPSizeHandle.cpp \ QCPSizeHandle.cpp \
QCPSizeHandleManager.cpp \ QCPSizeHandleManager.cpp \
TransparentDraggableCorePhysics.cpp \
TransparentDraggableFac.cpp \ TransparentDraggableFac.cpp \
TransparentDraggableGeoLith.cpp \ TransparentDraggableGeoLith.cpp \
TransparentDraggableGujing.cpp \ TransparentDraggableGujing.cpp \
@ -108,6 +109,7 @@ HEADERS += \
PropertyWidget.h \ PropertyWidget.h \
QCPSizeHandle.h \ QCPSizeHandle.h \
QCPSizeHandleManager.h \ QCPSizeHandleManager.h \
TransparentDraggableCorePhysics.h \
TransparentDraggableFac.h \ TransparentDraggableFac.h \
TransparentDraggableGeoLith.h \ TransparentDraggableGeoLith.h \
TransparentDraggableGujing.h \ TransparentDraggableGujing.h \

View File

@ -17,6 +17,7 @@
#include "transparentdraggableSelectRect.h" #include "transparentdraggableSelectRect.h"
#include "transparentdraggableLayer.h" #include "transparentdraggableLayer.h"
#include "transparentdraggableRightList.h" #include "transparentdraggableRightList.h"
#include "TransparentDraggableCorePhysics.h"
#include "qtcommonclass.h" #include "qtcommonclass.h"
#include "slf.h" #include "slf.h"
#include "MemRdWt.h" #include "MemRdWt.h"
@ -1207,7 +1208,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
{ {
m_event = event; m_event = event;
//曲线 //曲线
if(m_addRandomGraph) if(m_addRandomGraph && m_strLineName != "CORE_PHYSICS")
{ {
QMenu menu(this); QMenu menu(this);
menu.addAction(QIcon(::GetImagePath() + "icon/ZonePoint.png"), "添加分段线", this, &QMyCustomPlot::onAddShiftLine); menu.addAction(QIcon(::GetImagePath() + "icon/ZonePoint.png"), "添加分段线", this, &QMyCustomPlot::onAddShiftLine);
@ -1305,14 +1306,25 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
} }
else if (m_strLineName == "IMAGE_DATA") else if (m_strLineName == "IMAGE_DATA")
{ {
QMenu menu(this);
//岩心图片 //岩心图片
QMenu menu(this);
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.exec(event->globalPos());
}
else if (m_strLineName == "CORE_PHYSICS")
{
// 岩心分析
QMenu menu(this);
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "增加", this, &QMyCustomPlot::addCorePhysics);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::pasteCorePhysics);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::deleteCorePhysics);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::refreshCorePhysics);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }
@ -1904,7 +1916,35 @@ void QMyCustomPlot::addItemsImage(){
} }
void QMyCustomPlot::deleteItemsImage(){} void QMyCustomPlot::deleteItemsImage(){}
void QMyCustomPlot::refreshItemsImage(){} void QMyCustomPlot::refreshItemsImage(){}
void QMyCustomPlot::megResultImage(){}
// 增加
void QMyCustomPlot::addCorePhysics()
{
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
double left_Low = right_Hight;
QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid();
TransparentDraggableCorePhysics *dragRect = new TransparentDraggableCorePhysics(this, strUuid);
// 设置初始范围
dragRect->setRange(left_Low, right_Hight);
// dragRect->qcpItemLine
// 可选:设置颜色
// dragRect->setColor(crColor); // 半透明白色
//最小宽度
// dragRect->setMinWidth(0.1);
// dragRect->setTitle(strText);
m_mapDraggable_CorePhysics[strUuid] = dragRect;
}
//从剪切板文本数据粘贴
void QMyCustomPlot::pasteCorePhysics()
{}
//全部清空
void QMyCustomPlot::deleteCorePhysics()
{}
//刷新数据
void QMyCustomPlot::refreshCorePhysics()
{}
//右键--添加录井剖面 //右键--添加录井剖面
void QMyCustomPlot::onEditGeoLith() void QMyCustomPlot::onEditGeoLith()
@ -2753,10 +2793,10 @@ bool QMyCustomPlot::SaveToSLFImage()
return false; return false;
} }
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4, iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4,
"NO,SDEP,EDEP,RESULT", "NO,SDEP,EDEP,RESULT",
"4,4,4,4",//字段长度 "4,4,4,4",//字段长度
"1,4,4,1",//字段类型 "1,4,4,1",//字段类型
"0,0,0,2");//字段备注 "0,0,0,2");//字段备注
isfirst=true; isfirst=true;
} }
logio->SetTableRecordCount(iIndex,m_mapDraggable_Image.size()); logio->SetTableRecordCount(iIndex,m_mapDraggable_Image.size());
@ -2815,7 +2855,105 @@ bool QMyCustomPlot::SaveToSLFImage()
isrun=false; isrun=false;
// 写到slf文件 // 写到slf文件
return true;
}
bool QMyCustomPlot::saveToSLFCorePhysics()
{
static int isrun=false;
if(isrun) return false;
QString ss=m_strSlfName;
if(ss=="") return false;
isrun=true;
Slf_CORE_PHYSICS 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;
}
TransparentDraggableCorePhysics *pDraggableRect =NULL;
//排序
QList<float> listSDepth;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Image.begin(); iter != m_mapDraggable_Image.end(); iter++)
{
pDraggableRect = (TransparentDraggableCorePhysics*)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 = (TransparentDraggableCorePhysics*)iter.value();
QCPRange tmpRange = pDraggableRect->getRange();
float fSDepth = -tmpRange.upper;
if(fSDepth == listSDepth[i])//按顺序写入
{
memset(&m_Result,0,sizeof(GUJING_DATA));
m_Result.Order = i + 1;
m_Result.Depth = -tmpRange.lower;
m_Result.CorrDepth = -tmpRange.lower;
// 获取长度
m_Result.CoreValue = 20;
// m_Result.StartDepth = -tmpRange.upper;
// m_Result.EndDepth = -tmpRange.lower;
// m_Result.Order=i+1;
// // 拷贝字符串到数组,长度为数组长度-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.Left = static_cast<float>(pDraggableRect->getLeft());
// m_Result.Width = static_cast<float>(pDraggableRect->getWidth());
//写入
logio->WriteTable(iIndex,i+1,&m_Result);
break;
}
}
}
logio->CloseTable(iIndex);
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
// 写到slf文件
return true; return true;
} }
@ -4719,7 +4857,6 @@ void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QSt
{ {
QtCommonClass *qtCommon = new QtCommonClass(this); QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid(); QString strUuid = qtCommon->getUUid();
// 在初始化代码中 // 在初始化代码中
TransparentDraggableLine *dragRect = new TransparentDraggableLine(this, strUuid); TransparentDraggableLine *dragRect = new TransparentDraggableLine(this, strUuid);
// 设置初始范围 // 设置初始范围
@ -4729,8 +4866,8 @@ void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QSt
//最小宽度 //最小宽度
dragRect->setMinWidth(0.1); dragRect->setMinWidth(0.1);
dragRect->setTitle(strText); dragRect->setTitle(strText);
m_mapDraggable_Line[strUuid] = dragRect; m_mapDraggable_Line[strUuid] = dragRect;
} }
void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor) void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh, QColor crColor)
@ -6132,6 +6269,7 @@ void QMyCustomPlot::addRandomGraph(QVector<double> x, QVector<double> y, QString
{ {
if(m_bDrawCore_PHYSICS)//岩心分析 if(m_bDrawCore_PHYSICS)//岩心分析
{ {
m_addRandomGraph=false;
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线 graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈 graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
} }
@ -6193,6 +6331,7 @@ void QMyCustomPlot::addRandomGraph(QVector<double> x, QVector<double> y, QString
{ {
if(m_bDrawCore_PHYSICS)//岩心分析 if(m_bDrawCore_PHYSICS)//岩心分析
{ {
m_addRandomGraph=false;
graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线 graph->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈 graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈
} }

View File

@ -198,6 +198,8 @@ public:
QMap<QString, QObject*> m_mapDraggable_Line; QMap<QString, QObject*> m_mapDraggable_Line;
QMap<QString, QObject*> m_mapDraggable_SelectRect; QMap<QString, QObject*> m_mapDraggable_SelectRect;
QMap<QString, QObject*> m_mapDraggable_RightList; QMap<QString, QObject*> m_mapDraggable_RightList;
QMap<QString, QObject*> m_mapDraggable_CorePhysics; // 岩心分析
QObject* m_SelectShiftLine=nullptr;//当前选中的分段线 QObject* m_SelectShiftLine=nullptr;//当前选中的分段线
QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框 QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框
@ -214,6 +216,10 @@ public:
QMap<QString,QString> zoneOrderImage; QMap<QString,QString> zoneOrderImage;
bool SaveToSLFImage(); bool SaveToSLFImage();
// 岩心分析
QMap<QString,QString> zoneOrderCorePhysics;
bool saveToSLFCorePhysics();
//井壁取心 //井壁取心
QStringList liths_SWallCore; QStringList liths_SWallCore;
QStringList oils_SWallCore; QStringList oils_SWallCore;
@ -441,7 +447,12 @@ public slots:
void addItemsImage(); //从剪切板文本数据粘贴 void addItemsImage(); //从剪切板文本数据粘贴
void deleteItemsImage(); //全部清空 void deleteItemsImage(); //全部清空
void refreshItemsImage(); //刷新数据 void refreshItemsImage(); //刷新数据
void megResultImage(); //合并结论
//右键--编辑岩心分析
void addCorePhysics(); // 增加
void pasteCorePhysics(); //从剪切板文本数据粘贴
void deleteCorePhysics(); //全部清空
void refreshCorePhysics(); //刷新数据
//右键--编辑井壁取心 //右键--编辑井壁取心
void addItem_SWallCore(); //增加井壁取心 void addItem_SWallCore(); //增加井壁取心