优化蝌蚪图坐标计算方法

This commit is contained in:
jiayulong 2025-11-26 11:24:46 +08:00
parent 8b955e21df
commit 0e4a569e19
2 changed files with 35 additions and 2 deletions

View File

@ -1246,6 +1246,24 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString
DrawTabDip(widget); DrawTabDip(widget);
} }
void FormDraw::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio)
{
float scale ;
int k;
scale = flWidth[0]=1.;
for(k=1;k<nColumn;k++)
{
flWidth[k] = flWidth[k-1] / factor;
scale += flWidth[k];
}
scale = /*100. **/flHoriRatio*(x2 - x1) / scale;
for(k=0;k<nColumn;k++)
{
flWidth[k] = flWidth[k] * scale;
}
}
void FormDraw::DrawTabDip(QMyCustomPlot *widget) void FormDraw::DrawTabDip(QMyCustomPlot *widget)
{ {
float sdep,edep,flDepthScale,tempf,flVal; float sdep,edep,flDepthScale,tempf,flVal;
@ -1272,6 +1290,8 @@ void FormDraw::DrawTabDip(QMyCustomPlot *widget)
m_crCircle = QColor(0,0,0); m_crCircle = QColor(0,0,0);
m_crTail = QColor(0,0,0); m_crTail = QColor(0,0,0);
CalcDipWidth(9,flWidth, 1.2, 0, g_iOneWidth, 1.);
n = m_FracDefList.count(); n = m_FracDefList.count();
for (i=0; i<nPointNum; i++) for (i=0; i<nPointNum; i++)
{ {
@ -1301,8 +1321,20 @@ void FormDraw::DrawTabDip(QMyCustomPlot *widget)
pPenTail.setWidth(m_nTailWidth); pPenTail.setWidth(m_nTailWidth);
// 角度 // 角度
//flVal = frac.DIPorS; flVal = frac.DIPorS;
x = frac.DIPorS; tempf = flVal /10.;
tempi = tempf;
x = fmod(flVal,(float)(10.));
if ( x == 0 )
{
tempi=0;//tempi --;
}
tempf = 0.;
for (j=0; j<tempi; j++)
tempf += flWidth[j];
x = tempf+(flVal-tempi*10.)*(flWidth[tempi]/10.);
//x = frac.DIPorS;
y = -frac.DEP; y = -frac.DEP;
// int LineWidth = m_nRadius; // int LineWidth = m_nRadius;

View File

@ -96,6 +96,7 @@ public:
void ReadFracDef(); void ReadFracDef();
void ReadData(QString strSlfName, QString strLineName); void ReadData(QString strSlfName, QString strLineName);
void DrawTabDip(QMyCustomPlot *widget); void DrawTabDip(QMyCustomPlot *widget);
void CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio);
int m_PointNum; int m_PointNum;
// //