Tue, 05/07/2024 - 20:59
Forums:
When using AIS_PointCloud with SM_SubsetOfPoints, you can select individual points through a box or polygon selection and getting the indices of the selected points as follows:
Handle(SelectMgr_EntityOwner) aSelOwner = myAISContext->SelectedOwner();
Handle(AIS_PointCloudOwner) hPointCloudOwner = Handle(AIS_PointCloudOwner)::DownCast(aSelOwner);
if (!hPointCloudOwner.IsNull())
{
Handle(AIS_PointCloud) hPointCloud = Handle(AIS_PointCloud)::DownCast(aSelOwner->Selectable());
Handle(TColStd_HPackedMapOfInteger) hSelectedPoints = hPointCloudOwner->SelectedPoints();
const TColStd_PackedMapOfInteger& rMap = hSelectedPoints->Map();
Standard_Integer NPointsSelected = 0;
const Handle(Graphic3d_ArrayOfPoints) hArrayOfPoints = hPointCloud->GetPoints();
TColStd_PackedMapOfInteger::Iterator anIter(rMap);
for (; anIter.More(); anIter.Next())
{
NPointsSelected++;
Standard_Integer IndexOfSelectedPoint = anIter.Key();
}
}
I would like to select points in the point cloud programmatically and update the view with the programmatically selected points.
How can this be done?