]> Creatis software - creaMaracasVisu.git/commitdiff
#3485 ShowNPionts for Multiple Groups
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 25 May 2022 15:26:43 +0000 (17:26 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 25 May 2022 15:26:43 +0000 (17:26 +0200)
bbtk/bbs/appli/exampleShowNPoints.bbg [new file with mode: 0644]
bbtk/bbs/appli/exampleShowNPoints.bbs
bbtk/src/bbmaracasvisuShowNPoints.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h

diff --git a/bbtk/bbs/appli/exampleShowNPoints.bbg b/bbtk/bbs/appli/exampleShowNPoints.bbg
new file mode 100644 (file)
index 0000000..375ea96
--- /dev/null
@@ -0,0 +1,65 @@
+# ----------------------------------
+# - BBTKGEditor v 1.5 BBG BlackBox Diagram file
+# - /Users/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleShowNPoints.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:demo
+DESCRIPTION:Show N Points
+AUTHOR:info-dev@creatis.insa-lyon.fr
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:4
+BOX
+vtk:LoadHola:reader
+ISEXEC:FALSE
+7.441648:124.996054:-900.000000
+29.066648:122.496054:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:viewer
+ISEXEC:FALSE
+31.502200:95.482598:-900.000000
+70.102200:92.982598:-900.000000
+PORT
+nTypeView:"5 1 2 0"
+FIN_BOX
+BOX
+creaMaracasVisu:ShowNPoints:showNpoints
+ISEXEC:FALSE
+-16.144198:60.203713:-900.000000
+18.935802:57.703713:-900.000000
+PORT
+Radio:"10"
+FIN_BOX
+BOX
+wx:LayoutSplit:main
+ISEXEC:TRUE
+-15.931556:11.821580:-900.000000
+6.828444:9.321580:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+CONNECTIONS:7
+CONNECTION
+reader:Out:viewer:In
+NumberOfControlPoints:0
+CONNECTION
+reader:Out:showNpoints:Image
+NumberOfControlPoints:0
+CONNECTION
+viewer:Renderer1:showNpoints:Renderer
+NumberOfControlPoints:0
+CONNECTION
+viewer:Point:showNpoints:In
+NumberOfControlPoints:0
+CONNECTION
+viewer:BoxChange:showNpoints:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+showNpoints:Widget:main:Widget1
+NumberOfControlPoints:0
+CONNECTION
+viewer:Widget:main:Widget2
+NumberOfControlPoints:0
+APP_END
index 1c097cefdefd190ce7317a4b6ffd9f840c2fa712..d026b00a5702282f4d68062bc7f4445b1ac82ca0 100644 (file)
@@ -1,97 +1,48 @@
-# ---------------------------------------------------------------------
-#
-# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
-#                        pour la Sant�)
-# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
-# Previous Authors : Laurent Guigues, Jean-Pierre Roux
-# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
-#
-#  This software is governed by the CeCILL-B license under French law and 
-#  abiding by the rules of distribution of free software. You can  use, 
-#  modify and/ or redistribute the software under the terms of the CeCILL-B 
-#  license as circulated by CEA, CNRS and INRIA at the following URL 
-#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
-#  or in the file LICENSE.txt.
-#
-#  As a counterpart to the access to the source code and  rights to copy,
-#  modify and redistribute granted by the license, users are provided only
-#  with a limited warranty  and the software's author,  the holder of the
-#  economic rights,  and the successive licensors  have only  limited
-#  liability. 
-#
-#  The fact that you are presently reading this means that you have had
-#  knowledge of the CeCILL-B license and that you accept its terms.
-# ------------------------------------------------------------------------ */ 
+# ----------------------------------
+# - BBTKGEditor v 1.5 BBS BlackBox Script
+# - /Users/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleShowNPoints.bbs
+# ----------------------------------
 
-description "Show N Points"
-author "info-dev@creatis.insa-lyon.fr"
-category "demo"
+# BBTK GEditor Script
+# ----------------------
 
-// To show how easy it is to add smthing
-// =====================================
-
-load vtk
-include wxvtk
-load std
-load itk
+include std
+include itkvtk
 include vtk
+include creaMaracasVisu
 include wx
-load itkvtk
-load creaMaracasVisu
 
+author "info-dev@creatis.insa-lyon.fr"
+description "Show N Points"
+category "demo"
 
+new vtk:LoadHola reader
 
-# Use new box (choose the way you want to select images)
-# -----------------------------------------------------
+new creaMaracasVisu:ViewerNV viewer
+  set viewer.nTypeView "5 1 2 0"
 
-#load creaImageIO
-#new ImageReader chooser
+new creaMaracasVisu:ShowNPoints showNpoints
+  set showNpoints.Radio "10"
 
-# Concatenate all the supposed-to-be consistent 2D images into a single vtkImageData
-# WARNING : File names alphabetical order is suposed to be meaningful ...
+new wx:LayoutSplit main
+  set main.Orientation "H"
 
-#new ConcatImages reader
-#   connect chooser.Out reader.In
 
+connect reader.Out viewer.In
 
+connect reader.Out showNpoints.Image
 
-# Here loads hola.mhd
-# -------------------------
+connect viewer.Renderer1 showNpoints.Renderer
 
-include vtk/boxes/bbLoadHola
-new LoadHola reader
+connect viewer.Point showNpoints.In
 
-# uncomment next lines to have a file selector
-# ---------------------------------------------
-/*
-new FileSelector openFileDialog
-  set openFileDialog.Wildcard  "(*.mhd)|*.mhd"
-new MetaImageReader reader
-   connect openFileDialog.Out reader.In
-*/
+connect viewer.BoxChange showNpoints.BoxExecute
 
-# uncomment next lines to use Gimmick
-# -----------------------------------
-/*
-load creaImageIO
-new Gimmick reader
-*/
+connect showNpoints.Widget main.Widget1
 
-new ViewerNV viewer
-  connect reader.Out viewer.In
-  set viewer.nTypeView "5 1 2 0"
+connect viewer.Widget main.Widget2
 
-new ShowNPoints showNpoints
-  connect reader.Out showNpoints.Image
-  connect viewer.Renderer1 showNpoints.Renderer
-  connect viewer.Point showNpoints.In
-  connect viewer.BoxChange showNpoints.BoxExecute
-  set showNpoints.Radio 10
 
-new LayoutSplit main
-   set main.Orientation H
-   connect showNpoints.Widget main.Widget1
-   connect viewer.Widget main.Widget2
 
+# Complex input ports
 exec main
-
index cfeee438b6ccb5a8ab7d1dcbb35ac57c6f8f7411..4dfa0ed44d85b0d7146bfbfe065829b601a4a3aa 100644 (file)
@@ -106,7 +106,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
   BBTK_INPUT(ShowNPoints,InitLstPointsY,"Initial lst of points Y",std::vector<int>,"");
   BBTK_INPUT(ShowNPoints,InitLstPointsZ,"Initial lst of points Z",std::vector<int>,"");
   BBTK_INPUT(ShowNPoints,InitLstLabels,"Initial lst of labels",std::vector<std::string>,"");
-  BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point, 2:Add/DeleteAll points, 3:As 0 with out save/load option",int,"");
+  BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point, 2:Add/DeleteAll points, 3:As 0 with out save/load option, 4 Multiple NPoints",int,"");
 
   BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
   BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
index f7fa68f29570aefedf98041f7cb6a7350fc772f6..8b17078b3213ccb4a202770fcd0da589a5cce2ad 100644 (file)
@@ -10,6 +10,7 @@
 #include <wx/sizer.h>
 #include <wx/filedlg.h>
 #include <wx/msgdlg.h>
+#include <wx/notebook.h>
 
 #include "WidgetShowNPoints.h"
 
   WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
   {
+    printf("EED WidgetShowNPoints::WidgetShowNPoints Start \n");
        // EED 2022-05-19
     //  mmodelShowNPoints                               = new ModelShowNPoints();
-      mActualLstPoints=0;
-      ModelShowNPoints* modelShowNPoints = new ModelShowNPoints();
-      lstModelShowNPoints.push_back( modelShowNPoints );
-      lstViewShowNPoints.push_back( new  ViewShowNPoints( modelShowNPoints ) );
-      
+                        mActualCollection= 0;
+    ModelShowNPoints*   modelShowNPoints = new ModelShowNPoints();
+    lstModelShowNPoints.push_back( modelShowNPoints );
+    lstViewShowNPoints.push_back( new  ViewShowNPoints( modelShowNPoints ) );
       
     mtype                                                      = type;
     SetType(mtype);
-    wxPanel    *panel                                  = this;
-    wxSizer *sizer                                     = NULL;
+    wxPanel*    panelParent         = this;
+    wxSizer*    sizer                          = NULL;
+    wxSizer*    MNPsizer            = NULL;
+
+    wxNotebook* bookSetPoints       = NULL;
+    wxNotebook* bookGroupManager    = NULL;
+    wxPanel*    panel               = NULL;
+    wxPanel*    panel2              = NULL;
+
+
+      
+
+      bookSetPoints     = new wxNotebook(panelParent,
+                          -1,
+                          wxDefaultPosition,
+                          wxDefaultSize,
+                          wxNB_TOP );
+      panel  = new wxPanel(bookSetPoints);
 
-       if ((mtype==0) || (mtype==3))
+
+    // Group Manager
+    if (mtype==4)
+    {
+          bookGroupManager   = new wxNotebook(panelParent, //bbGetWxParent(),
+                              -1,
+                              wxDefaultPosition,
+                              wxDefaultSize,
+                              wxNB_TOP );
+          panel2  = new wxPanel(bookGroupManager);
+          txtNrCollections                      = new wxStaticText(panel2,-1, _T("1   /  1 "));
+          wxButton *btnBackCollection           = new wxButton( panel2, -1, _T("<"));
+          wxButton *btnNextCollection           = new wxButton( panel2, -1, _T(">"));
+          wxButton *btnInsertCollectionBefore   = new wxButton( panel2, -1, _T("Insert Before"));
+          wxButton *btnInsertCollectionAfter    = new wxButton( panel2, -1, _T("Insert After"));
+          wxButton *btnDeleteCollection         = new wxButton( panel2, -1, _T("Delete"));
+
+          Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore);
+          Connect(btnInsertCollectionAfter->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter);
+          Connect(btnDeleteCollection->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection);
+          Connect(btnBackCollection->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection);
+          Connect(btnNextCollection->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection);
+
+          wxFlexGridSizer *sizer1               = new wxFlexGridSizer(1);
+          wxFlexGridSizer *sizer2               = new wxFlexGridSizer(2);
+        
+          sizer2->Add( btnBackCollection );
+          sizer2->Add( btnNextCollection );
+
+          sizer1->Add( txtNrCollections );
+          sizer1->Add( sizer2 );
+          sizer1->Add( btnInsertCollectionBefore );
+          sizer1->Add( btnInsertCollectionAfter );
+          sizer1->Add( btnDeleteCollection );
+          MNPsizer                        = sizer1;
+          panel2->SetSizer( MNPsizer );
+          panel2->SetAutoLayout(true);
+          panel2->Layout();
+          bookGroupManager->AddPage(panel2 , _T("Collection") );
+    } // if mtype 4
+
+       if ( (mtype==0) || (mtype==3) || (mtype==4) )
        {
                // Widget interface
                askPointLabel                                   = new wxStaticText(panel, -1, _T("Point label :")); // JPR
                wxButton *btnDeleteAllPoints    = new wxButton( panel, -1, _T("Delete all points"));
                wxButton *btnSavePoints                 = NULL;
                wxButton *btnLoadPoints                 = NULL;
-               if (mtype==0)
+               if ( (mtype==0) || (mtype==4) )
                {
                        btnSavePoints                           = new wxButton( panel, -1, _T("Save points"));
                        btnLoadPoints                           = new wxButton( panel, -1, _T("Load points"));
-               }
+               } // if mtype
                txtNrPoints                                             = new wxStaticText(panel,-1, _T(" "));
 
                //NTU: Sliders for opacity and radio change
-               wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T("  Points Opacity  ")));
-               sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-               wxStaticText* txRadio = new wxStaticText(this, -1, wxString(_T("  Points Radius  ")));
-               sdrRadio = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-
-               wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
-               //    sizer1->Add(new wxStaticText(panel,-1,_T("  ")));
+               wxStaticText* txOpacity         = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
+               sdrOpacity                      = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+               wxStaticText* txRadio           = new wxStaticText(panel, -1, wxString(_T("  Points Radius  ")));
+               sdrRadio                        = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
 
                Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
                Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT
                Connect(btnEraseLastPoint->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
                Connect(btnErasePoint->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
                Connect(btnDeleteAllPoints->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
-               if (mtype==0)
+               if ((mtype==0) || (mtype==4) )
                {
-                       Connect(btnSavePoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
-                       Connect(btnLoadPoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
+                       Connect(btnSavePoints->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
+                       Connect(btnLoadPoints->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
                }
                //NTU: Slider events
                Connect(sdrOpacity->GetId()                     , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
                Connect(sdrRadio->GetId()                       , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
 
+        wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
                sizer1->Add(askPointLabel); // JPR
                sizer1->Add(textCtrl);
                sizer1->Add(btnAddPoint);
                sizer1->Add(sdrOpacity,1,wxGROW );
                sizer1->Add(txRadio);
                sizer1->Add(sdrRadio,1,wxGROW );
-               if (mtype==0)
+        if ((mtype==0) || (mtype==4) )
                {
                        sizer1->Add(btnSavePoints);
                        sizer1->Add(btnLoadPoints);
                  txtNrPoints                                           = new wxStaticText(panel,-1, _T(" "));
 
                  //NTU: Sliders for opacity and radio change
-                 wxStaticText* txOpacity                       = new wxStaticText(this, -1, wxString(_T("  Points Opacity  ")));
-                 sdrOpacity                                            = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-                 wxStaticText* txRadio                         = new wxStaticText(this, -1, wxString(_T("  Points Radio  ")));
-                 sdrRadio                                                      = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-                 wxFlexGridSizer *sizer1                       = new wxFlexGridSizer(1);
+                 wxStaticText* txOpacity                       = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
+                 sdrOpacity                                            = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+                 wxStaticText* txRadio                         = new wxStaticText(panel, -1, wxString(_T("  Points Radio  ")));
+                 sdrRadio                                                      = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
                  Connect(btnSetPositionPoint->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
                  Connect(sdrOpacity->GetId()   , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
                  Connect(sdrRadio->GetId()     , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
 
+          wxFlexGridSizer *sizer1            = new wxFlexGridSizer(1);
                  sizer1->Add(btnSetPositionPoint);
                  sizer1->Add(txtNrPoints);
                  sizer1->Add(txOpacity);
         wxButton               *btnDeleteAllPoints = new wxButton(panel, -1, _T("      Delete All      "));
         wxStaticText   *spacer                         = new wxStaticText(panel, -1, _T("\n")); // JPR
                                         textCtrl                       = new wxTextCtrl(panel, -1);
-        wxFlexGridSizer *sizer1                        = new wxFlexGridSizer(1);
         Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
         Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);    
-        sizer1->Add(askPointLabel); 
+        wxFlexGridSizer *sizer1             = new wxFlexGridSizer(1);
+        sizer1->Add(askPointLabel);
         sizer1->Add(btnAddPoint);
         sizer1->Add(btnDeleteAllPoints);
         sizer1->Add(spacer);
         sizer1->Add(textCtrl);
-        sdrOpacity  = new wxSlider();
-        sdrRadio    = new wxSlider();
-        txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n"));
-        sizer = sizer1;
+      //  sdrOpacity                          = new wxSlider();
+      //  sdrRadio                            = new wxSlider();
+        txtNrPoints                         = new wxStaticText(panel, -1, _T("\n\n\n"));
+        sizer                               = sizer1;
        } // bbGetInputType 2
 
-       if (sizer!=NULL)
-       {
-               panel->SetSizer(sizer);
-               panel->SetAutoLayout(true);
-               panel->Layout();
-       } // if sizer
+            
+      panel->SetSizer(sizer);
+      panel->SetAutoLayout(true);
+      panel->Layout();
+      bookSetPoints->AddPage(panel , _T("Set Points") );
+
+    if ((mtype >= 0) && (mtype <= 3) )
+    {
+        if (sizer!=NULL)
+        {
+            wxFlexGridSizer *sizerParent             = new wxFlexGridSizer(1);
+            sizerParent->Add( bookSetPoints );
+            panelParent->SetSizer( sizerParent );
+            panelParent->SetAutoLayout(true);
+            panelParent->Layout();
+        } // if sizer
+    } // if  mtype 0 1 2 3
+      
+    if (mtype == 4)
+    {
+        if ((sizer!=NULL) && (MNPsizer!=NULL))
+        {
+            wxFlexGridSizer *sizerG             = new wxFlexGridSizer(2);
+            sizerG->Add(bookGroupManager);
+            sizerG->Add(bookSetPoints);
+            panelParent->SetSizer(sizerG);
+            panelParent->SetAutoLayout(true);
+            panelParent->Layout();
+        } // if sizer
+    } // if mtype 4
 }
 
 //------------------------------------------------------------------------
@@ -167,14 +247,14 @@ ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints()
 {
     // EED 2022-05-19
     // return mmodelShowNPoints;
-    return lstModelShowNPoints[ mActualLstPoints ];
+    return lstModelShowNPoints[ mActualCollection ];
 }
 
 // EED 2022-05-19
 //------------------------------------------------------------------------
 ViewShowNPoints* WidgetShowNPoints::GetViewShowNPoints()
 {
-    return lstViewShowNPoints[ mActualLstPoints ];
+    return lstViewShowNPoints[ mActualCollection ];
 }
 
 
@@ -634,10 +714,10 @@ void  WidgetShowNPoints::SetInitLstPoints( std::vector<int> initLstPointsX,  std
                return;
        }
        int i,sizeX,sizeY,sizeZ,sizeLabels;
-       sizeX=(int)initLstPointsX.size();
-       sizeY=(int)initLstPointsY.size();
-       sizeZ=(int)initLstPointsZ.size();
-       sizeLabels=(int)initLstLabels.size();
+       sizeX = (int)initLstPointsX.size();
+       sizeY = (int)initLstPointsY.size();
+       sizeZ = (int)initLstPointsZ.size();
+       sizeLabels = (int)initLstLabels.size();
        int x,y,z;
        std::string label;
        if ( (sizeX==sizeY) && (sizeX==sizeZ) )
@@ -683,3 +763,72 @@ double WidgetShowNPoints::GetOpacity()
 {
        return sdrOpacity->GetValue()/100;
 }
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::InsertCollection()
+{
+    ModelShowNPoints*   model   = new ModelShowNPoints();
+    ViewShowNPoints*    view    = new ViewShowNPoints( model );
+    model->SetImage( lstModelShowNPoints[0]->GetImage() );
+    view->mopacity = lstViewShowNPoints[0]->mopacity;
+    view->renderer = lstViewShowNPoints[0]->renderer;
+    lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model );
+    lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view );
+    RefreshCollectionText();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnInsertCollectionBefore(wxCommandEvent &event)
+{
+    InsertCollection();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
+{
+    mActualCollection++;
+    InsertCollection();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
+{
+    if ( lstModelShowNPoints.size()>=1 )
+    {
+        DeleteAllPoints();  // Actual Collection
+        lstModelShowNPoints.erase( lstModelShowNPoints.begin()+mActualCollection );
+        mActualCollection--;
+    }
+    RefreshCollectionText();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
+{
+    mActualCollection--;
+    if ( mActualCollection <0  )
+    {
+        mActualCollection=0;
+    } //if <=0
+    RefreshCollectionText();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
+{
+    mActualCollection++;
+    if ( mActualCollection >=lstModelShowNPoints.size() )
+    {
+        mActualCollection = lstModelShowNPoints.size()-1;
+    } //if <=0
+    RefreshCollectionText();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::RefreshCollectionText()
+{
+    wxString strTmp;
+    strTmp.Printf(_T("%d   /  %d "),  (int)mActualCollection+1, (int)lstModelShowNPoints.size() );
+    txtNrCollections->SetLabel( strTmp );
+    SetOutputBox();
+}
index e1308c3f6ad135f38f4434c877ea46733f7f7aa7..a0b664a48ea85ebc5a1b94e80c5c08fced16afcf 100644 (file)
@@ -1,11 +1,7 @@
 
-
 #ifndef __WidgetShowNPoints_h_INCLUDED__
 #define __WidgetShowNPoints_h_INCLUDED__
 
-
-
-
 #include "ModelShowNPoints.h"
 #include "ViewShowNPoints.h"
 
@@ -14,7 +10,6 @@
 #include <wx/slider.h>
 #include <wx/stattext.h>
 
-
 class WidgetShowNPoints : public wxPanel
 {
   public:
@@ -31,7 +26,17 @@ class WidgetShowNPoints : public wxPanel
          void OnLoadPoints(wxCommandEvent &event);
 
          virtual void UpdatePoints(wxCommandEvent &event);
-         
+
+      void InsertCollection();
+      void OnInsertCollectionBefore(wxCommandEvent &event);
+      void OnInsertCollectionAfter(wxCommandEvent &event);
+      void OnDeleteCollection(wxCommandEvent &event);
+      void OnBackCollection(wxCommandEvent &event);
+      void OnNextCollection(wxCommandEvent &event);
+
+      void RefreshCollectionText();
+
+    
     // EED 2022-05-19
          //void RefreshPoint(int id);
       //void RefreshPoints();
@@ -70,21 +75,21 @@ class WidgetShowNPoints : public wxPanel
          //std::vector<vtkTextActor3D*>      lstActorsText;
       //std::vector<vtkSphereSource*>     lstSourceSphere;
       //std::vector<double>               mcolour;
-      //ModelShowNPoints                *mmodelShowNPoints;
+      //ModelShowNPoints*                 mmodelShowNPoints;
       //double                            mopacity;
-      std::vector<ViewShowNPoints*>     lstViewShowNPoints;
+      std::vector<ViewShowNPoints*>       lstViewShowNPoints;
 
          //NTU: For updating points
-         wxStaticText                              *askPointLabel;
-         wxTextCtrl                                *textCtrl;
-         wxStaticText                              *txtNrPoints;
-         wxSlider                                  *sdrOpacity;
-         wxSlider                                  *sdrRadio;
+         wxStaticText                              * askPointLabel;
+         wxTextCtrl                                * textCtrl;
+      wxStaticText                      * txtNrCollections;
+      wxStaticText                         * txtNrPoints;
+         wxSlider                                  * sdrOpacity;
+         wxSlider                                  * sdrRadio;
     
-    std::vector<ModelShowNPoints*>    lstModelShowNPoints;
-      int                               mActualLstPoints;
-  
+      std::vector<ModelShowNPoints*>    lstModelShowNPoints;
          int                                                       mtype;
+      int                               mActualCollection;
 };