Load and display point cloud directly from a plugin

Questions related to plugins development
Post Reply
RiGo59
Posts: 1
Joined: Thu Jan 22, 2015 8:37 am

Load and display point cloud directly from a plugin

Post by RiGo59 »

Dear forum,
I would like to load a *.ply point cloud, which is shown in CC-display window into a plugin application for further processing and display the resulting point cloud back in the CC-window afterwards.
Could you please give me a hint where I can find an example plugin implementation?
Best regards
Richard
daniel
Site Admin
Posts: 7396
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Load and display point cloud directly from a plugin

Post by daniel »

Hi,

If the entity is already loaded in the DB tree, then your plugin has access to it. There's several ways to access it but the standard one is to get the current selection. Look at the qHPR plugin for instance (which is applied on the currently selected cloud).

In your plugin 'action' method, simply get the selected entities list:

Code: Select all

	const ccHObject::Container& selectedEntities = m_app->getSelectedEntities();
Then if you only want a single point cloud you can do something like that:

Code: Select all

if (selectedEntities.size() != 1 || !selectedEntities.front().isA(CC_TYPE::POINT_CLOUD))
{
    m_app->dispToConsole("Select only one cloud!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
}
ccPointCloud* cloud = static_cast<ccPointCloud*>(selectedEntities.front());
P.S.: you should also enable/disable the plugin icon/action based on the current selection (so as to be sure that the user won't call the plugin if the current selection is not right). For this you have to reimplement the 'onNewSelection' method.
Daniel, CloudCompare admin
Post Reply