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?
to use the pointpicking function in my plugin
Re: to use the pointpicking function in my plugin
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).
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
Re: to use the pointpicking function in my plugin
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
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
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:
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
Re: to use the pointpicking function in my plugin
Thank you so much for your response. I made it. I complicated the question.