当前位置: 首页>>代码示例>>C++>>正文


C++ CCurve::PointsVisible方法代码示例

本文整理汇总了C++中CCurve::PointsVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CCurve::PointsVisible方法的具体用法?C++ CCurve::PointsVisible怎么用?C++ CCurve::PointsVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCurve的用法示例。


在下文中一共展示了CCurve::PointsVisible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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)
		{
//.........这里部分代码省略.........
开发者ID:kolzar,项目名称:sail7,代码行数:101,代码来源:graph.cpp

示例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();
}
开发者ID:kolzar,项目名称:sail7,代码行数:74,代码来源:qgraph.cpp

示例3: 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;
//.........这里部分代码省略.........
开发者ID:kolzar,项目名称:sail7,代码行数:101,代码来源:graph.cpp


注:本文中的CCurve::PointsVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。