井壁取心新增8个右键菜单功能:井壁取心、平移水平位置、从剪切板文本数据粘贴、删除选中对象、取消选中、全部清空、设置移动量、刷新数据。
This commit is contained in:
parent
a72acd8e70
commit
ea6d0346a2
|
|
@ -369,12 +369,16 @@ void TransparentDraggableGujing::setItemDepthOffset()
|
||||||
setRange(newRange.lower, newRange.upper);
|
setRange(newRange.lower, newRange.upper);
|
||||||
|
|
||||||
{
|
{
|
||||||
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, "", "", "", "", 1, "");
|
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, "");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
#include "TransparentDraggableSwallCore.h"
|
#include "TransparentDraggableSwallCore.h"
|
||||||
|
#include "PropertyWidget.h"
|
||||||
|
#include "CallManage.h"
|
||||||
|
|
||||||
extern double g_dPixelPerCm;//每厘米像素数
|
extern double g_dPixelPerCm;//每厘米像素数
|
||||||
//static GeoIndicatorGenerator m_drawGeo;
|
//static GeoIndicatorGenerator m_drawGeo;
|
||||||
|
|
@ -505,44 +507,38 @@ void TransparentDraggableSwallCore::onDelRect()
|
||||||
//mDragMode = DragNone;
|
//mDragMode = DragNone;
|
||||||
//删除框图
|
//删除框图
|
||||||
deleteRect();
|
deleteRect();
|
||||||
|
//保存
|
||||||
|
mPlot->SaveToSLF_SwallCore();
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentDraggableSwallCore::onMousePress(QMouseEvent *event)
|
void TransparentDraggableSwallCore::onMousePress(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
// //右键
|
//右键
|
||||||
// if(event->button() != Qt::LeftButton)
|
if(event->button() != Qt::LeftButton)
|
||||||
// {
|
{
|
||||||
// double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
|
double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度
|
||||||
// QCPRange currentRange = getRange();
|
QCPRange currentRange = getRange();
|
||||||
// if(mLeftHandle->selectTest(event->pos(), false) < 5) {
|
if(y >= currentRange.lower && y <= currentRange.upper) {
|
||||||
// mDragMode = DragNone;
|
mDragMode = DragNone;
|
||||||
// }
|
}
|
||||||
// else if(mRightHandle->selectTest(event->pos(), false) < 5) {
|
else {
|
||||||
// mDragMode = DragNone;
|
mDragMode = DragNone;
|
||||||
// }
|
return;
|
||||||
// //else if(x >= currentRange.lower && x <= currentRange.upper) {
|
}
|
||||||
// else if(y >= currentRange.lower && y <= currentRange.upper) {
|
//event->accept();
|
||||||
// mDragMode = DragNone;
|
|
||||||
// }
|
double low = mRect->topLeft->coords().x();
|
||||||
// else {
|
double hight = mRect->bottomRight->coords().x();
|
||||||
// mDragMode = DragNone;
|
//PropertyService()->initSwallCoreItemProperty(this, low, hight, m_Result);
|
||||||
// return;
|
|
||||||
// }
|
QMenu menu(nullptr);
|
||||||
// //event->accept();
|
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableSwallCore::onDelRect);
|
||||||
// QMenu menu(nullptr);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableSwallCore::setItemDepthOffset);
|
||||||
// QAction *delAction = menu.addAction("删除框图");
|
menu.exec(event->globalPos());
|
||||||
// //delAction->installEventFilter(this);
|
return;
|
||||||
// connect(delAction, &QAction::triggered, this, &TransparentDraggableResult::onDelRect);
|
}
|
||||||
// QAction* pItem = menu.exec(event->globalPos());
|
|
||||||
// if(pItem == delAction)
|
|
||||||
// {
|
|
||||||
// //event->accept();
|
|
||||||
// int ii=0;
|
|
||||||
// ii++;
|
|
||||||
// }
|
|
||||||
// menu.exec(event->globalPos());
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
||||||
|
|
@ -674,6 +670,52 @@ void TransparentDraggableSwallCore::onMouseMove(QMouseEvent *event)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置深度移动量
|
||||||
|
void TransparentDraggableSwallCore::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_SwallCore();
|
||||||
|
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
|
||||||
|
//取消所有选中单元格
|
||||||
|
emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TransparentDraggableSwallCore::onMouseRelease(QMouseEvent *event)
|
void TransparentDraggableSwallCore::onMouseRelease(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ public:
|
||||||
|
|
||||||
// 删除框图
|
// 删除框图
|
||||||
void deleteRect();
|
void deleteRect();
|
||||||
|
void setItemDepthOffset(); //设置深度移动量
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rangeChanged(QCPRange newRange);
|
void rangeChanged(QCPRange newRange);
|
||||||
|
|
@ -64,7 +65,7 @@ private slots:
|
||||||
double getMyLower();
|
double getMyLower();
|
||||||
double getMyUpper();
|
double getMyUpper();
|
||||||
|
|
||||||
private:
|
public:
|
||||||
QMyCustomPlot *mPlot;
|
QMyCustomPlot *mPlot;
|
||||||
QCPItemRect *mRect;
|
QCPItemRect *mRect;
|
||||||
// QCPItemRect *mLeftHandle;
|
// QCPItemRect *mLeftHandle;
|
||||||
|
|
@ -84,7 +85,6 @@ private:
|
||||||
QString m_Lith;
|
QString m_Lith;
|
||||||
QString m_Oil;
|
QString m_Oil;
|
||||||
//QString m_Color;
|
//QString m_Color;
|
||||||
int m_ind;
|
|
||||||
|
|
||||||
GeoIndicatorGenerator m_drawGeo;
|
GeoIndicatorGenerator m_drawGeo;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4130,7 +4130,7 @@ void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString
|
||||||
widget->xAxis2->setTicks(false);
|
widget->xAxis2->setTicks(false);
|
||||||
widget->yAxis2->setTicks(false);
|
widget->yAxis2->setTicks(false);
|
||||||
//
|
//
|
||||||
LoadFromSLF_SwallCore(widget, strSlfName, strLineName);
|
widget->LoadFromSLF_SwallCore(strSlfName, strLineName);
|
||||||
|
|
||||||
QString strAliasName = "";
|
QString strAliasName = "";
|
||||||
QString strUnit = "";
|
QString strUnit = "";
|
||||||
|
|
@ -4142,110 +4142,6 @@ void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FormDraw::LoadFromSLF_SwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
|
||||||
{
|
|
||||||
WALLCORE_DATA m_Result;
|
|
||||||
CMemRdWt *logio=new CMemRdWt();
|
|
||||||
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
|
||||||
{
|
|
||||||
delete logio;
|
|
||||||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList liths;
|
|
||||||
QStringList oils;
|
|
||||||
QStringList colors;
|
|
||||||
QStringList colorinds;
|
|
||||||
|
|
||||||
QString cs=GetConfPath();
|
|
||||||
QString color;
|
|
||||||
for(int j=0;j<4;j++)
|
|
||||||
{
|
|
||||||
if(j==0) color=cs+"corecolor.ini";
|
|
||||||
else if(j==1) color=cs+"corelith.ini";
|
|
||||||
else if(j==2) color=cs+"coreoil.ini";
|
|
||||||
else color=cs+"colorind.ini";
|
|
||||||
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
|
||||||
QStringList ss;
|
|
||||||
char buf[100];
|
|
||||||
if(fp) {
|
|
||||||
while(!feof(fp)) {
|
|
||||||
fscanf(fp,"%s",buf);
|
|
||||||
ss.append(buf);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
if(j==0) colors=ss;
|
|
||||||
else if(j==1) liths=ss;
|
|
||||||
else if(j==2) oils=ss;
|
|
||||||
else colorinds=ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
|
||||||
if(iIndex>-1) {
|
|
||||||
int count=logio->GetTableRecordCount(iIndex);
|
|
||||||
for(int i=0;i<count;i++) {
|
|
||||||
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
|
||||||
logio->ReadTable(iIndex,i+1,&m_Result);
|
|
||||||
double top=m_Result.Depth;
|
|
||||||
double bottom=m_Result.Depth;
|
|
||||||
|
|
||||||
QString LithologyImage="";
|
|
||||||
QString OilGasImage="";
|
|
||||||
QString ColorImage="";
|
|
||||||
|
|
||||||
//
|
|
||||||
if(m_Result.CoreLith<1) {
|
|
||||||
LithologyImage="";
|
|
||||||
}
|
|
||||||
else if (liths.size()>=m_Result.CoreLith)
|
|
||||||
{
|
|
||||||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[m_Result.CoreLith-1]+".svg";
|
|
||||||
QDir ss(LithologyImage);
|
|
||||||
if(!ss.exists()) {
|
|
||||||
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[m_Result.CoreLith-1]+".png";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_Result.CoreOil>0&&oils.size()>=m_Result.CoreOil)
|
|
||||||
{
|
|
||||||
OilGasImage=::GetGasSymbolDir()+""+oils[m_Result.CoreOil-1]+".svg";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
OilGasImage="";
|
|
||||||
}
|
|
||||||
int ind=colorinds.indexOf(QString::number(m_Result.CoreColor));
|
|
||||||
if (ind>-1&&ind<colors.size())
|
|
||||||
{
|
|
||||||
ColorImage=::GetColorSymbolDir()+""+colors[ind]+".svg";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ColorImage="";
|
|
||||||
}
|
|
||||||
float depth = m_Result.Depth;
|
|
||||||
float width = 1;
|
|
||||||
float Sideleft = m_Result.left;
|
|
||||||
if(m_Result.width<=0)
|
|
||||||
{
|
|
||||||
width = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
width = m_Result.width;
|
|
||||||
}
|
|
||||||
if(Sideleft<0) Sideleft=0;
|
|
||||||
if(width<=0) width=1;
|
|
||||||
|
|
||||||
//
|
|
||||||
widget->addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, ind);
|
|
||||||
}
|
|
||||||
logio->CloseTable(iIndex);
|
|
||||||
}
|
|
||||||
delete logio;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//固井结论
|
//固井结论
|
||||||
void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty)
|
void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty)
|
||||||
{
|
{
|
||||||
|
|
@ -4294,7 +4190,6 @@ void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString str
|
||||||
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty);
|
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormDraw::initDepth(QMyCustomPlot *curv)
|
void FormDraw::initDepth(QMyCustomPlot *curv)
|
||||||
{
|
{
|
||||||
curv->yAxis->setTickLabels(true);
|
curv->yAxis->setTickLabels(true);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,6 @@ public:
|
||||||
|
|
||||||
//井壁取心
|
//井壁取心
|
||||||
void initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
void initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
||||||
bool LoadFromSLF_SwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
|
||||||
|
|
||||||
//固井结论
|
//固井结论
|
||||||
void initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "固井结论", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={});
|
void initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "固井结论", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={});
|
||||||
|
|
|
||||||
|
|
@ -948,13 +948,26 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
||||||
//固井
|
//固井
|
||||||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing);
|
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Gujing);
|
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Gujing);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems_Gujing);
|
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Gujing);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Gujing);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Gujing);
|
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Gujing);
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_strLineName == "SWALL_CORE")
|
||||||
|
{
|
||||||
|
QMenu menu(this);
|
||||||
|
//井壁取心
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), "增加井壁取心", this, &QMyCustomPlot::addItem_SWallCore);
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), "平移水平位置", this, &QMyCustomPlot::moveItems_SWallCore);
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_SWallCore);
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_SWallCore);
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_SWallCore);
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
@ -1156,11 +1169,186 @@ void QMyCustomPlot::onEditGujing()
|
||||||
this->setSelectionRectMode(QCP::srmNone);
|
this->setSelectionRectMode(QCP::srmNone);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QMyCustomPlot::SaveToSLF_SwallCore()
|
||||||
|
{
|
||||||
|
static int isrun=false;
|
||||||
|
if(isrun) return false;
|
||||||
|
QString ss=m_strSlfName;
|
||||||
|
if(ss=="") return false;
|
||||||
|
isrun=true;
|
||||||
|
|
||||||
|
WALLCORE_DATA 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_SwallCore.size()) {
|
||||||
|
delete logio;
|
||||||
|
isrun=false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,8,
|
||||||
|
"NO,DEPTH,OIL,LITH,COLOR,LEFT,WIDTH,DEST",
|
||||||
|
"4,4,4,4,4,4,4,64",//字段长度
|
||||||
|
"1,4,1,1,1,4,4,6",//字段类型
|
||||||
|
"0,0,3,4,5,0,0,0");//字段备注,1-枚举
|
||||||
|
isfirst=true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
static int err=0;
|
||||||
|
int fc=logio->GetTableFieldCount(iIndex);
|
||||||
|
Slf_TABLE_FIELD *tf=new Slf_TABLE_FIELD[fc+1];
|
||||||
|
logio->GetTableFieldInfo(iIndex,tf);
|
||||||
|
if(fc<5||tf[0].RepCode!=REPR_INT||
|
||||||
|
tf[1].RepCode!=REPR_FLOAT||
|
||||||
|
tf[2].RepCode!=REPR_INT||
|
||||||
|
tf[3].RepCode!=REPR_INT||
|
||||||
|
tf[4].RepCode!=REPR_INT||
|
||||||
|
tf[5].RepCode!=REPR_FLOAT||
|
||||||
|
tf[6].RepCode!=REPR_FLOAT)
|
||||||
|
{
|
||||||
|
if(!err)QMessageBox::information(NULL,"提示","不是有效取心表,无法保存数据!");
|
||||||
|
err++;
|
||||||
|
delete tf;
|
||||||
|
delete logio;
|
||||||
|
isrun=false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else err=0;
|
||||||
|
delete tf;
|
||||||
|
}
|
||||||
|
logio->SetTableRecordCount(iIndex,m_mapDraggable_SwallCore.size());
|
||||||
|
if(!m_mapDraggable_SwallCore.size()) {
|
||||||
|
delete logio;
|
||||||
|
if(isfirst)AddTableToWellRound();
|
||||||
|
isrun=false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||||||
|
|
||||||
|
//排序
|
||||||
|
QList<float> listSDepth;
|
||||||
|
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_SwallCore.begin(); iter != m_mapDraggable_SwallCore.end(); iter++)
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableSwallCore*)iter.value();
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
//
|
||||||
|
float fSDepth = -tmpRange.lower;
|
||||||
|
listSDepth.append(fSDepth);
|
||||||
|
}
|
||||||
|
qSort(listSDepth);
|
||||||
|
|
||||||
|
//------------
|
||||||
|
QStringList liths;
|
||||||
|
QStringList oils;
|
||||||
|
QStringList colors;
|
||||||
|
QStringList colorinds;
|
||||||
|
QString cs=GetConfPath();
|
||||||
|
QString color;
|
||||||
|
for(int j=0;j<4;j++)
|
||||||
|
{
|
||||||
|
if(j==0) color=cs+"corecolor.ini";
|
||||||
|
else if(j==1) color=cs+"corelith.ini";
|
||||||
|
else if(j==2) color=cs+"coreoil.ini";
|
||||||
|
else color=cs+"colorind.ini";
|
||||||
|
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||||||
|
QStringList ss;
|
||||||
|
char buf[100];
|
||||||
|
if(fp) {
|
||||||
|
while(!feof(fp)) {
|
||||||
|
fscanf(fp,"%s",buf);
|
||||||
|
ss.append(buf);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
if(j==0) colors=ss;
|
||||||
|
else if(j==1) liths=ss;
|
||||||
|
else if(j==2) oils=ss;
|
||||||
|
else colorinds=ss;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for(int i=0; i<listSDepth.size(); i++)
|
||||||
|
{
|
||||||
|
char dest[64];
|
||||||
|
dest[0]=0;
|
||||||
|
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_SwallCore.begin(); iter != m_mapDraggable_SwallCore.end(); iter++)
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableSwallCore*)iter.value();
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
float fSDepth = -tmpRange.lower;
|
||||||
|
if(fSDepth == listSDepth[i])//按顺序写入
|
||||||
|
{
|
||||||
|
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
||||||
|
m_Result.Depth=fSDepth;
|
||||||
|
m_Result.Order=i+1;
|
||||||
|
|
||||||
|
QString name,lithname,oilname,colorname;
|
||||||
|
pDraggableRect->m_Lith.replace("\\","/");
|
||||||
|
int l=pDraggableRect->m_Lith.lastIndexOf("/");
|
||||||
|
if(l>-1) name=pDraggableRect->m_Lith.mid(l+1);
|
||||||
|
l=name.indexOf(".");
|
||||||
|
name=name.left(l);
|
||||||
|
lithname=name;
|
||||||
|
m_Result.CoreLith=liths.indexOf(name)+1;
|
||||||
|
if(m_Result.CoreLith<1) m_Result.CoreLith=1;
|
||||||
|
//
|
||||||
|
pDraggableRect->m_Oil.replace("\\","/");
|
||||||
|
l=pDraggableRect->m_Oil.lastIndexOf("/");
|
||||||
|
if(l>-1) name=pDraggableRect->m_Oil.mid(l+1);
|
||||||
|
|
||||||
|
l=name.indexOf(".");
|
||||||
|
if(l>-1)name=name.left(l);
|
||||||
|
oilname=name;
|
||||||
|
m_Result.CoreOil=oils.indexOf(name)+1;
|
||||||
|
if(m_Result.CoreOil<1) m_Result.CoreOil=1;
|
||||||
|
|
||||||
|
m_Result.CoreColor=pDraggableRect->mstrTitle.toInt();
|
||||||
|
|
||||||
|
m_Result.left=pDraggableRect->m_fLeftSpace / g_dPixelPerCm;
|
||||||
|
m_Result.width=SideWallCoreWidth * g_dPixelPerCm;//1.2厘米像素数
|
||||||
|
if(m_Result.width<=0) m_Result.width=1;
|
||||||
|
//
|
||||||
|
int ind=colorinds.indexOf(QString::number(m_Result.CoreColor));
|
||||||
|
if (ind>-1&&ind<colors.size())
|
||||||
|
{
|
||||||
|
colorname=colors[ind];
|
||||||
|
}
|
||||||
|
|
||||||
|
name="";
|
||||||
|
if(colorname!="空白"||name!="空") name+=colorname;
|
||||||
|
if(oilname!="空白"||name!="空") name+=oilname;
|
||||||
|
if(lithname!="空白"||name!="空") name+=lithname;
|
||||||
|
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()
|
||||||
{
|
{
|
||||||
static int isrun=false;
|
static int isrun=false;
|
||||||
|
|
@ -1267,6 +1455,520 @@ void QMyCustomPlot::AddTableToWellRound()
|
||||||
emit CallManage::getInstance()->sig_AddGujingToTree(m_strSlfName, m_strWellName, m_strLineName);
|
emit CallManage::getInstance()->sig_AddGujingToTree(m_strSlfName, m_strWellName, m_strLineName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//增加井壁取心
|
||||||
|
void QMyCustomPlot::addItem_SWallCore()
|
||||||
|
{
|
||||||
|
QStringList liths;
|
||||||
|
QStringList oils;
|
||||||
|
QStringList colors;
|
||||||
|
QStringList colorinds;
|
||||||
|
|
||||||
|
QString cs=GetConfPath();
|
||||||
|
QString color;
|
||||||
|
for(int j=0;j<4;j++)
|
||||||
|
{
|
||||||
|
if(j==0) color=cs+"corecolor.ini";
|
||||||
|
else if(j==1) color=cs+"corelith.ini";
|
||||||
|
else if(j==2) color=cs+"coreoil.ini";
|
||||||
|
else color=cs+"colorind.ini";
|
||||||
|
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||||||
|
QStringList ss;
|
||||||
|
char buf[100];
|
||||||
|
if(fp) {
|
||||||
|
while(!feof(fp)) {
|
||||||
|
fscanf(fp,"%s",buf);
|
||||||
|
ss.append(buf);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
if(j==0) colors=ss;
|
||||||
|
else if(j==1) liths=ss;
|
||||||
|
else if(j==2) oils=ss;
|
||||||
|
else colorinds=ss;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LithologyImage="";
|
||||||
|
QString OilGasImage="";
|
||||||
|
QString ColorImage="";
|
||||||
|
|
||||||
|
int CoreLith=27;
|
||||||
|
int CoreOil=7;
|
||||||
|
int CoreColor=0;
|
||||||
|
if (liths.size()>=CoreLith)
|
||||||
|
{
|
||||||
|
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".svg";
|
||||||
|
QDir ss(LithologyImage);
|
||||||
|
if(!ss.exists()) {
|
||||||
|
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[CoreLith-1]+".png";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CoreOil>0&&oils.size()>=CoreOil)
|
||||||
|
{
|
||||||
|
OilGasImage=::GetGasSymbolDir()+""+oils[CoreOil-1]+".svg";
|
||||||
|
}
|
||||||
|
int ind=colorinds.indexOf(QString::number(CoreColor));
|
||||||
|
if (ind>-1&&ind<colors.size())
|
||||||
|
{
|
||||||
|
ColorImage=::GetColorSymbolDir()+""+colors[ind]+".svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
float width = SideWallCoreWidth * g_dPixelPerCm;//1.2cm
|
||||||
|
float Sideleft = 0;
|
||||||
|
|
||||||
|
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||||||
|
//添加井壁取心
|
||||||
|
addSwallCoreToPlot(right_Hight, LithologyImage, OilGasImage, ColorImage, Sideleft, width, CoreColor);
|
||||||
|
|
||||||
|
//保存
|
||||||
|
this->SaveToSLF_SwallCore();
|
||||||
|
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
//平移水平位置
|
||||||
|
void QMyCustomPlot::moveItems_SWallCore()
|
||||||
|
{
|
||||||
|
int num=m_mapDraggable_SwallCore.size();
|
||||||
|
if(num)
|
||||||
|
{
|
||||||
|
bool ok=0;
|
||||||
|
QString Formtiom=QInputDialog::getText(NULL,"水平位置移动","请输入移动量(1,2,3,4..)",QLineEdit::Normal,"",&ok);
|
||||||
|
if(!ok) return;
|
||||||
|
if(Formtiom.toFloat())
|
||||||
|
{
|
||||||
|
float dleft=Formtiom.toFloat();//厘米数
|
||||||
|
|
||||||
|
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||||||
|
for (QMap<QString,QObject *>::Iterator iter = m_mapDraggable_SwallCore.begin(); iter != m_mapDraggable_SwallCore.end(); iter++)
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableSwallCore*)iter.value();
|
||||||
|
pDraggableRect->m_fLeftSpace += dleft*g_dPixelPerCm;
|
||||||
|
//刷新
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
pDraggableRect->setRange(tmpRange.lower, tmpRange.upper);
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存
|
||||||
|
this->SaveToSLF_SwallCore();
|
||||||
|
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//从剪切板文本数据粘贴
|
||||||
|
void QMyCustomPlot::addItems_SWallCore()
|
||||||
|
{
|
||||||
|
//清空
|
||||||
|
liths_SWallCore.clear();
|
||||||
|
oils_SWallCore.clear();
|
||||||
|
colors_SWallCore.clear();
|
||||||
|
colorinds_SWallCore.clear();
|
||||||
|
|
||||||
|
QString cs=GetConfPath();
|
||||||
|
QString color;
|
||||||
|
for(int j=0;j<4;j++)
|
||||||
|
{
|
||||||
|
if(j==0) color=cs+"corecolor.ini";
|
||||||
|
else if(j==1) color=cs+"corelith.ini";
|
||||||
|
else if(j==2) color=cs+"coreoil.ini";
|
||||||
|
else color=cs+"colorind.ini";
|
||||||
|
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||||||
|
QStringList ss;
|
||||||
|
char buf[100];
|
||||||
|
if(fp) {
|
||||||
|
while(!feof(fp)) {
|
||||||
|
fscanf(fp,"%s",buf);
|
||||||
|
ss.append(buf);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
if(j==0) colors_SWallCore=ss;
|
||||||
|
else if(j==1) liths_SWallCore=ss;
|
||||||
|
else if(j==2) oils_SWallCore=ss;
|
||||||
|
else colorinds_SWallCore=ss;
|
||||||
|
}
|
||||||
|
|
||||||
|
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_SWallCore(coredat);
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存
|
||||||
|
this->SaveToSLF_SwallCore();
|
||||||
|
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QMyCustomPlot::AddItem_SWallCore(QStringList lists)
|
||||||
|
{
|
||||||
|
if(lists.size()<2) return;
|
||||||
|
if(lists.size()<3) lists.insert(0,"0");
|
||||||
|
WALLCORE_DATA m_Result;
|
||||||
|
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
||||||
|
double top=-9999.0;
|
||||||
|
double bottom=-9999.0;
|
||||||
|
m_Result.Order=lists[0].toInt();
|
||||||
|
top=lists[1].toDouble();
|
||||||
|
bottom=top;
|
||||||
|
m_Result.Depth=top;
|
||||||
|
if(lists.size()>2) {
|
||||||
|
if(!lists[2].isEmpty()) {
|
||||||
|
if(lists[2].at(0).isDigit()) {
|
||||||
|
m_Result.CoreOil=lists[2].toDouble();
|
||||||
|
if(lists.size()>3) m_Result.CoreLith=lists[3].toDouble();
|
||||||
|
if(lists.size()>4) m_Result.CoreColor=lists[4].toDouble();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(int j=0;j<3;j++) {
|
||||||
|
QStringList ss;
|
||||||
|
if(j==0) ss=colors_SWallCore;
|
||||||
|
else if(j==1) ss=liths_SWallCore;
|
||||||
|
else ss=oils_SWallCore;
|
||||||
|
int len=0;
|
||||||
|
int len1=0;
|
||||||
|
int iid=0;
|
||||||
|
for(int i=0;i<ss.size();i++) {
|
||||||
|
if(lists[2].indexOf(ss[i])>-1) {
|
||||||
|
len1=strlen(ss[i].toStdString().c_str());
|
||||||
|
if(len<len1) {
|
||||||
|
len=len1;
|
||||||
|
iid=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(len) {
|
||||||
|
if(j==0) {
|
||||||
|
if(iid>=0&&iid<colorinds_SWallCore.size()) m_Result.CoreColor=colorinds_SWallCore[iid].toInt();
|
||||||
|
else m_Result.CoreColor=0;
|
||||||
|
}
|
||||||
|
else if(j==1) m_Result.CoreLith=iid+1;
|
||||||
|
else m_Result.CoreOil=iid+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(top&&bottom==0) bottom=top;
|
||||||
|
|
||||||
|
if(m_Result.CoreLith<1) m_Result.CoreLith=1;
|
||||||
|
if(m_Result.CoreOil<1) m_Result.CoreOil=1;
|
||||||
|
if(m_Result.CoreColor<0) m_Result.CoreColor=0;
|
||||||
|
|
||||||
|
QString LithologyImage="";
|
||||||
|
QString OilGasImage="";
|
||||||
|
QString ColorImage="";
|
||||||
|
|
||||||
|
//
|
||||||
|
if(m_Result.CoreLith<1) {
|
||||||
|
LithologyImage="";
|
||||||
|
}
|
||||||
|
else if (liths_SWallCore.size()>=m_Result.CoreLith)
|
||||||
|
{
|
||||||
|
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg";
|
||||||
|
QDir ss(LithologyImage);
|
||||||
|
if(!ss.exists()) {
|
||||||
|
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil)
|
||||||
|
{
|
||||||
|
OilGasImage=::GetGasSymbolDir()+""+oils_SWallCore[m_Result.CoreOil-1]+".svg";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OilGasImage="";
|
||||||
|
}
|
||||||
|
int ind=colorinds_SWallCore.indexOf(QString::number(m_Result.CoreColor));
|
||||||
|
if (ind>-1&&ind<colors_SWallCore.size())
|
||||||
|
{
|
||||||
|
ColorImage=::GetColorSymbolDir()+""+colors_SWallCore[ind]+".svg";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ColorImage="";
|
||||||
|
}
|
||||||
|
|
||||||
|
float width = 1;
|
||||||
|
float Sideleft = 0;
|
||||||
|
//增加井壁取心
|
||||||
|
addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, m_Result.CoreColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
//全部清空
|
||||||
|
void QMyCustomPlot::DeleteItems_SWallCore()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
|
||||||
|
//删除对象
|
||||||
|
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_SwallCore.begin();
|
||||||
|
while( it != m_mapDraggable_SwallCore.end() )
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableSwallCore*)it.value();
|
||||||
|
it++;
|
||||||
|
pDraggableRect->deleteRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存
|
||||||
|
this->SaveToSLF_SwallCore();
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
//刷新数据
|
||||||
|
void QMyCustomPlot::RefreshItems_SWallCore()
|
||||||
|
{
|
||||||
|
//删除对象
|
||||||
|
TransparentDraggableSwallCore *pDraggableRect =NULL;
|
||||||
|
QMap<QString,QObject *>::Iterator it = m_mapDraggable_SwallCore.begin();
|
||||||
|
while( it != m_mapDraggable_SwallCore.end() )
|
||||||
|
{
|
||||||
|
pDraggableRect = (TransparentDraggableSwallCore*)it.value();
|
||||||
|
it++;
|
||||||
|
pDraggableRect->deleteRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
//重新加载
|
||||||
|
LoadFromSLF_SwallCore(m_strSlfName, m_strLineName);
|
||||||
|
//属性清空
|
||||||
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineName)
|
||||||
|
{
|
||||||
|
WALLCORE_DATA m_Result;
|
||||||
|
CMemRdWt *logio=new CMemRdWt();
|
||||||
|
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||||||
|
{
|
||||||
|
delete logio;
|
||||||
|
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList liths;
|
||||||
|
QStringList oils;
|
||||||
|
QStringList colors;
|
||||||
|
QStringList colorinds;
|
||||||
|
|
||||||
|
QString cs=GetConfPath();
|
||||||
|
QString color;
|
||||||
|
for(int j=0;j<4;j++)
|
||||||
|
{
|
||||||
|
if(j==0) color=cs+"corecolor.ini";
|
||||||
|
else if(j==1) color=cs+"corelith.ini";
|
||||||
|
else if(j==2) color=cs+"coreoil.ini";
|
||||||
|
else color=cs+"colorind.ini";
|
||||||
|
FILE *fp=fopen(color.toStdString().c_str(),"rt");
|
||||||
|
QStringList ss;
|
||||||
|
char buf[100];
|
||||||
|
if(fp) {
|
||||||
|
while(!feof(fp)) {
|
||||||
|
fscanf(fp,"%s",buf);
|
||||||
|
ss.append(buf);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
if(j==0) colors=ss;
|
||||||
|
else if(j==1) liths=ss;
|
||||||
|
else if(j==2) oils=ss;
|
||||||
|
else colorinds=ss;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||||||
|
if(iIndex>-1) {
|
||||||
|
int count=logio->GetTableRecordCount(iIndex);
|
||||||
|
for(int i=0;i<count;i++) {
|
||||||
|
memset(&m_Result,0,sizeof(WALLCORE_DATA));
|
||||||
|
logio->ReadTable(iIndex,i+1,&m_Result);
|
||||||
|
double top=m_Result.Depth;
|
||||||
|
double bottom=m_Result.Depth;
|
||||||
|
|
||||||
|
QString LithologyImage="";
|
||||||
|
QString OilGasImage="";
|
||||||
|
QString ColorImage="";
|
||||||
|
|
||||||
|
//
|
||||||
|
if(m_Result.CoreLith<1) {
|
||||||
|
LithologyImage="";
|
||||||
|
}
|
||||||
|
else if (liths.size()>=m_Result.CoreLith)
|
||||||
|
{
|
||||||
|
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[m_Result.CoreLith-1]+".svg";
|
||||||
|
QDir ss(LithologyImage);
|
||||||
|
if(!ss.exists()) {
|
||||||
|
LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[m_Result.CoreLith-1]+".png";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_Result.CoreOil>0&&oils.size()>=m_Result.CoreOil)
|
||||||
|
{
|
||||||
|
OilGasImage=::GetGasSymbolDir()+""+oils[m_Result.CoreOil-1]+".svg";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OilGasImage="";
|
||||||
|
}
|
||||||
|
int ind=colorinds.indexOf(QString::number(m_Result.CoreColor));
|
||||||
|
if (ind>-1&&ind<colors.size())
|
||||||
|
{
|
||||||
|
ColorImage=::GetColorSymbolDir()+""+colors[ind]+".svg";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ColorImage="";
|
||||||
|
}
|
||||||
|
float depth = m_Result.Depth;
|
||||||
|
float width = 1;
|
||||||
|
float Sideleft = m_Result.left;
|
||||||
|
if(m_Result.width<=0)
|
||||||
|
{
|
||||||
|
width = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = m_Result.width;
|
||||||
|
}
|
||||||
|
if(Sideleft<0) Sideleft=0;
|
||||||
|
if(width<=0) width=1;
|
||||||
|
|
||||||
|
//
|
||||||
|
addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, m_Result.CoreColor);
|
||||||
|
}
|
||||||
|
logio->CloseTable(iIndex);
|
||||||
|
}
|
||||||
|
delete logio;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//从剪切板文本数据粘贴
|
||||||
|
void QMyCustomPlot::addItems_Core()
|
||||||
|
{
|
||||||
|
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(","," ");
|
||||||
|
originalText.replace("\t"," ");
|
||||||
|
originalText.replace("\r\n","\n");
|
||||||
|
originalText.replace("\r","\n");
|
||||||
|
|
||||||
|
QStringList line=originalText.split("\n");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
bool isfirst=false;
|
||||||
|
int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str());
|
||||||
|
if(iIndex<=0){
|
||||||
|
delete logio;
|
||||||
|
QMessageBox::information(NULL,"提示","缺失表"+m_strLineName+",请检查!!",QMessageBox::Yes);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int k=0;
|
||||||
|
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()) continue;
|
||||||
|
if(!i) {
|
||||||
|
if(coredat.size()<4){
|
||||||
|
QMessageBox::information(NULL,"提示","字段数不能小于4个!\nNO DEPTH CURRDEPTH AC DEN ...\n1 2200 220.1 350 2.3\n2 2202 2202.2 340 25.0\n");
|
||||||
|
delete logio;
|
||||||
|
if(isfirst)this->AddTableToWellRound();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit())
|
||||||
|
{
|
||||||
|
if(iIndex>=0) {
|
||||||
|
int count=logio->GetTableFieldCount(iIndex);
|
||||||
|
if(count!=coredat.size()) {
|
||||||
|
logio->DiscardObject(m_strLineName.toStdString().c_str());
|
||||||
|
}
|
||||||
|
iIndex=-1;
|
||||||
|
}
|
||||||
|
if (iIndex < 0)
|
||||||
|
{
|
||||||
|
QString Names=coredat.join(",");
|
||||||
|
Names=Names.toUpper();
|
||||||
|
QString types="1";
|
||||||
|
for(int i=0;i<coredat.size()-1;i++) types+=",4";
|
||||||
|
QString lengs="4";
|
||||||
|
for(int i=0;i<coredat.size()-1;i++) lengs+=",4";
|
||||||
|
QString ress="0";
|
||||||
|
for(int i=0;i<coredat.size()-1;i++) ress+=",0";
|
||||||
|
iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),CORE_PHYSICS_OBJECT,coredat.size(),
|
||||||
|
(char*)Names.toStdString().c_str(),
|
||||||
|
(char*)lengs.toStdString().c_str(),//字段长度
|
||||||
|
(char*)types.toStdString().c_str(),//字段类型
|
||||||
|
(char*)ress.toStdString().c_str());//字段备注,1-枚举
|
||||||
|
//if(coredat.indexOf(CoreObj->GetFieldName())==-1) CoreObj->SetFieldName(coredat.at(3));
|
||||||
|
isfirst=true;
|
||||||
|
}
|
||||||
|
logio->SetTableRecordCount(iIndex,0);
|
||||||
|
//if(CoreObj->GetFieldName().isEmpty()||coredat.indexOf(CoreObj->GetFieldName())<0) CoreObj->SetFieldName(coredat[3]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QMessageBox::information(NULL,"提示", "首行必须是表头!如:\nNO,DEPTH,...");
|
||||||
|
delete logio;
|
||||||
|
if(isfirst)this->AddTableToWellRound();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue;
|
||||||
|
for(int j=0;j<coredat.size();j++)
|
||||||
|
{
|
||||||
|
float yy=coredat[j].toFloat();
|
||||||
|
logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1);
|
||||||
|
}
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete logio;
|
||||||
|
if(isfirst)this->AddTableToWellRound();
|
||||||
|
|
||||||
|
// //保存
|
||||||
|
// this->SaveToSLF_SwallCore();
|
||||||
|
// //属性清空
|
||||||
|
// PropertyService()->InitCurrentViewInfo();
|
||||||
|
}
|
||||||
|
|
||||||
//从剪切板文本数据粘贴
|
//从剪切板文本数据粘贴
|
||||||
void QMyCustomPlot::addItems_Gujing()
|
void QMyCustomPlot::addItems_Gujing()
|
||||||
{
|
{
|
||||||
|
|
@ -1360,7 +2062,7 @@ void QMyCustomPlot::addItems_Gujing()
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消选中
|
//取消选中
|
||||||
void QMyCustomPlot::ClearSelectItems_Gujing()
|
void QMyCustomPlot::ClearSelectItems()
|
||||||
{
|
{
|
||||||
//属性清空
|
//属性清空
|
||||||
PropertyService()->InitCurrentViewInfo();
|
PropertyService()->InitCurrentViewInfo();
|
||||||
|
|
@ -2153,7 +2855,7 @@ void QMyCustomPlot::addResultToPlot(double left_Low, double right_Hight, QStrin
|
||||||
m_mapDraggable_Result[strUuid] = dragRect;
|
m_mapDraggable_Result[strUuid] = dragRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int ind)
|
void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor)
|
||||||
{
|
{
|
||||||
QtCommonClass *qtCommon = new QtCommonClass(this);
|
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||||
QString strUuid = qtCommon->getUUid();
|
QString strUuid = qtCommon->getUUid();
|
||||||
|
|
@ -2163,10 +2865,11 @@ void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QSt
|
||||||
//图片,提前设值,后面setRange改变
|
//图片,提前设值,后面setRange改变
|
||||||
dragRect->setOil(OilGasImage);
|
dragRect->setOil(OilGasImage);
|
||||||
dragRect->setLith(LithologyImage);
|
dragRect->setLith(LithologyImage);
|
||||||
dragRect->setTitle(QString::number(ind));
|
dragRect->setTitle(QString::number(iColor));
|
||||||
|
//左侧空白
|
||||||
|
dragRect->m_fLeftSpace = Sideleft*g_dPixelPerCm;
|
||||||
// 设置初始范围
|
// 设置初始范围
|
||||||
double h = 40;
|
double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40;
|
||||||
double x1 = this->xAxis->coordToPixel(Depth);
|
double x1 = this->xAxis->coordToPixel(Depth);
|
||||||
//
|
//
|
||||||
double Depth2 = this->xAxis->pixelToCoord(x1-h);
|
double Depth2 = this->xAxis->pixelToCoord(x1-h);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
const int iFracType=15;
|
const int iFracType=15;
|
||||||
|
|
||||||
|
//
|
||||||
|
#define SideWallCoreWidth 1.2
|
||||||
|
#define SideWallCoreHeight 0.4
|
||||||
|
|
||||||
class TransparentGroupResult;
|
class TransparentGroupResult;
|
||||||
class QMyCustomPlot : public QCustomPlot
|
class QMyCustomPlot : public QCustomPlot
|
||||||
{
|
{
|
||||||
|
|
@ -156,15 +160,19 @@ public:
|
||||||
QMap<QString,QString> zoneOrder_Gujing;
|
QMap<QString,QString> zoneOrder_Gujing;
|
||||||
bool SaveToSLF_Gujing();
|
bool SaveToSLF_Gujing();
|
||||||
QString GetIntResult_Gujing(QString result);
|
QString GetIntResult_Gujing(QString result);
|
||||||
void AddTableToWellRound(); //将固井结论表,添加到左侧树图
|
void AddTableToWellRound(); //将表,添加到左侧树图
|
||||||
void addItems_Gujing(); //从剪切板文本数据粘贴
|
|
||||||
void ClearSelectItems_Gujing(); //取消选中
|
|
||||||
void DeleteItems_Gujing(); //全部清空
|
|
||||||
void RefreshItems_Gujing(); //刷新数据
|
|
||||||
void MegResult_Gujing(); //合并结论
|
|
||||||
bool CopyToSLFFile(QString targetSLFFileName, bool deleteFromSrc, char*newCurveName);
|
bool CopyToSLFFile(QString targetSLFFileName, bool deleteFromSrc, char*newCurveName);
|
||||||
bool LoadFromSLF_Gujing(QString strSlfName, QString strLineName);
|
bool LoadFromSLF_Gujing(QString strSlfName, QString strLineName);
|
||||||
|
|
||||||
|
//井壁取心
|
||||||
|
QStringList liths_SWallCore;
|
||||||
|
QStringList oils_SWallCore;
|
||||||
|
QStringList colors_SWallCore;
|
||||||
|
QStringList colorinds_SWallCore;
|
||||||
|
//
|
||||||
|
bool SaveToSLF_SwallCore();
|
||||||
|
bool LoadFromSLF_SwallCore(QString strSlfName, QString strLineName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slot_time();
|
void slot_time();
|
||||||
|
|
||||||
|
|
@ -182,7 +190,7 @@ public:
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
void addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int ind);
|
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);
|
void addGujingToPlot(double left_Low, double right_Hight, const QString strResult);
|
||||||
|
|
||||||
|
|
@ -263,7 +271,23 @@ public slots:
|
||||||
void onEditLine();
|
void onEditLine();
|
||||||
|
|
||||||
//右键--编辑固井
|
//右键--编辑固井
|
||||||
void onEditGujing();
|
void onEditGujing();
|
||||||
|
void addItems_Gujing(); //从剪切板文本数据粘贴
|
||||||
|
void ClearSelectItems(); //取消选中
|
||||||
|
void DeleteItems_Gujing(); //全部清空
|
||||||
|
void RefreshItems_Gujing(); //刷新数据
|
||||||
|
void MegResult_Gujing(); //合并结论
|
||||||
|
|
||||||
|
//右键--编辑井壁取心
|
||||||
|
void addItem_SWallCore(); //增加井壁取心
|
||||||
|
void moveItems_SWallCore(); //平移水平位置
|
||||||
|
void addItems_SWallCore(); //从剪切板文本数据粘贴
|
||||||
|
void DeleteItems_SWallCore(); //全部清空
|
||||||
|
void RefreshItems_SWallCore(); //刷新数据
|
||||||
|
void AddItem_SWallCore(QStringList lists);
|
||||||
|
|
||||||
|
//
|
||||||
|
void addItems_Core();
|
||||||
|
|
||||||
//执行校正
|
//执行校正
|
||||||
void s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
void s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user