-//------------------------------------------------------------------------
-void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
-{
- int id = lstActors.size()-1;
- if (this->renderer!=NULL){
- if (id>=0){
- renderer->RemoveActor( lstActors[id] );
- lstActors.erase( lstActors.begin()+id );
- lstPointsX.erase( lstPointsX.begin()+id );
- lstPointsY.erase( lstPointsY.begin()+id );
- lstPointsZ.erase( lstPointsZ.begin()+id );
- renderer->GetRenderWindow()->Render();
- //--BBTK
-//EED??? mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
- } // if id
- } // if renderer
-}
-
+
+ //------------------------------------------------------------------------
+ void WidgetShowNPoints::ErasePoint(int id)
+ {
+ if (this->renderer!=NULL){
+ if (id>=0){
+ renderer->RemoveActor( lstActorsSphere[id] );
+ renderer->RemoveActor( lstActorsText[id] );
+ lstActorsSphere[id]->Delete();
+ lstActorsText[id]->Delete();
+ lstActorsSphere.erase( lstActorsSphere.begin()+id );
+ lstActorsText.erase( lstActorsText.begin()+id );
+ lstPointsX.erase( lstPointsX.begin()+id );
+ lstPointsY.erase( lstPointsY.begin()+id );
+ lstPointsZ.erase( lstPointsZ.begin()+id );
+ renderer->GetRenderWindow()->Render();
+ //--BBTK
+ mbbShowNPoints->bbSignalOutputModification(std::string("lstPointsX"));
+ mbbShowNPoints->bbSignalOutputModification(std::string("lstPointsY"));
+ mbbShowNPoints->bbSignalOutputModification(std::string("lstPointsZ"));
+ } // if id
+ } // if renderer
+ }
+
+ //------------------------------------------------------------------------
+ void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
+ {
+ int id=-1;
+ int i, size=(int)(lstActorsSphere.size());
+ double spc[3];
+ mimage->GetSpacing(spc);
+
+ for ( i=0 ; i<size; i++ )
+ {
+ double rx = spc[0]*(mpoint[0] - lstPointsX [i]);
+ double ry = spc[1]*(mpoint[1] - lstPointsY [i]);
+ double rz = spc[2]*(mpoint[2] - lstPointsZ [i]);
+ if ( rx*rx + ry*ry + rz*rz <= mradio*mradio)
+ {
+ id=i;
+ } // if
+ } // for
+ ErasePoint(id);
+ }
+
+ //------------------------------------------------------------------------
+ void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
+ {
+ ErasePoint(lstActorsSphere.size()-1);
+ }
+
+