to use the pointpicking function in my plugin

Questions related to plugins development
Post Reply
Lucien
Posts: 37
Joined: Wed Jun 08, 2016 7:51 am

to use the pointpicking function in my plugin

Post by Lucien »

Hello,
How can I employ the functions of CC in my plugin?

For exemple, I want to get the X,Y,Z of point in the cloud and write it in QTableWidget of my plugin by a click in CC.

I define a member : ccGLWindow* m_win in my plugin. How can I link it with the actuel CC window?
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: to use the pointpicking function in my plugin

Post by daniel »

If you create a new instance of ccGLWindow, it will be a different window than CC's one (this is what the qSRA plugin does for instance).

Otherwise you can get a pointer on the active 3D view with the 'm_app' member of the plugin (all plugins have it). I believe there's a 'getActive3DView' or similar method.

On this ccGLWindow* instance, you can then enable the picking mode, and cath the right signal when a point is clicked for instance (see how the various picking tools work).
Daniel, CloudCompare admin
Lucien
Posts: 37
Joined: Wed Jun 08, 2016 7:51 am

Re: to use the pointpicking function in my plugin

Post by Lucien »

I linked
connect(win, SIGNAL(itemPicked(ccHObject*, unsigned, int, int, const CCVector3&)), this, SLOT(processPickedPoint(ccHObject*, unsigned, int, int, const CCVector3&)));
Then I can print info. and show 2DLabel of each point. But I wasn't able to write its X,Y,Z in my pointer without modifying original code.
Could you tell me how can I store or access the coordinate information?
Thank you
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: to use the pointpicking function in my plugin

Post by daniel »

First you have to test that the picked object (first input parameter) is a cloud.

Then if it's a cloud, cast it to a ccGenericPointCloud for instance, and then access to a given point (the index is the second argument) with 'getPoint'.

Something like:

Code: Select all

if (obj->isKindOf(CC_TYPES::POINT_CLOUD))
{
	ccGenericPointCloud* inputCloud = ccHObjectCaster::ToGenericPointCloud(obj);
	const CCVector3* P = inputCloud->getPoint(index);
	...	
}
Daniel, CloudCompare admin
Lucien
Posts: 37
Joined: Wed Jun 08, 2016 7:51 am

Re: to use the pointpicking function in my plugin

Post by Lucien »

Thank you so much for your response. I made it. I complicated the question.
Post Reply