]> Creatis software - creaMaracasVisu.git/commitdiff
3539 ShowNPoints single selection
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 24 Aug 2023 09:46:28 +0000 (11:46 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 24 Aug 2023 09:46:28 +0000 (11:46 +0200)
bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx
bbtk/src/bbmaracasvisuShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx

index 46998f905f4005d5bab1c54be42ae38ce79ff963..fb3a57ff4d4bbd2133e626af984f541d21c5e591 100644 (file)
@@ -15,8 +15,6 @@ namespace bbcreaMaracasVisu
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints_Tools)
 BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints_Tools,bbtk::AtomicBlackBox);
 
-
-
 void ShowNPoints_Tools::NearestPointToMesh( vtkPoints *points,vtkStaticPointLocator *pointLocator,double *spc,double *p,double *pM)
 {
     p[0]  = p[0] * spc[0];
index 0163609438d8352c4f86c9e5a8c475c917c5adee..7843235b8bd7550134a4356c45b37fc9f96da26f 100644 (file)
@@ -88,15 +88,11 @@ void WidgetShowNPointsBox::SetOutputBox()
 }
 
 
-
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 
-
-
-
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints)
 BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox);
 
@@ -130,10 +126,8 @@ void ShowNPoints::Process()
                 mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() ,  bbGetInputInitLstIndexs() );
             }
 //        } // firsttime OJO machete Eduardo pour ANDREAS a verificar
-
         mwxwidget->AutoAddPoints();
         mwxwidget->TrackingPoint();
-
         bbSetOutputlstPointsX( mwxwidget->GetLstPointsX()               );
         bbSetOutputlstPointsY( mwxwidget->GetLstPointsY()               );
         bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ()               );
@@ -141,9 +135,7 @@ void ShowNPoints::Process()
         bbSetOutputlstIndexs( mwxwidget->GetLstIndexs()                 );
         bbSetOutputlstSelectedIndexs( mwxwidget->GetLstSelectedIndexs() );
         bbSetOutputWidgetShowNPoints( (WidgetShowNPoints*)mwxwidget );
-
        } // mwxwidget
-    
 }
 
 //-----------------------------------------------------------------
@@ -156,9 +148,9 @@ void ShowNPoints::CreateWidget(wxWindow* parent)
 //-----------------------------------------------------------------
 void ShowNPoints::bbUserSetDefaultValues()
 {
-    firsttime=true;
+    firsttime   = true;
     backOpacity = -1;
-       mwxwidget = NULL;
+       mwxwidget   = NULL;
        bbSetInputRadio(10);
        bbSetInputOpacity(1);
        std::vector<double> colour;
@@ -172,17 +164,16 @@ void ShowNPoints::bbUserSetDefaultValues()
        bbSetOutputWidgetShowNPoints(NULL);
 }
 
-//------------------  -----------------------------------------------
-       void ShowNPoints::bbUserInitializeProcessing()
-       {
-       }
+//-----------------------------------------------------------------
+void ShowNPoints::bbUserInitializeProcessing()
+{
+}
 
 //-----------------------------------------------------------------
-       void ShowNPoints::bbUserFinalizeProcessing()
-       {
-       }
+void ShowNPoints::bbUserFinalizeProcessing()
+{
+}
 
 //-----------------------------------------------------------------
 
-}
-// EO namespace bbcreaMaracasVisu
+} // EO namespace bbcreaMaracasVisu
index 2f9db6267173c2f6f9a8c7c9bb3313a175e0e7c7..69196bbe604e6632e449977ffabb313de2bd3338 100644 (file)
@@ -69,15 +69,16 @@ std::vector<std::string> ModelShowNPoints::GetLstLabels()
 void ModelShowNPoints::SetReferencePoint(std::vector<double> ppoint)
 {
        mReferencePoint = ppoint;
-       if(lstPointsX.size() > 0){
+       if(lstPointsX.size() > 0)
+    {
                int idPoint = IdInsidePoint();
-               if(idPoint == -1 && idCurrentPoint >= 0 && idCurrentPoint < lstPointsX.size()){
+               if(idPoint == -1 && idCurrentPoint >= 0 && idCurrentPoint < lstPointsX.size())
+        {
             idCurrentPoint = idCurrentPoint;
-               }
-               else{
+               } else{
             idCurrentPoint = idPoint;
-               }
-       }
+               } // if idPoint
+       } // if lstPointsX.size
 }
 
 //------------------------------------------------------------------------
@@ -359,7 +360,8 @@ int ModelShowNPoints::IdInsidePoint()
        int id=-1;
        int i, size=(int)( lstPointsX.size() );
     double spc[3];
-    double radio2=(mradio+1)*(mradio+1);
+    double tmpRadio = mradio/3;
+    double radio2=(tmpRadio+1)*(tmpRadio+1);
        if(mimage ==NULL)
        {
                printf("WidgetShowNPoints::IdInsidePoint  image not set\n");
index bdce5b2fcc58fe029f5f797547abc3a9d7b6884d..280e0c733823965bf028e562f871cc3d5c512781 100644 (file)
@@ -10,7 +10,6 @@
 #include <vtkPointData.h>
 #include <vtkDataArray.h>
 #include <vtkMath.h>
-#include <vtkStaticPointLocator.h>
 #include <vtkPoints.h>
 
 #include "vtkSphereSource.h"
@@ -1670,15 +1669,21 @@ void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
 void WidgetShowNPoints::DetectCollectionActive()
 {
     int id;
-    int i,size=lstModelShowNPoints.size();
-    for (i=0;i<size;i++)
+    if ( cbVisuActualCollection->GetValue()==false  )
     {
-        id = lstModelShowNPoints[i]->IdInsidePoint();
-        if (id>=0)
+        int i,size=lstModelShowNPoints.size();
+        for (i=0;i<size;i++)
         {
-            mActualCollection=i;
-        } // if id>=0
-    } // for i
+            id = lstModelShowNPoints[i]->IdInsidePoint();
+            if  (id>=0)
+            {
+                mActualCollection=i;
+            } // if  id>=0
+        } // for i
+    } else {
+        id = GetModelShowNPoints()->IdInsidePoint();   // forcing the selection of the point 
+    } // if cbVisuActualCollection
+    
     RefreshCollectionText();
     RefreshColourCollection();
 }
@@ -1858,8 +1863,8 @@ void WidgetShowNPoints::OnLoadCollections_( std::string filename )
                 GetViewShowNPoints()->AddVtkPoint();
             }// for
         } // for i
-
         fclose(ff);
+        mActualCollection=0;
     } else {   // else ff
         printf("WidgetShowNPoints::Load Group of Points  ...Error... reading file");
     } //ff