This commit is contained in:
wangxiaolei 2026-03-13 17:42:37 +08:00
commit e6bef9af94
7 changed files with 809 additions and 101 deletions

View File

@ -4,13 +4,6 @@
#include <QObject> #include <QObject>
#include "qmycustomplot.h" #include "qmycustomplot.h"
struct Slf_JIEGUPOS {
int Order;
float Depth;
float Number;
char Dest[64];
};
//套管 //套管
class CObjTubingstringResult :public QObject class CObjTubingstringResult :public QObject
{ {

View File

@ -843,59 +843,202 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
else else
{ {
QString strItem = m_propertyData[pProperty]; QString strItem = m_propertyData[pProperty];
bool bShow = variant.value<bool>(); if(strItem != "")
// {
bool bShow = variant.value<bool>();
//
QString strAliasName = m_formInfo->m_strAliasName; QString strAliasName = m_formInfo->m_strAliasName;
if(strAliasName == "气测-FMT-射孔-文本" || strAliasName == "") if(strAliasName == "气测-FMT-射孔-文本" || strAliasName == "")
{
if(bShow)
{ {
strAliasName = strItem; if(bShow)
m_formInfo->m_strAliasName = strAliasName; {
//改变曲线Title strAliasName = strItem;
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName); m_formInfo->m_strAliasName = strAliasName;
} //改变曲线Title
} emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
else }
{
if(bShow)
{
strAliasName += "/" + strItem;
m_formInfo->m_strAliasName = strAliasName;
//改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
} }
else else
{ {
QStringList listAliasName = strAliasName.split("/");//QString字符串分割函数 if(bShow)
if(listAliasName.contains(strItem))
{ {
listAliasName.removeOne(strItem); strAliasName += "/" + strItem;
} m_formInfo->m_strAliasName = strAliasName;
if(listAliasName.size()==0)
{
strAliasName == "气测-FMT-射孔-文本";
//改变曲线Title //改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName); emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
} }
else else
{ {
strAliasName = ""; QStringList listAliasName = strAliasName.split("/");//QString字符串分割函数
for(int i=0; i<listAliasName.size(); i++) if(listAliasName.contains(strItem))
{ {
if(i>0) listAliasName.removeOne(strItem);
{
strAliasName += "/";
}
strAliasName += listAliasName[i];
} }
if(listAliasName.size()==0)
{
strAliasName == "气测-FMT-射孔-文本";
//改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
}
else
{
strAliasName = "";
for(int i=0; i<listAliasName.size(); i++)
{
if(i>0)
{
strAliasName += "/";
}
strAliasName += listAliasName[i];
}
//改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
}
}
}
}
}
}
else if (m_strCurrentProperty == JiegutextItem_Property)
{
//气测/FMT/射孔/文本item
if("顶深(m)" == m_propertyData[pProperty])
{
//qDebug() << "顶深(m)->改变";
if(m_tdJiegutext)
{
double upper = variant.value<double>();
m_tdJiegutext->setUpper(-upper);
//保存
m_tdJiegutext->mPlot->SaveToSLF_Jiegutext();
}
}
else if("底深(m)" == m_propertyData[pProperty])
{
//qDebug() << "底深(m)->改变";
if(m_tdJiegutext)
{
double lower = variant.value<double>();
m_tdJiegutext->setLower(-lower);
//保存
m_tdJiegutext->mPlot->SaveToSLF_Jiegutext();
}
}
else if("显示名称" == m_propertyData[pProperty])
{
QString newAliasName = variant.value<QString>();
m_formInfo->m_strAliasName = newAliasName;
m_formInfo->update();
}
else if("字体" == m_propertyData[pProperty])
{
//字体
// 假设variant已经被设置为包含QColor
QFont newFont = variant.value<QFont>();
m_formInfo->m_curveNameFont = newFont;
m_formInfo->update();
}
else if("颜色" == m_propertyData[pProperty])
{
QColor newColor = variant.value<QColor>();
m_formInfo->m_lineColor = newColor;
m_formInfo->update();
}
else if("选择井曲线" == m_propertyData[pProperty])
{
QString sFilePath = variant.value<QString>();
if(sFilePath.indexOf("@")>-1)
{
int ind=sFilePath.indexOf("@");
QString strLineName = sFilePath.left(ind);
sFilePath=sFilePath.mid(ind+1);
sFilePath.trimmed();
//只支持以下名称
//if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT")
{
QString strOldLineName = m_formInfo->m_strLineName;
QString strOldSlfName = m_formInfo->m_strSlfName;
//暂时不允许改变slf井次名称不然不在同一口井绘制
if(strOldSlfName != sFilePath)
{
QMessageBox::information(nullptr,"提示","不允许改变slf井次名称");
return;
}
//名称不变
if(strOldLineName == strLineName)
{
return;
}
//
m_formInfo->m_strLineName = strLineName;
//m_formInfo->m_strSlfName = sFilePath;
m_formInfo->update();
//改变曲线名
emit CallManage::getInstance()->sig_changeJiegutextLine(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, strOldLineName, strLineName);
}
}
}
else
{
QString strItem = m_propertyData[pProperty];
if(strItem != "")
{
bool bShow = variant.value<bool>();
//
QString strAliasName = m_formInfo->m_strAliasName;
if(strAliasName == "气测-FMT-射孔-文本" || strAliasName == "")
{
if(bShow)
{
strAliasName = strItem;
m_formInfo->m_strAliasName = strAliasName;
//改变曲线Title //改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName); emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
} }
} }
else
{
if(bShow)
{
strAliasName += "/" + strItem;
m_formInfo->m_strAliasName = strAliasName;
//改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
}
else
{
QStringList listAliasName = strAliasName.split("/");//QString字符串分割函数
if(listAliasName.contains(strItem))
{
listAliasName.removeOne(strItem);
}
if(listAliasName.size()==0)
{
strAliasName == "气测-FMT-射孔-文本";
//改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
}
else
{
strAliasName = "";
for(int i=0; i<listAliasName.size(); i++)
{
if(i>0)
{
strAliasName += "/";
}
strAliasName += listAliasName[i];
}
//改变曲线Title
emit CallManage::getInstance()->sig_changeJiegutextTitle(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName, strAliasName);
}
}
}
} }
} }
} }
@ -2536,3 +2679,47 @@ void PropertyWidget::initJiegutextProperty(FormInfo *formInfo)
} }
m_strCurrentProperty = Jiegutext_Property; m_strCurrentProperty = Jiegutext_Property;
} }
void PropertyWidget::initJiegutextItemProperty(TransparentDraggableJiegutext* tdJiegutext, double lower, double upper)
{
//初始化,清空
InitCurrentViewInfo();
FormInfo* formInfo = tdJiegutext->mPlot->m_formTrack->getFormInfoByParameters(tdJiegutext->mPlot->m_strUuid, tdJiegutext->mPlot->m_strWellName,
tdJiegutext->mPlot->m_strTrackName, tdJiegutext->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_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color);
QStringList listAliasName = formInfo->m_strAliasName.split("/");//QString字符串分割函数
//
for(int i=0; i< formInfo->m_FieldNameList.size(); i++)
{
bool bCkeck = false;
if(listAliasName.contains(formInfo->m_FieldNameList[i]))
{
bCkeck = true;
}
_CreateVariantPropertyItem("表格数据", formInfo->m_FieldNameList[i], bCkeck, QVariant::Bool);
}
}
//当前属性类型
m_strCurrentProperty = JiegutextItem_Property;
m_tdJiegutext = tdJiegutext;
//
_CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double);
_CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double);
}

