本文整理汇总了C++中CBCGPRect::PtInRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPRect::PtInRect方法的具体用法?C++ CBCGPRect::PtInRect怎么用?C++ CBCGPRect::PtInRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBCGPRect
的用法示例。
在下文中一共展示了CBCGPRect::PtInRect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDrawShape
//*******************************************************************************
void CBCGPChartTextObject::OnDrawShape(CBCGPGraphicsManager* pGM, const CBCGPRect& rectDiagram)
{
if (m_bDrawConnector && !m_format.m_outlineFormat.m_brLineColor.IsEmpty())
{
CBCGPRect rectShape = m_rectScreen;
rectShape.Normalize();
if (!rectShape.PtInRect(m_ptAnchor))
{
CBCGPPoint pt;
if (bcg_CS_intersect(rectShape, m_ptAnchor, rectShape.CenterPoint(), pt))
{
pGM->DrawLine(m_ptAnchor, pt, m_format.m_outlineFormat.m_brLineColor,
m_format.m_outlineFormat.GetLineWidth(TRUE), &m_format.m_outlineFormat.m_strokeStyle);
}
CBCGPEllipse ellipse(m_ptAnchor, 2 * m_format.GetScaleRatio().cx, 2 * m_format.GetScaleRatio().cy);
pGM->FillEllipse(ellipse, m_format.m_brFillColor);
pGM->DrawEllipse(ellipse, m_format.m_outlineFormat.m_brLineColor);
}
}
CBCGPChartObject::OnDrawShape(pGM, rectDiagram);
}
示例2: bcg_pointInPie
bool bcg_pointInPie (const CBCGPRect& rect, double dblAngleStart, double dblAngleFinish, const CBCGPPoint& ptTestIn, double dblDoughnutPercent)
{
if (!rect.PtInRect(ptTestIn))
{
return false;
}
CBCGPPoint ptTest = ptTestIn;
CBCGPPoint ptCenter = rect.CenterPoint();
double dblRadiusX = 0.5 * rect.Width();
double dblRadiusY = 0.5 * rect.Height();
if (dblRadiusX > dblRadiusY && dblRadiusX != 0.)
{
ptTest.Scale(CBCGPPoint(dblRadiusY / dblRadiusX, 1.0), ptCenter);
}
else if (dblRadiusY > dblRadiusX && dblRadiusY != 0.)
{
ptTest.Scale(CBCGPPoint(1.0, dblRadiusX / dblRadiusY, 1.0), ptCenter);
}
double dblAngle = bcg_normalize_rad(bcg_angle(ptCenter, ptTest));
dblAngleStart = bcg_normalize_rad(dblAngleStart);
dblAngleFinish = bcg_normalize_rad(dblAngleFinish);
BOOL bIn = FALSE;
const BOOL bIsFullEllipse = bcg_IsFullEllipse(bcg_rad2deg(dblAngleStart), bcg_rad2deg(dblAngleFinish), TRUE, 0.1f);
if (bIsFullEllipse)
{
bIn = TRUE;
}
else
{
if (dblAngleStart > dblAngleFinish)
{
bIn = (dblAngle <= dblAngleFinish) || (dblAngleStart <= dblAngle);
}
else
{
bIn = (dblAngle >= dblAngleStart) && (dblAngle <= dblAngleFinish);
}
}
if (bIn)
{
double angleCos = cos(dblAngle);
double angleSin = sin(dblAngle);
CBCGPPoint ptEdge(ptCenter.x + angleCos * .5 * rect.Width(), ptCenter.y + angleSin * .5 * rect.Height());
double r = bcg_distance(ptEdge, ptCenter);
double distToCenter = bcg_distance(ptTestIn, ptCenter);
return (distToCenter <= r && distToCenter > r * dblDoughnutPercent);
}
return false;
}
示例3: bcg_CS_clip_inv
int bcg_CS_clip_inv(const CBCGPRect& rect, CBCGPPoint& pt1_1, CBCGPPoint& pt1_2,
CBCGPPoint* pt2_1, CBCGPPoint* pt2_2)
{
if (rect.IsRectEmpty ())
{
return 1;
}
BOOL bInRect1 = rect.PtInRect (pt1_1);
BOOL bInRect2 = rect.PtInRect (pt1_2);
if (bInRect1 && bInRect2)
{
return 0;
}
if (pt1_1 == pt1_2)
{
return bInRect1 ? 0 : 1;
}
CBCGPPoint pt1(pt1_1);
CBCGPPoint pt2(pt1_2);
if (!bcg_CS_clip(rect, pt1, pt2))
{
return 1;
}
int count = 0;
if (bInRect1)
{
pt1_1 = pt1;
count = 1;
}
else if (bInRect2)
{
pt1_2 = pt2;
count = 1;
}
else
{
count = 1;
if (pt2_1 != NULL && pt2_2 != NULL)
{
*pt2_1 = pt1;
*pt2_2 = pt1_2;
count = 2;
}
pt1_2 = pt2;
}
return count;
}
示例4: OnSetMouseCursor
//*******************************************************************************
BOOL CBCGPLinearGaugeImpl::OnSetMouseCursor(const CBCGPPoint& pt)
{
if (m_bIsInteractiveMode)
{
CBCGPRect rect = m_rect;
rect.DeflateRect(m_nFrameSize, m_nFrameSize);
if (rect.PtInRect(pt))
{
::SetCursor (globalData.GetHandCursor());
return TRUE;
}
}
return CBCGPGaugeImpl::OnSetMouseCursor(pt);
}
示例5: HitTest
//*******************************************************************************
BOOL CBCGPChartLineObject::HitTest(const CBCGPPoint& pt) const
{
double dblWidth = m_format.m_outlineFormat.GetLineWidth(TRUE) / 2;
CBCGPPoint ptTopLeft = m_rectScreen.TopLeft();
CBCGPPoint ptBottomRight = m_rectScreen.BottomRight();
if (ptTopLeft.x == ptBottomRight.x)
{
CBCGPRect r = m_rectScreen.NormalizedRect();
r.InflateRect(dblWidth, dblWidth);
return r.PtInRect(pt);
}
double dblACoef = (ptBottomRight.y - ptTopLeft.y) / (ptBottomRight.x - ptTopLeft.x);
double dblBCoef = ptBottomRight.y - dblACoef * ptBottomRight.x;
double dblY = dblACoef * pt.x + dblBCoef;
return pt.y > dblY - dblWidth && pt.y < dblY + dblWidth;
}
示例6: HitTestValue
//*******************************************************************************
BOOL CBCGPLinearGaugeImpl::HitTestValue(const CBCGPPoint& pt, double& dblValue, int nScale, BOOL bInsideGauge) const
{
CBCGPGaugeScaleObject* pScale = GetScale(nScale);
if (pScale == NULL)
{
ASSERT(FALSE);
return FALSE;
}
CBCGPRect rect = m_rect;
rect.OffsetRect(-m_ptScrollOffset);
if (m_bIsVertical)
{
rect.DeflateRect((pScale->m_dblOffsetFromFrame + m_nFrameSize) * m_sizeScaleRatio.cx, m_sizeMaxLabel.cy / 2 + (m_nFrameSize + 1) * m_sizeScaleRatio.cy);
}
else
{
rect.DeflateRect(m_sizeMaxLabel.cx / 2 + (m_nFrameSize + 1) * m_sizeScaleRatio.cx, (pScale->m_dblOffsetFromFrame + m_nFrameSize) * m_sizeScaleRatio.cy);
}
if (bInsideGauge && !rect.PtInRect(pt))
{
return FALSE;
}
if (m_bIsVertical)
{
const double dblTotalSize = rect.Height();
dblValue = pScale->m_dblStart + (rect.bottom - pt.y) * fabs(pScale->m_dblFinish - pScale->m_dblStart) / dblTotalSize;
}
else
{
const double dblTotalSize = rect.Width();
dblValue = pScale->m_dblStart + (pt.x - rect.left) * fabs(pScale->m_dblFinish - pScale->m_dblStart) / dblTotalSize;
}
return TRUE;
}
示例7: bcg_CS_clip
BOOL bcg_CS_clip(const CBCGPRect& rect, CBCGPPoint& point1, CBCGPPoint& point2)
{
if (rect.IsRectEmpty ())
{
return TRUE;
}
if (point1 == point2)
{
return rect.PtInRect(point1);
}
int code1 = bcg_CS_code(rect, point1);
int code2 = bcg_CS_code(rect, point2);
double kx = 0.0;
double ky = 0.0;
CBCGPSize d(point2.x - point1.x, point2.y - point1.y);
if (d.cx != 0.0)
{
ky = d.cy / d.cx;
}
else if (d.cy == 0.0)
{
if (code1 == 0 && code2 == 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
if (d.cy != 0.0)
{
kx = d.cx / d.cy;
}
BOOL visible = FALSE;
CBCGPPoint pt1(point1);
CBCGPPoint pt2(point2);
int count_inv = 0;
for(int i = 0; i < 4; i++)
{
if (code1 & code2)
{
break;
}
else if (code1 == 0 && code2 == 0)
{
visible = TRUE;
break;
}
if (code1 == 0)
{
int c = code1;
code1 = code2;
code2 = c;
CBCGPPoint p(pt1);
pt1 = pt2;
pt2 = p;
count_inv++;
}
if (code1 & 0x01)
{
pt1.y += ky * (rect.left - pt1.x);
pt1.x = rect.left;
}
else if (code1 & 0x02)
{
pt1.y += ky * (rect.right - pt1.x);
pt1.x = rect.right;
}
else if (code1 & 0x04)
{
pt1.x += kx * (rect.top - pt1.y);
pt1.y = rect.top;
}
else if (code1 & 0x08)
{
pt1.x += kx * (rect.bottom - pt1.y);
pt1.y = rect.bottom;
}
code1 = bcg_CS_code(rect, pt1);
}
if (visible)
{
if ((count_inv % 2) != 0)
{
point1 = pt1;
point2 = pt2;
//.........这里部分代码省略.........