本文整理汇总了C++中CBCGPRect::Height方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPRect::Height方法的具体用法?C++ CBCGPRect::Height怎么用?C++ CBCGPRect::Height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBCGPRect
的用法示例。
在下文中一共展示了CBCGPRect::Height方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HitTestShape
//***************************************************************************************
int CBCGPRadialMenuObject::HitTestShape(const CBCGPPoint& pt)
{
CBCGPRect rect = m_rect;
if (rect.Width() < rect.Height())
{
rect.top += (rect.Height() - rect.Width()) / 2;
rect.bottom = rect.top + rect.Width();
}
else if (rect.Height() < rect.Width())
{
rect.left += (rect.Width() - rect.Height()) / 2;
rect.right = rect.left + rect.Height();
}
rect.DeflateRect(2., 2.);
rect.right -= m_nShadowDepth;
rect.bottom -= m_nShadowDepth;
const double radius = rect.Width() / 2;
const double radiusSmall = INTERNAL_PART * rect.Width() + 1.0;
const CBCGPPoint center = rect.CenterPoint();
double dblDistanceToCenter = bcg_distance(pt, center);
if (dblDistanceToCenter > radius)
{
return -1;
}
const int nItems = (int)m_arItems.GetSize();
if (dblDistanceToCenter <= radiusSmall)
{
return m_bHasCenterButton ? nItems - 1 : -1;
}
const int nCircleItems = m_bHasCenterButton ? nItems - 1 : nItems;
if (nCircleItems == 0)
{
return -1;
}
double dblDeltaAngle = 360. / nCircleItems;
double dblStartAngle = 90. - dblDeltaAngle / 2;
double dblAngle = bcg_normalize_deg(bcg_rad2deg(acos((pt.x - center.x) / dblDistanceToCenter)));
if (pt.y > center.y)
{
dblAngle = 360 - dblAngle;
}
int nHit = (int)((dblAngle - dblStartAngle) / dblDeltaAngle);
if (dblAngle < dblStartAngle)
{
nHit = nCircleItems - 1 - (int)((dblStartAngle - dblAngle) / dblDeltaAngle);
}
return nHit;
}
示例2: RecalcSquarifiedLayout
//********************************************************************************
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);
}
示例3: OnDrawTickMarkTextLabel
//*******************************************************************************
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));
}
示例4: 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;
}
示例5: DrawTextWidthShadow
void CBCGPBaseTreeMapNode::DrawTextWidthShadow(CBCGPGraphicsManager* pGM, const CString& str, const CBCGPRect& rect, const CBCGPBrush& br, const CBCGPTextFormat& tf)
{
ASSERT_VALID(pGM);
CBCGPSize sizeText = pGM->GetTextSize(str, tf);
if (sizeText.cx > rect.Width() || sizeText.cy > rect.Height())
{
return;
}
CBCGPRect rectShadow = rect;
rectShadow.OffsetRect(1, 1);
pGM->DrawText(str, rectShadow, tf, CBCGPBrush(CBCGPColor::Black));
pGM->DrawText(str, rect, tf, br);
}
示例6: RecalcSliceLayout
//********************************************************************************
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);
}
}
示例7: ValueToPoint
//*******************************************************************************
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;
}
示例8: 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;
}
示例9: OnDraw
//***************************************************************************************
void CBCGPRadialMenuObject::OnDraw(CBCGPGraphicsManager* pGM, const CBCGPRect& /*rectClip*/, DWORD dwFlags)
{
if (dwFlags == BCGP_DRAW_STATIC)
{
return;
}
m_nShadowDepth = pGM->IsSupported(BCGP_GRAPHICS_MANAGER_COLOR_OPACITY) ? GetShadowDepth() : 0;
CBCGPRect rect = m_rect;
if (rect.Width() < rect.Height())
{
rect.top += (rect.Height() - rect.Width()) / 2;
rect.bottom = rect.top + rect.Width();
}
else if (rect.Height() < rect.Width())
{
rect.left += (rect.Width() - rect.Height()) / 2;
rect.right = rect.left + rect.Height();
}
rect.DeflateRect(2., 2.);
rect.right -= m_nShadowDepth;
rect.bottom -= m_nShadowDepth;
const double radius = rect.Width() / 2;
const double radiusSmall = INTERNAL_PART * rect.Width() + 1.0;
const CBCGPPoint center = rect.CenterPoint();
CBCGPSize sizeIcon((double)m_cxIcon, 16);
if (!m_Icons.IsNull())
{
sizeIcon.cy = pGM->GetImageSize(m_Icons).cy;
}
const int nItems = (int)m_arItems.GetSize();
if (IsDirty())
{
int nCircleItems = m_bHasCenterButton ? nItems - 1 : nItems;
double dblDeltaAngle = nCircleItems == 0 ? 0. : 360. / nCircleItems;
double dblStartAngle = 90. - dblDeltaAngle / 2;
for (int i = 0; i < nItems; i++)
{
CBCGPRadialMenuItem* pItem = m_arItems[i];
ASSERT_VALID(pItem);
pItem->m_bIsCenter = i == nItems -1 && m_bHasCenterButton;
pItem->m_Shape.Destroy();
pItem->m_Shape.Clear();
if (!pItem->m_bIsCenter)
{
double dblFinishAngle = dblStartAngle + dblDeltaAngle;
const double dblStartAngleRad = bcg_deg2rad(dblStartAngle);
const double dblFinishAngleRad = bcg_deg2rad(dblFinishAngle);
const double dblMiddleAngleRad = bcg_deg2rad(dblStartAngle + dblDeltaAngle / 2);
double angleStartCos = cos(dblStartAngleRad);
double angleStartSin = sin(dblStartAngleRad);
double angleFinishCos = cos(dblFinishAngleRad);
double angleFinishSin = sin(dblFinishAngleRad);
pItem->m_Shape.SetStart(
CBCGPPoint(center.x + angleStartCos * radius, center.y - angleStartSin * radius));
pItem->m_Shape.AddArc(
CBCGPPoint(center.x + angleFinishCos * radius, center.y - angleFinishSin * radius),
CBCGPSize(radius, radius), dblStartAngle > dblFinishAngle, FALSE);
pItem->m_Shape.AddLine(
CBCGPPoint(center.x + angleFinishCos * radiusSmall, center.y - angleFinishSin * radiusSmall));
pItem->m_Shape.AddArc(
CBCGPPoint(center.x + angleStartCos * radiusSmall, center.y - angleStartSin * radiusSmall),
CBCGPSize(radiusSmall, radiusSmall), dblStartAngle < dblFinishAngle, FALSE);
pItem->m_ptCenter = CBCGPPoint(
center.x + cos(dblMiddleAngleRad) * 2 * radius / 3,
center.y - sin(dblMiddleAngleRad) * 2 * radius / 3);
dblStartAngle = dblFinishAngle;
}
else
{
pItem->m_Shape.SetStart(center);
pItem->m_Shape.AddLine(center);
pGM->CombineGeometry(pItem->m_Shape, pItem->m_Shape, CBCGPEllipseGeometry(CBCGPEllipse(center, radiusSmall, radiusSmall)), RGN_OR);
pItem->m_ptCenter = center;
}
}
}
CBCGPEllipse ellipseInt(center, radiusSmall, radiusSmall);
//.........这里部分代码省略.........
示例10: OnCalcScreenPoints
//*******************************************************************************
void CBCGPChartObject::OnCalcScreenPoints(CBCGPGraphicsManager* pGM)
{
ASSERT_VALID(this);
m_rectScreen.SetRectEmpty();
m_rectScreenBounds.SetRectEmpty();
m_ptAnchor.x = m_ptAnchor.y = 0.;
if (m_pParentChart == NULL)
{
return;
}
CBCGPSize szScaleRatio = m_pParentChart->GetScaleRatio();
CBCGPChartAxis* pXAxis = m_pXAxis;
CBCGPChartAxis* pYAxis = m_pYAxis;
if (m_coordinateMode == CBCGPChartObject::CM_CHART_VALUES ||
m_coordinateMode == CBCGPChartObject::CM_CHART_VALUE_DIST_ANGLE ||
m_coordinateMode == CBCGPChartObject::CM_AXIS_INSIDE_MARK ||
m_coordinateMode == CBCGPChartObject::CM_AXIS_OUTSIDE_MARK)
{
if (pXAxis == NULL)
{
m_pXAxis = pXAxis = m_pParentChart->GetChartAxis(BCGP_CHART_X_PRIMARY_AXIS);
}
if (pYAxis == NULL)
{
m_pYAxis = pYAxis = m_pParentChart->GetChartAxis(BCGP_CHART_Y_PRIMARY_AXIS);
}
}
CBCGPSize szObjectSize = m_szObjectSize.IsNull() ? OnCalcObjectSize(pGM) : m_szObjectSize;
m_rectScreenBounds = OnCalcBoundingRect();
CBCGPRect rectBounds = m_rectScreenBounds;
CBCGPPoint ptLeftTop(CBCGPChartObject::_EmptyPoint);
CBCGPPoint ptRightBottom(CBCGPChartObject::_EmptyPoint);
if (m_coordinateMode == CBCGPChartObject::CM_PERCENTS)
{
if (m_rectCoordinates.left != CBCGPChartObject::_EmptyCoordinate)
{
ptLeftTop.x = rectBounds.left + rectBounds.Width() * m_rectCoordinates.left / 100.;
}
if (m_rectCoordinates.top != CBCGPChartObject::_EmptyCoordinate)
{
ptLeftTop.y = rectBounds.top + rectBounds.Height() * m_rectCoordinates.top / 100;
}
if (m_rectCoordinates.right != CBCGPChartObject::_EmptyCoordinate)
{
ptRightBottom.x = rectBounds.right - rectBounds.Width() * m_rectCoordinates.right / 100.;
}
if (m_rectCoordinates.bottom != CBCGPChartObject::_EmptyCoordinate)
{
ptRightBottom.y = rectBounds.bottom - rectBounds.Height() * m_rectCoordinates.bottom / 100.;
}
}
else if (m_coordinateMode == CBCGPChartObject::CM_PIXELS)
{
if (m_rectCoordinates.left != CBCGPChartObject::_EmptyCoordinate)
{
ptLeftTop.x = rectBounds.left + m_rectCoordinates.left * szScaleRatio.cx;
}
if (m_rectCoordinates.top != CBCGPChartObject::_EmptyCoordinate)
{
ptLeftTop.y = rectBounds.top + m_rectCoordinates.top * szScaleRatio.cy;
}
if (m_rectCoordinates.right != CBCGPChartObject::_EmptyCoordinate)
{
ptRightBottom.x = rectBounds.right - m_rectCoordinates.right * szScaleRatio.cx;
}
if (m_rectCoordinates.bottom != CBCGPChartObject::_EmptyCoordinate)
{
ptRightBottom.y = rectBounds.bottom - m_rectCoordinates.bottom * szScaleRatio.cy;
}
}
else if (m_coordinateMode == CBCGPChartObject::CM_PIXELS_FIXED_SIZE)
{
if (m_rectCoordinates.left != CBCGPChartObject::_EmptyCoordinate)
{
ptLeftTop.x = rectBounds.left + m_rectCoordinates.left * szScaleRatio.cx;
}
else
{
ptLeftTop.x = rectBounds.left;
}
if (m_rectCoordinates.top != CBCGPChartObject::_EmptyCoordinate)
//.........这里部分代码省略.........