岩心图片属性
This commit is contained in:
parent
62f62e53d9
commit
9c8725eaed
|
|
@ -1441,11 +1441,21 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
|||
{
|
||||
//岩心图片
|
||||
QMenu menu(this);
|
||||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑岩心图片", this, &QMyCustomPlot::onEditImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItemsImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::deleteItemsImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::refreshItemsImage);
|
||||
if (!m_bEditor)
|
||||
{
|
||||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑岩心图片", this, &QMyCustomPlot::onOpenEditResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "增加", this, &QMyCustomPlot::onEditImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "curve.png"), "关闭编辑岩心图片", this, &QMyCustomPlot::onCloseEditResult);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItemsImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::clearItemsImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "设置深度移动量", this, &QMyCustomPlot::setImageDepth);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "删除选中对象", this, &QMyCustomPlot::deleteItemsImage);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems);
|
||||
menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::refreshItemsImage);
|
||||
}
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (m_strLineName == "CORE_PHYSICS")
|
||||
|
|
@ -1880,6 +1890,7 @@ void QMyCustomPlot::onEditImage()
|
|||
{
|
||||
this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||||
this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
|
||||
this->setCursor(Qt::CrossCursor);
|
||||
|
||||
if(m_bFirstTimeConnect)
|
||||
{
|
||||
|
|
@ -2054,7 +2065,100 @@ void QMyCustomPlot::addItemsImage(){
|
|||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
||||
void QMyCustomPlot::setImageDepth()
|
||||
{
|
||||
// 1. 创建对话框
|
||||
QDialog dlg(nullptr);
|
||||
dlg.setWindowTitle("添加裂缝");
|
||||
dlg.setFixedSize(320, 200); // 窗口大小
|
||||
|
||||
// ====================== 控件创建 ======================
|
||||
// 深度标签 + 输入框
|
||||
QLabel *labDepth = new QLabel("请输入移动的深度量(上移-, 下移+)");
|
||||
QSpinBox *editDepth = new QSpinBox;
|
||||
editDepth->setValue(0); // 默认值
|
||||
editDepth->setFixedWidth(300);
|
||||
editDepth->setMinimum(-1000000); // 允许输入负数
|
||||
|
||||
// 按钮
|
||||
QPushButton *btnOk = new QPushButton("确定");
|
||||
QPushButton *btnCancel = new QPushButton("放弃");
|
||||
|
||||
// ====================== 布局 ======================
|
||||
QVBoxLayout *lay1 = new QVBoxLayout ;
|
||||
lay1->addWidget(labDepth);
|
||||
lay1->addWidget(editDepth);
|
||||
lay1->setSpacing(20);
|
||||
// lay1->setContentsMargins(30, 0, 30, 0);
|
||||
|
||||
QHBoxLayout *layBtn = new QHBoxLayout;
|
||||
layBtn->addStretch();
|
||||
layBtn->addWidget(btnOk);
|
||||
layBtn->addWidget(btnCancel);
|
||||
layBtn->addStretch();
|
||||
// layBtn->setContentsMargins(30, 0, 30, 0);
|
||||
|
||||
QVBoxLayout *mainLay = new QVBoxLayout(&dlg);
|
||||
mainLay->addStretch();
|
||||
mainLay->addLayout(lay1);
|
||||
// mainLay->addSpacing(40);
|
||||
mainLay->addStretch();
|
||||
mainLay->addLayout(layBtn);
|
||||
// mainLay->addSpacing(40);
|
||||
// mainLay->setContentsMargins(20, 20, 20, 20);
|
||||
|
||||
// ====================== 信号绑定 ======================
|
||||
|
||||
connect(btnOk, &QPushButton::clicked, &dlg, [&](){
|
||||
dlg.accept(); // 确认关闭
|
||||
});
|
||||
connect(btnCancel, &QPushButton::clicked, &dlg, &QDialog::reject);
|
||||
|
||||
// ====================== 弹出对话框并获取结果 ======================
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
// 获取用户输入
|
||||
int depth = editDepth->text().toDouble();
|
||||
TransparentDraggableImage *pDraggableRect = (TransparentDraggableImage*)this->m_selectItem;
|
||||
if(pDraggableRect == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QCPRange cpr = pDraggableRect->getRange();
|
||||
cpr.lower = cpr.lower - depth;
|
||||
cpr.upper = cpr.upper - depth;
|
||||
pDraggableRect->setRange(cpr.lower, cpr.upper, true);
|
||||
|
||||
this->SaveToSLFImage();
|
||||
}
|
||||
}
|
||||
|
||||
void QMyCustomPlot::deleteItemsImage()
|
||||
{
|
||||
//删除对象
|
||||
TransparentDraggableImage *pDraggableRect =NULL;
|
||||
QMap<QString,QObject *>::Iterator it = m_mapDraggable_Image.begin();
|
||||
while( it != m_mapDraggable_Image.end() )
|
||||
{
|
||||
pDraggableRect = (TransparentDraggableImage*)it.value();
|
||||
if(this->m_selectItem == pDraggableRect)
|
||||
{
|
||||
pDraggableRect->deleteRect();
|
||||
break;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
this->replot();
|
||||
|
||||
//保存
|
||||
SaveToSLFImage();
|
||||
// m_mapDraggable_Image.clear();
|
||||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
||||
void QMyCustomPlot::clearItemsImage()
|
||||
{
|
||||
if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return;
|
||||
QString obj = m_strLineName + "BAK";
|
||||
|
|
@ -2078,6 +2182,7 @@ void QMyCustomPlot::deleteItemsImage()
|
|||
//属性清空
|
||||
PropertyService()->InitCurrentViewInfo();
|
||||
}
|
||||
|
||||
void QMyCustomPlot::refreshItemsImage()
|
||||
{
|
||||
//删除对象
|
||||
|
|
@ -2200,24 +2305,6 @@ void QMyCustomPlot::addCrackObject()
|
|||
QString showNames = "";
|
||||
|
||||
this->m_cPickFrac->createNewCrack(depth, type);
|
||||
|
||||
// if("高导缝" == type)
|
||||
// {
|
||||
|
||||
// }
|
||||
// else if("网状缝" == type)
|
||||
// {
|
||||
// this->m_cPickFrac->createNewCrack(2, depth, type);
|
||||
// }
|
||||
// else if("孔洞" == type)
|
||||
// {
|
||||
// this->m_cPickFrac->createNewCrack(3, depth, type);
|
||||
// }
|
||||
|
||||
// auto curve = new CPickFrac(this, strUuid, -depth, type, showNames);
|
||||
// m_mapDraggable_CrackObject[strUuid] = curve;
|
||||
|
||||
// ========= 这里就是你要的结果!=========
|
||||
// qDebug() << "深度:" << depth << " 类型:" << type;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,6 +290,7 @@ public:
|
|||
|
||||
QObject* m_SelectShiftLine=nullptr;//当前选中的分段线
|
||||
QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框
|
||||
QObject* m_selectItem = nullptr;
|
||||
|
||||
//固井
|
||||
QMap<QString,QString> zoneOrder_Gujing;
|
||||
|
|
@ -541,7 +542,9 @@ public slots:
|
|||
//右键--编辑岩心照片
|
||||
void onEditImage();
|
||||
void addItemsImage(); //从剪切板文本数据粘贴
|
||||
void deleteItemsImage(); //全部清空
|
||||
void clearItemsImage(); //全部清空
|
||||
void setImageDepth();
|
||||
void deleteItemsImage();
|
||||
void refreshItemsImage(); //刷新数据
|
||||
|
||||
//右键--编辑岩心分析
|
||||
|
|
|
|||
|
|
@ -396,46 +396,46 @@ void TransparentDraggableImage::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;
|
||||
}
|
||||
// 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();
|
||||
double left = getLeft();
|
||||
double width = getWidth();
|
||||
QColor borderColor = this->m_BorderColor; // 边框颜色
|
||||
Qt::PenStyle borderStyle = this->m_BorderStyle; // 边框线型
|
||||
int borderWidth = this->m_BorderWidth; // 边框线宽(像素)
|
||||
PropertyService()->initImageItemProperty(this, low, hight, m_Result, left, width,borderColor,borderStyle,borderWidth);
|
||||
// //event->accept();
|
||||
// // 显示属性
|
||||
// double low = mRect->topLeft->coords().x();
|
||||
// double hight = mRect->bottomRight->coords().x();
|
||||
// double left = getLeft();
|
||||
// double width = getWidth();
|
||||
// QColor borderColor = this->m_BorderColor; // 边框颜色
|
||||
// Qt::PenStyle borderStyle = this->m_BorderStyle; // 边框线型
|
||||
// int borderWidth = this->m_BorderWidth; // 边框线宽(像素)
|
||||
// PropertyService()->initImageItemProperty(this, low, hight, m_Result, left, width,borderColor,borderStyle,borderWidth);
|
||||
|
||||
QMenu menu(nullptr);
|
||||
QAction *delAction = menu.addAction("删除框图");
|
||||
//delAction->installEventFilter(this);
|
||||
connect(delAction, &QAction::triggered, this, &TransparentDraggableImage::onDelRect);
|
||||
// QAction* pItem = menu.exec(event->globalPos());
|
||||
// if(pItem == delAction)
|
||||
// {
|
||||
// //event->accept();
|
||||
// int ii=0;
|
||||
// ii++;
|
||||
// }
|
||||
menu.exec(event->globalPos());
|
||||
// QMenu menu(nullptr);
|
||||
// QAction *delAction = menu.addAction("删除框图");
|
||||
// //delAction->installEventFilter(this);
|
||||
// connect(delAction, &QAction::triggered, this, &TransparentDraggableImage::onDelRect);
|
||||
// // QAction* pItem = menu.exec(event->globalPos());
|
||||
// // if(pItem == delAction)
|
||||
// // {
|
||||
// // //event->accept();
|
||||
// // int ii=0;
|
||||
// // ii++;
|
||||
// // }
|
||||
// menu.exec(event->globalPos());
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -469,6 +469,7 @@ void TransparentDraggableImage::onMousePress(QMouseEvent *event)
|
|||
mDragStartY = y;
|
||||
mDragStartRange = currentRange;
|
||||
|
||||
mPlot->m_selectItem = this;
|
||||
}
|
||||
|
||||
void TransparentDraggableImage::onMouseMove(QMouseEvent *event)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user