本文整理汇总了C++中Collector::checkClosed方法的典型用法代码示例。如果您正苦于以下问题:C++ Collector::checkClosed方法的具体用法?C++ Collector::checkClosed怎么用?C++ Collector::checkClosed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collector
的用法示例。
在下文中一共展示了Collector::checkClosed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find_connecting
CollectorArray::iterator find_connecting( CollectorArray::iterator& target, CollectorArray& input )
{
CollectorArray::iterator ret = input.end();
Collector* pp = *target;
if ( pp->checkClosed() ) {
return ret;
}
if (overlap( pp->_points.back(), pp->_points.front() ) ) {
// poly2tri only accept polyline with non repeating points
pp->_points.pop_back();
pp->_closed = true;
return ret;
}
// Look for another unclosed path of the same style,
// which could join our begin or end point.
for (CollectorArray::iterator it = input.begin(); it != input.end(); ++it) {
Collector* po = (*it);
if ( pp == po )
continue;
if ( po->checkClosed() )
continue;
// Can we join?
PointDataArray::iterator pStart = pp->_points.begin();
PointDataArray::iterator oStart = po->_points.begin();
if (overlap( *oStart, pp->_points.back() ) ) {
// Yes, po can be appended to pp.
pp->_points.insert( pp->_points.end(), ++oStart, po->_points.end());
po->_right_style = Path::kINVALID;
MergeRectangle(pp->_bound, po->_bound);
ret = it; // remove this iterator and restart
return ret;
} else if (overlap( *pStart, po->_points.back() ) ) {
// Yes, pp can be appended to po.
po->_points.insert( po->_points.end(), ++pStart, pp->_points.end());
pp->_right_style = Path::kINVALID;
MergeRectangle(po->_bound, pp->_bound);
ret = target; // remove this iterator and restart
return ret;
}
}
return ret;
}