Hide points - option
Posted: Tue Jan 24, 2017 11:35 am
hi Daniel,
I am trying to hide a few points in my cloud. The user would select point on the cloud using mouse and that point should be invisible now. I have checked the ccGenericPointCloud and graphicalsegmentationTool source. It seems I can only hide once using the existing methods. If i want to hide again, I need to call resetTheVisibilityArray() which will make the previously hidden points visible.
Below code hides a single point on a mouse click. But if i try to hide another point later, the previously hidden points become visible(obviously since I called the resetVisiblityArray). Are there options to keep on making points invisible? If nothing exist please suggest ideas where I can get it done by modifying the core.
In another words , getTheVisibilityArray() is always null unless i explicitly call resetVisibilityArray().
I am trying to hide a few points in my cloud. The user would select point on the cloud using mouse and that point should be invisible now. I have checked the ccGenericPointCloud and graphicalsegmentationTool source. It seems I can only hide once using the existing methods. If i want to hide again, I need to call resetTheVisibilityArray() which will make the previously hidden points visible.
Below code hides a single point on a mouse click. But if i try to hide another point later, the previously hidden points become visible(obviously since I called the resetVisiblityArray). Are there options to keep on making points invisible? If nothing exist please suggest ideas where I can get it done by modifying the core.
In another words , getTheVisibilityArray() is always null unless i explicitly call resetVisibilityArray().
Code: Select all
void myPlugin::hideSelectedPoint(ccHObject* entity, unsigned itemIndex, int x, int y, const CCVector3& P)
{
if (!entity)
{
return;
}
if (entity->isKindOf(CC_TYPES::POINT_CLOUD))
{
ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(entity);
cloud->resetVisibilityArray(); // any alternatives other than resetting the whole visibility?
ccGenericPointCloud::VisibilityTableType* visibilityArray = cloud->getTheVisibilityArray();
visibilityArray->setValue(itemIndex, POINT_HIDDEN );
}
}