View File

@ -25,6 +25,7 @@
#include "TransparentDraggableGeoLith.h" #include "TransparentDraggableGeoLith.h"
#include "TransparentDraggableRect.h" #include "TransparentDraggableRect.h"
#include "TransparentDraggableLayer.h" #include "TransparentDraggableLayer.h"
#include "TransparentDraggableJiegutext.h"
#include "TransparentGroupResult.h" #include "TransparentGroupResult.h"
@ -55,6 +56,7 @@
#define LayerItem_Property "LayerItem_Property" //地质分层item #define LayerItem_Property "LayerItem_Property" //地质分层item
#define Jiegutext_Property "Jiegutext_Property" //气测/FMT/射孔/文本 #define Jiegutext_Property "Jiegutext_Property" //气测/FMT/射孔/文本
#define JiegutextItem_Property "JiegutextItem_Property" //气测/FMT/射孔/文本item
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
@ -127,6 +129,7 @@ public:
TransparentDraggableGeoLith* m_tdGeoLith; TransparentDraggableGeoLith* m_tdGeoLith;
TransparentDraggableRect* m_tdText; TransparentDraggableRect* m_tdText;
TransparentDraggableLayer* m_tdLayer; TransparentDraggableLayer* m_tdLayer;
TransparentDraggableJiegutext* m_tdJiegutext;
public: public:
QWidget* GetPropertyWidget(); QWidget* GetPropertyWidget();
@ -183,6 +186,8 @@ public:
//气测/FMT/射孔/文本 //气测/FMT/射孔/文本
void initJiegutextProperty(FormInfo *formInfo); void initJiegutextProperty(FormInfo *formInfo);
void initJiegutextItemProperty(TransparentDraggableJiegutext* tdJiegutext, double lower, double upper);
void ChangFillProperty();//填充属性改变 void ChangFillProperty();//填充属性改变
void ChangHeadItemProperty();//图头项改变 void ChangHeadItemProperty();//图头项改变

