Getting started - accessing point cloud/creating point cloud

Any question about the database & algorithms library 'CCLib'
acotti
Posts: 4
Joined: Wed Oct 25, 2017 9:30 am

Getting started - accessing point cloud/creating point cloud

Postby acotti » Wed Oct 25, 2017 9:44 am

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

daniel
Site Admin
Posts: 3375
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Postby daniel » Wed Oct 25, 2017 8:05 pm

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.
Daniel, CloudCompare admin


Return to “CCLib”

Who is online

Users browsing this forum: No registered users and 1 guest