+
+int SMESH_PreviewActorsCollection::count() const
+{
+ return myIndices.count();
+}
+
+int SMESH_PreviewActorsCollection::chunkSize() const
+{
+ return myChunkSize;
+}
+
+int SMESH_PreviewActorsCollection::currentChunk() const
+{
+ return myCurrentChunk;
+}
+
+bool SMESH_PreviewActorsCollection::hasPrevious() const
+{
+ return chunkSize() > 0 && currentChunk() > 0;
+}
+
+bool SMESH_PreviewActorsCollection::hasNext() const
+{
+ return chunkSize() > 0 && (currentChunk()+1)*chunkSize() < count();
+}
+
+void SMESH_PreviewActorsCollection::previous()
+{
+ if ( !hasPrevious() ) return;
+ myCurrentChunk--;
+ showCurrentChunk();
+}
+
+void SMESH_PreviewActorsCollection::next()
+{
+ if ( !hasNext() ) return;
+ myCurrentChunk++;
+ showCurrentChunk();
+}
+
+void SMESH_PreviewActorsCollection::showCurrentChunk()
+{
+ clearActors();
+ int imin = currentChunk() * chunkSize();
+ int imax = std::min( (currentChunk()+1) * chunkSize(), count() );
+ for ( int i = imin; i < imax; i++ ) {
+ int index = myIndices[i];
+ if ( !index || myMapOfActors.contains( index ) ) continue;
+ TopoDS_Shape s = myMapOfShapes.FindKey( index );
+ if ( s.IsNull() ) continue;
+ // create actor if the index is present
+ if ( GEOM_Actor* anActor = createActor( s.Oriented(TopAbs_FORWARD))) {
+ // Create new entry for actor
+ QString entry = QString( "%1_%2" ).arg( myEntry ).arg( index );
+ // Create interactive object
+ Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
+ anIO->setEntry( entry.toLatin1().constData() );
+ // Init Actor
+ anActor->SetVectorMode( myType==TopAbs_EDGE );
+ anActor->setIO( anIO );
+ anActor->SetSelector( mySelector );
+ anActor->SetPickable( true );
+ anActor->SetResolveCoincidentTopology( true );
+
+ // Add Actor to the Actors Map
+ myMapOfActors.insert(index, anActor);
+ }
+ }
+ mySelector->ClearIObjects();
+ if ( myRenderer )
+ AddToRender( myRenderer );
+}
+
+void SMESH_PreviewActorsCollection::clearActors()
+{
+ if (myRenderer)
+ RemoveFromRender(myRenderer);
+
+ QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
+ for ( ; iter != myMapOfActors.end(); ++iter )
+ if ( GEOM_Actor* anActor = iter.value() )
+ anActor->Delete();
+ myMapOfActors.clear();
+}