View File

@ -1,4 +1,6 @@
#include "TransparentDraggableJiegutext.h" #include "TransparentDraggableJiegutext.h"
#include "PropertyWidget.h"
#include "CallManage.h"
extern double g_dPixelPerCm;//每厘米像素数 extern double g_dPixelPerCm;//每厘米像素数
//static GeoIndicatorGenerator m_drawGeo; //static GeoIndicatorGenerator m_drawGeo;
@ -223,9 +225,58 @@ void TransparentDraggableJiegutext::updateHandles()
void TransparentDraggableJiegutext::onDelRect() void TransparentDraggableJiegutext::onDelRect()
{ {
//mDragMode = DragNone;
//删除框图 //删除框图
deleteRect(); deleteRect();
//保存
mPlot->SaveToSLF_Jiegutext();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//设置深度移动量
void TransparentDraggableJiegutext::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()->initGujingItemProperty(this, low, hight, m_Result);
//保存
mPlot->SaveToSLF_Jiegutext();
//属性清空
PropertyService()->InitCurrentViewInfo();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
}
} }
@ -251,20 +302,13 @@ void TransparentDraggableJiegutext::onMousePress(QMouseEvent *event)
} }
//event->accept(); //event->accept();
double low = mRect->topLeft->coords().x();
double hight = mRect->bottomRight->coords().x();
PropertyService()->initJiegutextItemProperty(this, low, hight);
QMenu menu(nullptr); QMenu menu(nullptr);
QAction *delAction = menu.addAction("删除框图"); menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableJiegutext::onDelRect);
//delAction->installEventFilter(this); menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableJiegutext::setItemDepthOffset);
connect(delAction, &QAction::triggered, this, &TransparentDraggableJiegutext::onDelRect);
// QAction* pItem = menu.exec(event->globalPos());
// if(pItem == delAction)
// {
// //event->accept();
// int ii=0;
// ii++;
// }
menu.exec(event->globalPos()); menu.exec(event->globalPos());
return; return;
@ -429,10 +473,66 @@ void TransparentDraggableJiegutext::onMouseMove(QMouseEvent *event)
} }
//设置顶深
void TransparentDraggableJiegutext::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;
}
setRange(newRange.lower, newRange.upper);
}
//设置底深
void TransparentDraggableJiegutext::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 TransparentDraggableJiegutext::onMouseRelease(QMouseEvent *event) void TransparentDraggableJiegutext::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()->initJiegutextItemProperty(this, low, hight);
//保存
mPlot->SaveToSLF_Jiegutext();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, "");
}
//避免二次绘制框图 //避免二次绘制框图
mPlot->m_bDrawRect = false; mPlot->m_bDrawRect = false;
//emit rangeChanged(getRange()); //emit rangeChanged(getRange());

