本文整理汇总了C++中DocRect::Union方法的典型用法代码示例。如果您正苦于以下问题:C++ DocRect::Union方法的具体用法?C++ DocRect::Union怎么用?C++ DocRect::Union使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocRect
的用法示例。
在下文中一共展示了DocRect::Union方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoScrollRedraw
void LibraryFile::DoScrollRedraw(void)
{
// Scroll / redraw the newly added groups...
if(FirstLibraryAdded != NULL && LastLibraryAdded != NULL)
{
SGLibGroup *FirstGroup = FirstLibraryAdded->ParentGroup;
SGLibGroup *SecondGroup = LastLibraryAdded->ParentGroup;
if(FirstGroup != NULL && SecondGroup != NULL)
{
// Redraw whatever we need to and reformat the gallery ready for poking...
ParentGallery->ReformatAndRedrawIfNecessary();
// Calculate where the new folders are...
DocRect ScrollToRect;
FirstGroup->GetFormatRect(&ScrollToRect);
if(SecondGroup != FirstGroup)
{
DocRect TempRect;
FirstGroup->GetFormatRect(&TempRect);
ScrollToRect = ScrollToRect.Union(TempRect);
}
// Actually do the scroll...
ParentGallery->ScrollToShow(&ScrollToRect, TRUE);
}
}
}
示例2: GetBlobBoundingRect
DocRect NodeSimpleShape::GetBlobBoundingRect()
{
#if !defined(EXCLUDE_FROM_RALPH)
// Find the Shapes bounding rectangle
DocRect Rect = GetBoundingRect();
// Find the blob manager
BlobManager* pBlobMgr = GetApplication()->GetBlobManager();
// And if we can find the current view, add on the size of a selection blob
if (pBlobMgr!= NULL)
{
// Wee need to add in each of the blobs. there is a blob on each corner
// of the parallelogram
DocRect BlobSize;
pBlobMgr->GetBlobRect(Parallel[0], &BlobSize);
Rect = Rect.Union(BlobSize);
// Next corner of the parallelogram
pBlobMgr->GetBlobRect(Parallel[1], &BlobSize);
Rect = Rect.Union(BlobSize);
// and the next
pBlobMgr->GetBlobRect(Parallel[2], &BlobSize);
Rect = Rect.Union(BlobSize);
// and the last one
pBlobMgr->GetBlobRect(Parallel[3], &BlobSize);
Rect = Rect.Union(BlobSize);
}
// Make sure we include the Bounds of our children
IncludeChildrensBoundingRects(&Rect);
// return the rectangle with the blobs included
return Rect;
#else
return DocRect(0,0,0,0);
#endif
}
示例3: MutateFill
AttrFillGeometry* FillGeometryNudger::MutateFill(AttrFillGeometry* FillToMutate)
{
if (!FillToMutate->IsVisible() ||
FillToMutate->GetSelectionCount() == 0)
return NULL;
// Make a copy of this Fill to change
AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
if (NewFill == NULL)
return NULL;
// Construct the translation matrix
Trans2DMatrix TransMat(X_NudgeDistance, Y_NudgeDistance);
BOOL isARampBlob = FALSE;
// And apply it to the fill
NewFill->TransformSelectedControlPoints(TransMat, &isARampBlob);
if (LastNudgeType == FillToMutate->GetRuntimeClass())
{
BOOL IsSame = TRUE;
if (FillToMutate->GetStartPoint() &&
*FillToMutate->GetStartPoint() != LastNudgeStart)
IsSame = FALSE;
if (FillToMutate->GetEndPoint() &&
*FillToMutate->GetEndPoint() != LastNudgeEnd)
IsSame = FALSE;
if (FillToMutate->GetEndPoint2() &&
*FillToMutate->GetEndPoint2() != LastNudgeEnd2)
IsSame = FALSE;
if (IsSame)
return NewFill;
}
Node *pNode = FillToMutate;
while ((pNode != NULL) && !pNode->IsSpread())
pNode = pNode->FindParent();
if (pNode == NULL)
return NewFill; // We're not really in the tree
Spread* pSpread = (Spread*)pNode;
DocRect OldBounds = FillToMutate->GetBlobBoundingRect();
DocRect NewBounds = NewFill->GetBlobBoundingRect();
DocRect Bounds = OldBounds.Union(NewBounds);
RenderRegion* pRegion = DocView::RenderOnTop(&Bounds, pSpread, UnclippedEOR);
while (pRegion)
{
if (!isARampBlob)
{
// MUST do a full redraw of the fill blobs
FillToMutate->RenderFillBlobs(pRegion);
NewFill->RenderFillBlobs(pRegion);
}
else
{
FillToMutate->DisableRampRedraw ();
FillToMutate->RenderFillBlobs(pRegion);
FillToMutate->EnableRampRedraw ();
NewFill->DisableRampRedraw ();
NewFill->RenderFillBlobs(pRegion);
NewFill->EnableRampRedraw ();
}
// Get the Next render region
pRegion = DocView::GetNextOnTop(&Bounds);
}
AttrFillGeometry::LastRenderedMesh = NULL;
LastNudgeType = FillToMutate->GetRuntimeClass();
if (FillToMutate->GetStartPoint())
LastNudgeStart = *FillToMutate->GetStartPoint();
if (FillToMutate->GetEndPoint())
LastNudgeEnd = *FillToMutate->GetEndPoint();
if (FillToMutate->GetEndPoint2())
LastNudgeEnd2 = *FillToMutate->GetEndPoint2();
return NewFill;
}
示例4: DoWithParam
void OpAlign::DoWithParam(OpDescriptor* pOp, OpParam* pAlignParam)
{
// DMc alterations so that this works with compound nodes
SelRange Selection(*(GetApplication()->FindSelection()));
RangeControl rg = Selection.GetRangeControlFlags();
rg.PromoteToParent = TRUE;
Selection.Range::SetRangeControl(rg);
DocRect SelRect = Selection.GetBoundingRect();
DocRect TargetRect;
TargetRect.MakeEmpty();
INT32 NumObjs = Selection.Count();
AlignParam* pAlign =(AlignParam*)pAlignParam;
BOOL moved=FALSE; // set to TRUE if any object is moved
BeginSlowJob(-1,FALSE);
BOOL OK=DoStartTransOp(FALSE);
// find parent spread of first object in selection
Node* pFirstNode=NULL;
Spread* pSpread =NULL;
if (OK)
{
pFirstNode=Selection.FindFirst();
if (pFirstNode!=NULL)
pSpread=pFirstNode->FindParentSpread();
OK=(pSpread!=NULL);
if (!OK)
ERROR2RAW("OpAlign::DoWithParam() - could not find parent spread");
}
// Find the size of the target rectangle
if (pAlign->target==ToSelection)
TargetRect=SelRect;
else
{
Page* pPage=pSpread->FindFirstPageInSpread();
while (pPage)
{
DocRect PageRect=pPage->GetPageRect();
if (pAlign->target==ToSpread || SelRect.IsIntersectedWith(PageRect))
TargetRect=TargetRect.Union(PageRect);
pPage=pPage->FindNextPage();
}
}
// allocate all dynamic memory required
Node** pObj=NULL;
ObjInfo* x =NULL;
ObjInfo* y =NULL;
INT32* dx =NULL;
INT32* dy =NULL;
if (OK) ALLOC_WITH_FAIL(pObj,(Node**) CCMalloc(NumObjs*sizeof(Node*)), this);
if (pObj!=NULL) ALLOC_WITH_FAIL(x, (ObjInfo*)CCMalloc(NumObjs*sizeof(ObjInfo)),this);
if ( x!=NULL) ALLOC_WITH_FAIL(y, (ObjInfo*)CCMalloc(NumObjs*sizeof(ObjInfo)),this);
if ( y!=NULL) ALLOC_WITH_FAIL(dx, (INT32*) CCMalloc(NumObjs*sizeof(INT32)), this);
if ( dx!=NULL) ALLOC_WITH_FAIL(dy, (INT32*) CCMalloc(NumObjs*sizeof(INT32)), this);
OK=(dy!=NULL);
// if memory claimed OK and target rect not empty proceed with op
// (ie. do nothing if 'within page(s)' when no object on a page)
DocRect EmptyRect;
if (OK && TargetRect!=EmptyRect)
{
// create an array of pointers to objects (nodes) to be affected
Node* pNode=Selection.FindFirst();
INT32 i=0;
while (pNode!=NULL)
{
if (pNode->IsBounded() && !((NodeRenderableBounded*)pNode)->GetBoundingRect(TRUE).IsEmpty())
pObj[i++]=pNode;
pNode=Selection.FindNext(pNode);
}
NumObjs=i;
// cache x & y info in separate arrays so they can be sorted separately
XLONG SumObjWidths =0;
XLONG SumObjHeights=0;
for (i=0; i<NumObjs; i++)
{
DocRect ObjRect=((NodeRenderableBounded*)pObj[i])->GetBoundingRect();
x[i].i=i;
x[i].lo=ObjRect.lo.x;
x[i].hi=ObjRect.hi.x;
SumObjWidths+=ObjRect.hi.x-ObjRect.lo.x;
y[i].i=i;
y[i].lo=ObjRect.lo.y;
y[i].hi=ObjRect.hi.y;
SumObjHeights+=ObjRect.hi.y-ObjRect.lo.y;
}
// for each object, calculate the x and y displacements independently
AlignOneAxis(pAlign->h,NumObjs,SumObjWidths, TargetRect.lo.x,TargetRect.hi.x,x,dx);
AlignOneAxis(pAlign->v,NumObjs,SumObjHeights,TargetRect.lo.y,TargetRect.hi.y,y,dy);
// apply the x and y displacements simultaneously to each object
for (i=0; i<NumObjs; i++)
if (dx[i]!=0 || dy[i]!=0)
{
//.........这里部分代码省略.........