Page 1 of 1

Getting started - accessing point cloud/creating point cloud

Posted: Wed Oct 25, 2017 9:44 am
by acotti
Dear Daniel,

I'm trying to understand how to access a point cloud via a plug-in I'm currently developing. After having looked that the documentation, things are not entirely clear to me. Cloud you please help me to better understand how all works.

Here is the scenario I'm looking for.

scenario 1:
I have some raw data files of a point cloud in a non supported format by CC. My reader gives me a arrays of vector3D. How would I import this cloud into CC, i.e. put this cloud in the db tree and make it visible in the viewport?

scenario 2:
I have a loaded point cloud in CC, did some manual filtering with the segment tool, and would like to retrieve the remaining points (with their attributes) once the point cloud is selected in the db tree?

I think my more general point is that I can't get the information I'm looking for (obviously). in the dummy plug-in it says
You can access to most of CC components (database, 3D views, console, etc.) via the 'm_app' attribute (ccMainAppInterface object).
I've been exploring the documentations (and looking at some plug-in code) for days now and can't find anything related to m_app or ccMainAppInterface.

I most likely missing the point here, but any pointer(s) to the right direction would be greatly appreciated.

All the best.
Antoine

Re: Getting started - accessing point cloud/creating point cloud

Posted: Wed Oct 25, 2017 8:05 pm
by daniel
1) You can do it as any other plugin creating new point clouds: use the 'm_app' member of the plugin (all plugins have it and it is automatically initialized by CC when the plugin is loaded) and call:

Code: Select all

m_app->addToDB(yourCloud);
The entity will be automatically displayed in the active 3D view.

As the dummy plugin states, most of the (authorized) interactions with the application are done with this 'm_app' member (see the ccMainAppInterface class for all its methods). If necessary it's always possible to add new methods.

2) To retrieve a point cloud that is already in the DB tree, you have several options.

a) The most common (in CC) is to let the user select the cloud, and then call the plugin action (see how it works with the simple 'qPCV' plugin for instace). You just have to ask to 'm_app' the selected entities:

Code: Select all

const ccHObject::Container& selectedEntities = m_app->getSelectedEntities();
Then check that the selected entities are indeed what you are expecting (by the way you can enable or disable the plugin action based on the current selection - see the 'onNewSelection' method that can be re-implemented).

b) Another option is to let the user choose among a list of candidate entities. qPCV also does this:

Code: Select all

	ccHObject* root = m_app->dbRootObject();
	if (root)
	{
		ccHObject::Container clouds;
		root->filterChildren(clouds, true, CC_TYPES::POINT_CLOUD);
		for (size_t i = 0; i < clouds.size(); ++i)
		{
		   ...
		}
	}
c) Lastly, if it's an entity your plugin already 'know' about (because it has a specific name, or it has already been processed by the plugin) then you can try to find it. Once again via the 'dbRootObject' object returned by 'm_app'. You can either find an entity via it's unique ID (see ccHObject::find). Or you can look recursively at the DB tree contents and look 'manually' for an entity with a given name, etc.

Don't hesitate to ask for more specific questions if necessary.

Re: Getting started - accessing point cloud/creating point cloud

Posted: Mon Sep 04, 2023 9:12 am
by codierknecht
Hi,

I'm new to the development of CloudCompare-Plugins. I tried my self on a little plugin gathering different properties of selected PointCloud entities (like the number of points) and displaying it on a ccOverlayDialog.
However, I was not able to access the individual points or the number of those. This might be a silly question but I couldn't figure out how to correctly interface of ccPointCloud. Moreover, I didn't find documentation about different types of PointClouds, like what is the difference between ccPointCloud and ccGenericPointCloud are there any resources about such things.

Thanks in advance

*UPDATE*

I didn't had seen that ccPointCloud [0] inherits from ccPointCloudTbl [1] which provides direct access to the individual points.

[0] https://www.cloudcompare.org/doc/qCC_db ... cloud.html
[1] https://www.cloudcompare.org/doc/CCLib/ ... d_tpl.html

Re: Getting started - accessing point cloud/creating point cloud

Posted: Sat Sep 16, 2023 10:20 am
by daniel
Yep ;)