How to get the selected points from an ais_pointcloud object in opencascade?

136 Views Asked by At

I uesd v3d_view to present some CAD and PointCloud objects,which were stored in ais_shape and ais_pointcloud class.But when i want to select some points from an ais_pointcloud,it's not the same as selecting TopAbs_Face from the Ais_shape.

The schematic diagram is as follows: choen points

As you can see, i select the "yellow" points(the noise points) and want to remove them from the "red" points.

The code I select TopAbs_Face from an ais_shape object is as follows:

   if (!myOccView->getContext()->Selection()->IsEmpty()) {
    const Handle(AIS_Selection) selection = myOccView->getContext()->Selection();
    for (selection->Init(); selection->More(); selection->Next()) {
        Handle(SelectMgr_EntityOwner) entity = selection->Value();
        TopoDS_Shape shape = Handle(StdSelect_BRepOwner)::DownCast(entity)->Shape();

        // Create an explorer to iterate over all faces in the shape.
        TopExp_Explorer explorer_face(shape, TopAbs_FACE);
        ......
        }
}

The code I select points from an ais_shape object is as follows:

       Handle(AIS_Selection) selection = myOccView->getContext()->Selection();       
   Handle(AIS_PointCloud) myPointCloud = Handle(AIS_PointCloud)::DownCast(aisObj);
   for (selection->Init(); selection->More(); selection->Next()) {
            Handle(SelectMgr_EntityOwner) entity = selection->Value();
            Handle(AIS_PointCloudOwner) owner = Handle(AIS_PointCloudOwner)::DownCast(entity);
            Handle(TColStd_HPackedMapOfInteger) selectedPoints = owner->SelectedPoints();
            ......
   }

I don't how to use the selectedPoints(TColStd_HPackedMapOfInteger object) to get every gp_pnt point,could you give me some advice or some sample code?Thanks in advance.

0

There are 0 best solutions below