Could you maybe point me in the right direction for which function in CC actually handles the highlighting of a point? I am providing a snippet of my code which is able to create labels for any clicked point with its 3D coordinates. This just creates the labels. I am unable to set a position on the screen for them because for that, I need to know where the 3D coordinates would appear among the already existing point clouds. How do I proceed further?
Code: Select all
void displayIntersectedPointInCC(Vector3d point)
{
if (!cloudCreated)
{
cloud = new ccPointCloud();
cloudCreated = true;
}
int count = intersectedObjectPoints.size();
if (cloud->reserve(count))
{
cloud->setName("Intersected Points");
cloud->setDisplay(associatedCloud->getDisplay());
cloud->setGlobalShift(associatedCloud->getGlobalShift());
cloud->setGlobalScale(associatedCloud->getGlobalScale());
const CCVector3* P = new CCVector3{ static_cast<float>(point[0]), static_cast<float>(point[1]), static_cast<float>(point[2]) };
cloud->addPoint(*P);
MainWindow::TheInstance()->addToDB(cloud);
if (!intersectedPointsContainerCreated)
{
intersectedPointsContainerCreated = true;
intersectedPointsContainer = new ccHObject("Intersected Points");
cloud->addChild(intersectedPointsContainer);
intersectedPointsContainer->setDisplay(cloud->getDisplay());
MainWindow::TheInstance()->addToDB(intersectedPointsContainer, false, true, false, false);
}
intersectedPointsContainer->a
cc2DLabel* newLabel = new cc2DLabel();
newLabel->addPoint(cloud, 0);
newLabel->setVisible(true);
newLabel->setDisplayedIn2D(false);
newLabel->displayPointLegend(true);
newLabel->setCollapsed(false);
newLabel->setDisplay(cloud->getDisplay());
assert(intersectedPointsContainer);
intersectedPointsContainer->addChild(newLabel);
MainWindow::TheInstance()->addToDB(newLabel, false, true, false, false);
}
}