View File

@ -35,6 +35,11 @@ public:
// 删除框图 // 删除框图
void deleteRect(); void deleteRect();
//设置顶深
void setUpper(double upper);
//设置底深
void setLower(double lower);
signals: signals:
void rangeChanged(QCPRange newRange); void rangeChanged(QCPRange newRange);
@ -43,7 +48,8 @@ private:
void updateHandles() ; void updateHandles() ;
private slots: private slots:
void onDelRect(); 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);
@ -61,6 +67,7 @@ public:
QCPItemText *mItemTitle[MAX_NUM]; QCPItemText *mItemTitle[MAX_NUM];
QStringList mstrTitle; QStringList mstrTitle;
QString m_strUuid = ""; QString m_strUuid = "";
QStringList mList_coredat;
//分隔线 //分隔线
QCPItemLine* pLine[MAX_NUM-1]; QCPItemLine* pLine[MAX_NUM-1];

View File

@ -1107,6 +1107,24 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::megResultImage); menu.addAction(QIcon(::GetImagePath() + "development.png"), "合并结论", this, &QMyCustomPlot::megResultImage);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }
//
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
QString strType = pInfo->m_strType;
if (strType == "JiegutextObject")
{
QMenu menu(this);
//气测/FMT/射孔/文本
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Jiegutext);
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Jiegutext);
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Jiegutext);
menu.exec(event->globalPos());
}
} }
//右键--添加分段线 //右键--添加分段线
@ -3536,38 +3554,6 @@ void QMyCustomPlot::DeleteItems_Gujing()
PropertyService()->InitCurrentViewInfo(); PropertyService()->InitCurrentViewInfo();
} }
//刷新数据
void QMyCustomPlot::RefreshItems_Jiegutext(QString strAliasName)
{
//删除对象
TransparentDraggableJiegutext *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
while( it != m_mapDraggable_Jiegutext.end() )
{
pDraggableRect = (TransparentDraggableJiegutext*)it.value();
it++;
pDraggableRect->deleteRect();
}
//重新加载
//QString strAliasName = "气测-FMT-射孔-文本";
LoadFromSLF_Jiegutext(m_strSlfName, m_strLineName, strAliasName);
//设置所有title供用户选择
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
//
pInfo->m_strAliasName = strAliasName;
pInfo->m_FieldNameList.clear();
pInfo->m_FieldNameList.append(this->m_FieldNameList);
pInfo->update();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//刷新数据 //刷新数据
void QMyCustomPlot::RefreshItems_Gujing() void QMyCustomPlot::RefreshItems_Gujing()
{ {
@ -3791,7 +3777,7 @@ void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QS
dragRect->setResult(imagePath); dragRect->setResult(imagePath);
// 设置初始范围 // 设置初始范围
dragRect->setRange(left_Low, right_Hight); dragRect->setRange(left_Low, right_Hight);
// 可选:设置颜色` // 可选:设置颜色
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
//最小宽度 //最小宽度
dragRect->setMinWidth(0.1); dragRect->setMinWidth(0.1);
@ -4431,7 +4417,7 @@ void QMyCustomPlot::addGujingToPlot(double left_Low, double right_Hight, const Q
} }
//气测/FMT/射孔/文本 //气测/FMT/射孔/文本
void QMyCustomPlot::addJiegutextToPlot(double left_Low, double right_Hight, const QStringList strText, QColor crColor) void QMyCustomPlot::addJiegutextToPlot(double left_Low, double right_Hight, const QStringList strText, const QStringList strList_coredat, QColor crColor)
{ {
QtCommonClass *qtCommon = new QtCommonClass(this); QtCommonClass *qtCommon = new QtCommonClass(this);
QString strUuid = qtCommon->getUUid(); QString strUuid = qtCommon->getUUid();
@ -4444,7 +4430,7 @@ void QMyCustomPlot::addJiegutextToPlot(double left_Low, double right_Hight, cons
dragRect->setColor(crColor); // 半透明白色 dragRect->setColor(crColor); // 半透明白色
//最小宽度 //最小宽度
dragRect->setMinWidth(0.1); dragRect->setMinWidth(0.1);
//dragRect->setTitle(strText);//直接创建时赋值 dragRect->mList_coredat.append(strList_coredat);//直接创建时赋值
m_mapDraggable_Jiegutext[strUuid] = dragRect; m_mapDraggable_Jiegutext[strUuid] = dragRect;
} }
@ -5803,8 +5789,6 @@ void QMyCustomPlot::s_changeJiegutextTitle(QString strUuid, QString strSlfName,
return; return;
} }
//刷新数据
//RefreshItems_Jiegutext(strAliasName);
//删除对象 //删除对象
TransparentDraggableJiegutext *pDraggableRect =NULL; TransparentDraggableJiegutext *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin(); QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
@ -6295,22 +6279,25 @@ bool QMyCustomPlot::LoadFromSLF_Jiegutext(QString strSlfName, QString csCurve, Q
bottom=m_pResult->CorrDepth; bottom=m_pResult->CorrDepth;
} }
QStringList coredat;
CoreValues.clear(); CoreValues.clear();
ValueTypes.clear(); ValueTypes.clear();
for(int j=0;j<fieldnum;j++) for(int j=0;j<fieldnum;j++)
{ {
int iType = logio->GetTableFieldData(iIndex,j,buf,i+1);
ValueTypes.append(iType);
float val=0;
val=atof(buf);
coredat.append(QString::number(val));
if(listAliasName.contains(m_FieldNameList[j])) if(listAliasName.contains(m_FieldNameList[j]))
{ {
int iType = logio->GetTableFieldData(iIndex,j,buf,i+1);
ValueTypes.append(iType);
float val=0;
val=atof(buf);
CoreValues.append(QString::number(val)); CoreValues.append(QString::number(val));
} }
} }
// //
this->addJiegutextToPlot(-bottom, -top, CoreValues); this->addJiegutextToPlot(-bottom, -top, CoreValues, coredat);
} }
logio->CloseTable(iIndex); logio->CloseTable(iIndex);
delete m_pResult; delete m_pResult;
@ -6318,3 +6305,389 @@ bool QMyCustomPlot::LoadFromSLF_Jiegutext(QString strSlfName, QString csCurve, Q
delete logio; delete logio;
return true; return true;
} }
//从剪切板文本数据粘贴
void QMyCustomPlot::addItems_Jiegutext()
{
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("");
if(line.size()<1) return;
QString TableName;
QStringList temp1;
if(line.size()>1) {
temp1=line[0].split(" ");
temp1.removeAll("");
if(temp1.size()==1&&temp1.at(0).length()&&!temp1.at(0).at(0).isDigit()) {
TableName=temp1.at(0);
line.removeAt(0);
//CoreObj->SetName(TableName);//此处更改曲线名称,暂时不处理
}
}
QString ss=m_strSlfName;
CMemRdWt *logio=new CMemRdWt();
if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite))
{
delete logio;
QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return;
}
int k=0;
QStringList coredat=line[0].split(" ");
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
if(iIndex>=0) {
int count=logio->GetTableFieldCount(iIndex);
if(count!=coredat.size()) {
logio->DiscardObject(m_strLineName.toStdString().c_str());
}
iIndex=-1;
}
bool hasNO=false;
int isSK=0;
bool isfirst=false;
if(iIndex<0)
{
QString name,Length,type,temp;
bool ret=false;
QStringList css;
if(line.size()>1) css=line[1].split(" ");
if(coredat.size()&&!coredat[0].isEmpty()) {
int NUM=0;
if(!coredat.at(0).at(0).isDigit()){
if(coredat.at(0).indexOf("NO",0,Qt::CaseInsensitive)<0
&&coredat.at(0).indexOf("序号")<0
&&coredat.at(0).indexOf("INDEX")<0
&&coredat.at(0).indexOf("ORDER")<0
)
{
coredat.insert(0,"NO");
hasNO=true;
}
}
if(hasNO) css.insert(0,"1");
if((m_strLineName.indexOf("SK",0,Qt::CaseInsensitive)>-1||m_strLineName.indexOf("PERT",0,Qt::CaseInsensitive)>-1)&&(coredat.size()==4||coredat.size()==5))
{
isSK=1;
name="NO,SDEP,EDEP,ZONE,RESULT,THICK,TT,ZONENO,LAYER,DEST";
Length="4,4,4,8,4,4,4,64,64,64";
type= "1,4,4,6,1,4,4,6,6,6";
temp= "0,0,0,0,1,0,0,0,0,0";
NUM=10;
}
else {
//CViewInfoText*pInv=dynamic_cast<CViewInfoText*>(m_discreteLogViewInfo);
for(int j=0;j<coredat.size();j++)
{
if(j==0) name+="NO";
else if(j==1) name+="SDEP";
else if(j==2)name+="EDEP";
if(j==0){
Length+="4";
type+="1";
}
else {
bool isdi=false;
if(css.size()>j)
{
for (int k=0;k<css.at(j).size();k++)
{
if(!css.at(j).at(k).isDigit()&&css.at(j).at(k)!='.'&&css.at(j).at(k)!='-'){
isdi=true;
break;
}
}
}
bool bDrawGASLOG=false;
//if(pInv&&pInv->GetDrawGASLOG()||isdi) {
if(bDrawGASLOG||isdi) {
type+="6";
Length+="64";
}
else {
type+="4";
Length+="4";
}
}
temp+="0";
if(j!=coredat.size())
{
name+=",";
Length+=",";
type+=",";
temp+=",";
}
}
if(!coredat.at(0).at(0).isDigit()&&coredat.at(0).at(0)!='.'&&coredat.at(0).at(0)!='-') name=coredat.join(",");
NUM=coredat.size();
}
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,NUM,
(char*)name.toStdString().c_str(),
(char*)Length.toStdString().c_str(),//字段长度
(char*)type.toStdString().c_str(),//字段类型
(char*)temp.toStdString().c_str());//字段备注,1-枚举
isfirst=true;
logio->SetTableRecordCount(iIndex,0);
}
}
//
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
//
QString strAliasName = pInfo->m_strAliasName;
QStringList listAliasName = strAliasName.split("/");//QString字符串分割函数
//
int count=logio->GetTableFieldCount(iIndex);
Slf_TABLE_FIELD*pField=new Slf_TABLE_FIELD[count];
logio->GetTableFieldInfo(iIndex,pField);
//
m_FieldNameList.clear();
for(int i=0;i<count;i++) {
m_FieldNameList.push_back(pField[i].Name);
}
//
//k = 0;
float yy;
for(int i=0;i<line.size();i++)
{
coredat=line[i].split(" ");
if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll("");
if(coredat.size()<1) continue;
if(coredat[0].isEmpty()) continue;
if(coredat.size()<2)continue;
if(!coredat.at(0).at(0).isDigit()) continue;
if(hasNO) coredat.insert(0,QString::number(0));
// for(int j=0;j<coredat.size();j++)
// {
// if(isSK&&(coredat.size()==5||coredat.size()==6))
// {
// if(j<3){
// yy=coredat[j].toFloat();
// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
// }
// else if(j==3) logio->SetTableFieldData(iIndex,7,(char*)coredat[j].toStdString().c_str(),k+1);
// else if(j==4) logio->SetTableFieldData(iIndex,8,(char*)coredat[j].toStdString().c_str(),k+1);
// else if(j==5) logio->SetTableFieldData(iIndex,9,(char*)coredat[j].toStdString().c_str(),k+1);
// }
// else {
// if(pField[j].RepCode==6) {
// logio->SetTableFieldData(iIndex,j,(char*)coredat[j].toStdString().c_str(),k+1);
// }
// else {
// yy=coredat[j].toFloat();
// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
// }
// }
// }
// k++;
//-------------------------------------
CoreValues.clear();
for(int j=0;j<coredat.size();j++)
{
if(listAliasName.contains(m_FieldNameList[j]))
{
CoreValues.append(coredat[j]);
}
}
//
double top=coredat[1].toDouble();
double bottom=coredat[1].toDouble();
if(m_FieldNameList.size()>2&&
(m_FieldNameList[2].indexOf("EDEP")>-1 ||
m_FieldNameList[2].indexOf("ENDEP")>-1)
)
{
bottom=coredat[2].toDouble();
}
this->addJiegutextToPlot(-bottom, -top, CoreValues, coredat);
}
delete logio;
delete []pField;
if(isfirst)
{
AddTableToWellRound();
pInfo->m_FieldNameList.clear();
pInfo->m_FieldNameList.append(m_FieldNameList);
}
SaveToSLF_Jiegutext();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
bool QMyCustomPlot::SaveToSLF_Jiegutext()
{
static int isrun=false;
if(isrun) return false;
QString ss=m_strSlfName;
if(ss=="") return false;
isrun=true;
Slf_TxtPOS m_Result;
CMemRdWt *logio=new CMemRdWt();
if(!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_Jiegutext.size()) {
delete logio;
isrun=false;
return false;
}
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,3,
"NO,DEPTH,DDEP",
"4,4,4",//字段长度
"1,4,4",//字段类型
"0,0,0");//字段备注,1-枚举
isfirst=true;
}
logio->SetTableRecordCount(iIndex,m_mapDraggable_Jiegutext.size());
if(!m_mapDraggable_Jiegutext.size()) {
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return false;
}
int count=logio->GetTableFieldCount(iIndex);
Slf_TABLE_FIELD *pField = new Slf_TABLE_FIELD[count];
logio->GetTableFieldInfo(iIndex,pField);
TransparentDraggableJiegutext *pDraggableRect =NULL;
//排序
QList<float> listSDepth;
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_Jiegutext.begin(); iter != m_mapDraggable_Jiegutext.end(); iter++)
{
pDraggableRect = (TransparentDraggableJiegutext*)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_Jiegutext.begin(); iter != m_mapDraggable_Jiegutext.end(); iter++)
{
pDraggableRect = (TransparentDraggableJiegutext*)iter.value();
//
QCPRange tmpRange = pDraggableRect->getRange();
float fSDepth = -tmpRange.upper;
if(fSDepth == listSDepth[i])//按顺序写入
{
memset(&m_Result,0,sizeof(Slf_TxtPOS));
m_Result.Order = i+1;
m_Result.Depth = -tmpRange.upper;
m_Result.CorrDepth = -tmpRange.lower;
float yy=m_Result.Order;
logio->SetTableFieldData(iIndex,0,(char *)&yy,i+1);
yy=m_Result.Depth;
logio->SetTableFieldData(iIndex,1,(char *)&yy,i+1);
yy=m_Result.CorrDepth;
logio->SetTableFieldData(iIndex,2,(char *)&yy,i+1);
for(int iRecNum=3; iRecNum<pDraggableRect->mList_coredat.size(); iRecNum++)
{
if(pField[iRecNum].RepCode==6) {
logio->SetTableFieldData(iIndex, iRecNum, (char*)pDraggableRect->mList_coredat[iRecNum].toStdString().c_str(), i+1);
}
else {
yy=pDraggableRect->mList_coredat[iRecNum].toFloat();
logio->SetTableFieldData(iIndex,iRecNum,(char*)&yy,i+1);
}
//logio->SetTableFieldData(iIndex,iRecNum,(char*)pDraggableRect->mList_coredat[iRecNum].toLocal8Bit().data(),i+1);//toStdString().c_str()
}
}
}
}
logio->CloseTable(iIndex);
delete []pField;
delete logio;
if(isfirst)AddTableToWellRound();
isrun=false;
return true;
}
//全部清空
void QMyCustomPlot::DeleteItems_Jiegutext()
{
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();
//删除对象
TransparentDraggableJiegutext *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
while( it != m_mapDraggable_Jiegutext.end() )
{
pDraggableRect = (TransparentDraggableJiegutext*)it.value();
it++;
pDraggableRect->deleteRect();
}
//保存
this->SaveToSLF_Jiegutext();
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//刷新数据
void QMyCustomPlot::RefreshItems_Jiegutext()
{
//删除对象
TransparentDraggableJiegutext *pDraggableRect =NULL;
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Jiegutext.begin();
while( it != m_mapDraggable_Jiegutext.end() )
{
pDraggableRect = (TransparentDraggableJiegutext*)it.value();
it++;
pDraggableRect->deleteRect();
}
//
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
//
QString strAliasName = pInfo->m_strAliasName;
//加载
this->LoadFromSLF_Jiegutext(m_strSlfName, m_strLineName, strAliasName);
//属性清空
PropertyService()->InitCurrentViewInfo();
}

View File

@ -21,6 +21,13 @@ struct Slf_TxtPOS {
float CorrDepth; float CorrDepth;
}; };
struct Slf_JIEGUPOS {
int Order;
float Depth;
float Number;
char Dest[64];
};
class TransparentGroupResult; class TransparentGroupResult;
class QMyCustomPlot : public QCustomPlot class QMyCustomPlot : public QCustomPlot
{ {
@ -223,6 +230,7 @@ public:
QList<int> ValueTypes; QList<int> ValueTypes;
QStringList CoreValues; QStringList CoreValues;
bool LoadFromSLF_Jiegutext(QString strSlfName, QString csCurve, QString strAliasName); bool LoadFromSLF_Jiegutext(QString strSlfName, QString csCurve, QString strAliasName);
bool SaveToSLF_Jiegutext();
public slots: public slots:
void slot_time(); void slot_time();
@ -257,7 +265,41 @@ public:
void addGujingToPlot(double left_Low, double right_Hight, const QString strResult); void addGujingToPlot(double left_Low, double right_Hight, const QString strResult);
//气测/FMT/射孔/文本 //气测/FMT/射孔/文本
void addJiegutextToPlot(double left_Low, double right_Hight, const QStringList strText, QColor crColor=QColor(255, 255, 255, 80));
public slots:
void slot_time();
public:
void init(QString strName, QVector<double> x, QVector<double> y);
//岩心照片
void addImageToPlot(double left_Low, double right_Hight, const QString imagePath);
//曲线
void addRandomGraph(QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle);
//文字结论
void addTextToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80));
//地质分层
void addLayerToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80));
//解释结论
TransparentGroupResult* addResultGroup(double left_Low, double right_Hight, QString &strUuid, QString strText = "");
void addResultToPlot(double left_Low, double right_Hight, QString myResult, QString &strUuid, QString strText="");
//录井剖面
void addGeoLithToPlot(double left_Low, double right_Hight, const QString myLith, const QString myOil, const QString myColor, bool bRefresh=true);
//井壁取心
void addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor);
//固井结论
void addGujingToPlot(double left_Low, double right_Hight, const QString strResult);
//气测/FMT/射孔/文本
void addJiegutextToPlot(double left_Low, double right_Hight, const QStringList strText, const QStringList strList_coredat, QColor crColor=QColor(255, 255, 255, 80));
//沉积相 //沉积相
void addMFacToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80)); void addMFacToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80));
@ -382,8 +424,9 @@ public slots:
void AddItem_Layer(QStringList lists); void AddItem_Layer(QStringList lists);
//右键--气测-管柱-文本-FMT-射孔 //右键--气测-管柱-文本-FMT-射孔
void RefreshItems_Jiegutext(QString strAliasName = "气测-FMT-射孔-文本"); //刷新数据 void addItems_Jiegutext(); //从剪切板文本数据粘贴
void DeleteItems_Jiegutext(); //全部清空
void RefreshItems_Jiegutext(); //刷新数据
// //
void addItems_Core(); void addItems_Core();