本文整理汇总了C++中CBCGPRect类的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPRect类的具体用法?C++ CBCGPRect怎么用?C++ CBCGPRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBCGPRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeIcon
//*******************************************************************************
void CBCGPKnob::OnDrawTickMarkTextLabel(CBCGPGraphicsManager* pGM, const CBCGPTextFormat& tf, const CBCGPRect& rectText, const CString& strLabel, double dblVal, int nScale, const CBCGPBrush& br)
{
if (m_sizeIcon.cx == 0)
{
CBCGPCircularGaugeImpl::OnDrawTickMarkTextLabel(pGM, tf, rectText, strLabel, dblVal, nScale, br);
return;
}
if (m_sizeIcon.cy == 0)
{
m_sizeIcon.cy = pGM->GetImageSize(m_Icons).cy;
}
CBCGPSize sizeIcon(m_sizeIcon.cx * m_sizeScaleRatio.cx, m_sizeIcon.cy * m_sizeScaleRatio.cy);
double cx = 0.;
double cy = 0.;
double angle = 0.;
if (ValueToAngle(dblVal, angle, nScale))
{
cx = sizeIcon.cx * cos(bcg_deg2rad(angle)) / 2;
}
CBCGPPoint ptImage(
rectText.left + max(0., .5 * (rectText.Width() - sizeIcon.cx)) + cx,
rectText.top + max(0., .5 * (rectText.Height() - sizeIcon.cy)) + cy);
pGM->DrawImage(m_Icons, ptImage, sizeIcon, 1., CBCGPImage::BCGP_IMAGE_INTERPOLATION_MODE_LINEAR,
CBCGPRect(CBCGPPoint(m_sizeIcon.cx * m_nCurrLabelIndex, 0), m_sizeIcon));
}
示例2: ASSERT_VALID
//*******************************************************************************
CBCGPGeometry* CBCGPChartInterLineColoringEffect::CreateClipGeometry(double dblOrigin)
{
CBCGPChartAxis* pYAxis = m_pSeries1->GetRelatedAxis(CBCGPChartSeries::AI_Y);
ASSERT_VALID(pYAxis);
CBCGPRect rectBounds = pYAxis->GetBoundingRect();
BOOL bIsVertical = pYAxis->IsVertical();
double dblVal = pYAxis->PointFromValue(dblOrigin, TRUE);
rectBounds.Normalize();
if (bIsVertical)
{
rectBounds.top = dblVal;
}
else
{
rectBounds.right = dblVal;
}
CBCGPRectangleGeometry* pGeometry = new CBCGPRectangleGeometry(rectBounds);
return pGeometry;
}
示例3: 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);
}
示例4: ASSERT_VALID
//********************************************************************************
void CBCGPTreeMapGroup::OnDraw(CBCGPGraphicsManager* pGM, const CBCGPRect& rectClip, const CBCGPBrush& brBorder)
{
ASSERT_VALID(pGM);
if (m_rect.IsRectEmpty())
{
return;
}
CBCGPRect rectInter;
if (!rectInter.IntersectRect(m_rect, rectClip))
{
return;
}
if (!m_rectCaption.IsRectEmpty())
{
pGM->FillRectangle(m_rectCaption, m_brFillCaption);
DrawTextWidthShadow(pGM, m_strLabel, m_rectCaption, m_brText, m_tf);
}
int nSubNodes = (int)m_arSubNodes.GetSize();
for (int i = 0; i < nSubNodes; i++)
{
m_arSubNodes[i]->OnDraw(pGM, rectClip, brBorder);
}
}
示例5: ASSERT_VALID
//*******************************************************************************
void CBCGPTextGaugeImpl::OnDraw(CBCGPGraphicsManager* pGM, const CBCGPRect& /*rectClip*/, DWORD dwFlags)
{
ASSERT_VALID(pGM);
if (m_rect.IsRectEmpty() || !m_bIsVisible || m_strText.IsEmpty())
{
return;
}
if ((dwFlags & m_DefaultDrawFlags) == 0)
{
return;
}
CBCGPRect rect = m_rect;
if (m_bIsSubGauge)
{
rect.OffsetRect(-m_ptScrollOffset);
}
pGM->FillRectangle(rect, GetFillBrush ());
const CBCGPBrush& br = m_bOff ? m_brTextLight : m_brText;
CreateResources(CBCGPBrush(), FALSE);
pGM->DrawText(m_strText, rect, m_textFormat, br);
pGM->DrawRectangle(rect, GetOutlineBrush (), GetScaleRatioMid());
SetDirty(FALSE);
}
示例6: 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;
}
示例7: 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;
}
示例8: 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);
}
示例9: ASSERT
//********************************************************************************
void CBCGPTreeMapGroup::RecalcSliceLayout(CBCGPGraphicsManager* pGM, int nStart, int nFinish, const CBCGPRect& rect, BOOL bIsVertical)
{
ASSERT(nStart >= 0);
ASSERT(nStart < (int)m_arSubNodes.GetSize());
ASSERT(nFinish >= 0);
ASSERT(nFinish < (int)m_arSubNodes.GetSize());
double dblTotal = GetChildrenTotal(nStart, nFinish);
double x = rect.left;
double y = rect.top;
for (int i = nStart; i <= nFinish; i++)
{
CBCGPBaseTreeMapNode* pNode = m_arSubNodes[i];
if (pNode->GetValue() <= 0.0)
{
pNode->SetRect(CBCGPRect());
continue;
}
CBCGPRect rectSubNode = rect;
if (bIsVertical)
{
double cx = rect.Width() / dblTotal * pNode->GetValue();
rectSubNode.left = x;
rectSubNode.right = x + cx;
x += cx;
}
else
{
double cy = rect.Height() / dblTotal * pNode->GetValue();
rectSubNode.top = y;
rectSubNode.bottom = y + cy;
y += cy;
}
m_arSubNodes[i]->SetRect(rectSubNode);
m_arSubNodes[i]->RecalcLayout(pGM);
}
}
示例10: RecalcSliceLayout
//********************************************************************************
void CBCGPTreeMapGroup::RecalcSquarifiedLayout(CBCGPGraphicsManager* pGM, int nStart, int nFinish, const CBCGPRect& rect)
{
if (nFinish - nStart < 2)
{
RecalcSliceLayout(pGM, nStart, nFinish, rect, rect.Width() > rect.Height());
return;
}
ASSERT(nStart >= 0);
ASSERT(nStart < (int)m_arSubNodes.GetSize());
ASSERT(nFinish >= 0);
ASSERT(nFinish < (int)m_arSubNodes.GetSize());
int i = 0;
double dblTotal = GetChildrenTotal(nStart, nFinish);
double dblTotalLeft = 0.;
for (i = nStart; i <= nFinish; i++)
{
dblTotalLeft += max(0.0, m_arSubNodes[i]->GetValue());
if (dblTotalLeft >= 0.5 * dblTotal)
{
if (rect.Width() > rect.Height())
{
CBCGPRect rectLeft = rect;
rectLeft.right = rectLeft.left + rectLeft.Width() * dblTotalLeft / dblTotal;
RecalcSquarifiedLayout(pGM, nStart, i, rectLeft);
CBCGPRect rectRight = rect;
rectRight.left = rectLeft.right + 1;
RecalcSquarifiedLayout(pGM, i + 1, nFinish, rectRight);
}
else
{
CBCGPRect rectTop = rect;
rectTop.bottom = rectTop.top + rectTop.Height() * dblTotalLeft / dblTotal;
RecalcSquarifiedLayout(pGM, nStart, i, rectTop);
CBCGPRect rectBottom = rect;
rectBottom.top = rectTop.bottom + 1;
RecalcSquarifiedLayout(pGM, i + 1, nFinish, rectBottom);
}
return;
}
}
ASSERT(FALSE);
}
示例11: GetScale
//*******************************************************************************
BOOL CBCGPLinearGaugeImpl::ValueToPoint(double dblValue, CBCGPPoint& point, int nScale) const
{
CBCGPGaugeScaleObject* pScale = GetScale(nScale);
if (pScale == NULL)
{
ASSERT(FALSE);
return FALSE;
}
double dblStart = min(pScale->m_dblStart, pScale->m_dblFinish);
double dblFinish = max(pScale->m_dblStart, pScale->m_dblFinish);
if (dblValue < dblStart || dblValue > dblFinish)
{
return FALSE;
}
if (pScale->m_dblFinish == pScale->m_dblStart)
{
return FALSE;
}
CBCGPRect rect = m_rect;
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);
}
const double dblTotalSize = m_bIsVertical ? rect.Height() : rect.Width();
const double delta = dblTotalSize * fabs(dblValue - pScale->m_dblStart) / fabs(pScale->m_dblFinish - pScale->m_dblStart);
point.x = m_bIsVertical ? rect.left : rect.left + delta;
point.y = m_bIsVertical ? rect.bottom - delta : rect.top;
return TRUE;
}
示例12: 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;
}
示例13: SetRect
//********************************************************************************
void CBCGPTreeMapGroup::SetRect(const CBCGPRect& rectIn)
{
CBCGPRect rect = rectIn;
if (m_sizeMargin != CBCGPSize(-1., -1.))
{
rect.DeflateRect(m_sizeMargin);
}
else
{
for (CBCGPBaseTreeMapNode* pParent = m_pParent; pParent != NULL; pParent = pParent->m_pParent)
{
ASSERT_VALID(pParent);
if (pParent->m_sizeMargin != CBCGPSize(-1., -1.))
{
rect.DeflateRect(pParent->m_sizeMargin);
break;
}
}
}
m_rect = rect;
}
示例14: OnDraw
//*****************************************************************************************
void CBCGPTreeMap::OnDraw(CBCGPGraphicsManager* pGM, const CBCGPRect& rectClip, DWORD dwFlags)
{
if (IsDirty())
{
m_Root.RecalcLayout(pGM);
SetDirty(FALSE);
}
if ((dwFlags & BCGP_DRAW_STATIC) == 0)
{
return;
}
if (m_Root.m_arSubNodes.GetSize() > 0)
{
pGM->FillRectangle(m_rect, m_brFill);
m_Root.OnDraw(pGM, rectClip.IsRectEmpty() ? m_rect : rectClip, m_brFill);
}
}
示例15: OnCalcBoundingRect
//*******************************************************************************
CBCGPRect CBCGPChartObject::OnCalcBoundingRect()
{
if (m_pXAxis == NULL && m_pYAxis == NULL || m_coordinateMode == CM_AXIS_OUTSIDE_MARK || m_coordinateMode == CM_AXIS_INSIDE_MARK ||
m_pXAxis != NULL && !m_pXAxis->m_bInitialized)
{
return m_pParentChart->GetRect();
}
CBCGPRect rectXAxis;
CBCGPRect rectYAxis;
if (m_pXAxis != NULL)
{
rectXAxis = m_pXAxis->GetBoundingRect();
}
if (m_pYAxis != NULL)
{
rectYAxis = m_pYAxis->GetBoundingRect();
}
if (!rectXAxis.IsRectEmpty() && !rectYAxis.IsRectEmpty())
{
rectXAxis.IntersectRect(rectYAxis);
if (rectXAxis.IsRectEmpty())
{
return rectYAxis;
}
}
else if (rectXAxis.IsRectEmpty())
{
return rectYAxis;
}
return rectXAxis;
}