追加固井结论绘制
This commit is contained in:
parent
a1f7d40f97
commit
44286c9a12
562
logPlus/TransparentDraggableGujing.cpp
Normal file
562
logPlus/TransparentDraggableGujing.cpp
Normal file
|
|
@ -0,0 +1,562 @@
|
||||||
|
#include "TransparentDraggableGujing.h"
|
||||||
|
|
||||||
|
extern double g_dPixelPerCm;//每厘米像素数
|
||||||
|
//static GeoIndicatorGenerator m_drawGeo;
|
||||||
|
|
||||||
|
TransparentDraggableGujing::TransparentDraggableGujing(QMyCustomPlot *parentPlot, QString strUuid, double minWidth, QString strTitle)
|
||||||
|
: QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth)
|
||||||
|
{
|
||||||
|
m_strUuid = strUuid;
|
||||||
|
//
|
||||||
|
initRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
TransparentDraggableGujing::~TransparentDraggableGujing()
|
||||||
|
{
|
||||||
|
if(mPlot) {
|
||||||
|
// mPlot->removeItem(mRect);
|
||||||
|
// mPlot->removeItem(mLeftHandle);
|
||||||
|
// mPlot->removeItem(mRightHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TransparentDraggableGujing::DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
|
||||||
|
{
|
||||||
|
QString svg=svgFileName;
|
||||||
|
QRectF boundingRect = painter->transform().mapRect(borderRect);
|
||||||
|
painter->save();
|
||||||
|
QTransform transform;
|
||||||
|
transform.reset();
|
||||||
|
if (!IsWellSectonHorizonLayout)
|
||||||
|
{
|
||||||
|
painter->setWorldTransform(transform);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QPixmap tiledmap(svg);
|
||||||
|
QRect border(boundingRect.left(),boundingRect.top(),boundingRect.width(),boundingRect.height());
|
||||||
|
painter->drawPixmap(border,tiledmap);
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
//拉伸
|
||||||
|
void TransparentDraggableGujing::DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
|
||||||
|
{
|
||||||
|
QString svg=svgFileName;
|
||||||
|
QSvgRenderer m_SvgRenderer;
|
||||||
|
m_SvgRenderer.load(svg);
|
||||||
|
m_SvgRenderer.render(painter,borderRect);
|
||||||
|
}
|
||||||
|
//平铺
|
||||||
|
void TransparentDraggableGujing::DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout)
|
||||||
|
{
|
||||||
|
QString svg=svgFileName;
|
||||||
|
QRectF boundingRect = painter->transform().mapRect(borderRect);
|
||||||
|
painter->save();
|
||||||
|
QTransform transform;
|
||||||
|
transform.reset();
|
||||||
|
if (!IsWellSectonHorizonLayout)
|
||||||
|
{
|
||||||
|
painter->setWorldTransform(transform);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QPixmap tiledmap(svg);
|
||||||
|
painter->drawTiledPixmap(boundingRect,tiledmap);
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//设置最小宽度
|
||||||
|
void TransparentDraggableGujing::setMinWidth(double minWidth)
|
||||||
|
{
|
||||||
|
mMinWidth = minWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置标题
|
||||||
|
void TransparentDraggableGujing::setTitle(QString strTitle)
|
||||||
|
{
|
||||||
|
mstrTitle = strTitle;
|
||||||
|
mItemTitle->setText(mstrTitle);
|
||||||
|
mPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置解释结论
|
||||||
|
void TransparentDraggableGujing::setResult(QString filePath)
|
||||||
|
{
|
||||||
|
m_Result = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransparentDraggableGujing::drawResult(double left_Low, double right_Hight, double lY1, double lY2)
|
||||||
|
{
|
||||||
|
if(m_Result=="")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double x1 = mPlot->xAxis->coordToPixel(left_Low);
|
||||||
|
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
|
||||||
|
double y1 = mPlot->yAxis->coordToPixel(lY1);
|
||||||
|
double y2 = mPlot->yAxis->coordToPixel(lY2);
|
||||||
|
|
||||||
|
//
|
||||||
|
QString filePath = m_Result;
|
||||||
|
//
|
||||||
|
QString strLast = filePath.right(4);
|
||||||
|
if(strLast.toLower()==".svg")
|
||||||
|
{
|
||||||
|
QString path,filename;
|
||||||
|
GetWellNameAndPath(filePath, filename, path);
|
||||||
|
QString basename = filename;
|
||||||
|
|
||||||
|
QString val=filePath;
|
||||||
|
QImage image(y2-y1, x1-x2,QImage::Format_RGB32);
|
||||||
|
QPainter painter(&image);
|
||||||
|
QRectF fillRect(0,0, y2-y1, x1-x2);
|
||||||
|
painter.fillRect(fillRect,Qt::white);
|
||||||
|
//拉伸
|
||||||
|
DrawSVGSteched(&painter,filePath,fillRect,0);
|
||||||
|
//平铺
|
||||||
|
//DrawSVGTiled(&painter,filePath,fillRect,0);
|
||||||
|
//正常
|
||||||
|
//DrawSVGNormal(&painter,filePath,fillRect,0);
|
||||||
|
|
||||||
|
val=GetImagePath()+"TempNew";
|
||||||
|
QDir ss;
|
||||||
|
if(!ss.exists(val)) {
|
||||||
|
ss.mkdir(val);
|
||||||
|
}
|
||||||
|
val+=QDir::separator();
|
||||||
|
val+=basename+".png";
|
||||||
|
image.save(val);
|
||||||
|
|
||||||
|
//
|
||||||
|
mPixmap->setPixmap(QPixmap(val)); // 设置图片
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//mPixmap->setPixmap(QPixmap(filePath)); // 设置图片
|
||||||
|
|
||||||
|
QString path,filename;
|
||||||
|
GetWellNameAndPath(filePath, filename, path);
|
||||||
|
QString basename = filename;
|
||||||
|
|
||||||
|
QString val=filePath;
|
||||||
|
QImage image(y2-y1, x1-x2,QImage::Format_RGB32);
|
||||||
|
QPainter painter(&image);
|
||||||
|
QRectF fillRect(0,0, y2-y1, x1-x2);
|
||||||
|
painter.fillRect(fillRect,Qt::white);
|
||||||
|
//平铺
|
||||||
|
DrawSVGTiled(&painter,filePath,fillRect,0);
|
||||||
|
|
||||||
|
val=GetImagePath()+"TempNew";
|
||||||
|
QDir ss;
|
||||||
|
if(!ss.exists(val)) {
|
||||||
|
ss.mkdir(val);
|
||||||
|
}
|
||||||
|
val+=QDir::separator();
|
||||||
|
val+=basename+".png";
|
||||||
|
image.save(val);
|
||||||
|
|
||||||
|
//
|
||||||
|
mPixmap->setPixmap(QPixmap(val)); // 设置图片
|
||||||
|
}
|
||||||
|
|
||||||
|
mPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置矩形范围
|
||||||
|
void TransparentDraggableGujing::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);
|
||||||
|
drawResult(left_Low, right_Hight, lY1, lY2);
|
||||||
|
|
||||||
|
//mItemTitle->position->setCoords(0.5, 0.5);
|
||||||
|
// 设置父锚点,定位点
|
||||||
|
//mItemTitle->position->setParentAnchor(mRect->bottom);
|
||||||
|
mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
|
||||||
|
(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 TransparentDraggableGujing::getRange()
|
||||||
|
{
|
||||||
|
return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置矩形颜色
|
||||||
|
void TransparentDraggableGujing::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
mRect->setBrush(QBrush(color));
|
||||||
|
mRect->setPen(QPen(color.darker()));
|
||||||
|
mPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除框图
|
||||||
|
void TransparentDraggableGujing::deleteRect()
|
||||||
|
{
|
||||||
|
if(mPlot) {
|
||||||
|
|
||||||
|
// mRect->deleteLater();
|
||||||
|
// mLeftHandle->deleteLater();
|
||||||
|
// mRightHandle->deleteLater();
|
||||||
|
// mPixmap->deleteLater();
|
||||||
|
|
||||||
|
mPlot->m_mapDraggable_Gujing.remove(m_strUuid);
|
||||||
|
|
||||||
|
mPlot->removeItem(mRect);
|
||||||
|
mPlot->removeItem(mLeftHandle);
|
||||||
|
mPlot->removeItem(mRightHandle);
|
||||||
|
mPlot->removeItem(mPixmap);
|
||||||
|
mPlot->removeItem(mItemTitle);
|
||||||
|
|
||||||
|
mPlot->replot();
|
||||||
|
this->deleteLater();
|
||||||
|
|
||||||
|
//
|
||||||
|
// //避免二次绘制框图
|
||||||
|
// mPlot->m_bDrawRect = false;
|
||||||
|
// mDragMode = DragNone;
|
||||||
|
// //取消选中框
|
||||||
|
// mPlot->selectionRect()->cancel();
|
||||||
|
// mPlot->replot();
|
||||||
|
// mPlot->selectionRect()->mActive=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TransparentDraggableGujing::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, &TransparentDraggableGujing::onMousePress);
|
||||||
|
connect(mPlot, &QCustomPlot::mouseMove, this, &TransparentDraggableGujing::onMouseMove);
|
||||||
|
connect(mPlot, &QCustomPlot::mouseRelease, this, &TransparentDraggableGujing::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 TransparentDraggableGujing::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 TransparentDraggableGujing::onDelRect()
|
||||||
|
{
|
||||||
|
//mDragMode = DragNone;
|
||||||
|
//删除框图
|
||||||
|
deleteRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TransparentDraggableGujing::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();
|
||||||
|
|
||||||
|
QMenu menu(nullptr);
|
||||||
|
QAction *delAction = menu.addAction("删除框图");
|
||||||
|
//delAction->installEventFilter(this);
|
||||||
|
connect(delAction, &QAction::triggered, this, &TransparentDraggableGujing::onDelRect);
|
||||||
|
|
||||||
|
// QAction* pItem = menu.exec(event->globalPos());
|
||||||
|
// if(pItem == delAction)
|
||||||
|
// {
|
||||||
|
// //event->accept();
|
||||||
|
|
||||||
|
// int ii=0;
|
||||||
|
// ii++;
|
||||||
|
// }
|
||||||
|
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 TransparentDraggableGujing::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 TransparentDraggableGujing::onMouseRelease(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if(event->button() == Qt::LeftButton && mDragMode != DragNone) {
|
||||||
|
event->accept();
|
||||||
|
//避免二次绘制框图
|
||||||
|
mPlot->m_bDrawRect = false;
|
||||||
|
//emit rangeChanged(getRange());
|
||||||
|
mDragMode = DragNone;
|
||||||
|
//取消选中状态
|
||||||
|
// QCPDataSelection emptySelection;
|
||||||
|
// mPlot->graph(0)->setSelection(emptySelection);
|
||||||
|
// mPlot->replot();
|
||||||
|
|
||||||
|
//取消选中框
|
||||||
|
mPlot->selectionRect()->cancel();
|
||||||
|
mPlot->replot();
|
||||||
|
mPlot->selectionRect()->mActive=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double TransparentDraggableGujing::getMyLower()
|
||||||
|
{
|
||||||
|
double dLower = mPlot->xAxis->range().lower;
|
||||||
|
double proposedLeft = mDragStartRange.lower;
|
||||||
|
|
||||||
|
TransparentDraggableGujing *pDraggableRect =NULL;
|
||||||
|
{
|
||||||
|
QMap<QString,QObject *>::Iterator it = mPlot->m_mapDraggable_Gujing.begin();
|
||||||
|
while( it != mPlot->m_mapDraggable_Gujing.end() )
|
||||||
|
{
|
||||||
|
if(it.key() == m_strUuid)
|
||||||
|
{
|
||||||
|
it++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
if(tmpRange.upper >= dLower && tmpRange.upper <= proposedLeft)
|
||||||
|
{
|
||||||
|
dLower = tmpRange.upper;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dLower;
|
||||||
|
}
|
||||||
|
|
||||||
|
double TransparentDraggableGujing::getMyUpper()
|
||||||
|
{
|
||||||
|
double dUpper = mPlot->xAxis->range().upper;
|
||||||
|
double proposedRight = mDragStartRange.upper;
|
||||||
|
|
||||||
|
TransparentDraggableGujing *pDraggableRect =NULL;
|
||||||
|
{
|
||||||
|
QMap<QString,QObject *>::Iterator it = mPlot->m_mapDraggable_Gujing.begin();
|
||||||
|
while( it != mPlot->m_mapDraggable_Gujing.end() )
|
||||||
|
{
|
||||||
|
if(it.key() == m_strUuid)
|
||||||
|
{
|
||||||
|
it++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pDraggableRect = (TransparentDraggableGujing*)it.value();
|
||||||
|
//
|
||||||
|
QCPRange tmpRange = pDraggableRect->getRange();
|
||||||
|
if(tmpRange.lower <= dUpper && tmpRange.lower >= proposedRight)
|
||||||
|
{
|
||||||
|
dUpper = tmpRange.lower;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dUpper;
|
||||||
|
}
|
||||||
|
|
||||||
85
logPlus/TransparentDraggableGujing.h
Normal file
85
logPlus/TransparentDraggableGujing.h
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
#ifndef TRANSPARENTDRAGGABLEGUJING_H
|
||||||
|
#define TRANSPARENTDRAGGABLEGUJING_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "qmycustomplot.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <QMenu>
|
||||||
|
#include "geometryutils.h"
|
||||||
|
#include <QSvgRenderer>
|
||||||
|
|
||||||
|
#pragma execution_character_set("utf-8") // 强制指定执行字符集为 UTF-8
|
||||||
|
|
||||||
|
class TransparentDraggableGujing : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit TransparentDraggableGujing(QMyCustomPlot *parentPlot, QString strUuid="", double minWidth = 1.0, QString strTitle = "");
|
||||||
|
|
||||||
|
|
||||||
|
~TransparentDraggableGujing();
|
||||||
|
|
||||||
|
|
||||||
|
void DrawSVGNormal(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
|
||||||
|
//拉伸
|
||||||
|
void DrawSVGSteched(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
|
||||||
|
//平铺
|
||||||
|
void DrawSVGTiled(QPainter* painter,QString svgFileName,QRectF borderRect,bool IsWellSectonHorizonLayout);
|
||||||
|
//设置最小宽度
|
||||||
|
void setMinWidth(double minWidth);
|
||||||
|
//设置标题
|
||||||
|
void setTitle(QString strTitle);
|
||||||
|
|
||||||
|
//设置解释结论
|
||||||
|
void setResult(QString filePath);
|
||||||
|
void drawResult(double left_Low, double right_Hight, double lY1, double lY2);
|
||||||
|
|
||||||
|
// 设置矩形范围
|
||||||
|
void setRange(double left_Low, double right_Hight);
|
||||||
|
// 获取当前范围
|
||||||
|
QCPRange getRange();
|
||||||
|
|
||||||
|
// 设置矩形颜色
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
|
// 删除框图
|
||||||
|
void deleteRect();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void rangeChanged(QCPRange newRange);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initRect();
|
||||||
|
void updateHandles() ;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onDelRect();
|
||||||
|
void onMousePress(QMouseEvent *event);
|
||||||
|
void onMouseMove(QMouseEvent *event);
|
||||||
|
void onMouseRelease(QMouseEvent *event);
|
||||||
|
double getMyLower();
|
||||||
|
double getMyUpper();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMyCustomPlot *mPlot;
|
||||||
|
QCPItemRect *mRect;
|
||||||
|
QCPItemRect *mLeftHandle;
|
||||||
|
QCPItemRect *mRightHandle;
|
||||||
|
|
||||||
|
QCPItemPixmap *mPixmap;
|
||||||
|
QCPItemText *mItemTitle;
|
||||||
|
QString mstrTitle="";
|
||||||
|
QString m_strUuid = "";
|
||||||
|
QString m_Result;
|
||||||
|
|
||||||
|
enum DragMode { DragNone, DragLeft, DragRight, DragRect };
|
||||||
|
DragMode mDragMode = DragNone;
|
||||||
|
//double mDragStartX = 0;
|
||||||
|
double mDragStartY = 0;
|
||||||
|
QCPRange mDragStartRange;
|
||||||
|
|
||||||
|
// 添加最小宽度成员变量
|
||||||
|
double mMinWidth;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TRANSPARENTDRAGGABLEGUJING_H
|
||||||
|
|
@ -78,7 +78,7 @@ void TransparentDraggableSwallCore::setTitle(QString strTitle)
|
||||||
{
|
{
|
||||||
mstrTitle = strTitle;
|
mstrTitle = strTitle;
|
||||||
mItemTitle->setText(mstrTitle);
|
mItemTitle->setText(mstrTitle);
|
||||||
mPlot->replot();
|
//mPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置解释结论
|
//设置解释结论
|
||||||
|
|
@ -330,9 +330,9 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight
|
||||||
mRect->topLeft->setCoords(left_Low, lY1);
|
mRect->topLeft->setCoords(left_Low, lY1);
|
||||||
mRect->bottomRight->setCoords(right_Hight, lY1+(lY2-lY1)/3);
|
mRect->bottomRight->setCoords(right_Hight, lY1+(lY2-lY1)/3);
|
||||||
|
|
||||||
//位置与rect不一样,否则图像反转
|
// //位置与rect不一样,否则图像反转
|
||||||
mPixmap_Color->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4);
|
// mPixmap_Color->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4);
|
||||||
mPixmap_Color->bottomRight->setCoords(left_Low, lY2);
|
// mPixmap_Color->bottomRight->setCoords(left_Low, lY2);
|
||||||
//
|
//
|
||||||
//mPixmap_Lith->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4);
|
//mPixmap_Lith->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4);
|
||||||
//mPixmap_Lith->bottomRight->setCoords(left_Low, lY2);
|
//mPixmap_Lith->bottomRight->setCoords(left_Low, lY2);
|
||||||
|
|
@ -346,8 +346,8 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight
|
||||||
//mItemTitle->position->setCoords(0.5, 0.5);
|
//mItemTitle->position->setCoords(0.5, 0.5);
|
||||||
// 设置父锚点,定位点
|
// 设置父锚点,定位点
|
||||||
//mItemTitle->position->setParentAnchor(mRect->bottom);
|
//mItemTitle->position->setParentAnchor(mRect->bottom);
|
||||||
mItemTitle->position->setCoords((mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
|
mItemTitle->position->setCoords(mRect->bottomRight->coords().x(), //(mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
|
||||||
(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置
|
lY1+(lY2-lY1)/4); //(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置
|
||||||
|
|
||||||
//mRect->topLeft->setCoords(left, mPlot->yAxis->range().upper);
|
//mRect->topLeft->setCoords(left, mPlot->yAxis->range().upper);
|
||||||
//mRect->bottomRight->setCoords(right, mPlot->yAxis->range().lower);
|
//mRect->bottomRight->setCoords(right, mPlot->yAxis->range().lower);
|
||||||
|
|
@ -387,7 +387,7 @@ void TransparentDraggableSwallCore::deleteRect()
|
||||||
// mPlot->removeItem(mRightHandle);
|
// mPlot->removeItem(mRightHandle);
|
||||||
mPlot->removeItem(mPixmap_Lith);
|
mPlot->removeItem(mPixmap_Lith);
|
||||||
mPlot->removeItem(mPixmap_Oil);
|
mPlot->removeItem(mPixmap_Oil);
|
||||||
mPlot->removeItem(mPixmap_Color);
|
//mPlot->removeItem(mPixmap_Color);
|
||||||
mPlot->removeItem(mItemTitle);
|
mPlot->removeItem(mItemTitle);
|
||||||
|
|
||||||
mPlot->replot();
|
mPlot->replot();
|
||||||
|
|
@ -443,10 +443,10 @@ void TransparentDraggableSwallCore::initRect()
|
||||||
mPixmap_Oil->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 KeepAspectRatio
|
mPixmap_Oil->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 KeepAspectRatio
|
||||||
mPixmap_Oil->setLayer("overlay"); // 确保在最上层
|
mPixmap_Oil->setLayer("overlay"); // 确保在最上层
|
||||||
|
|
||||||
mPixmap_Color = new QCPItemPixmap(mPlot);
|
// mPixmap_Color = new QCPItemPixmap(mPlot);
|
||||||
//mPixmap_Color->setPixmap(QPixmap(":/image/file.png")); // 设置图片
|
// //mPixmap_Color->setPixmap(QPixmap(":/image/file.png")); // 设置图片
|
||||||
mPixmap_Color->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 KeepAspectRatio
|
// mPixmap_Color->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 KeepAspectRatio
|
||||||
mPixmap_Color->setLayer("overlay"); // 确保在最上层
|
// mPixmap_Color->setLayer("overlay"); // 确保在最上层
|
||||||
|
|
||||||
mItemTitle = new QCPItemText(mPlot);
|
mItemTitle = new QCPItemText(mPlot);
|
||||||
mItemTitle->setText(mstrTitle);
|
mItemTitle->setText(mstrTitle);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ private:
|
||||||
|
|
||||||
QCPItemPixmap *mPixmap_Lith;
|
QCPItemPixmap *mPixmap_Lith;
|
||||||
QCPItemPixmap *mPixmap_Oil;
|
QCPItemPixmap *mPixmap_Oil;
|
||||||
QCPItemPixmap *mPixmap_Color;
|
//QCPItemPixmap *mPixmap_Color;
|
||||||
QCPItemText *mItemTitle;
|
QCPItemText *mItemTitle;
|
||||||
QString mstrTitle="";
|
QString mstrTitle="";
|
||||||
QString m_strUuid = "";
|
QString m_strUuid = "";
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,8 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
|
||||||
void FormDraw::s_addTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
void FormDraw::s_addTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||||||
{
|
{
|
||||||
if(strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT"
|
if(strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT"
|
||||||
|| strLineName == "GEO_LITH" || strLineName == "SWALL_CORE")
|
|| strLineName == "GEO_LITH" || strLineName == "SWALL_CORE"
|
||||||
|
|| strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT")
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -372,6 +373,11 @@ void FormDraw::s_addTableLine(QString strUuid, QString strSlfName, QString strWe
|
||||||
//井壁取心
|
//井壁取心
|
||||||
initSwallCore(curv, strSlfName, strLineName);
|
initSwallCore(curv, strSlfName, strLineName);
|
||||||
}
|
}
|
||||||
|
else if(strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT")
|
||||||
|
{
|
||||||
|
//固井结论
|
||||||
|
initGujing(curv, strSlfName, strLineName);
|
||||||
|
}
|
||||||
|
|
||||||
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||||
|
|
||||||
|
|
@ -2543,7 +2549,6 @@ bool FormDraw::LoadFromSLF_SwallCore(QMyCustomPlot *widget, QString strSlfName,
|
||||||
if(Sideleft<0) Sideleft=0;
|
if(Sideleft<0) Sideleft=0;
|
||||||
if(width<=0) width=1;
|
if(width<=0) width=1;
|
||||||
|
|
||||||
//
|
|
||||||
//
|
//
|
||||||
widget->addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, ind);
|
widget->addSwallCoreToPlot(-m_Result.Depth, LithologyImage, OilGasImage, ColorImage, Sideleft, width, ind);
|
||||||
}
|
}
|
||||||
|
|
@ -2553,6 +2558,132 @@ bool FormDraw::LoadFromSLF_SwallCore(QMyCustomPlot *widget, QString strSlfName,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//固井结论
|
||||||
|
void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
||||||
|
{
|
||||||
|
int iMyWidth = widget->axisRect(0)->width();
|
||||||
|
float vmax = iMyWidth;
|
||||||
|
float vmin = 0;
|
||||||
|
widget->m_iX1 = vmin;
|
||||||
|
widget->m_iX2 = iMyWidth;
|
||||||
|
widget->m_iY1 = g_iY1;
|
||||||
|
widget->m_iY2 = g_iY2;
|
||||||
|
//
|
||||||
|
widget->xAxis->setRange(vmin, vmax);
|
||||||
|
widget->yAxis->setRange(g_iY1, g_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);
|
||||||
|
//
|
||||||
|
LoadFromSLF_Gujing(widget, strSlfName, strLineName);
|
||||||
|
|
||||||
|
QString strAliasName = "";
|
||||||
|
QString strUnit = "";
|
||||||
|
QColor newlineColor=QColor(0,0,0);
|
||||||
|
double width=2;
|
||||||
|
QString strScaleType = "";
|
||||||
|
//道-对象
|
||||||
|
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FormDraw::LoadFromSLF_Gujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
||||||
|
{
|
||||||
|
CMemRdWt *logio=new CMemRdWt();
|
||||||
|
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||||||
|
{
|
||||||
|
delete logio;
|
||||||
|
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString configfile=GetConfPath()+GetOilFieldName()+"GujingOrder.ini";
|
||||||
|
QStringList lines;
|
||||||
|
QFile file( configfile );
|
||||||
|
if ( file.open( QIODevice::ReadOnly ) ) {
|
||||||
|
QTextStream stream( &file );
|
||||||
|
stream.setCodec("UTF-8"); // 设置UTF-8编码
|
||||||
|
QString line;
|
||||||
|
int n = 1;
|
||||||
|
while ( !stream.atEnd() ) {
|
||||||
|
line = stream.readLine(); // 不包括“\n”的一行文本
|
||||||
|
lines += line;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString,QString> zoneOrder;
|
||||||
|
for(int i=0;i<lines.size();i++){
|
||||||
|
zoneOrder.insert(lines[i],QString::number(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
|
||||||
|
if(iIndex>-1) {
|
||||||
|
int len=logio->GetTableRecordLength(iIndex);
|
||||||
|
int sl=sizeof(GUJING_DATA);
|
||||||
|
if(sl>len) len=sl;
|
||||||
|
GUJING_DATA *m_Result;
|
||||||
|
m_Result=(GUJING_DATA *)new char[len+1];
|
||||||
|
int count=logio->GetTableRecordCount(iIndex);
|
||||||
|
for(int i=0;i<count;i++) {
|
||||||
|
memset(m_Result,0,len);
|
||||||
|
logio->ReadTable(iIndex,i+1,m_Result);
|
||||||
|
|
||||||
|
int NO = m_Result->NO;
|
||||||
|
float SDEP = m_Result->SDEP;
|
||||||
|
float EDEP = m_Result->EDEP;
|
||||||
|
int RESULT = m_Result->RESULT;
|
||||||
|
QString result = "";
|
||||||
|
|
||||||
|
//
|
||||||
|
QString iconshotname=zoneOrder.key(QString::number(m_Result->RESULT));
|
||||||
|
if(iconshotname!="")
|
||||||
|
result=::GetGujingSymbolDir()+iconshotname+".svg";
|
||||||
|
int len=2;
|
||||||
|
int pos=result.indexOf(".//");
|
||||||
|
if(pos<0) pos=result.indexOf("./");
|
||||||
|
else len=3;
|
||||||
|
QString svg;
|
||||||
|
if(pos==0)
|
||||||
|
{
|
||||||
|
svg=QCoreApplication::applicationDirPath()+ QDir::separator();
|
||||||
|
svg+=result.mid(len-1);
|
||||||
|
}
|
||||||
|
else svg=result;
|
||||||
|
QDir ss;
|
||||||
|
if(!ss.exists(svg))
|
||||||
|
{
|
||||||
|
QString path=svg.left(svg.lastIndexOf('.')+1);
|
||||||
|
svg=path+"png";
|
||||||
|
}
|
||||||
|
result=QDir::toNativeSeparators(svg);
|
||||||
|
|
||||||
|
//显示固井
|
||||||
|
widget->addGujingToPlot(-EDEP, -SDEP, result);
|
||||||
|
}
|
||||||
|
logio->CloseTable(iIndex);
|
||||||
|
delete m_Result;
|
||||||
|
}
|
||||||
|
delete logio;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void FormDraw::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio)
|
void FormDraw::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio)
|
||||||
{
|
{
|
||||||
float scale ;
|
float scale ;
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,11 @@ 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);
|
bool LoadFromSLF_SwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
||||||
|
|
||||||
|
//固井结论
|
||||||
|
void initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
||||||
|
bool LoadFromSLF_Gujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,8 @@ void FormInfo::paintEvent(QPaintEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_strType=="tableObject" && (m_strLineName=="WORDS_RELUST" || m_strLineName == "RESULT"
|
if(m_strType=="tableObject" && (m_strLineName=="WORDS_RELUST" || m_strLineName == "RESULT"
|
||||||
|| m_strLineName == "GEO_LITH"|| m_strLineName == "SWALL_CORE") )
|
|| m_strLineName == "GEO_LITH"|| m_strLineName == "SWALL_CORE"
|
||||||
|
|| m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT") )
|
||||||
{
|
{
|
||||||
//文字结论,不绘制左右范围
|
//文字结论,不绘制左右范围
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,8 @@ void FormTrack::s_addWave(QString strSlfName, QString strWellName, QString strTr
|
||||||
void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
|
void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
|
||||||
{
|
{
|
||||||
if(strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT"
|
if(strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT"
|
||||||
|| strLineName == "GEO_LITH" || strLineName == "SWALL_CORE")
|
|| strLineName == "GEO_LITH" || strLineName == "SWALL_CORE"
|
||||||
|
|| strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT")
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ SOURCES += \
|
||||||
QCPSizeHandle.cpp \
|
QCPSizeHandle.cpp \
|
||||||
QCPSizeHandleManager.cpp \
|
QCPSizeHandleManager.cpp \
|
||||||
TransparentDraggableGeoLith.cpp \
|
TransparentDraggableGeoLith.cpp \
|
||||||
|
TransparentDraggableGujing.cpp \
|
||||||
TransparentDraggableRect.cpp \
|
TransparentDraggableRect.cpp \
|
||||||
TransparentDraggableResult.cpp \
|
TransparentDraggableResult.cpp \
|
||||||
TransparentDraggableSwallCore.cpp \
|
TransparentDraggableSwallCore.cpp \
|
||||||
|
|
@ -77,6 +78,7 @@ HEADERS += \
|
||||||
QCPSizeHandle.h \
|
QCPSizeHandle.h \
|
||||||
QCPSizeHandleManager.h \
|
QCPSizeHandleManager.h \
|
||||||
TransparentDraggableGeoLith.h \
|
TransparentDraggableGeoLith.h \
|
||||||
|
TransparentDraggableGujing.h \
|
||||||
TransparentDraggableRect.h \
|
TransparentDraggableRect.h \
|
||||||
TransparentDraggableResult.h \
|
TransparentDraggableResult.h \
|
||||||
TransparentDraggableSwallCore.h \
|
TransparentDraggableSwallCore.h \
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "TransparentDraggableResult.h"
|
#include "TransparentDraggableResult.h"
|
||||||
#include "TransparentDraggableGeoLith.h"
|
#include "TransparentDraggableGeoLith.h"
|
||||||
#include "TransparentDraggableSwallCore.h"
|
#include "TransparentDraggableSwallCore.h"
|
||||||
|
#include "TransparentDraggableGujing.h"
|
||||||
#include "qtcommonclass.h"
|
#include "qtcommonclass.h"
|
||||||
|
|
||||||
//是否隐藏刻度
|
//是否隐藏刻度
|
||||||
|
|
@ -305,6 +306,7 @@ 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));
|
||||||
|
|
||||||
// 设置初始范围
|
// 设置初始范围
|
||||||
double h = 40;
|
double h = 40;
|
||||||
|
|
@ -349,6 +351,26 @@ void QMyCustomPlot::addGeoLithToPlot(double left_Low, double right_Hight, const
|
||||||
this->replot();
|
this->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMyCustomPlot::addGujingToPlot(double left_Low, double right_Hight, const QString strResult)
|
||||||
|
{
|
||||||
|
QtCommonClass *qtCommon = new QtCommonClass(this);
|
||||||
|
QString strUuid = qtCommon->getUUid();
|
||||||
|
|
||||||
|
// 在初始化代码中
|
||||||
|
TransparentDraggableGujing *dragRect = new TransparentDraggableGujing(this, strUuid);
|
||||||
|
//图片,提前设值,后面setRange改变
|
||||||
|
dragRect->setResult(strResult);
|
||||||
|
// 设置初始范围
|
||||||
|
dragRect->setRange(left_Low, right_Hight);
|
||||||
|
// 可选:设置颜色
|
||||||
|
dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色
|
||||||
|
//最小宽度
|
||||||
|
dragRect->setMinWidth(0.1);
|
||||||
|
//dragRect->setTitle(strText);
|
||||||
|
|
||||||
|
m_mapDraggable_Gujing[strUuid] = dragRect;
|
||||||
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::onResetZoom()
|
void QMyCustomPlot::onResetZoom()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ public:
|
||||||
QMap<QString, QObject*> m_mapDraggable_Result;
|
QMap<QString, QObject*> m_mapDraggable_Result;
|
||||||
QMap<QString, QObject*> m_mapDraggable_GeoLith;
|
QMap<QString, QObject*> m_mapDraggable_GeoLith;
|
||||||
QMap<QString, QObject*> m_mapDraggable_SwallCore;
|
QMap<QString, QObject*> m_mapDraggable_SwallCore;
|
||||||
|
QMap<QString, QObject*> m_mapDraggable_Gujing;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slot_time();
|
void slot_time();
|
||||||
|
|
@ -81,6 +82,8 @@ public:
|
||||||
|
|
||||||
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 ind);
|
||||||
|
|
||||||
|
void addGujingToPlot(double left_Low, double right_Hight, const QString strResult);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void s_LineClicked(int index);
|
void s_LineClicked(int index);
|
||||||
void onResetZoom();
|
void onResetZoom();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user