]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx
#3533 Update Curent contour and actual point ShowNPoints in Undo Redo
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ViewShowNPoints.cxx
index b4ba379963e38cee8124ace5da22e20ca395dd54..b5ed682a8c1aafaf4da5d19d909f2657e11084ab 100644 (file)
@@ -90,7 +90,8 @@ void ViewShowNPoints::AddVtkPoint()
         printf("EED ShowNPoints Warning: Renderer Not Set\n");
         return;
     }
-    
+
+    lstActorAdded.push_back(true);
     renderer->AddActor( sphereActor );
     // Actor
     vtkTextActor3D *textActor = vtkTextActor3D::New();
@@ -127,6 +128,7 @@ void ViewShowNPoints::ErasePoint(int id)
             lstActorsSphere.erase( lstActorsSphere.begin()+id );
             lstActorsText.erase( lstActorsText.begin()+id );
             lstSourceSphere.erase( lstSourceSphere.begin()+id );
+            lstActorAdded.erase( lstActorAdded.begin()+id );
         } // if id
     } // if renderer
 }
@@ -142,3 +144,34 @@ void ViewShowNPoints::SetModelShowNPoints( ModelShowNPoints*  modelShowNPoints)
 {
     mmodelShowNPoints = modelShowNPoints;
 }
+
+//------------------------------------------------------------------------
+void ViewShowNPoints::TryToShowActorInRender( int id, bool show )
+{
+    if (show==false)  // try to remove actor to render
+    {
+        if (lstActorAdded[id]==true)
+        {
+            lstActorAdded[id]=false;
+            renderer->RemoveActor( lstActorsSphere[id] );
+            renderer->RemoveActor( lstActorsText[id] );
+        } // if lstActorAdded  true
+    } else { // try to add actor to render
+        if (lstActorAdded[id]==false)
+        {
+            lstActorAdded[id]=true;
+            renderer->AddActor( lstActorsSphere[id] );
+            renderer->AddActor( lstActorsText[id] );
+        } // if lstActorAdded  false
+    } // if show
+}
+
+//------------------------------------------------------------------------
+void ViewShowNPoints::TryToShowActorsInRender( bool show )
+{
+    int id,size=lstActorsSphere.size();
+    for (id=0;id<size;id++)
+    {
+        TryToShowActorInRender( id, show );
+    } // for id
+}