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


C++ Primitive::getSelectedCurveCenter方法代码示例

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


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

示例1: mousePressEvent

void Scene::mousePressEvent( QMouseEvent* e )
{
	// Regular behavior
	QGLViewer::mousePressEvent(e);

	if ((e->button() == Qt::RightButton) && (e->modifiers() == Qt::ShiftModifier))
	{
		QMenu menu( this );

		QAction* selectControllerAction = menu.addAction("Select controller");
		QAction* selectCurveAction = menu.addAction("Select curve");
		menu.addSeparator();

		QAction* action = NULL;

		/*switch (selectMode){
			case CONTROLLER:
			case CONTROLLER_ELEMENT:
				if(selection.isEmpty()){
					print("Please select some controllers.");
					break;
				}*/

				Controller * ctrl = (Controller *)activeObject()->ptr["controller"];

				QAction* symmGrp = menu.addAction("Create Symmetry group..");
				QAction* concentricGrp = menu.addAction("Create Concentric group..");
				QAction* coplanGrp = menu.addAction("Create Coplanar group..");
				menu.addSeparator();
				QAction* self1foldSymm = menu.addAction("Create 1-fold Self-Symmetry..");
				QAction* self2foldSymm = menu.addAction("Create 2-fold Self-Symmetry..");
				menu.addSeparator();
				QAction* addFixedPoint = menu.addAction("Add fixed Point");

				// == Deformer stuff ===
				menu.addSeparator();
				QAction* selectFFD = menu.addAction("FFD");
				QAction* selectVoxelDeformer = menu.addAction("Voxel Deformer");
				// == end deformer ===

				// == Primitive geometry stuff ==
				menu.addSeparator();
				QMenu & mesh_menu			= *menu.addMenu("Modify geometry");
				QAction* simplifyAction		= mesh_menu.addAction("Simplify");
				QAction* remeshAction		= mesh_menu.addAction("Re-mesh");
				QAction* replaceAction		= mesh_menu.addAction("Replace geometry...");
				mesh_menu.addSeparator();
				QAction* loopAction			= mesh_menu.addAction("Loop");
				QAction* longEdgeAction		= mesh_menu.addAction("Longest Edge");
				QAction* butterflyAction	= mesh_menu.addAction("Modified Butterfly");
				mesh_menu.addSeparator();
				QAction* laplacianSmoothAction = mesh_menu.addAction("Laplacian smoothing");
				QAction* scaleSmoothAction	= mesh_menu.addAction("Scale dependent smoothing");
				QAction* mcfSmoothAction = mesh_menu.addAction("MCF smoothing");
				// == end ===


				action = menu.exec(e->globalPos()); // show menu

				// Selections
				if(action == selectControllerAction)	setSelectMode(CONTROLLER);
				if(action == selectCurveAction)			setSelectMode(CONTROLLER_ELEMENT);
				if(action == selectFFD)					setSelectMode(FFD_DEFORMER);
				if(action == selectVoxelDeformer)		setSelectMode(VOXEL_DEFORMER);

				Group* newGroup = NULL;

				int opt = 0;
				if(action == symmGrp)		newGroup = new SymmetryGroup(SYMMETRY);
				if(action == self1foldSymm) ctrl->getSelectedPrimitive()->setSymmetryPlanes(1);
				if(action == self2foldSymm) ctrl->getSelectedPrimitive()->setSymmetryPlanes(2);

				if(action == addFixedPoint)	
				{
					Primitive * prim = ctrl->getSelectedPrimitive();
					Point pos = prim->getSelectedCurveCenter();
					prim->addFixedPoint(pos);
				}

				if(newGroup)
				{
					newGroup->process(ctrl->getPrimitives(selection));

					newGroup->id = QString::number(ctrl->groups.size());
					ctrl->groups[newGroup->id] = newGroup;
					emit(groupsChanged());

					print("New group added.");
				}

				if(mesh_menu.actions().contains(action))
				{
					Primitive * prim = ctrl->getSelectedPrimitive();
					if(prim){
						QSurfaceMesh * mesh = prim->getMesh();

						double avgEdge = mesh->getAverageEdgeLength();

						if(action == simplifyAction)	Decimater::simplify(mesh, 0.5);

//.........这里部分代码省略.........
开发者ID:HonghuaLi,项目名称:stacker,代码行数:101,代码来源:Scene.cpp


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