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


C++ Container::size方法代码示例

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


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

示例1: doAction

int qPoissonReconPlugin::doAction(ccHObject::Container& selectedEntities,
								  unsigned& uiModificationFlags,
								  ccProgressDialog* progressCb/*=NULL*/,
								  QWidget* parent/*=NULL*/)
{
	//we need one point cloud
    unsigned selNum = selectedEntities.size();
    if (selNum!=1)
        return -1;

	//a real point cloud
    ccHObject* ent = selectedEntities[0];
	if (!ent->isA(CC_POINT_CLOUD))
		return -1;

	//with normals!
    ccPointCloud* pc = static_cast<ccPointCloud*>(ent);
	if (!pc->hasNormals())
		return -2;

	bool ok;
	#if (QT_VERSION >= QT_VERSION_CHECK(4, 5, 0))
	int depth = QInputDialog::getInt(0, "Poisson reconstruction","Octree depth:", 8, 1, 24, 1, &ok);
	#else
	int depth = QInputDialog::getInteger(0, "Poisson reconstruction","Octree depth:", 8, 1, 24, 1, &ok);
	#endif

	if (!ok)
		return 1;

	 //TODO: faster, lighter
	unsigned i,count = pc->size();
	float* points = new float[count*3];
	if (!points)
		return -3;
	float* normals = new float[count*3];
	if (!normals)
	{
		delete[] points;
		return -3;
	}

	float* _points = points;
	float* _normals = normals;
	for (i=0;i<count;++i)
	{
		const CCVector3* P = pc->getPoint(i);
		*_points++ = (float)P->x;
		*_points++ = (float)P->y;
		*_points++ = (float)P->z;

		const PointCoordinateType* N = pc->getPointNormal(i);
		*_normals++ = (float)N[0];
		*_normals++ = (float)N[1];
		*_normals++ = (float)N[2];
	}

	/*** RECONSTRUCTION PROCESS ***/

	CoredVectorMeshData mesh;
	PoissonReconLib::PoissonReconResultInfo info;
	bool result = false;

	if (progressCb)
	{
		progressCb->setCancelButton(0);
		progressCb->setRange(0,0);
		progressCb->setInfo("Operation in progress");
		progressCb->setMethodTitle("Poisson Reconstruction");
		progressCb->start();
		//QApplication::processEvents();

		//run in a separate thread
		s_points = points;
		s_normals = normals;
		s_count = count;
		s_depth = depth;
		s_mesh = &mesh;
		s_info = &info;
		QFuture<void> future = QtConcurrent::run(doReconstruct);

		unsigned progress = 0;
		while (!future.isFinished())
		{
		    #if defined(_WIN32) || defined(WIN32)
			::Sleep(500);
			#else
			sleep(500);
			#endif

			progressCb->update(++progress);
			//Qtconcurrent::run can't be canceled!
			/*if (progressCb->isCancelRequested())
			{
				future.cancel();
				future.waitForFinished();
				s_result = false;
				break;
			}
			//*/
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: onNewSelection

bool qPoissonReconPlugin::onNewSelection(const ccHObject::Container& selectedEntities)
{
	return (selectedEntities.size()==1 && selectedEntities[0]->isA(CC_POINT_CLOUD));
}
开发者ID:,项目名称:,代码行数:4,代码来源:


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