本文整理汇总了C++中CBCGPRect::IsRectEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPRect::IsRectEmpty方法的具体用法?C++ CBCGPRect::IsRectEmpty怎么用?C++ CBCGPRect::IsRectEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBCGPRect
的用法示例。
在下文中一共展示了CBCGPRect::IsRectEmpty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
}
示例4: 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;
//.........这里部分代码省略.........
示例5: OnDrawScale
//*******************************************************************************
void CBCGPLinearGaugeImpl::OnDrawScale(CBCGPGraphicsManager* pGM, int nScale)
{
CBCGPGaugeScaleObject* pScale = GetScale(nScale);
if (pScale == NULL)
{
ASSERT(FALSE);
return;
}
const double scaleRatio = GetScaleRatioMid();
const CBCGPBrush& brFill = pScale->m_brFill.IsEmpty() ? m_Colors.m_brScaleFill : pScale->m_brFill;
const CBCGPBrush& brOutline = pScale->m_brOutline.IsEmpty() ? m_Colors.m_brScaleOutline : pScale->m_brOutline;
if (!brFill.IsEmpty() || !brOutline.IsEmpty())
{
CBCGPRect rectRange;
CBCGPPolygonGeometry shapeRange;
if (GetRangeShape(rectRange, shapeRange,
pScale->m_dblStart, pScale->m_dblFinish,
pScale->m_dblMajorTickMarkSize, pScale->m_dblMajorTickMarkSize,
0, nScale))
{
if (!rectRange.IsRectEmpty())
{
pGM->FillRectangle(rectRange, brFill);
pGM->DrawRectangle(rectRange, brOutline, scaleRatio);
}
else
{
pGM->FillGeometry(shapeRange, brFill);
pGM->DrawGeometry(shapeRange, brOutline, scaleRatio);
}
}
}
int i = 0;
double dblStep = (pScale->m_dblFinish > pScale->m_dblStart) ? pScale->m_dblStep : -pScale->m_dblStep;
double dblMinorTickSize = pScale->m_dblMinorTickMarkSize * scaleRatio;
double dblMajorTickSize = pScale->m_dblMajorTickMarkSize * scaleRatio;
CBCGPGaugeScaleObject::BCGP_TICKMARK_POSITION position = pScale->m_MinorTickMarkPosition;
for (double dblVal = pScale->m_dblStart;
(dblStep > 0. && dblVal <= pScale->m_dblFinish) || (dblStep < 0. && dblVal >= pScale->m_dblFinish);
dblVal += dblStep, i++)
{
const BOOL bIsLastTick = (pScale->m_dblFinish > pScale->m_dblStart && dblVal + dblStep > pScale->m_dblFinish);
BOOL bIsMajorTick = pScale->m_dblMajorTickMarkStep != 0. && ((i % bcg_round(pScale->m_dblMajorTickMarkStep)) == 0);
if (!bIsMajorTick && (i == 0 || bIsLastTick))
{
// Always draw first and last ticks
bIsMajorTick = TRUE;
}
double dblCurrTickSize = bIsMajorTick ? dblMajorTickSize : dblMinorTickSize;
CBCGPPoint ptFrom;
ValueToPoint(dblVal, ptFrom, nScale);
if (!bIsMajorTick && position != CBCGPGaugeScaleObject::BCGP_TICKMARK_POSITION_NEAR &&
dblCurrTickSize < dblMajorTickSize)
{
double dblDeltaTick = dblMajorTickSize - dblCurrTickSize;
if (position == CBCGPGaugeScaleObject::BCGP_TICKMARK_POSITION_CENTER)
{
dblDeltaTick /= 2.0;
}
if (m_bIsVertical)
{
ptFrom.x += dblDeltaTick;
}
else
{
ptFrom.y += dblDeltaTick;
}
}
CBCGPPoint ptTo = ptFrom;
if (m_bIsVertical)
{
ptTo.x += dblCurrTickSize;
}
else
{
ptTo.y += dblCurrTickSize;
}
if (dblCurrTickSize > 0.)
{
OnDrawTickMark(pGM, ptFrom, ptTo,
bIsMajorTick ? pScale->m_MajorTickMarkStyle : pScale->m_MinorTickMarkStyle,
bIsMajorTick, dblVal, nScale,
bIsMajorTick ? pScale->m_brTickMarkMajor : pScale->m_brTickMarkMinor,
//.........这里部分代码省略.........
示例6: OnDraw
//*******************************************************************************
void CBCGPLinearGaugeImpl::OnDraw(CBCGPGraphicsManager* pGMSrc, const CBCGPRect& /*rectClip*/, DWORD dwFlags/* = BCGP_DRAW_STATIC | BCGP_DRAW_DYNAMIC*/)
{
ASSERT_VALID(this);
ASSERT_VALID(pGMSrc);
if (m_rect.IsRectEmpty() || !m_bIsVisible)
{
return;
}
BOOL bCacheImage = m_bCacheImage;
if (pGMSrc->IsOffscreen())
{
bCacheImage = FALSE;
}
CBCGPGraphicsManager* pGM = pGMSrc;
CBCGPGraphicsManager* pGMMem = NULL;
CBCGPRect rectSaved;
if (bCacheImage)
{
if (m_ImageCache.GetHandle() == NULL)
{
SetDirty();
}
if (m_ImageCache.GetHandle() != NULL && !IsDirty() && (dwFlags & BCGP_DRAW_STATIC))
{
pGMSrc->DrawImage(m_ImageCache, m_rect.TopLeft());
dwFlags &= ~BCGP_DRAW_STATIC;
if (dwFlags == 0)
{
return;
}
}
if (dwFlags & BCGP_DRAW_STATIC)
{
pGMMem = pGM->CreateOffScreenManager(m_rect, &m_ImageCache);
if (pGMMem != NULL)
{
pGM = pGMMem;
rectSaved = m_rect;
m_rect = m_rect - m_rect.TopLeft();
}
}
}
if (IsDirty())
{
int i = 0;
for (i = 0; i < m_arScales.GetSize(); i++)
{
CBCGPGaugeScaleObject* pScale = m_arScales[i];
ASSERT_VALID(pScale);
pScale->CleanUp();
}
SetDirty(FALSE);
}
CBCGPRect rect = m_rect;
rect.DeflateRect(1., 1.);
const double scaleRatio = GetScaleRatioMid();
const double nFrameSize = m_nFrameSize * scaleRatio;
if (dwFlags & BCGP_DRAW_STATIC)
{
const CBCGPBrush& brFill = m_nFrameSize <= 2 ? m_Colors.m_brFill : m_Colors.m_brFrameFill;
pGM->FillRectangle(rect, brFill);
pGM->DrawRectangle(rect, m_Colors.m_brFrameOutline, scaleRatio);
if (scaleRatio == 1.0 && !pGM->IsSupported(BCGP_GRAPHICS_MANAGER_ANTIALIAS))
{
CBCGPRect rect1 = rect;
rect1.DeflateRect(1, 1);
pGM->DrawRectangle(rect1, m_Colors.m_brFrameOutline);
}
if (m_nFrameSize > 2)
{
CBCGPRect rectInternal = rect;
rectInternal.DeflateRect(nFrameSize, nFrameSize);
pGM->FillRectangle(rectInternal, m_Colors.m_brFill);
pGM->DrawRectangle(rectInternal, m_Colors.m_brFrameOutline, scaleRatio);
}
//.........这里部分代码省略.........
示例7: DoPaint
//***********************************************************************************************************
void CBCGPBaseVisualCtrl::DoPaint(CDC* pDC, CRect rectClip)
{
CRect rectClient;
GetClientRect(rectClient);
m_bInPaint = TRUE;
pDC->FillRect(rectClient, &globalData.brWindow);
globalData.DrawParentBackground (this, pDC);
CBCGPRect rect = GetRect();
if (m_pGM == NULL)
{
m_pGM = CBCGPGraphicsManager::CreateInstance();
}
if (m_pGM == NULL)
{
m_bInPaint = FALSE;
return;
}
if (rect.IsRectEmpty())
{
CRect rectClient;
GetClientRect(rectClient);
SetRect(rectClient);
rect = GetRect();
}
m_pGM->BindDC(pDC, rect);
if (m_dblScale != 0.0 && m_pGM->IsSupported(BCGP_GRAPHICS_MANAGER_SCALING))
{
m_pGM->SetScale(m_dblScale);
}
if (!m_pGM->BeginDraw())
{
return;
}
BOOL bSetClipRect = FALSE;
if (rectClip.IsRectEmpty())
{
rectClip = rect;
}
else
{
bSetClipRect = TRUE;
m_pGM->SetClipRect(rectClip);
}
OnDraw(m_pGM, rectClip);
if (bSetClipRect)
{
m_pGM->ReleaseClipArea();
}
SetDirty(FALSE);
m_pGM->EndDraw();
m_bInPaint = FALSE;
}