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


C++ HeeksObj::GetColor方法代码示例

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


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

示例1: wxGetApp

static void	WriteSolids(std::wofstream &ofs)
{

	std::set<int> stock_ids;
	wxGetApp().m_program->Stocks()->GetSolidIds(stock_ids);
	for(std::set<int>::iterator It = stock_ids.begin(); It != stock_ids.end(); It++)
	{
		int id = *It;
		HeeksObj* object = wxGetApp().GetIDObject(SolidType, id);
		if(object)
		{
			CBox box;
			object->GetBox(box);
			ofs<<"voxelcut.set_current_color("<<object->GetColor()->COLORREF_color()<<")\n";
			double c[3];
			box.Centre(c);
			ofs<<"toolpath.coords.add_block("<<c[0]<<", "<<c[1]<<", "<<box.MinZ()<<", "<<box.Width()<<", "<<box.Height()<<", "<<box.Depth()<<")\n";
		}
	}
}
开发者ID:play113,项目名称:swer,代码行数:20,代码来源:Simulate.cpp

示例2: FilletOrChamferEdges

void CShape::FilletOrChamferEdges(std::list<HeeksObj*> &list, double radius, bool chamfer_not_fillet)
{
	// make a map with a list of edges for each solid
	std::map< HeeksObj*, std::list< HeeksObj* > > solid_edge_map;

	for(std::list<HeeksObj*>::const_iterator It = list.begin(); It != list.end(); It++){
		HeeksObj* edge = *It;
		if(edge->GetType() == EdgeType)
		{
			HeeksObj* solid = edge->HEEKSOBJ_OWNER->HEEKSOBJ_OWNER;
			if(solid && solid->GetType() == SolidType)
			{
				std::map< HeeksObj*, std::list< HeeksObj* > >::iterator FindIt = solid_edge_map.find(solid);
				if(FindIt == solid_edge_map.end())
				{
					std::list< HeeksObj* > empty_list;
					solid_edge_map.insert( make_pair(solid, empty_list) );
					FindIt = solid_edge_map.find(solid);
				}

				std::list< HeeksObj* > &list = FindIt->second;
				list.push_back(edge);
			}
		}
	}

	// do each solid
	for(std::map< HeeksObj*, std::list< HeeksObj* > >::iterator It = solid_edge_map.begin(); It != solid_edge_map.end(); It++)
	{
		HeeksObj* solid = It->first;
		std::list< HeeksObj* > &list = It->second;

		try{
			if(chamfer_not_fillet)
			{
				BRepFilletAPI_MakeChamfer chamfer(((CShape*)solid)->Shape());
				for(std::list< HeeksObj* >::iterator It2 = list.begin(); It2 != list.end(); It2++)
				{
					CEdge* edge = (CEdge*)(*It2);
					for(CFace* face = (CFace*)(edge->GetFirstFace()); face; face = (CFace*)(edge->GetNextFace()))
					{
						chamfer.Add(radius, TopoDS::Edge(edge->Edge()), TopoDS::Face(face->Face()));
					}
				}
				TopoDS_Shape new_shape = chamfer.Shape();
				wxGetApp().Add(new CSolid(*((TopoDS_Solid*)(&new_shape)), _("Solid with edge blend"), *(solid->GetColor()), ((CShape*)solid)->m_opacity), NULL);
				wxGetApp().Remove(solid);
			}
			else
			{
				BRepFilletAPI_MakeFillet fillet(((CShape*)solid)->Shape());
				for(std::list< HeeksObj* >::iterator It2 = list.begin(); It2 != list.end(); It2++)
				{
					fillet.Add(radius, TopoDS::Edge(((CEdge*)(*It2))->Edge()));
				}
				TopoDS_Shape new_shape = fillet.Shape();
				wxGetApp().Add(new CSolid(*((TopoDS_Solid*)(&new_shape)), _("Solid with edge blend"), *(solid->GetColor()), ((CShape*)solid)->m_opacity), NULL);
				wxGetApp().Remove(solid);
			}
		}
		catch (Standard_Failure) {
			Handle_Standard_Failure e = Standard_Failure::Caught();
			wxMessageBox(wxString(_("Error making fillet")) + _T(": ") + Ctt(e->GetMessageString()));
		}
		catch(...)
		{
			wxMessageBox(_("A fatal error happened during Blend"));
		}
	}

	wxGetApp().Repaint();
}
开发者ID:JonasThomas,项目名称:heekscad,代码行数:72,代码来源:Shape.cpp


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