当前位置: 首页>>代码示例>>C++>>正文


C++ CGroup::GetFirstChild方法代码示例

本文整理汇总了C++中CGroup::GetFirstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ CGroup::GetFirstChild方法的具体用法?C++ CGroup::GetFirstChild怎么用?C++ CGroup::GetFirstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGroup的用法示例。


在下文中一共展示了CGroup::GetFirstChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CutShapes

HeeksObj* CShape::CutShapes(std::list<HeeksObj*> &list_in, bool dodelete)
{
	if(list_in.front()->GetType() == GroupType)
	{
		CGroup* group = (CGroup*)list_in.front();
		CGroup* newgroup = new CGroup();
		group->HEEKSOBJ_OWNER->Add(newgroup,NULL);

		std::list<HeeksObj*> children;
		HeeksObj* child = group->GetFirstChild();
		while(child)
		{
			children.push_back(child);
			child = group->GetNextChild();
		}

		std::list<HeeksObj*>::iterator iter = children.begin();
		while(iter != children.end())
		{
			std::list<HeeksObj*> newlist;
			std::list<HeeksObj*>::const_iterator it = list_in.begin();
			while(it!=list_in.end())
			{
				newlist.push_back(*it);
				++it;
			}
			newlist.pop_front();
			newlist.push_front(*iter);
			HeeksObj* newshape = CutShapes(newlist,false);
			newshape->HEEKSOBJ_OWNER->Remove(newshape);
			newgroup->Add(newshape,NULL);
			++iter;
		}

		group->HEEKSOBJ_OWNER->Remove(group);
		wxGetApp().Remove(list_in);
		return newgroup;
	}

	// subtract from the first one in the list all the others
	std::list<TopoDS_Shape> shapes;
	std::list<HeeksObj*> delete_list;
	HeeksObj* first_solid = NULL;

	for(std::list<HeeksObj*>::const_iterator It = list_in.begin(); It != list_in.end(); It++){
		HeeksObj* object = *It;
		if(object->GetType() == SolidType)
		{
			shapes.push_back(((CSolid*)object)->Shape());
			if(first_solid == NULL)first_solid = object;
			delete_list.push_back(object);
		}
		else if(object->GetType() == FaceType)
		{
			shapes.push_back(((CFace*)object)->Face());
			if(first_solid == NULL)first_solid = object;
			delete_list.push_back(object);
		}
	}

	TopoDS_Shape new_shape;
	if(Cut(shapes, new_shape))
	{
		HeeksObj* new_object = CShape::MakeObject(new_shape, _("Result of Cut Operation"), SOLID_TYPE_UNKNOWN, ((CShape*)first_solid)->m_color, ((CShape*)first_solid)->m_opacity);
		wxGetApp().Add(new_object, NULL);
		if(dodelete)
		{
			wxGetApp().Remove(delete_list);
			wxGetApp().Repaint();
		}
		return new_object;
	}
	return first_solid;
}
开发者ID:JonasThomas,项目名称:heekscad,代码行数:74,代码来源:Shape.cpp


注:本文中的CGroup::GetFirstChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。