Greyhound plugin

Questions related to plugins development
Post Reply
Jälv
Posts: 28
Joined: Sun Jul 02, 2017 8:35 pm

Greyhound plugin

Post by Jälv »

Hello,

I started to develop a plugin to allow CloudCompare to connect to a Greyhound server and there are a few things
that I would like to do but I don't know if it is possible / how to do them.

For now my plugin is able to download a point cloud from a Greyhound server by providing the bounding box of the points to be downloaded.
As on the server, the data is organized in an Octree, when I'm downloading points I do it one depth at a time (download 1 depth, add it the the viewer, download new depth, etc)

The idea behind that is to give quick feedback to the user, however for this to work I have to show a progress dialog when downloading and this is not ideal. What I would like to do is to download the points in the background letting the user still be able to do things (like move the camera) and refresh the viewer once a set of point is downloaded.

I would also like to have some guidance on how to define my custom ccHObject to be able to filter actions in my plugin's onNewSelection. And is it possible to customize the context menu when right-clicking a custom ccHObject ?
Jälv
Posts: 28
Joined: Sun Jul 02, 2017 8:35 pm

Re: Greyhound plugin

Post by Jälv »

Regarding the ability to let the user move the camera while more points are being downloaded, I found how to do it, I just had to replace
my ccProgressDialog with a QEventLoop :D
dcaron05
Posts: 3
Joined: Wed Sep 14, 2016 7:52 pm

Re: Greyhound plugin

Post by dcaron05 »

Hi, I just want to say that this is great news and I really hope it can work. I think it would be a very valuable feature.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Greyhound plugin

Post by daniel »

Indeed! With the solution you found (which is good), is the GUI responsive enough? Otherwise you could move the data streaming part in a separate thread (just like BIN files are loaded for instance).
Daniel, CloudCompare admin
Jälv
Posts: 28
Joined: Sun Jul 02, 2017 8:35 pm

Re: Greyhound plugin

Post by Jälv »

Yes by using a QEventLoop the UI is responsive, the download is happening in another thread the code looks like this.

Code: Select all

QFutureWatcher<ccPointCloud*> downloader;
QEventLoop loop;

downloader.setFuture(QtConcurrent::run([&]()-> ccPointCloud* {return greyhound_reader.download(b, depth); }));
QObject::connect(&downloader, &QFutureWatcher<ccPointCloud*>::finished, &loop, &QEventLoop::quit);
loop.exec();
downloader.waitForFinished()

ccPointCloud* cloud = downloader.result();
I would like to create a custom HObject to represent a connection to a Greyhound server and a PointCloud downloaded from Greyhound to be able to enable/disable actions depending what objects are selectionned in the the DBTree.
How can I do this ?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Greyhound plugin

Post by daniel »

One easy but 'hacky' option is to create your own type that extends the ccHObject class (or even the ccPointCloud class) in your plugin. It should 'work' more or less transparently in CC. And you can use the 'meta data' mechanism to store some custom information that can even be saved/loaded in BIN files (but you'll lose the ability to properly reload your objects of course if they have a custom type, unknown from CC).

The 'real' solution is to extend the 'ccCustomHObject' interface. And your plugin also needs to provide a 'ccExternalFactory' instance (via 'getCustomObjectsFactory') if you want your plugin to be able to serialize/deserialize your custom objects to/from BIN files. Sadly there's no example of this solution in the public code-base. But don't hesitate to discuss it with us if you are interested in this solution (I can add you to the Slack team by the way: https://cloudcompare-dev-team.slack.com).
Daniel, CloudCompare admin
Jälv
Posts: 28
Joined: Sun Jul 02, 2017 8:35 pm

Re: Greyhound plugin

Post by Jälv »

I'd rather try to do the real solution, and I'd be happy to join cc's slack
Post Reply