本文整理汇总了C++中MgShape::release方法的典型用法代码示例。如果您正苦于以下问题:C++ MgShape::release方法的具体用法?C++ MgShape::release怎么用?C++ MgShape::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MgShape
的用法示例。
在下文中一共展示了MgShape::release方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eraseWnd
void MgCmdManagerImpl::eraseWnd(const MgMotion* sender)
{
Box2d snap(sender->view->xform()->getWndRectM());
std::vector<int> delIds;
void *it = NULL;
MgShapes* s = sender->view->shapes();
for (MgShape* shape = s->getFirstShape(it); shape; shape = s->getNextShape(it)) {
if (shape->shape()->hitTestBox(snap)) {
delIds.push_back(shape->getID());
}
}
s->freeIterator(it);
if (!delIds.empty()
&& sender->view->shapeWillDeleted(s->findShape(delIds.front()))) {
MgShapesLock locker(MgShapesLock::Remove, sender->view);
for (std::vector<int>::iterator i = delIds.begin(); i != delIds.end(); ++i) {
MgShape* shape = s->findShape(*i);
if (shape && sender->view->removeShape(shape)) {
shape->release();
}
}
sender->view->regenAll();
}
}
示例2: touchEnded
bool MgCmdErase::touchEnded(const MgMotion* sender)
{
MgShapes* s = sender->view->shapes();
if (!m_delIds.empty()
&& sender->view->shapeWillDeleted(s->findShape(m_delIds.front()))) {
MgShapesLock locker(s, MgShapesLock::Remove);
int count = 0;
for (std::vector<int>::iterator it = m_delIds.begin(); it != m_delIds.end(); ++it) {
MgShape* shape = s->findShape(*it);
if (shape && sender->view->removeShape(shape)) {
shape->release();
count++;
}
}
if (count > 0) {
sender->view->regen();
}
}
m_delIds.clear();
m_boxsel = false;
sender->view->redraw(false);
return true;
}
示例3: click
bool MgCmdErase::click(const MgMotion* sender)
{
MgShape* shape = hitTest(sender);
if (shape && sender->view->shapeWillDeleted(shape)) {
MgShapesLock locker(sender->view->shapes(), MgShapesLock::Remove);
if (sender->view->removeShape(shape)) {
shape->release();
sender->view->regen();
}
}
return true;
}