本文整理汇总了C++中URect::Union方法的典型用法代码示例。如果您正苦于以下问题:C++ URect::Union方法的具体用法?C++ URect::Union怎么用?C++ URect::Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URect
的用法示例。
在下文中一共展示了URect::Union方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
//---------------------------------------------------------------------------------------
int GmoCompositeShape::add(GmoShape* pShape)
{
m_components.push_back(pShape);
if (m_components.size() == 1)
{
//copy bounds
m_origin = pShape->get_origin();
m_size = pShape->get_size();
}
else
{
//TODO: Note from LenMus:
// lmCompositeShape: the selection rectangle should not be the boundling rectangle
// but each rectangle of each component shape. This will save the need to define
// specific shapes just to override selection rectangle. i.i. metronome marks
//compute new selection rectangle by union of individual selection rectangles
URect bbox = get_bounds();
bbox.Union(pShape->get_bounds());
m_origin = bbox.get_top_left();
m_size.width = bbox.get_width();
m_size.height = bbox.get_height();
}
//return index to added shape
return (int)m_components.size() - 1;
}
示例2: recompute_bounds
//---------------------------------------------------------------------------------------
void GmoCompositeShape::recompute_bounds()
{
URect bbox;
std::list<GmoShape*>::iterator it;
for (it = m_components.begin(); it != m_components.end(); ++it)
bbox.Union((*it)->get_bounds());
m_origin = bbox.get_top_left();
m_size.width = bbox.get_width();
m_size.height = bbox.get_height();
}