支持将表格数据FRAC_HOLE.TABLE转为蝌蚪图
This commit is contained in:
parent
336e873ab3
commit
aab7958cf9
|
|
@ -53,6 +53,11 @@ signals:
|
|||
//删除波列
|
||||
void sig_delWave(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//新建表格曲线
|
||||
void sig_AddTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
//删除表格曲线
|
||||
void sig_delTableLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//属性
|
||||
//左刻度
|
||||
void sig_ChangeLeftScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale);
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
DESTDIR = ../Bin
|
||||
DESTDIR = ../../Bin
|
||||
TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀
|
||||
} else {
|
||||
DESTDIR = ../Bin
|
||||
DESTDIR = ../../Bin
|
||||
TARGET = $$join(TARGET,,,)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29459,6 +29459,20 @@ void QCPItemLine::draw(QCPPainter *painter)
|
|||
{
|
||||
QCPVector2D startVec(start->pixelPosition());
|
||||
QCPVector2D endVec(end->pixelPosition());
|
||||
//jyl
|
||||
if(m_bCustom)
|
||||
{
|
||||
float x1 = startVec.x() + m_nRadius*sin(m_dr);
|
||||
float y1 = startVec.y() - m_nRadius*cos(m_dr);
|
||||
startVec.setX(x1);
|
||||
startVec.setY(y1);
|
||||
//
|
||||
float x2 = startVec.x() + m_nTailLen*sin(m_dr);
|
||||
float y2 = startVec.y() - m_nTailLen*cos(m_dr);
|
||||
endVec.setX(x2);
|
||||
endVec.setY(y2);
|
||||
}
|
||||
|
||||
if (qFuzzyIsNull((startVec - endVec).lengthSquared())) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -30406,6 +30420,14 @@ void QCPItemEllipse::draw(QCPPainter *painter)
|
|||
{
|
||||
QPointF p1 = topLeft->pixelPosition();
|
||||
QPointF p2 = bottomRight->pixelPosition();
|
||||
//jyl
|
||||
if(m_bCustom)
|
||||
{
|
||||
QPointF p1_tmp = QPointF(p1.rx()-m_nRadius, p1.ry()-m_nRadius);
|
||||
p2 = QPointF(p1.rx()+m_nRadius, p1.ry()+m_nRadius);
|
||||
p1 = p1_tmp;
|
||||
}
|
||||
|
||||
if (p1.toPoint() == p2.toPoint()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3722,10 +3722,10 @@ void QCPDataContainer<DataType>::preallocateGrow(int minimumPreallocSize)
|
|||
}
|
||||
|
||||
int newPreallocSize = minimumPreallocSize;
|
||||
//jyl
|
||||
//jyl
|
||||
//newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
|
||||
newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 23)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
|
||||
++mPreallocIteration;
|
||||
++mPreallocIteration;
|
||||
|
||||
int sizeDifference = newPreallocSize - mPreallocSize;
|
||||
mData.resize(mData.size() + sizeDifference);
|
||||
|
|
@ -3755,6 +3755,8 @@ void QCPDataContainer<DataType>::performAutoSqueeze()
|
|||
const int usedSize = size();
|
||||
bool shrinkPostAllocation = false;
|
||||
bool shrinkPreAllocation = false;
|
||||
//jyl
|
||||
//if (totalAlloc > 650000) { // if allocation is larger, shrink earlier with respect to total used size
|
||||
if (totalAlloc > 650000) { // if allocation is larger, shrink earlier with respect to total used size
|
||||
shrinkPostAllocation = postAllocSize > usedSize * 1.5; // QVector grow strategy is 2^n for static data. Watch out not to oscillate!
|
||||
shrinkPreAllocation = mPreallocSize * 10 > usedSize;
|
||||
|
|
@ -7229,11 +7231,17 @@ public:
|
|||
QCPItemPosition *const start;
|
||||
QCPItemPosition *const end;
|
||||
|
||||
protected:
|
||||
public:
|
||||
// property members:
|
||||
QPen mPen, mSelectedPen;
|
||||
QCPLineEnding mHead, mTail;
|
||||
|
||||
//jyl
|
||||
bool m_bCustom = false;
|
||||
float m_nTailLen; // 尾长
|
||||
float m_dr; // 方位
|
||||
float m_nRadius; // 半径
|
||||
|
||||
// reimplemented virtual methods:
|
||||
virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
|
||||
|
||||
|
|
@ -7541,13 +7549,17 @@ public:
|
|||
QCPItemAnchor *const left;
|
||||
QCPItemAnchor *const center;
|
||||
|
||||
protected:
|
||||
public:
|
||||
enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
|
||||
|
||||
// property members:
|
||||
QPen mPen, mSelectedPen;
|
||||
QBrush mBrush, mSelectedBrush;
|
||||
|
||||
//jyl
|
||||
bool m_bCustom = false;
|
||||
float m_nRadius; // 半径
|
||||
|
||||
// reimplemented virtual methods:
|
||||
virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
|
||||
virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
|
||||
|
|
|
|||
47
logPlus/customellipse.h
Normal file
47
logPlus/customellipse.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef CUSTOMELLIPSE_H
|
||||
#define CUSTOMELLIPSE_H
|
||||
#include <qcustomplot.h>
|
||||
|
||||
class CustomEllipse : public QCPItemEllipse
|
||||
{
|
||||
public:
|
||||
CustomEllipse(QCustomPlot *parentPlot) : QCPItemEllipse(parentPlot) {}
|
||||
|
||||
// 重写绘制函数
|
||||
virtual void draw(QCPPainter *painter) override
|
||||
{
|
||||
// 自定义绘制代码
|
||||
//painter->setPen(QPen(Qt::blue, 2)); // 例如,改变边框颜色和宽度
|
||||
//painter->setBrush(QBrush(Qt::green)); // 改变填充颜色
|
||||
QCPItemEllipse::draw(painter); // 调用基类的绘制函数
|
||||
return;
|
||||
|
||||
QPointF p1 = topLeft->pixelPosition();
|
||||
//QPointF p2 = bottomRight->pixelPosition();
|
||||
QPointF p2 = QPointF(p1.rx()+5, p1.ry()+5);
|
||||
if (p1.toPoint() == p2.toPoint()) {
|
||||
return;
|
||||
}
|
||||
QRectF ellipseRect = QRectF(p1, p2).normalized();
|
||||
const int clipEnlarge = qCeil(mainPen().widthF());
|
||||
QRect clip = clipRect().adjusted(-clipEnlarge, -clipEnlarge, clipEnlarge, clipEnlarge);
|
||||
if (ellipseRect.intersects(clip)) { // only draw if bounding rect of ellipse is visible in cliprect
|
||||
painter->setPen(mainPen());
|
||||
painter->setBrush(mainBrush());
|
||||
#ifdef __EXCEPTIONS
|
||||
try { // drawEllipse sometimes throws exceptions if ellipse is too big
|
||||
#endif
|
||||
painter->drawEllipse(ellipseRect);
|
||||
#ifdef __EXCEPTIONS
|
||||
} catch (...) {
|
||||
qDebug() << Q_FUNC_INFO << "Item too large for memory, setting invisible";
|
||||
setVisible(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// 可以添加更多自定义方法或属性
|
||||
};
|
||||
|
||||
#endif // CUSTOMELLIPSE_H
|
||||
|
|
@ -52,6 +52,9 @@ FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) :
|
|||
//波列
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_AddWave(QString, QString, QString, QString, QString)), this, SLOT(s_addWave(QString, QString, QString, QString, QString)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_delWave(QString, QString, QString, QString)), this, SLOT(s_delWave(QString, QString, QString, QString)));
|
||||
//表格曲线
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_AddTableLine(QString, QString, QString, QString, QString)), this, SLOT(s_addTableLine(QString, QString, QString, QString, QString)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_delTableLine(QString, QString, QString, QString)), this, SLOT(s_delTableLine(QString, QString, QString, QString)));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -251,6 +254,60 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
|
|||
m_listWaveName.push_back(strWaveName);
|
||||
}
|
||||
|
||||
|
||||
void FormDraw::s_addTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
||||
{
|
||||
//井名&道名不一致
|
||||
if(strUuid == m_strUuid && m_strWellName == strWellName && m_strTrackName == strTrackName)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_listTableName.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;");
|
||||
//
|
||||
//QRect rect = this->rect();
|
||||
//curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height());
|
||||
|
||||
double dHight = 0;
|
||||
dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm;
|
||||
|
||||
qDebug() << "FormDraw dHight=" << QString::number((int)dHight-3184);
|
||||
if(dHight>32767)
|
||||
{
|
||||
dHight = 32767;
|
||||
}
|
||||
|
||||
//curv->setMaximumHeight((int)dHight);
|
||||
//curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184
|
||||
curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184
|
||||
|
||||
|
||||
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
|
||||
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
// curv->setSizePolicy(policy);
|
||||
|
||||
curv->show();
|
||||
initTableLine(curv, strSlfName, strLineName);
|
||||
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||
|
||||
//
|
||||
m_listTableName.push_back(strLineName);
|
||||
}
|
||||
|
||||
void FormDraw::s_mouseWheel(QWheelEvent *event)
|
||||
{
|
||||
emit CallManage::getInstance()->sig_mouseWheel(event);
|
||||
|
|
@ -381,6 +438,51 @@ void FormDraw::s_delWave(QString strUuid, QString strWellName, QString strTrackN
|
|||
}
|
||||
}
|
||||
|
||||
void FormDraw::s_delTableLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName)
|
||||
{
|
||||
//井名&道名不一致
|
||||
if(strUuid == m_strUuid && m_strWellName == strWellName && m_strTrackName == strTrackName)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
qDebug() << "FormDraw s_delTableLine";
|
||||
|
||||
if(m_listTableName.contains(strLineName))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "FormDraw strLineName not exist! " << strLineName;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// 获取当前widget的所有子控件
|
||||
const QObjectList &children = this->children();
|
||||
// 遍历子控件列表
|
||||
for (QObject *child : children) {
|
||||
// 判断子控件是否为QWidget类型
|
||||
if (QWidget *childWidget = qobject_cast<QWidget *>(child)) {
|
||||
// 打印子控件的信息,使用缩进表示层级关系
|
||||
//qDebug() << QString("%1").arg(childWidget->objectName());
|
||||
QString strObjName = childWidget->objectName();
|
||||
if(strObjName=="QMyCustomPlot")
|
||||
{
|
||||
QMyCustomPlot *form = (QMyCustomPlot*)childWidget;
|
||||
if(form->m_strLineName == strLineName)
|
||||
{
|
||||
childWidget->deleteLater(); // 安排控件的删除,稍后执行
|
||||
m_listWaveName.removeOne(strLineName);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FormDraw::s_MouseMove(QString strUuid, QString strWellName, QString strTrackName, float dep)
|
||||
{
|
||||
//井名&道名不一致
|
||||
|
|
@ -810,8 +912,8 @@ void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWa
|
|||
logio->CloseWave(index);
|
||||
delete logio;
|
||||
|
||||
float vmax = 0;//(float)_nSamples;
|
||||
float vmin = 0;
|
||||
float vmax = -9999;//(float)_nSamples;
|
||||
float vmin = -9999;
|
||||
//
|
||||
double** wavedata;
|
||||
wavedata = new double*[_nSamples];
|
||||
|
|
@ -1055,6 +1157,336 @@ void FormDraw::initWave2(QMyCustomPlot *widget, QString strSlfName, QString strW
|
|||
}
|
||||
}
|
||||
|
||||
//表格曲线
|
||||
void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
||||
{
|
||||
m_Value2=NULL;
|
||||
m_Value3=NULL;
|
||||
//m_csUnit = "(°)";
|
||||
m_bTableData=0;
|
||||
m_LeftVal2=0;
|
||||
m_RightVal2=360;
|
||||
//m_csCurveDDIR="DDIR";
|
||||
//m_csCurveDANG="DANG";
|
||||
//m_csCurveGrad="GRAD";
|
||||
m_nTailWidth=2;
|
||||
m_crTail=qRgb(0,0,0);
|
||||
m_crPointFill=qRgb(0,0,0);
|
||||
m_nRadius = 4;
|
||||
m_nTailLen = 8;
|
||||
m_nCircleWidth=1;
|
||||
m_flGrad1 = 10;
|
||||
m_flGrad2 = 50;
|
||||
|
||||
//Table dip
|
||||
m_qsTable="FRAC_HOLE.TABLE";
|
||||
m_qsDIR=("DIR"); // 方位 曲线名
|
||||
m_qsDIP=("DIPorS");//倾角
|
||||
m_qsDepth="DEP";
|
||||
m_qsID = "ID";
|
||||
m_qsProperty=("ID");
|
||||
m_iPrecision = 3;
|
||||
//
|
||||
ReadFracDef();
|
||||
for (int i = 0 ; i < iFracType ; i++)
|
||||
{
|
||||
m_bTypeDraw[i] = false;
|
||||
}
|
||||
//
|
||||
m_qsDIR=("DDIR"); // 方位 曲线名
|
||||
m_qsDIP=("DANG");//倾角
|
||||
m_qsDepth="DEPT";
|
||||
m_qsID = "ID";
|
||||
ReadData(strSlfName, strLineName);
|
||||
|
||||
|
||||
//------------------------
|
||||
int nPointNum = m_FracTabList.count();
|
||||
if ( nPointNum < 1 )return ;
|
||||
FRAC_TABLE frac = m_FracTabList.at(0);
|
||||
|
||||
float vmax = -9999;
|
||||
float vmin = -9999;
|
||||
//最大值,最小值
|
||||
vmax=vmin=frac.DIR;
|
||||
|
||||
//slf文件读取曲线
|
||||
for(int i=0; i<nPointNum; i++)
|
||||
{
|
||||
frac = m_FracTabList.at(i);
|
||||
if(vmax<frac.DIR)vmax=frac.DIR;
|
||||
if(vmin>frac.DIR)vmin=frac.DIR;
|
||||
}
|
||||
|
||||
widget->m_iX1 = vmin;
|
||||
widget->m_iX2 = vmax;
|
||||
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;
|
||||
//
|
||||
DrawTabDip(widget);
|
||||
}
|
||||
|
||||
void FormDraw::DrawTabDip(QMyCustomPlot *widget)
|
||||
{
|
||||
float sdep,edep,flDepthScale,tempf,flVal;
|
||||
int i,j,n,nPointNum=0,tempi;
|
||||
QRectF rt,rtRect;
|
||||
float x,y;
|
||||
float dgtord,dr;
|
||||
float flWidth[50];
|
||||
FRAC_TABLE frac;
|
||||
bool bDraw;
|
||||
FRAC_DEF fd;
|
||||
//CString cs;
|
||||
|
||||
if(m_iPrecision<0) m_iPrecision=0;
|
||||
|
||||
nPointNum = m_FracTabList.count();
|
||||
if ( nPointNum < 1 )return ;
|
||||
|
||||
dgtord=3.14159265/180.;
|
||||
//
|
||||
m_nCircleWidth = 1;
|
||||
m_nTailWidth = 1;
|
||||
m_nRadius = 4;
|
||||
m_crCircle = QColor(0,0,0);
|
||||
m_crTail = QColor(0,0,0);
|
||||
|
||||
n = m_FracDefList.count();
|
||||
for (i=0; i<nPointNum; i++)
|
||||
{
|
||||
frac = m_FracTabList.at(i);
|
||||
|
||||
bDraw = false;
|
||||
for (j=0; j<n; j++)
|
||||
{
|
||||
fd = m_FracDefList.at(j);
|
||||
// 裂缝描述表中未保存裂缝名称:
|
||||
//比较裂缝名称比较准确,代码更改,如果比较代码会引起不一致性
|
||||
if ( (int)(frac.ID) == fd.iCode )
|
||||
{
|
||||
bDraw = m_bTypeDraw[j];//fd.bDraw;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//if ( bDraw )
|
||||
{
|
||||
QBrush cBrush(fd.crColor);
|
||||
//圆圈
|
||||
QPen pPen(m_crCircle);
|
||||
pPen.setWidth(m_nCircleWidth);
|
||||
|
||||
//尾巴
|
||||
QPen pPenTail(m_crTail);
|
||||
pPenTail.setWidth(m_nTailWidth);
|
||||
|
||||
// 角度
|
||||
//flVal = frac.DIPorS;
|
||||
x = frac.DIPorS;
|
||||
y = -frac.DEP;
|
||||
|
||||
// int LineWidth = m_nRadius;
|
||||
// rtRect.setLeft(x - LineWidth);
|
||||
// rtRect.setRight( x + LineWidth);
|
||||
// rtRect.setBottom( y + LineWidth);
|
||||
// rtRect.setTop(y - LineWidth);
|
||||
// pDC->setPen(pPen);
|
||||
// pDC->drawEllipse(rtRect.left(),rtRect.top(),rtRect.width(),rtRect.height());
|
||||
// QPainterPath myPath;
|
||||
// myPath.addEllipse(rtRect);
|
||||
// pDC->fillPath(myPath,cBrush);
|
||||
|
||||
//CustomEllipse *qcpitemellipse = new CustomEllipse(widget);
|
||||
|
||||
QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget);
|
||||
qcpItemEllipse->setPen(pPen);
|
||||
qcpItemEllipse->m_bCustom = true;
|
||||
qcpItemEllipse->m_nRadius = m_nRadius;
|
||||
qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置
|
||||
qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置
|
||||
//qcpItemEllipse->setBrush(cBrush);//填充圆的颜色
|
||||
|
||||
//方位
|
||||
dr=frac.DIR *dgtord;
|
||||
QCPItemLine *qcpItemLine = new QCPItemLine(widget);
|
||||
qcpItemLine->setPen(pPenTail);
|
||||
qcpItemLine->m_bCustom = true;
|
||||
qcpItemLine->m_nTailLen = m_nTailLen; //尾长
|
||||
qcpItemLine->m_nRadius = m_nRadius; //半径
|
||||
qcpItemLine->m_dr = dr;
|
||||
qcpItemLine->start->setCoords(y, x);//圆心位置
|
||||
qcpItemLine->end->setCoords(y, x);//圆心位置
|
||||
|
||||
//break;
|
||||
|
||||
// x += m_nRadius*sin(dr);
|
||||
// // 注意映射方式
|
||||
// y -=m_nRadius*cos(dr);
|
||||
// //pDC->moveto(x,y);
|
||||
// float x1=x +m_nTailLen*sin(dr);
|
||||
// // 注意映射方式
|
||||
// float y1= y-m_nTailLen*cos(dr);
|
||||
|
||||
// pDC->setPen(pPenTail);
|
||||
// pDC->drawLine(x,y,x1,y1);
|
||||
|
||||
|
||||
// if ( m_bDrawValue ) //显示倾角、方位
|
||||
// {
|
||||
// rtRect.setTop(rtRect.top()-GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize()));
|
||||
// rtRect.setBottom(rtRect.bottom()+GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize()));
|
||||
// QString cs1 = QString::number(frac.DIPorS,'f',m_iPrecision);
|
||||
// QString cs2 = QString::number(frac.DIR,'f',m_iPrecision);
|
||||
// cs=cs1+"//"+cs2;
|
||||
// cs.Replace((" "),"");
|
||||
// if ( frac.DIPorS >= 30 )
|
||||
// {
|
||||
// x = 2.*(float)(GetLineWidth(pDC,m_nRadius));
|
||||
// rtRect.setRight(rtRect.center().x() - x);
|
||||
// rtRect.setLeft(mrt.left());
|
||||
// pDC->drawText(rtRect,Qt::AlignVCenter|Qt::AlignHCenter,cs.GetString());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// x = 2.*(float)(GetLineWidth(pDC,m_nRadius));
|
||||
// rtRect.setLeft(rtRect.center().x() + x);
|
||||
// rtRect.setRight(mrt.right());
|
||||
// pDC->drawText(rtRect,Qt::AlignVCenter,cs.GetString());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//read config file: FRAC.CFG,save info into m_FracDef
|
||||
void FormDraw::ReadFracDef()
|
||||
{
|
||||
m_FracDefList.clear();
|
||||
FRAC_DEF fd;
|
||||
//char path[MAX_PATH+1];
|
||||
char str[512],name[512];
|
||||
int r,g,b,id;
|
||||
FILE *fp;
|
||||
QString qs;
|
||||
|
||||
//sprintf(str,"%sconf\\FRAC.CFG",path);
|
||||
QString fracFilePath = GetConfPath() + "FRAC_New.CFG";
|
||||
fp = fopen(fracFilePath.toStdString().c_str(),"r");
|
||||
if ( fp !=NULL )
|
||||
{
|
||||
fgets(str,256,fp); // 跳过第一行
|
||||
while (!feof(fp))
|
||||
{
|
||||
fgets(str,256,fp);
|
||||
qs = str; qs.trimmed();
|
||||
if (qs.length() < 8) break ;
|
||||
//代码 名称 形状代码(1:正弦曲线 2:连线 3:封闭区域) 颜色(红 绿 蓝) 线宽度
|
||||
sscanf(str,"%d %s %d %d %d %d %d",&fd.iCode, name, &fd.iType, &r, &g, &b, &fd.nLineWidth);
|
||||
fd.crColor = QColor(r,g,b);//RGB(r,g,b);
|
||||
fd.csName = name;
|
||||
fd.csName = fd.csName.trimmed();//.Trim();
|
||||
fd.bDraw = 0;
|
||||
m_FracDefList.append(fd);
|
||||
if ( feof(fp))
|
||||
break;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name,"打开裂缝参数配置文件错误:%s!",str);
|
||||
QMessageBox::information(nullptr, "读取文件失败", name);
|
||||
}
|
||||
}
|
||||
|
||||
//for table dip ,read FRAC_HOLE.TABLE
|
||||
void FormDraw::ReadData(QString strSlfName, QString strLineName)
|
||||
{
|
||||
QString cs;
|
||||
int nField,len;
|
||||
FRAC_TABLE frac;
|
||||
CMemRdWt mrw;
|
||||
m_PointNum = 0 ;
|
||||
char strFracTable[256];
|
||||
int i,j,iIndex,nCount,iType=1;
|
||||
char wellname2[512];
|
||||
char *buffer;
|
||||
Slf_TABLE_FIELD *Table_Field;
|
||||
char bufField[1024];
|
||||
float val;
|
||||
//
|
||||
m_FracTabList.clear();
|
||||
if(m_qsTable=="AC"|| m_qsTable=="")
|
||||
{
|
||||
m_qsTable="FRAC_HOLE.TABLE";
|
||||
}
|
||||
//
|
||||
if(strSlfName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
//CString wellname(strSlfName);
|
||||
if ( mrw.Open(strSlfName.toStdString().c_str()) ) // 打开井文件
|
||||
{
|
||||
//CString strFracTable(m_qsTable);
|
||||
iIndex = mrw.OpenTable(m_qsTable.toStdString().c_str());
|
||||
if (iIndex >= 0)
|
||||
{
|
||||
nField = mrw.GetTableFieldCount(iIndex);
|
||||
Table_Field = new Slf_TABLE_FIELD[nField+1];
|
||||
// 读取字段信息
|
||||
mrw.GetTableFieldInfo(iIndex, Table_Field);
|
||||
|
||||
// 读取数据记录
|
||||
nCount = mrw.GetTableRecordCount(iIndex);
|
||||
i = mrw.GetTableRecordLength(iIndex);
|
||||
buffer = new char[i+2];
|
||||
m_PointNum = nCount;
|
||||
|
||||
for(i=0; i<nCount; i++)
|
||||
{
|
||||
memset(&frac, 0x00, sizeof(FRAC_TABLE));
|
||||
mrw.ReadTable(iIndex, i+1, buffer);
|
||||
frac.DEP = -9999;
|
||||
len = 0;
|
||||
for(j=0; j<nField; j++)
|
||||
{
|
||||
val = GetData(Table_Field[j].RepCode, &buffer[len]);
|
||||
cs = Table_Field[j].Name;
|
||||
if ( m_qsDepth.compare(cs)==0)
|
||||
frac.DEP = val;
|
||||
if ( m_qsDIP.compare(cs)==0)
|
||||
frac.DIPorS = val;
|
||||
if ( m_qsDIR.compare(cs)==0)
|
||||
frac.DIR = val;
|
||||
if ( m_qsID.compare(cs)==0)
|
||||
frac.ID = (int)(val);
|
||||
|
||||
len += Table_Field[j].Length;
|
||||
}
|
||||
m_FracTabList.append(frac);
|
||||
}
|
||||
delete [] Table_Field;
|
||||
delete [] buffer;
|
||||
mrw.CloseTable(iIndex);
|
||||
}
|
||||
mrw.Close(); //关闭井文件
|
||||
}
|
||||
}
|
||||
|
||||
void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
|
||||
double newLeftScale, double newRightScale, QString strScaleType, QColor newlineColor, double width, Qt::PenStyle lineStyle)
|
||||
{
|
||||
|
|
@ -1170,7 +1602,11 @@ void FormDraw::dropEvent(QDropEvent* event)
|
|||
//新建波列
|
||||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
// 接受拖拽事件
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -8,9 +8,35 @@
|
|||
#include "formtitle.h"
|
||||
#include "formtrack.h"
|
||||
#include "LogIO.h"
|
||||
#include "MemRdWt.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
const int iFracType=15;
|
||||
//蝌蚪图
|
||||
typedef struct FRACDEF
|
||||
{
|
||||
int iCode; //代码
|
||||
QString csName; // 名称
|
||||
int iType; //形状代码(1:正弦曲线 2:连线 3:封闭区域)
|
||||
QColor crColor; //颜色(红 绿 蓝)
|
||||
int nLineWidth; //线宽度
|
||||
int bDraw; // 是否显示
|
||||
}FRAC_DEF;
|
||||
|
||||
typedef struct FRACTABLE
|
||||
{
|
||||
float DEP; //深度
|
||||
float AorX;
|
||||
float XETAorH;
|
||||
float W;
|
||||
float DIPorS; //倾角
|
||||
float DIR; //方位
|
||||
float ID; //裂缝代码/可信度
|
||||
float NUM;
|
||||
float X[16],Y[16];//X0,Y0,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9;
|
||||
}FRAC_TABLE;
|
||||
|
||||
namespace Ui {
|
||||
class FormDraw;
|
||||
}
|
||||
|
|
@ -47,6 +73,7 @@ public:
|
|||
|
||||
QStringList m_listLineName;
|
||||
QStringList m_listWaveName;
|
||||
QStringList m_listTableName;
|
||||
|
||||
//X坐标
|
||||
float m_vmax;
|
||||
|
|
@ -60,9 +87,43 @@ public:
|
|||
void setupLineStyleDemo(QMyCustomPlot *customPlot);
|
||||
void setupSelectionDemo(QMyCustomPlot *customPlot);
|
||||
|
||||
//波列
|
||||
void initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
|
||||
void initWave2(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
|
||||
|
||||
//表格曲线
|
||||
void initTableLine(QMyCustomPlot *widget, QString strSlfName, QString strLineName);
|
||||
void ReadFracDef();
|
||||
void ReadData(QString strSlfName, QString strLineName);
|
||||
void DrawTabDip(QMyCustomPlot *widget);
|
||||
|
||||
int m_PointNum;
|
||||
//
|
||||
int FracNum;
|
||||
float *m_pflTab_Frac;
|
||||
bool m_bFracIsOK;
|
||||
//CString m_csUnit;
|
||||
//
|
||||
Slf_CURVE m_Curve,m_Curve2,m_Curve3;
|
||||
char *m_Value2,*m_Value3;
|
||||
// 以下变量需保存在模板里
|
||||
// 绘制时,方位/倾角/可信度曲线的深度、采样间隔应该一致
|
||||
//CString m_csCurveDDIR,m_csCurveDANG,m_csCurveGrad; // 方位/倾角/可信度 曲线名
|
||||
float m_LeftVal2,m_RightVal2;
|
||||
float m_flGrad1,m_flGrad2; // 可信度
|
||||
int m_bTableData;
|
||||
QRectF m_Rect;
|
||||
float m_nRadius,m_nCircleWidth; // 半径,圆线宽度
|
||||
float m_nTailWidth,m_nTailLen; // 尾宽度、尾长
|
||||
QColor m_crPointFill,m_crTail,m_crCircle;
|
||||
//TabDip
|
||||
QString m_qsWellName,m_qsTable; //
|
||||
QString m_qsDepth,m_qsDIP,m_qsDIR,m_qsID,m_qsProperty; // 控制曲线
|
||||
QList<FRAC_DEF> m_FracDefList;
|
||||
QList<FRAC_TABLE> m_FracTabList;
|
||||
bool m_bTypeDraw[iFracType];
|
||||
bool m_bDrawValue;
|
||||
int m_iPrecision;//小数位数
|
||||
|
||||
signals:
|
||||
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
|
@ -81,6 +142,11 @@ public slots:
|
|||
//
|
||||
void s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
|
||||
void s_delWave(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//
|
||||
void s_addTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
|
||||
void s_delTableLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
};
|
||||
|
||||
#endif // FORMDRAW_H
|
||||
|
|
|
|||
|
|
@ -279,6 +279,11 @@ void FormInfo::dropEvent(QDropEvent* event)
|
|||
//新建波列
|
||||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
// 接受拖拽事件
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -84,7 +84,11 @@ void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackNam
|
|||
{
|
||||
emit sig_AddWave(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
||||
}
|
||||
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit sig_AddTableLine(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
||||
}
|
||||
}
|
||||
|
||||
void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
|
||||
|
|
@ -175,6 +179,50 @@ void FormTrack::s_addWave(QString strSlfName, QString strWellName, QString strTr
|
|||
// ui->tableWidget->setItem(row, 0, item);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
qDebug() << "FormTrack s_addWave";
|
||||
|
||||
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 = "tableObject";
|
||||
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);
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// 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);
|
||||
}
|
||||
|
||||
QJsonObject FormTrack::makeJson()
|
||||
{
|
||||
// 创建根对象
|
||||
|
|
|
|||
|
|
@ -67,10 +67,13 @@ public:
|
|||
signals:
|
||||
void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void sig_AddWave(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void sig_AddTableLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
|
||||
public slots:
|
||||
void s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void s_addWave(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void 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 s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -125,6 +125,11 @@ void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfNa
|
|||
//新建波列
|
||||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||||
}
|
||||
}
|
||||
|
||||
//ui->tableWidget->resizeColumnsToContents(); // 调整列宽以适应内容
|
||||
|
|
|
|||
|
|
@ -647,15 +647,10 @@ void MainWindowCurve::dropEvent(QDropEvent* event)
|
|||
|
||||
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName << " strLineName:" << strLineName << " strType:" << strType;
|
||||
|
||||
if(strType=="curveObject")
|
||||
if(strType=="curveObject" || strType=="waveObject" || strType=="tableObject")
|
||||
{
|
||||
//新建井+道+曲线(首条)
|
||||
NewWellAndTrack(strWellName, strSlfName, strLineName, "curveObject");
|
||||
}
|
||||
else if(strType=="waveObject")
|
||||
{
|
||||
//新建井+道+波列(首条)
|
||||
NewWellAndTrack(strWellName, strSlfName, strLineName, "waveObject");
|
||||
NewWellAndTrack(strWellName, strSlfName, strLineName, strType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ void PreQTableWidget::dropEvent(QDropEvent *event)
|
|||
//新建波列
|
||||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
|
||||
//
|
||||
//m_listLineName.push_back(strLineName);
|
||||
|
|
@ -180,6 +185,11 @@ void PreQTableWidget::dropEvent(QDropEvent *event)
|
|||
//新建波列
|
||||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
|
||||
//
|
||||
//m_listLineName.push_back(strLineName);
|
||||
|
|
@ -240,6 +250,11 @@ void PreQTableWidget::performDrag()
|
|||
//删除波列
|
||||
emit CallManage::getInstance()->sig_delWave(m_strUuid, formInfo->m_strWellName, formInfo->m_strTrackName, formInfo->m_strLineName);
|
||||
}
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//删除波列
|
||||
emit CallManage::getInstance()->sig_delTableLine(m_strUuid, formInfo->m_strWellName, formInfo->m_strTrackName, formInfo->m_strLineName);
|
||||
}
|
||||
|
||||
//
|
||||
//m_listLineName.removeOne(formInfo->m_strLineName);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user