diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 44942c5..136b689 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -73,9 +73,6 @@ signals: //裂痕 void sig_AddCrack(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0); - //地质层位道 - void sig_AddGeoSection(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0); - //气测/FMT/射孔/文本 void sig_AddJiegutext(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0); diff --git a/logPlus/ObjGeostratums.cpp b/logPlus/ObjGeostratums.cpp deleted file mode 100644 index d5ad14d..0000000 --- a/logPlus/ObjGeostratums.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include "ObjGeostratums.h" -#include "LogIO.h"; -#include -#include -#include - - -CObjGeostratums::CObjGeostratums() -{ -} - -CObjGeostratums::~CObjGeostratums() -{ -} - -bool CObjGeostratums::LoadFromSLF(QMyCustomPlot *widget, QString strSlfName, QString csCurve) -{ - LAYER_DATA m_Result; - if(strSlfName=="") return false; - CLogIO *logio=new CLogIO(); - if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; -// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); - return false; - } - - int iIndex=logio->OpenTable(csCurve.toStdString().c_str()); - if (iIndex <0) { - iIndex=logio->OpenTable("LAYER_DATA"); - } - - if (iIndex >=0) - { - int count=logio->GetTableRecordCount(iIndex); - - int ColorNum=6; - if(ColorNum<1) ColorNum=1; - QList rgbList; - rgbList.append(QRgb(4294967295)); - rgbList.append(QRgb(4294966617)); - rgbList.append(QRgb(4294944512)); - rgbList.append(QRgb(4293345792)); - rgbList.append(QRgb(4288741473)); - rgbList.append(QRgb(4278190080)); - - for(int j=0;jReadTable(iIndex,j+1,&m_Result); - float sdep=m_Result.StartDepth; - float edep=m_Result.EndDepth; - // - char buf[490]; - buf[0]=0; - ::GetDescription(m_Result,buf); - - QColor bkColor = rgbList.at(j%ColorNum); - - //显示文本 - widget->addTextToPlot(-edep, -sdep, QString::fromLocal8Bit(buf), bkColor); - } - logio->CloseTable(iIndex); - } - delete logio; - return true; -} - diff --git a/logPlus/ObjGeostratums.h b/logPlus/ObjGeostratums.h deleted file mode 100644 index 6a3c93b..0000000 --- a/logPlus/ObjGeostratums.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef OBJGEOSTRATUMS_H -#define OBJGEOSTRATUMS_H - -#include -#include "qmycustomplot.h" - -/** -* @class -* @brief 地质分层 -* @see -*/ -class CObjGeostratums :public QObject -{ - Q_OBJECT -public: - CObjGeostratums(); - virtual ~CObjGeostratums(); - - virtual bool LoadFromSLF(QMyCustomPlot *widget, QString strSlfName, QString csCurve); - -private: - -}; - -#endif diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index fc76798..c88b3c9 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -294,6 +294,11 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant //先处理通用属性 CommonPropertyChanged(pProperty, variant); } + else if (m_strCurrentProperty == Layer_Property)//文字结论 + { + //先处理通用属性 + CommonPropertyChanged(pProperty, variant); + } else if (m_strCurrentProperty == TextItem_Property) { //文字结论item @@ -334,6 +339,46 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } } } + else if (m_strCurrentProperty == LayerItem_Property) + { + //文字结论item + if("顶深(m)" == m_propertyData[pProperty]) + { + //qDebug() << "顶深(m)->改变"; + if(m_tdLayer) + { + double upper = variant.value(); + m_tdLayer->setUpper(-upper); + //保存 + m_tdLayer->mPlot->SaveToSLF_Layer(); + } + } + else if("底深(m)" == m_propertyData[pProperty]) + { + //qDebug() << "底深(m)->改变"; + if(m_tdLayer) + { + double lower = variant.value(); + m_tdLayer->setLower(-lower); + //保存 + m_tdLayer->mPlot->SaveToSLF_Layer(); + } + } + else if("文字结论" == m_propertyData[pProperty]) + { + //qDebug() << "文字结论->改变"; + if(m_tdLayer) + { + QString newResult = variant.value(); + m_tdLayer->setTitle(newResult); + // + QCPRange currentRange = m_tdLayer->getRange(); + m_tdLayer->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdLayer->mPlot->SaveToSLF_Layer(); + } + } + } else if (m_strCurrentProperty == GujingItem_Property) { //固井结论item @@ -1682,6 +1727,11 @@ void PropertyWidget::initProperty(FormInfo *formInfo) //文字结论 this->initTextProperty(formInfo); } + else if (m_strLineName == "LAYER_DATA") + { + //地质分层 + this->initLayerProperty(formInfo); + } else{ this->initTableProperty(formInfo); } @@ -1872,6 +1922,32 @@ void PropertyWidget::initTextItemProperty(TransparentDraggableRect* tdText, doub _CreateVariantPropertyItem("当前项", "文字结论", strResult, QVariant::String); } +void PropertyWidget::initLayerProperty(FormInfo *formInfo) +{ + _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); + + _CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String); + _CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font); + _CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color); + + m_strCurrentProperty = Layer_Property; +} + +void PropertyWidget::initLayerItemProperty(TransparentDraggableLayer* tdLayer, double lower, double upper, QString strResult) +{ + //初始化,清空 + InitCurrentViewInfo(); + + //当前属性类型 + m_strCurrentProperty = LayerItem_Property; + m_tdLayer = tdLayer; + + // + _CreateVariantPropertyItem("当前项", "顶深(m)", -upper, QVariant::Double); + _CreateVariantPropertyItem("当前项", "底深(m)", -lower, QVariant::Double); + _CreateVariantPropertyItem("当前项", "文字结论", strResult, QVariant::String); +} + void PropertyWidget::initGujingProperty(FormInfo *formInfo) { _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index 72160ce..8eb082d 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -24,6 +24,7 @@ #include "TransparentDraggableSwallCore.h" #include "TransparentDraggableGeoLith.h" #include "TransparentDraggableRect.h" +#include "TransparentDraggableLayer.h" //当前曲线类型 #define Widget_Property "Widget_Property" @@ -46,6 +47,9 @@ #define Text_Property "Text_Property" //文字结论 #define TextItem_Property "TextItem_Property" //文字结论item +#define Layer_Property "Layer_Property" //地质分层 +#define LayerItem_Property "LayerItem_Property" //地质分层item + #pragma execution_character_set("utf-8") /** @@ -115,6 +119,7 @@ public: TransparentDraggableSwallCore* m_tdSwallCore; TransparentDraggableGeoLith* m_tdGeoLith; TransparentDraggableRect* m_tdText; + TransparentDraggableLayer* m_tdLayer; public: QWidget* GetPropertyWidget(); @@ -162,6 +167,10 @@ public: void initTextProperty(FormInfo *formInfo); void initTextItemProperty(TransparentDraggableRect* tdText, double lower, double upper, QString strResult); + // 地质分层属性 + void initLayerProperty(FormInfo *formInfo); + void initLayerItemProperty(TransparentDraggableLayer* tdLayer, double lower, double upper, QString strResult); + void ChangFillProperty();//填充属性改变 void ChangHeadItemProperty();//图头项改变 diff --git a/logPlus/TransparentDraggableLayer.cpp b/logPlus/TransparentDraggableLayer.cpp new file mode 100644 index 0000000..ba76ed4 --- /dev/null +++ b/logPlus/TransparentDraggableLayer.cpp @@ -0,0 +1,506 @@ +#include "TransparentDraggableLayer.h" +#include "PropertyWidget.h" +#include "CallManage.h" + +extern double g_dPixelPerCm;//每厘米像素数 +//static GeoIndicatorGenerator m_drawGeo; + +TransparentDraggableLayer::TransparentDraggableLayer(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle) + : QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth) +{ + m_strUuid = strUuid; + // + initRect(); +} + +TransparentDraggableLayer::~TransparentDraggableLayer() +{ + if(mPlot) { +// mPlot->removeItem(mRect); +// mPlot->removeItem(mLeftHandle); +// mPlot->removeItem(mRightHandle); + } +} + +//设置最小宽度 +void TransparentDraggableLayer::setMinWidth(double minWidth) +{ + mMinWidth = minWidth; +} + +//设置标题 +void TransparentDraggableLayer::setTitle(QString strTitle) +{ + mstrTitle = strTitle; + mItemTitle->setText(mstrTitle); + //mPlot->replot(); +} + +// 设置矩形范围 +void TransparentDraggableLayer::setRange(double left_Low, double right_Hight) +{ + if(left_Low >= right_Hight) return; + + double lY1 = mPlot->yAxis->range().lower;//+10 + double lY2 = mPlot->yAxis->range().upper; + mRect->topLeft->setCoords(left_Low, lY1); + mRect->bottomRight->setCoords(right_Hight, lY2); + + //位置与rect不一样,否则图像反转 + mPixmap->topLeft->setCoords(right_Hight, lY1); + mPixmap->bottomRight->setCoords(left_Low, lY2); + + float flNewPos = mPlot->xAxis->coordToPixel((left_Low + right_Hight)/2.0) - 15; + mItemTitle->position->setCoords(mPlot->xAxis->pixelToCoord(flNewPos), + (mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置 + + //mRect->topLeft->setCoords(left, mPlot->yAxis->range().upper); + //mRect->bottomRight->setCoords(right, mPlot->yAxis->range().lower); + + updateHandles(); + mPlot->replot(); +} + +// 获取当前范围 +QCPRange TransparentDraggableLayer::getRange() +{ + return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x()); +} + +// 设置矩形颜色 +void TransparentDraggableLayer::setColor(const QColor &color) +{ + mRect->setBrush(QBrush(color)); + mRect->setPen(QPen(color.darker())); + //mPlot->replot(); +} + +// 删除框图 +void TransparentDraggableLayer::deleteRect() +{ + if(mPlot) { + mPlot->m_mapDraggable_Layer.remove(m_strUuid); + + mPlot->removeItem(mRect); + mPlot->removeItem(mLeftHandle); + mPlot->removeItem(mRightHandle); + mPlot->removeItem(mPixmap); + mPlot->removeItem(mItemTitle); + + mPlot->replot(); + this->deleteLater(); + } +} + + +void TransparentDraggableLayer::initRect() +{ + // 创建透明矩形 + mRect = new QCPItemRect(mPlot); + mRect->setLayer("overlay"); // 确保在最上层 + mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色 + mRect->setPen(QPen(QColor(70, 70, 255, 200))); + + // 创建左右边界控制点 + mLeftHandle = new QCPItemRect(mPlot); + mLeftHandle->setLayer("overlay"); + mLeftHandle->setBrush(QBrush(Qt::red)); + mLeftHandle->setPen(QPen(Qt::darkRed)); + + mRightHandle = new QCPItemRect(mPlot); + mRightHandle->setLayer("overlay"); + mRightHandle->setBrush(QBrush(Qt::red)); + mRightHandle->setPen(QPen(Qt::darkRed)); + + // 设置初始位置 + //double center = mPlot->xAxis->range().center(); +// setRange(center - 10, center + 10); + + // 连接鼠标事件 + connect(mPlot, &QCustomPlot::mousePress, this, &TransparentDraggableLayer::onMousePress); + connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableLayer::onMouseMove); + connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableLayer::onMouseRelease); + + mPixmap = new QCPItemPixmap(mPlot); + //mPixmap->setPixmap(QPixmap(":/image/file.png")); // 设置图片 + mPixmap->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 + mPixmap->setLayer("overlay"); // 确保在最上层 + + mItemTitle = new QCPItemText(mPlot); + mItemTitle->setText(mstrTitle); + //mItemTitle->setBrush(QBrush(Qt::red)); + mItemTitle->setFont(QFont("Arial", 12, QFont::Bold)); + mItemTitle->setColor(Qt::black); + mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); + mItemTitle->position->setType(QCPItemPosition::ptPlotCoords); + //mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio); + mItemTitle->position->setCoords(0.5, 0); + mItemTitle->setLayer("overlay"); +} + +void TransparentDraggableLayer::updateHandles() +{ + // 左边界矩形控制点 + mLeftHandle->topLeft->setParentAnchor(mRect->topLeft); + mLeftHandle->bottomRight->setParentAnchor(mRect->topRight);//(mRect->bottomLeft); + mLeftHandle->topLeft->setCoords(-0.5, 0.5); // 矩形大小 + mLeftHandle->bottomRight->setCoords(0.5, -0.5); // 矩形大小 + + // 右边界矩形控制点 + mRightHandle->topLeft->setParentAnchor(mRect->bottomLeft); + mRightHandle->bottomRight->setParentAnchor(mRect->bottomRight); + mRightHandle->topLeft->setCoords(-0.5, 0.5); // 矩形大小 + mRightHandle->bottomRight->setCoords(0.5, -0.5); // 矩形大小 + +} + +void TransparentDraggableLayer::onDelRect() +{ + //mDragMode = DragNone; + //删除框图 + deleteRect(); + //保存 + mPlot->SaveToSLF_Layer(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + +//设置深度移动量 +void TransparentDraggableLayer::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); + + { + //保存 + mPlot->SaveToSLF_Layer(); + + //属性清空 + PropertyService()->InitCurrentViewInfo(); + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); + } +} + +//设置顶深 +void TransparentDraggableLayer::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 TransparentDraggableLayer::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 TransparentDraggableLayer::onMousePress(QMouseEvent *event) +{ + if(event->button() != Qt::LeftButton)//右键 + { + double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度 + QCPRange currentRange = getRange(); + if(mLeftHandle->selectTest(event->pos(), false) < 5) { + mDragMode = DragNone; + } + else if(mRightHandle->selectTest(event->pos(), false) < 5) { + mDragMode = DragNone; + } + //else if(x >= currentRange.lower && x <= currentRange.upper) { + else if(y >= currentRange.lower && y <= currentRange.upper) { + mDragMode = DragNone; + } + else { + mDragMode = DragNone; + return; + } + + //event->accept(); + + double low = mRect->topLeft->coords().x(); + double hight = mRect->bottomRight->coords().x(); + PropertyService()->initLayerItemProperty(this, low, hight, mstrTitle); + + QMenu menu(nullptr); + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableLayer::onDelRect); + menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableLayer::setItemDepthOffset); + menu.exec(event->globalPos()); + + return; + } + + event->accept(); + + // 检查点击了哪个部分 + //double x = mPlot->xAxis->pixelToCoord(event->pos().x()); + //double y = mPlot->yAxis->pixelToCoord(event->pos().y()); + + double y = mPlot->xAxis->pixelToCoord(event->pos().y());//x轴展示深度 + + QCPRange currentRange = getRange(); + + if(mLeftHandle->selectTest(event->pos(), false) < 5) { + mDragMode = DragLeft; + } + else if(mRightHandle->selectTest(event->pos(), false) < 5) { + mDragMode = DragRight; + } + //else if(x >= currentRange.lower && x <= currentRange.upper) { + else if(y >= currentRange.lower && y <= currentRange.upper) { + mDragMode = DragRect; + } + else { + mDragMode = DragNone; + return; + } + + //mDragStartX = x; + mDragStartY = y; + mDragStartRange = currentRange; + +} + +void TransparentDraggableLayer::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; + + QCPRange newRange = mDragStartRange; + + switch(mDragMode) { + case DragLeft: { + //double proposedLeft = mDragStartRange.lower + dx; + double proposedLeft = mDragStartRange.lower + dy; + // 确保不超出轴范围且不使宽度小于最小值 + newRange.lower = qBound( + //mPlot->xAxis->range().lower, + getMyLower(), + proposedLeft, + mDragStartRange.upper - mMinWidth); + break; + } + case DragRight: { + //double proposedRight = mDragStartRange.upper + dx; + double proposedRight = mDragStartRange.upper + dy; + // 确保不超出轴范围且不使宽度小于最小值 + newRange.upper = qBound( + mDragStartRange.lower + mMinWidth, + proposedRight, + getMyUpper()); + //mPlot->xAxis->range().upper); + break; + } + case DragRect: { + double width = mDragStartRange.size(); + //double center = mDragStartRange.center() + dx; + double center = mDragStartRange.center() + dy; + newRange.lower = center - width/2; + newRange.upper = center + width/2; + + // 检查是否超出轴范围 + if(newRange.lower < getMyLower()) { + newRange.lower = getMyLower(); + newRange.upper = newRange.lower + width; + } + else if(newRange.upper > getMyUpper()) { + newRange.upper = getMyUpper(); + newRange.lower = newRange.upper - width; + } + +// QCPRange axisRange = mPlot->xAxis->range(); +// if(newRange.lower < axisRange.lower) { +// newRange.lower = axisRange.lower; +// newRange.upper = newRange.lower + width; +// } +// else if(newRange.upper > axisRange.upper) { +// newRange.upper = axisRange.upper; +// newRange.lower = newRange.upper - width; +// } + break; + } + default: + break; + } + +// //取整数(方便显示统计,左右边界整数显示。) +// newRange.lower = (int)newRange.lower; +// QCPRange rangeByFile = mPlot->xAxis->range(); +// if (std::fabs(rangeByFile.upper - (int)newRange.upper) >= 1.0) +// { +// newRange.upper = (int)newRange.upper; +// } + + // 最终确保宽度不小于最小值(针对整体拖动的情况) + if(newRange.size() < mMinWidth) { + if(mDragMode == DragRect) { + // 如果是整体拖动,保持中心点不变 + double center = newRange.center(); + newRange.lower = center - mMinWidth/2; + newRange.upper = center + mMinWidth/2; + } else { + // 如果是边界拖动,强制设置最小宽度 + if(mDragMode == DragLeft) { + newRange.lower = newRange.upper - mMinWidth; + } else if(mDragMode == DragRight) { + newRange.upper = newRange.lower + mMinWidth; + } + } + } + + setRange(newRange.lower, newRange.upper); + +} + +void TransparentDraggableLayer::onMouseRelease(QMouseEvent *event) +{ + if(event->button() == Qt::LeftButton && mDragMode != DragNone) { + event->accept(); + //属性 + //if(mDragMode == DragRect) + { + double low = mRect->topLeft->coords().x(); + double hight = mRect->bottomRight->coords().x(); + PropertyService()->initLayerItemProperty(this, low, hight, mstrTitle); + //保存 + mPlot->SaveToSLF_Layer(); + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); + } + + //避免二次绘制框图 + 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; + } +} + +double TransparentDraggableLayer::getMyLower() +{ + double dLower = mPlot->xAxis->range().lower; + double proposedLeft = mDragStartRange.lower; + + TransparentDraggableLayer *pDraggableRect =NULL; + { + QMap::Iterator it = mPlot->m_mapDraggable_Layer.begin(); + while( it != mPlot->m_mapDraggable_Layer.end() ) + { + if(it.key() == m_strUuid) + { + it++; + continue; + } + pDraggableRect = (TransparentDraggableLayer*)it.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + if(tmpRange.upper >= dLower && tmpRange.upper <= proposedLeft) + { + dLower = tmpRange.upper; + } + it++; + } + } + + return dLower; +} + +double TransparentDraggableLayer::getMyUpper() +{ + double dUpper = mPlot->xAxis->range().upper; + double proposedRight = mDragStartRange.upper; + + TransparentDraggableLayer *pDraggableRect =NULL; + { + QMap::Iterator it = mPlot->m_mapDraggable_Layer.begin(); + while( it != mPlot->m_mapDraggable_Layer.end() ) + { + if(it.key() == m_strUuid) + { + it++; + continue; + } + pDraggableRect = (TransparentDraggableLayer*)it.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + if(tmpRange.lower <= dUpper && tmpRange.lower >= proposedRight) + { + dUpper = tmpRange.lower; + } + it++; + } + } + + return dUpper; +} + diff --git a/logPlus/TransparentDraggableLayer.h b/logPlus/TransparentDraggableLayer.h new file mode 100644 index 0000000..ffe86d4 --- /dev/null +++ b/logPlus/TransparentDraggableLayer.h @@ -0,0 +1,97 @@ +#ifndef TRANSPARENTDRAGGABLELAYER_H +#define TRANSPARENTDRAGGABLELAYER_H + +#include +#include "qmycustomplot.h" +#include +#include + +#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8 + +class TransparentDraggableLayer : public QObject +{ + Q_OBJECT +public: + explicit TransparentDraggableLayer(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = ""); + + + ~TransparentDraggableLayer(); + + //设置最小宽度 + void setMinWidth(double minWidth); + //设置标题 + void setTitle(QString strTitle); + + // 设置矩形范围 + void setRange(double left_Low, double right_Hight); + // 获取当前范围 + QCPRange getRange(); + + // 设置矩形颜色 + void setColor(const QColor &color); + + // 删除框图 + void deleteRect(); + + //设置顶深 + void setUpper(double upper); + //设置底深 + void setLower(double lower); + +signals: + void rangeChanged(QCPRange newRange); + +private: + void initRect(); + void updateHandles() ; + +private slots: + void onDelRect(); //删除 + void setItemDepthOffset(); //设置深度移动量 + void onMousePress(QMouseEvent *event); + void onMouseMove(QMouseEvent *event); + void onMouseRelease(QMouseEvent *event); + double getMyLower(); + double getMyUpper(); + +public: + QMyCustomPlot *mPlot; + QCPItemRect *mRect; + QCPItemRect *mLeftHandle; + QCPItemRect *mRightHandle; + + QCPItemPixmap *mPixmap; + QCPItemText *mItemTitle; + QString mstrTitle=""; + QString m_strUuid = ""; + + //以下字段为临时添加,后面需要数据组集成 + QFont wordfont; //文字字体 + QColor fontColor; //字体颜色 + QColor backgroundColor; //背景颜色 + int leftAndRightAlign; //左右对齐方式 + int upAndDownAlign; //上下对齐方式 + +// BEGIN_ENUM(LeftAndRightDesc) +// { 0,L"中间对齐" }, +// { 1,L"左对齐" }, +// { 2,L"右对齐" } +// END_ENUM(LeftAndRightDesc); + +// BEGIN_ENUM(UpAndDownDesc) +// { 0,L"上对齐" }, +// { 1,L"中间对齐" }, +// { 2,L"下对齐" } +// END_ENUM(UpAndDownDesc); + + enum DragMode { DragNone, DragLeft, DragRight, DragRect }; + DragMode mDragMode = DragNone; + //double mDragStartX = 0; + double mDragStartY = 0; + QCPRange mDragStartRange; + + // 添加最小宽度成员变量 + double mMinWidth; +}; + +#endif // TRANSPARENTDRAGGABLELAYER_H diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 190e6f1..191f0d9 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -12,7 +12,6 @@ #include "PickFrac.h" #include "DrawFac.h" #include "ObjTubingstringResult.h" -#include "ObjGeostratums.h" #include "ObjTextResult.h" #include "DrawNrad.h" #include "formline.h" @@ -87,9 +86,6 @@ FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) : //裂缝 connect(CallManage::getInstance(), SIGNAL(sig_AddCrack(QString, QString, QString, QString, QString, int)), this, SLOT(s_addCrack(QString, QString, QString, QString, QString,int))); - //地质层位道 - connect(CallManage::getInstance(), SIGNAL(sig_AddGeoSection(QString, QString, QString, QString, QString, int)), this, SLOT(s_addGeoSection(QString, QString, QString, QString, QString,int))); - //气测/FMT/射孔/文本 connect(CallManage::getInstance(), SIGNAL(sig_AddJiegutext(QString, QString, QString, QString, QString, int)), this, SLOT(s_addJiegutext(QString, QString, QString, QString, QString,int))); @@ -300,9 +296,10 @@ void FormDraw::DisplayLines(QJsonArray linesArray) } } if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT" - || strLineName == "WORDS_RELUST" || strLineName == "GEO_LITH" || strLineName == "SWALL_CORE") + || strLineName == "WORDS_RELUST" || strLineName == "GEO_LITH" || strLineName == "SWALL_CORE" + || strLineName == "LAYER_DATA") { - //固井结论/井壁取心/录井剖面/文字结论 + //固井结论/井壁取心/录井剖面/文字结论/地质分层 DisplayTable_One(lineObjInfo); } } @@ -828,7 +825,8 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri if (strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT" || strLineName == "GEO_LITH" || strLineName == "SWALL_CORE" || strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT" - || strLineName == "CORE_PHYSICS" || strLineName == "IMAGE_DATA") + || strLineName == "CORE_PHYSICS" || strLineName == "IMAGE_DATA" + || strLineName == "LAYER_DATA" ) { } @@ -883,6 +881,21 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri initWords(curv, strSlfName, strLineName); } } + else if (strLineName == "LAYER_DATA") + { + //地质层位 + if(listOtherProperty.size()>=3) + { + QString strAliasName = listOtherProperty[0]; + QColor newlineColor=QColor(0,0,0); + newlineColor.setNamedColor(listOtherProperty[1]); + initLayer(curv, strSlfName, strLineName, strAliasName, newlineColor, listOtherProperty); + } + else + { + initLayer(curv, strSlfName, strLineName); + } + } else if (strLineName == "RESULT") { //解释结论 @@ -2118,93 +2131,6 @@ void FormDraw::s_addCrack(QString strUuid, QString strSlfName, QString strWellNa m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strWaveName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "CrackObject"); } -//地质层位道 -void FormDraw::s_addGeoSection(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW) -{ - //井名&道名不一致 - if(strUuid == m_strUuid && m_strWellName == strWellName && m_strTrackName == strTrackName) - { - } - else - { - return; - } - - if(m_listLineName.contains(strLineName)) - { - qDebug() << "FormDraw strLineName already exist! " << strLineName; - return; - } - - // - QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); - curv->m_strUuid = m_strUuid; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 - curv->show(); - - //------------------- - int iMyWidth = curv->axisRect(0)->width(); - - m_LeftVal = 0; - m_RightVal = iMyWidth; - - float vmax = iMyWidth; - float vmin = 0; - curv->m_iX1 = vmin; - curv->m_iX2 = vmax; - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; - // - curv->xAxis->setRange(vmin, vmax); - curv->yAxis->setRange(m_iY1, m_iY2); - curv->axisRect()->setupFullAxesBox(); - // - curv->xAxis->ticker()->setTickCount(10);//x个主刻度 - curv->yAxis->ticker()->setTickCount(60);//y个主刻度 - - //对调XY轴,在最前面设置 - QCPAxis *yAxis = curv->yAxis; - QCPAxis *xAxis = curv->xAxis; - curv->xAxis = yAxis; - curv->yAxis = xAxis; - - //地质层位道 - QString strWaveName = "LAYER_DATA"; - CObjGeostratums *objGeostratums = new CObjGeostratums(); - objGeostratums->LoadFromSLF(curv, strSlfName, strWaveName); - - // - connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); - - // - m_listLineName.push_back(strLineName); - - QString strAliasName = "地质分层"; - QString strUnit = ""; - QColor newlineColor=QColor(0,0,0); - double width=2; - QString strScaleType = ""; - //道-对象 - m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strWaveName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "GeoSectionObject"); -} - //气测/FMT/射孔/文本 void FormDraw::s_addJiegutext(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW) { @@ -3412,7 +3338,6 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString void FormDraw::initWords(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty) { - int iMyWidth = widget->axisRect(0)->width(); float vmax = iMyWidth; float vmin = 0; @@ -3445,6 +3370,53 @@ void FormDraw::initWords(QMyCustomPlot *widget, QString strSlfName, QString strL // widget->LoadFromSLF_Text(strSlfName, strLineName); + if(listOtherProperty.size()>=3) + { + strAliasName = listOtherProperty[0]; + newlineColor.setNamedColor(listOtherProperty[1]); + } + QString strUnit = ""; + double width=2; + QString strScaleType = ""; + //道-对象 + m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty); +} + +void FormDraw::initLayer(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty) +{ + int iMyWidth = widget->axisRect(0)->width(); + float vmax = iMyWidth; + float vmin = 0; + widget->m_iX1 = vmin; + widget->m_iX2 = iMyWidth; + widget->m_iY1 = m_iY1; + widget->m_iY2 = m_iY2; + // + widget->xAxis->setRange(vmin, vmax); + widget->yAxis->setRange(m_iY1, m_iY2); + widget->axisRect()->setupFullAxesBox(); + // + widget->xAxis->ticker()->setTickCount(10);//x个主刻度 + widget->yAxis->ticker()->setTickCount(60);//y个主刻度 + + //对调XY轴,在最前面设置 + QCPAxis *yAxis = widget->yAxis; + QCPAxis *xAxis = widget->xAxis; + widget->xAxis = yAxis; + widget->yAxis = xAxis; + + + m_LeftVal = 0; + m_RightVal = 90; + //隐藏刻度 + widget->xAxis->setTicks(false); + widget->yAxis->setTicks(false); + widget->xAxis2->setTicks(false); + widget->yAxis2->setTicks(false); + + //地质层位道 + widget->LoadFromSLF_Layer(strSlfName, strLineName); + if(listOtherProperty.size()>=3) { strAliasName = listOtherProperty[0]; @@ -3457,6 +3429,7 @@ void FormDraw::initWords(QMyCustomPlot *widget, QString strSlfName, QString strL m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty); } + void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString strLineName) { diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 14f2695..37f1bd7 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -184,6 +184,9 @@ public: //文字结论 void initWords(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "文字结论", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); + //地质层位 + void initLayer(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "地质分层", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); + //解释结论 void initResult(QMyCustomPlot *widget, QString strSlfName, QString strLineName); bool LoadFromSLF_Result(QMyCustomPlot *widget, QString strSlfName, QString strLineName); @@ -244,10 +247,6 @@ public slots: //气测/FMT/射孔/文本 void s_addJiegutext(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW); - - //地质层位道 - void s_addGeoSection(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW); - //沉积相 void s_addLogface(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW); diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index ddf589f..39687b8 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -170,6 +170,15 @@ QJsonObject FormInfo::makeJson() //item属性写入slf文件,不需要此次记录 return rootObj; } + else if (m_strLineName == "LAYER_DATA") + { + //地质分层 + rootObj["Type"] = m_strType; + rootObj["curveNameFont"] = m_curveNameFont.toString(); + rootObj["lineColor"] = m_lineColor.name(); + //item属性写入slf文件,不需要此次记录 + return rootObj; + } } rootObj["Unit"] = m_strUnit; @@ -421,37 +430,12 @@ void FormInfo::paintEvent(QPaintEvent* event) painter.setPen(m_lineColor); //painter.drawText(rect.left() + 20, 55, m_strUnit); //painter.drawText(rect.left() + 20, 80, QString::number(m_vmin)+" ~ "+QString::number(m_vmax)); - if(m_strType=="curveObject") - { - //曲线 - //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3, Qt::AlignCenter, m_strUnit); - } - //--------------- - if(m_strLineName=="WORDS_RELUST") - { - //文字结论,不绘制左右范围 - //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "文字结论"); - } - else if(m_strLineName=="RESULT") + + if(m_strLineName=="RESULT") { //解释结论,不绘制左右范围 painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "解释结论"); - } - else if(m_strLineName=="GEO_LITH") - { - //录井剖面,不绘制左右范围 - //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "录井剖面"); - } - else if(m_strLineName=="SWALL_CORE") - { - //井壁取心,不绘制左右范围 - //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "井壁取心"); - } - else if(m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT") - { - //固井结论,不绘制左右范围 - //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "固井结论"); - } + } else if(m_strLineName=="CORE_PHYSICS") { //岩心分析,不绘制左右范围 @@ -473,7 +457,8 @@ void FormInfo::paintEvent(QPaintEvent* event) if(m_strType=="tableObject" && (m_strLineName=="WORDS_RELUST" || m_strLineName == "RESULT" || m_strLineName == "GEO_LITH"|| m_strLineName == "SWALL_CORE" || m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT" - || m_strLineName == "CORE_PHYSICS" || m_strLineName == "IMAGE_DATA") ) + || m_strLineName == "CORE_PHYSICS" || m_strLineName == "IMAGE_DATA" + || m_strLineName == "LAYER_DATA") ) { } diff --git a/logPlus/formtrack.cpp b/logPlus/formtrack.cpp index c637357..c26cc73 100644 --- a/logPlus/formtrack.cpp +++ b/logPlus/formtrack.cpp @@ -94,10 +94,6 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName) connect(this, SIGNAL(sig_AddSantuyibiao(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)), this, SLOT(s_addSantuyibiao(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); - //地质层位道 - connect(this, SIGNAL(sig_AddGeoSection(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)), - this, SLOT(s_addGeoSection(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); - //气测/FMT/射孔/文本 connect(this, SIGNAL(sig_AddJiegutext(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)), this, SLOT(s_addJiegutext(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); @@ -256,10 +252,6 @@ void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackNam else if(strType=="SantuyibiaoObject") { emit sig_AddSantuyibiao(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType); - } - else if(strType=="GeoSectionObject") - { - emit sig_AddGeoSection(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType); } else if(strType=="JiegutextObject") { @@ -545,7 +537,8 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString if(strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT" || strLineName == "GEO_LITH" || strLineName == "SWALL_CORE" || strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT" - || strLineName == "CORE_PHYSICS" || strLineName == "IMAGE_DATA") + || strLineName == "CORE_PHYSICS" || strLineName == "IMAGE_DATA" + || strLineName == "LAYER_DATA") { } @@ -578,9 +571,10 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString formInfo->setBackColor(QColor(255,255,255)); if(strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT" || strLineName == "GEO_LITH" || strLineName == "SWALL_CORE" - || strLineName == "WORDS_RELUST" ) + || strLineName == "WORDS_RELUST" + || strLineName == "LAYER_DATA" ) { - //固井结论 / 井壁取心 / 录井剖面 + //固井结论 / 井壁取心 / 录井剖面 /文字结论 /地质分层 if(listOtherProperty.size()>=3) { QFont curveNameFont("微软雅黑", 10); // 名称字体 @@ -603,18 +597,6 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString //ui->tableWidget->setItemDelegateForRow(row, m_delegate); // ui->tableWidget->setCellWidget(row, 0, formInfo); - - - //------------------------------------ -// QFont font("微软雅黑", 10, QFont::Bold, false); -// // -// QTableWidgetItem* item = new QTableWidgetItem(strLineName); -// item->setFlags(item->flags() & (~Qt::ItemIsEditable)); -// item->setForeground(QBrush(lineColor));// 设置字体颜色 -// item->setFont(font); // 应用新的字体 -// item->setTextAlignment(Qt::AlignCenter);//居中 -// // -// ui->tableWidget->setItem(row, 0, item); } void FormTrack::s_addDepth(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType) @@ -883,39 +865,6 @@ void FormTrack::s_addCrack(QString strSlfName, QString strWellName, QString strT ui->tableWidget->setCellWidget(row, 0, formInfo); } -void FormTrack::s_addGeoSection(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType) -{ - qDebug() << "FormTrack s_addGeoSection"; - - ui->tableWidget->m_strUuid = m_strUuid; - int row = ui->tableWidget->rowCount(); - ui->tableWidget->setRowCount(row + 1); - - //避免出现小滚动条 - //ui->tableWidget->resize(g_iOneWidth, 100*(row + 1)+10); - //this->resize(g_iOneWidth, 100*(row + 1)+30); - - //曲线信息栏 - FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor); - formInfo->m_strUuid = m_strUuid; - formInfo->m_strAliasName = strAliasName; - formInfo->m_strUnit = strUnit; - formInfo->m_strScaleType = strScaleType; - formInfo->m_strType = "GeoSectionObject"; - formInfo->m_nJg = 2; - formInfo->setLineWidth(dWidth); - formInfo->setVMax(vmax); - formInfo->setVMin(vmin); - formInfo->setFrontColor(QColor(0,0,0)); - formInfo->setBackColor(QColor(255,255,255)); - //设置高度 - ui->tableWidget->setRowHeight(row, 100); - //单元格委托 - //ui->tableWidget->setItemDelegateForRow(row, m_delegate); - // - ui->tableWidget->setCellWidget(row, 0, formInfo); -} - void FormTrack::s_addJiegutext(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType) { qDebug() << "FormTrack s_addJiegutext"; diff --git a/logPlus/formtrack.h b/logPlus/formtrack.h index 57ae4d2..7df9944 100644 --- a/logPlus/formtrack.h +++ b/logPlus/formtrack.h @@ -91,7 +91,6 @@ signals: void sig_AddDrawImage(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void sig_AddSantuyibiao(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void sig_AddCrack(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); - void sig_AddGeoSection(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void sig_AddJiegutext(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void sig_AddLogface(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void sig_AddMCals(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); @@ -114,7 +113,6 @@ public slots: void s_addDrawImage(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void s_addSantuyibiao(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void s_addCrack(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); - void s_addGeoSection(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void s_addJiegutext(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void s_addLogface(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); void s_addMCals(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType); diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index a7fad6b..4ecf681 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -313,11 +313,6 @@ void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfNa //裂缝 emit CallManage::getInstance()->sig_AddCrack(m_strUuid, strSlfName, strWellName, strTrackName, strLineName); } - else if(strType=="GeoSectionObject") - { - //地质层位道 - emit CallManage::getInstance()->sig_AddGeoSection(m_strUuid, strSlfName, strWellName, strTrackName, strLineName); - } else if(strType=="JiegutextObject") { //气测/FMT/射孔/文本 diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index 47cd56d..710e9d3 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -40,7 +40,6 @@ SOURCES += \ Gradient.cpp \ InDefTableDlg.cpp \ InterfaceWidget.cpp \ - ObjGeostratums.cpp \ ObjTextResult.cpp \ ObjTubingstringResult.cpp \ PickFrac.cpp \ @@ -51,6 +50,7 @@ SOURCES += \ TransparentDraggableGeoLith.cpp \ TransparentDraggableGujing.cpp \ TransparentDraggableJiegutext.cpp \ + TransparentDraggableLayer.cpp \ TransparentDraggableLine.cpp \ TransparentDraggableMFac.cpp \ TransparentDraggablePhase.cpp \ @@ -104,7 +104,6 @@ HEADERS += \ Gradient.h \ InDefTableDlg.h \ InterfaceWidget.h \ - ObjGeostratums.h \ ObjTextResult.h \ ObjTubingstringResult.h \ PickFrac.h \ @@ -115,6 +114,7 @@ HEADERS += \ TransparentDraggableGeoLith.h \ TransparentDraggableGujing.h \ TransparentDraggableJiegutext.h \ + TransparentDraggableLayer.h \ TransparentDraggableLine.h \ TransparentDraggableMFac.h \ TransparentDraggablePhase.h \ diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index a0549e1..8662063 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -3178,12 +3178,19 @@ void MainWindowCurve::s_DrawImage() //地质层位道 void MainWindowCurve::s_NewGeoSection() { - QStringList sret = this->getSelectWell(); + //选中道 + if(m_SelectTableItem.m_iTableType==2) { + //新建表格曲线 + emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "LAYER_DATA"); + return; + } + + QStringList sret = this->getSelectWell_New(); if(sret.length() <= 0) return; //新建井+道+曲线(首条) - NewWellAndTrack(sret.at(0), sret.at(1), "LAYER_DATA", "GeoSectionObject"); + NewWellAndTrack(sret.at(0), sret.at(1), "LAYER_DATA", "tableObject"); } //气测/FMT/射孔/文本 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index a4674c2..83acd54 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -15,6 +15,7 @@ #include "transparentdraggableGuan.h" #include "TransparentDraggableLine.h" #include "transparentdraggableSelectRect.h" +#include "transparentdraggableLayer.h" #include "transparentdraggableRightList.h" #include "qtcommonclass.h" #include "slf.h" @@ -992,6 +993,17 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Text); menu.exec(event->globalPos()); } + else if (m_strLineName == "LAYER_DATA") + { + QMenu menu(this); + //地质分层 + menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑地质分层", this, &QMyCustomPlot::onEditLayer); + menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Layer); + menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems); + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Layer); + menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Layer); + menu.exec(event->globalPos()); + } } //右键--添加分段线 @@ -1188,6 +1200,87 @@ void QMyCustomPlot::onEditText() } } +//右键--添加地质分层 +void QMyCustomPlot::onEditLayer() +{ + this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式 + this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选 + + if(m_bFirstTimeConnect) + { + //信号槽只绑定一次,避免重复绑定 + m_bFirstTimeConnect = false; + + for (int i=0; i < this->graphCount(); ++i) { + QCPGraph *graph = this->graph(i); + graph->setSelectable(QCP::stDataRange); + break; + } + + connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){ + if(this->m_bDrawRect == false) + { + this->m_bDrawRect = true; + return; + } + // 当选择完成时,获取矩形范围并放大 + QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) + m_bEditRect=true;//当前是否正在编辑曲线。 + + // 转换为坐标轴范围 + double top = rect.top(); + double bottom = rect.bottom(); + + double right_Hight = this->xAxis->pixelToCoord(top); + double left_Low = this->xAxis->pixelToCoord(bottom); + + //追加判断,避免框选重叠 + TransparentDraggableRect *pDraggableRect =NULL; + { + QMap::Iterator it = m_mapDraggable_Rect.begin(); + while( it != m_mapDraggable_Rect.end() ) + { + pDraggableRect = (TransparentDraggableRect*)it.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight) + { + return; + } + + if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight) + { + return; + } + + if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight) + { + return; + } + + it++; + } + } + + { + QColor bkColor(255,255,255); + //添加地质分层 + this->addLayerToPlot(left_Low, right_Hight, "", bkColor); + + //保存 + this->SaveToSLF_Layer(); + + //属性清空 + PropertyService()->InitCurrentViewInfo(); + + //取消框选 + this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables); + this->setSelectionRectMode(QCP::srmNone); + } + }); + } +} + //右键--添加固井 void QMyCustomPlot::onEditGujing() { @@ -1860,6 +1953,131 @@ bool QMyCustomPlot::SaveToSLF_Text() return true; } +//地质层位 +bool QMyCustomPlot::SaveToSLF_Layer() +{ + static int isrun=false; + if(isrun) return false; + QString ss=m_strSlfName; + if(ss=="") return false; + isrun=true; + + int count=m_mapDraggable_Layer.size(); + LAYER_DATA m_Result; + CLogIO *logio=new CLogIO(); + if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeWrite)) + { + 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) { + iIndex=logio->OpenTable("LAYER_DATA"); + if(iIndex<0) { + if(!count) { + delete logio; + isrun=false; + return false; + } + iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,35, + "NO,SDEP,EDEP,ZONE,RESULTNO,THICK,TT,MDEPTH1,MDEPTH2,MDEPTH3,MDEPTH4,MDEPTH5,MDEPTH6,MDEPTH7,MDEPTH8,MDEPTH9,MDEPTH10,OIL,POOROIL,OILWATER,WATEROIL,GAS,POORGAS,GASWATER,WATERGAS,DEST1,DEST2,DEST3,DEST4,DEST5,DEST6,DEST7,DEST8,DEST9,DEST10,SDEP1,EDEP1,SDEP2,EDEP2,SDEP3,EDEP3,SDEP4,EDEP4,SDEP5,EDEP5,SDEP6,EDEP6,SDEP7,EDEP7,SDEP8,EDEP8,SDEP9,EDEP9,SDEP10,EDEP10", + "4,4,4,8,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,48,48,48,48,48,48,48,48,48,48,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",//字段长度 + "1,4,4,6,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",//字段类型 + "0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");//字段备注 + isfirst=true; + } + } + + TransparentDraggableLayer *pDraggableRect =NULL; + + //排序 + QList listSDepth; + for (QMap::Iterator iter = m_mapDraggable_Layer.begin(); iter != m_mapDraggable_Layer.end(); iter++) + { + pDraggableRect = (TransparentDraggableLayer*)iter.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + // + float fSDepth = -tmpRange.upper; + listSDepth.append(fSDepth); + } + qSort(listSDepth); + + if (iIndex >=0) + { + int len=logio->GetTableRecordLength(iIndex); + logio->SetTableRecordCount(iIndex,count); + + // + for(int i=0; i::Iterator iter = m_mapDraggable_Layer.begin(); iter != m_mapDraggable_Layer.end(); iter++) + { + pDraggableRect = (TransparentDraggableLayer*)iter.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + float fSDepth = -tmpRange.upper; + if(fSDepth == listSDepth[i])//按顺序写入 + { + memset(&m_Result,0,sizeof(LAYER_DATA)); + m_Result.StartDepth=-tmpRange.upper; + m_Result.EndDepth=-tmpRange.lower; + m_Result.Thick=m_Result.EndDepth-m_Result.StartDepth; + strncpy(m_Result.Zone, pDraggableRect->mstrTitle.toLocal8Bit().data(),sizeof(m_Result.Zone)); + + strcpy(m_Result.Description1,""); + strcpy(m_Result.Description2,""); + strcpy(m_Result.Description3,""); + strcpy(m_Result.Description4,""); + strcpy(m_Result.Description5,""); + strcpy(m_Result.Description6,""); + strcpy(m_Result.Description7,""); + strcpy(m_Result.Description8,""); + strcpy(m_Result.Description9,""); + strcpy(m_Result.Description10,""); + + //m_Result.Result=LithOrder.value(pGeoItem->GetLith()).toInt(); + + m_Result.Sdep1=0; + m_Result.Edep1=0; + m_Result.Sdep2=0; + m_Result.Edep2=0; + m_Result.Sdep3=0; + m_Result.Edep3=0; + m_Result.Sdep4=0; + m_Result.Edep4=0; + m_Result.Sdep5=0; + m_Result.Edep5=0; + m_Result.Sdep6=0; + m_Result.Edep6=0; + m_Result.Sdep7=0; + m_Result.Edep7=0; + m_Result.Sdep8=0; + m_Result.Edep8=0; + m_Result.Sdep9=0; + m_Result.Edep9=0; + m_Result.Sdep10=0; + m_Result.Edep10=0; + m_Result.Order=i+1; + logio->WriteTable(iIndex,i+1,&m_Result); + // if(!FieldName.isEmpty()) + // { + // logio->SetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),(char*)pGeoItem->GetCharacters().toStdString().c_str(),j+1); + // } + } + } + } + logio->CloseTable(iIndex); + } + delete logio; + if(isfirst)AddTableToWellRound(); + isrun=false; + return true; +} + //保存固井结论道 bool QMyCustomPlot::SaveToSLF_Gujing() { @@ -2206,7 +2424,20 @@ void QMyCustomPlot::DeleteItems_SWallCore() CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); AddTableToWellRound(); - RefreshItems_SWallCore(); //刷新数据 + //删除对象 + TransparentDraggableSwallCore *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_SwallCore.begin(); + while( it != m_mapDraggable_SwallCore.end() ) + { + pDraggableRect = (TransparentDraggableSwallCore*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //保存 + SaveToSLF_SwallCore(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); } //全部清空 @@ -2217,7 +2448,20 @@ void QMyCustomPlot::DeleteItems_GeoLith() CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); AddTableToWellRound(); - RefreshItems_GeoLith(); //刷新数据 + //删除对象 + TransparentDraggableGeoLith *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_GeoLith.begin(); + while( it != m_mapDraggable_GeoLith.end() ) + { + pDraggableRect = (TransparentDraggableGeoLith*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //保存 + SaveToSLF_GeoLith(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); } //从剪切板文本数据粘贴 @@ -2888,7 +3132,20 @@ void QMyCustomPlot::DeleteItems_Gujing() CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); AddTableToWellRound(); - RefreshItems_Gujing(); //刷新数据 + //删除对象 + TransparentDraggableGujing *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Gujing.begin(); + while( it != m_mapDraggable_Gujing.end() ) + { + pDraggableRect = (TransparentDraggableGujing*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //保存 + this->SaveToSLF_Gujing(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); } //刷新数据 @@ -3606,6 +3863,23 @@ void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QSt m_mapDraggable_Rect[strUuid] = dragRect; } +void QMyCustomPlot::addLayerToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) +{ + QtCommonClass *qtCommon = new QtCommonClass(this); + QString strUuid = qtCommon->getUUid(); + // 在初始化代码中 + TransparentDraggableLayer *dragRect = new TransparentDraggableLayer(this, strUuid); + dragRect->setTitle(strText); + // 可选:设置颜色 + dragRect->setColor(crColor); // 半透明白色 + // 设置初始范围 + dragRect->setRange(left_Low, right_Hight); + //最小宽度 + dragRect->setMinWidth(0.1); + + m_mapDraggable_Layer[strUuid] = dragRect; +} + TransparentGroupResult* QMyCustomPlot::addResultGroup(double left_Low, double right_Hight, QString &strUuid, QString strText /*= ""*/) { TransparentGroupResult *upGroup = nullptr; @@ -5103,6 +5377,58 @@ void QMyCustomPlot::s_changeGeoLithLine(QString strUuid, QString strSlfName, QSt //不清空属性窗口 } +bool QMyCustomPlot::LoadFromSLF_Layer(QString strSlfName, QString strLineName) +{ + LAYER_DATA m_Result; + if(strSlfName=="") return false; + CLogIO *logio=new CLogIO(); + if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; +// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + return false; + } + + int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); + if (iIndex <0) { + iIndex=logio->OpenTable("LAYER_DATA"); + } + + if (iIndex >=0) + { + int count=logio->GetTableRecordCount(iIndex); + + int ColorNum=6; + if(ColorNum<1) ColorNum=1; + QList rgbList; + rgbList.append(QRgb(4294967295)); + rgbList.append(QRgb(4294966617)); + rgbList.append(QRgb(4294944512)); + rgbList.append(QRgb(4293345792)); + rgbList.append(QRgb(4288741473)); + rgbList.append(QRgb(4278190080)); + + for(int j=0;jReadTable(iIndex,j+1,&m_Result); + float sdep=m_Result.StartDepth; + float edep=m_Result.EndDepth; + // + char buf[490]; + buf[0]=0; + ::GetDescription(m_Result,buf); + + QColor bkColor = rgbList.at(j%ColorNum); + + //地质分层 + this->addLayerToPlot(-edep, -sdep, QString::fromLocal8Bit(buf), bkColor); + } + logio->CloseTable(iIndex); + } + delete logio; + return true; +} + bool QMyCustomPlot::LoadFromSLF_Text(QString strSlfName, QString strLineName) { QString FieldName="RESULT"; @@ -5235,13 +5561,6 @@ void QMyCustomPlot::DeleteItems_Text() CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); AddTableToWellRound(); - //刷新数据 - RefreshItems_Text(); -} - -//刷新数据 -void QMyCustomPlot::RefreshItems_Text() -{ //删除对象 TransparentDraggableRect *pDraggableRect =NULL; QMap::Iterator it = m_mapDraggable_Rect.begin(); @@ -5257,3 +5576,121 @@ void QMyCustomPlot::RefreshItems_Text() //属性清空 PropertyService()->InitCurrentViewInfo(); } + +//刷新数据 +void QMyCustomPlot::RefreshItems_Text() +{ + //删除对象 + TransparentDraggableRect *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Rect.begin(); + while( it != m_mapDraggable_Rect.end() ) + { + pDraggableRect = (TransparentDraggableRect*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //加载 + this->LoadFromSLF_Text(m_strSlfName, m_strLineName); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + +//全部清空 +void QMyCustomPlot::DeleteItems_Layer() +{ + 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(); + + //删除对象 + TransparentDraggableLayer *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Layer.begin(); + while( it != m_mapDraggable_Layer.end() ) + { + pDraggableRect = (TransparentDraggableLayer*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //保存 + this->SaveToSLF_Layer(); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + +//刷新数据 +void QMyCustomPlot::RefreshItems_Layer() +{ + //删除对象 + TransparentDraggableLayer *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Layer.begin(); + while( it != m_mapDraggable_Layer.end() ) + { + pDraggableRect = (TransparentDraggableLayer*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //加载 + this->LoadFromSLF_Layer(m_strSlfName, m_strLineName); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + +//从剪切板文本数据粘贴 +void QMyCustomPlot::addItems_Layer() +{ + 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=0) coredat.removeAll(""); + if(coredat.size()<1) continue; + if(!coredat[0].isEmpty()&&!coredat[0].at(0).isDigit()) continue; + + //地质分层 + AddItem_Layer(coredat); + } + + //保存 + this->SaveToSLF_Layer(); + + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + +void QMyCustomPlot::AddItem_Layer(QStringList lists) +{ + if(lists.size()==3) lists.insert(0,"0"); + double top=-9999.0; + double bottom=-9999.0; + if(lists.size()>1) top=lists[1].toDouble(); + if(lists.size()>2) bottom=lists[2].toDouble(); + if(top&&bottom==0) bottom=top; + if(top==bottom&&top==-9999.0) return; + + if(lists.size()<4) + { + this->addLayerToPlot(-bottom, -top, ""); + return; + } + + //插入文本 + this->addLayerToPlot(-bottom, -top, lists[3]); +} diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index b835256..06cf16c 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -142,6 +142,7 @@ public: QMap m_mapDragGroup; QMap m_mapDraggable_Rect; //文字结论 + QMap m_mapDraggable_Layer; //地质分层 QMap m_mapDraggable_Result; //解释结论 QMap m_mapDraggable_GeoLith; //录井剖面 QMap m_mapDraggable_SwallCore; //井壁取心 @@ -192,33 +193,51 @@ public: bool SaveToSLF_Text(); bool LoadFromSLF_Text(QString strSlfName, QString strLineName); + //地质层位 + bool SaveToSLF_Layer(); + bool LoadFromSLF_Layer(QString strSlfName, QString strLineName); + public slots: void slot_time(); public: void init(QString strName, QVector x, QVector y); + + //岩心照片 void addImageToPlot(double left_Low, double right_Hight, const QString imagePath); + + //曲线 void addRandomGraph(QVector x, QVector 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)); - TransparentGroupResult* addResultGroup(double left_Low, double right_Hight, QString &strUuid, QString strText = ""); + //地质分层 + 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, int &iMaxNum, 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 addPhaseToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80)); void addFacToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80)); + //套管组件 void addGuanToPlot(double left_Low, double right_Hight, const QString imagePath, float in); void addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80)); @@ -321,6 +340,13 @@ public slots: void RefreshItems_Text(); //刷新数据 void AddItem_Text(QStringList lists); + //右键--编辑地质分层 + void onEditLayer(); + void addItems_Layer(); //从剪切板文本数据粘贴 + void DeleteItems_Layer(); //全部清空 + void RefreshItems_Layer(); //刷新数据 + void AddItem_Layer(QStringList lists); + // void addItems_Core();