Page 1 of 1
to use the pointpicking function in my plugin
Posted: Mon Jul 25, 2016 3:08 pm
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?
Re: to use the pointpicking function in my plugin
Posted: Mon Jul 25, 2016 8:57 pm
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).
Re: to use the pointpicking function in my plugin
Posted: Tue Jul 26, 2016 4:26 pm
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
Re: to use the pointpicking function in my plugin
Posted: Tue Jul 26, 2016 7:03 pm
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);
...
}
Re: to use the pointpicking function in my plugin
Posted: Wed Jul 27, 2016 10:24 am
by Lucien
Thank you so much for your response. I made it. I complicated the question.