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
Load and display point cloud directly from a plugin
Re: Load and display point cloud directly from a plugin
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:
Then if you only want a single point cloud you can do something like that:
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.
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();
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());
Daniel, CloudCompare admin