本文整理汇总了C++中CCurve::IsVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CCurve::IsVisible方法的具体用法?C++ CCurve::IsVisible怎么用?C++ CCurve::IsVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurve
的用法示例。
在下文中一共展示了CCurve::IsVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawLegend
void QGraph::DrawLegend(QPainter &painter, QPoint &Place, QFont &LegendFont, QColor &LegendColor)
{
painter.save();
int LegendSize, ypos;
QString strong;
LegendSize = 30;
ypos = 12;
painter.setFont(LegendFont);
CCurve* pCurve;
QPen TextPen(LegendColor);
QPen LegendPen(Qt::gray);
int npos = 0;
for (int nc=0; nc< m_oaCurves.size(); nc++)
{
pCurve = (CCurve*) m_oaCurves[nc];
if(pCurve->IsVisible())
{
pCurve->GetTitle(strong);
if(pCurve->n>0 && strong.length())//is there anything to draw ?
{
LegendPen.setColor(pCurve->GetColor());
LegendPen.setStyle(GetStyle(pCurve->GetStyle()));
LegendPen.setWidth(pCurve->GetWidth());
painter.setPen(LegendPen);
painter.drawLine(Place.x(), Place.y() + ypos*npos,
Place.x() + (int)(LegendSize), Place.y() + ypos*npos);
painter.setPen(TextPen);
painter.drawText(Place.x() + (int)(1.5*LegendSize), Place.y() + ypos*npos+(int)(ypos/2),
strong);
npos++;
}
}
}
painter.restore();
}
示例2: DrawCurve
void QGraph::DrawCurve(int nIndex, QPainter &painter)
{
painter.save();
static double scaley;
static int i, ptside;
static QPoint From, To, Min, Max;
static QRect rViewRect;
ptside = 2;
CCurve* pCurve = GetCurve(nIndex);
scaley = m_scaley;
QBrush FillBrush(m_BkColor);
painter.setBrush(FillBrush);
QPen CurvePen(pCurve->GetColor());
CurvePen.setStyle(GetStyle(pCurve->GetStyle()));
CurvePen.setWidth((int)pCurve->GetWidth());
painter.setPen(CurvePen);
Min.setX(int(xmin/m_scalex) +m_ptoffset.x());
Min.setY(int(ymin/scaley) +m_ptoffset.y());
Max.setX(int(xmax/m_scalex) +m_ptoffset.x());
Max.setY(int(ymax/scaley) +m_ptoffset.y());
rViewRect.setTopLeft(Min);
rViewRect.setBottomRight(Max);
if(pCurve->n>=1)
{
From.setX(int(pCurve->x[0]/m_scalex+m_ptoffset.x()));
From.setY(int(pCurve->y[0]/scaley +m_ptoffset.y()));
if(pCurve->IsVisible())
{
for (i=1; i<pCurve->n;i++)
{
To.setX(int(pCurve->x[i]/m_scalex+m_ptoffset.x()));
To.setY(int(pCurve->y[i]/scaley +m_ptoffset.y()));
painter.drawLine(From, To);
From = To;
}
}
if(pCurve->PointsVisible())
{
for (i=0; i<pCurve->n;i++)
{
if(pCurve->GetSelected() !=i)
painter.drawRect(int(pCurve->x[i]/m_scalex+m_ptoffset.x())-ptside,
int(pCurve->y[i]/ scaley+m_ptoffset.y())-ptside,
2*ptside,2*ptside);
}
}
}
if(m_bHighlightPoint)
{
int point = pCurve->GetSelected();
if(point>=0)
{
//highlight
QColor HighColor(0,40, 150);
CurvePen.setWidth((int)pCurve->GetWidth());
CurvePen.setColor(HighColor);
painter.setPen(CurvePen);
To.setX(int(pCurve->x[point]/m_scalex+m_ptoffset.x()));
To.setY(int(pCurve->y[point]/scaley +m_ptoffset.y()));
painter.drawRect(To.x()-ptside-1,To.y()-ptside-1, 2*(ptside+1),2*(ptside+1));
}
}
painter.restore();
}
示例3: SetXScale
bool Graph::SetXScale()
{
CCurve *pCurve;
int nc;
if(m_bAutoX)
{
bool bCurve = false;
if (m_oaCurves.size())
{
//init only if we have a curve
for (nc=0; nc < m_oaCurves.size(); nc++)
{
pCurve = (CCurve*)m_oaCurves[nc];
if ((pCurve->IsVisible() ||pCurve->PointsVisible()) && pCurve->n>1)
{
bCurve = true;
break;//there is something to draw
}
}
}
if (bCurve)
{
Cxmin = 9999999.0;
Cxmax = -9999999.0;
for (nc=0; nc < m_oaCurves.size(); nc++)
{
pCurve = (CCurve*)m_oaCurves[nc];
if ((pCurve->IsVisible() ||pCurve->PointsVisible()) && pCurve->n>0)
{
Cxmin = qMin(Cxmin, pCurve->GetxMin());
Cxmax = qMax(Cxmax, pCurve->GetxMax());
}
}
if(Cxmax<=Cxmin)
Cxmax = (Cxmin+1.0)*2.0;
if(m_Type == 1)
{
xmin = qMin(xmin, Cxmin);
xmax = qMax(xmax, Cxmax);
}
else
{
xmin = Cxmin;
xmax = Cxmax;
}
if(Cxmin>=0.0) xmin = 0.0;
if(Cxmax<=0.0) xmax = 0.0;
}
else
{
// until things are made clear
for (nc=0; nc < m_oaCurves.size(); nc++)
{
pCurve = (CCurve*)m_oaCurves[nc];
if ((pCurve->IsVisible() ||pCurve->PointsVisible()) && pCurve->n>0)
{
xmin = qMin(xmin, pCurve->x[0]);
xmax = qMax(xmax, pCurve->x[0]);
}
}
}
xo=0.0;
if(fabs((xmin-xmax)/xmin)<0.001)
{
if(fabs(xmin)<0.00001) xmax = 1.0;
else
{
xmax = 2.0 * xmin;
if(xmax < xmin)
{
double tmp = xmax;
xmax = xmin;
xmin = tmp;
}
}
}
if(m_w<=0.0) return false;
m_scalex = (xmax-xmin)/m_w;
//try to set an automatic scale for X Axis
SetAutoXUnit();
}
else
{
//scales are set manually
if(m_w<=0.0) return false;
// m_scalex = (xmax-xmin)/m_w;
if (xunit<1.0)
{
//.........这里部分代码省略.........
示例4: SetYScale
bool Graph::SetYScale()
{
int nc;
CCurve *pCurve;
if(m_bAutoY)
{
bool bCurve = false;
if (m_oaCurves.size())
{
//init only if we have a curve
for (nc=0; nc < m_oaCurves.size(); nc++)
{
pCurve = (CCurve*)m_oaCurves[nc];
if ((pCurve->IsVisible() ||pCurve->PointsVisible()) && pCurve->n>0)
{
bCurve = true;
break;
}
}
}
if(bCurve)
{
Cymin = 9999999.0;
Cymax = -9999999.0;
for (nc=0; nc < m_oaCurves.size(); nc++)
{
pCurve = (CCurve*)m_oaCurves[nc];
if ((pCurve->IsVisible() ||pCurve->PointsVisible()) && pCurve->n>0)
{
Cymin = qMin(Cymin, pCurve->GetyMin());
Cymax = qMax(Cymax, pCurve->GetyMax());
}
}
if(Cymax<=Cymin)
{
Cymax = (Cymin+1.0)*2.0;
}
if(m_Type == 1)
{
ymin = qMin(ymin, Cymin);
ymax = qMax(ymax, Cymax);
}
else
{
ymin = Cymin;
ymax = Cymax;
}
if(Cymin>=0.0) ymin = 0.0;
if(Cymax<=0.0) ymax = 0.0;
}
else
{
// until things are made clear
for (int nc=0; nc < m_oaCurves.size(); nc++)
{
pCurve = (CCurve*)m_oaCurves[nc];
if ((pCurve->IsVisible() ||pCurve->PointsVisible()) && pCurve->n>0)
{
ymin = qMin(ymin, pCurve->y[0]);
ymax = qMax(ymax, pCurve->y[0]);
}
}
}
yo=0.0;
if (fabs((ymin-ymax)/ymin)<0.001)
{
if(fabs(ymin)<0.00001) ymax = 1.0;
else
{
ymax = 2.0 * ymin;
if(ymax < ymin)
{
double tmp = ymax;
ymax = ymin;
ymin = tmp;
}
}
}
if(m_h<=0.0) return false;
if (!m_bYInverted)
{
m_scaley = -(ymax-ymin)/m_h;
}
else
{
m_scaley = (ymax-ymin)/m_h;
}
//try to set an automatic scale for Y Axis
SetAutoYUnit();
}
else
{
//scales are set manually
if(m_h<=0) return false;
//.........这里部分代码省略.........