get the point cloud in the window

All about Windows versions
Post Reply
zzwbeyond
Posts: 15
Joined: Wed Mar 16, 2016 1:16 pm

get the point cloud in the window

Post by zzwbeyond »

Hello everyone,

I create my plugin in CC, and I want to get the point cloud in the window with my plugin. But I can't get using follow code:

Code: Select all

	m_activeWindow = m_app->getActiveGLWindow();	
	winDBRoot = m_activeWindow->getOwnDB();
	globalDBRoot = m_activeWindow->getSceneDB();
	
	ccHObject::Container toProcess;
	if (winDBRoot) {
		toProcess.push_back(winDBRoot);
	}
	if (globalDBRoot) {
		toProcess.push_back(globalDBRoot);
	}

	while (!toProcess.empty()) {
		ccHObject* ent = toProcess.back();
		toProcess.pop_back();

		if (!ent->isEnabled())
			continue;

		if (ent->isVisible()) {
			if (ent->isA(CC_TYPES::POINT_CLOUD)) {
				ccLog::Warning("point cloud is found!");
			}
		} 
	}
Is there something wrong with my code? And how can I do to get the point cloud in the cloudcompare window?
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: get the point cloud in the window

Post by daniel »

You should look at how the other plugins work. For instance qHPR or qRANSAC_SD:
https://github.com/cloudcompare/trunk/b ... D.cpp#L111

Code: Select all

	const ccHObject::Container& selectedEntities = m_app->getSelectedEntities();
	size_t selNum = selectedEntities.size();
	if (selNum!=1)
	{
		m_app->dispToConsole("Select only one cloud!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
		return;
	}

	ccHObject* ent = selectedEntities[0];
	assert(ent);
	if (!ent || !ent->isA(CC_TYPES::POINT_CLOUD))
	{
		m_app->dispToConsole("Select a real point cloud!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
		return;
	}

	ccPointCloud* pc = static_cast<ccPointCloud*>(ent);
Daniel, CloudCompare admin
zzwbeyond
Posts: 15
Joined: Wed Mar 16, 2016 1:16 pm

Re: get the point cloud in the window

Post by zzwbeyond »

Thanks, daniel.
I know this method, but I do not want to select the point cloud in my plugin. Is there some way to acquire the point cloud in the window without selecting the point cloud?
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: get the point cloud in the window

Post by daniel »

You mean that you want to get any cloud loaded in the DB tree?

In this case you can ask to the 'm_app' instance (ccMainAppInterface) the 'root' object of the DB tree with the 'dbRootObject' method.

You can then recursively search for all point clouds children (see the 'ccHObject::filterChildren' method).
Daniel, CloudCompare admin
Post Reply