AIS_PointCloud redisplay

Hello all,

how to redisplay a AIS_PointCloud after removing some points?

Thank you :)

Handle(SelectMgr_EntityOwner) object = objects.at(i);
Handle(AIS_PointCloudOwner) pointCloudOwner = Handle(AIS_PointCloudOwner)::DownCast(object);
Handle(TColStd_HPackedMapOfInteger) points = pointCloudOwner->SelectedPoints();

int from = points->ChangeMap().GetMinimalMapped();
int to = points->ChangeMap().GetMaximalMapped();

for (int i=from; i<to; i++)
  if (points->ChangeMap().Contains(i))
    points->ChangeMap().Remove(i);

//until here everything makes sense and seems to work. But how to update the display?
Kirill Gavrilov's picture

Your code removes point indexes from selection map. To remove points from presentation you need remove them from array Graphic3d_ArrayOfPoints defined by AIS_PointCloud (e.g. re-create array or do some smarter things in subclass if your points array is really large) and then redisplay object (AIS_InteractiveContext::Redisplay() or similar).

Daniel Duesentrieb's picture

Thanks Kirill,

I delete the points in my source and all works fine (and fast).

My point cloud has ~200.000 points and I was worried it takes too long. Turns out I can't even see a delay. I guess things changed since I was programming on a Commodore VC20 and saved my programs on a music cassette...