]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Fri, 31 Oct 2008 14:54:25 +0000 (14:54 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Fri, 31 Oct 2008 14:54:25 +0000 (14:54 +0000)
126 files changed:
CMakeLists.txt [new file with mode: 0644]
appli/CMakeLists.txt [new file with mode: 0644]
appli/wxContourGUIExample/CMakeLists.txt [new file with mode: 0644]
appli/wxContourGUIExample/wxContourGUIExample.cxx [new file with mode: 0644]
appli/wxContourGUIExample/wxContourGUIExample.h [new file with mode: 0644]
bbtk/CMakeLists.txt [new file with mode: 0644]
bbtk/Configure.cmake [new file with mode: 0644]
bbtk/PackageConfig.cmake.in [new file with mode: 0644]
bbtk/README.txt [new file with mode: 0644]
bbtk/UsePackage.cmake.in [new file with mode: 0644]
bbtk/bbs/CMakeLists.txt [new file with mode: 0644]
bbtk/bbs/appli/README.txt [new file with mode: 0644]
bbtk/bbs/boxes/README.txt [new file with mode: 0644]
bbtk/data/CMakeLists.txt [new file with mode: 0644]
bbtk/doc/CMakeLists.txt [new file with mode: 0644]
bbtk/doc/bbdoc/CMakeLists.txt [new file with mode: 0644]
bbtk/doc/bbdoc/header.html.in [new file with mode: 0644]
bbtk/doc/doxygen/CMakeLists.txt [new file with mode: 0644]
bbtk/doc/doxygen/DoxyMainPage.txt.in [new file with mode: 0644]
bbtk/doc/doxygen/Doxyfile.txt.in [new file with mode: 0644]
bbtk/src/CMakeLists.txt [new file with mode: 0644]
bbtk/src/bbCreaContournDimensions.cxx [new file with mode: 0644]
bbtk/src/bbCreaContournDimensions.h [new file with mode: 0644]
lib/AdditionalUsenDimensions.cmake.in [new file with mode: 0644]
lib/AdditionalnDimensionsConfig.cmake.in [new file with mode: 0644]
lib/CMakeLists.txt [new file with mode: 0644]
lib/Interface_Icons_NDimensions/CMakeLists.txt [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfDeleteMenu.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfDeleteMenu.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfEditMenu.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfEditMenu.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfIOMenu.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfIOMenu.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfMainPanel.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfMainPanel.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfMenuBar.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfNewContourMenu.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfSegmentationMenu.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfToolsMenu.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfToolsMenu.h [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.cxx [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/CMakeLists.txt [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/ConceptDataWrap.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/ConceptDataWrap.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/ContourWrap_ViewControl.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/ContourWrap_ViewControl.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/PerformingOperation.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/PerformingOperation.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/__wxContourEventHandler.cxx__ [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxConceptControl.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxConceptControl.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourMainPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ActionCommnadsID.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_AutomaticFormsToolsPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_AutomaticFormsToolsPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ControlPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ControlPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_DrawToolsPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_DrawToolsPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_EdtionToolsPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_EdtionToolsPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_Grid.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_Grid.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ListViewPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_ListViewPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_MenuBar.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_MenuBar.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_OperationsToolsPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_OperationsToolsPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_StandardToolsPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContour_StandardToolsPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/AxeThing.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/AxeThing.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CMakeLists.txt [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandDataBase.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandDataBase.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandObject.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandObject.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandsHandler.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandsHandler.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandsRegisterStructure.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/CommandsRegisterStructure.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ComposedCommand.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ComposedCommand.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ContourThing.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ContourThing.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ContourWorkspace.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ContourWorkspace.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ExecutableCommand.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ExecutableCommand.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ICommandsUser.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ImageSectionThing.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ImageSectionThing.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ImageSourceThing.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/ImageSourceThing.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/InstantMembersNameList.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/InstantMembersNameList.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/KeyThing.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/KeyThing.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/NameWrapper.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/NameWrapper.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineGroup.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineGroup.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineModelManager.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineModelReader.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/OutlineModelReader.h [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/PrefixMaxKeyGenerator.cxx [new file with mode: 0644]
lib/kernel_ManagerContour_NDimensions/PrefixMaxKeyGenerator.h [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3521361
--- /dev/null
@@ -0,0 +1,59 @@
+PROJECT(CreaContours)
+
+SET(PROJECT_MAJOR_VERSION 1)
+SET(PROJECT_MINOR_VERSION 0)
+SET(PROJECT_BUILD_VERSION 0)
+
+SET(CREA_VERBOSE_CMAKE TRUE)
+
+FIND_PACKAGE(crea REQUIRED)
+IF (crea_FOUND)
+  INCLUDE(${crea_USE_FILE})
+ENDIF(crea_FOUND)
+
+FIND_PACKAGE(NDimensionsEnvironment REQUIRED)
+IF (NDimensionsEnvironment_FOUND)
+  INCLUDE(${NDimensionsEnvironment_USE_FILE})
+ENDIF(NDimensionsEnvironment_FOUND)
+
+FIND_PACKAGE(maracasVisuLib REQUIRED)
+IF (maracasVisuLib_FOUND)
+  INCLUDE(${maracasVisuLib_USE_FILE})
+ENDIF(maracasVisuLib_FOUND)
+
+FIND_PACKAGE(creaImageIO REQUIRED)
+IF (creaImageIO_FOUND)
+  INCLUDE(${creaImageIO_USE_FILE})
+ENDIF(creaImageIO_FOUND)
+
+
+SET(USE_GDCM ON)
+SET(USE_GDCM_VTK ON)
+SET(USE_WXWIDGETS ON)
+SET(USE_VTK ON)
+SET(USE_ITK OFF)
+SET(USE_BOOST OFF)
+
+CREA_FIND_AND_USE_LIBRARIES()
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
+SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
+MARK_AS_ADVANCED(
+  CMAKE_BACKWARDS_COMPATIBILITY
+  EXECUTABLE_OUTPUT_PATH 
+  LIBRARY_OUTPUT_PATH
+  )
+  
+ IF(WIN32)
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/win32)
+LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/win32)
+ENDIF(WIN32)
+
+
+INCLUDE_DIRECTORIES(lib/Interface_ManagerContour_NDimensions)
+INCLUDE_DIRECTORIES(lib/Interface_Icons_NDimensions)
+INCLUDE_DIRECTORIES(lib/kernel_ManagerContour_NDimensions)
+
+SUBDIRS(lib)
+SUBDIRS(appli)
+SUBDIRS(bbtk)
diff --git a/appli/CMakeLists.txt b/appli/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c8396e8
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS(wxContourGUIExample)
diff --git a/appli/wxContourGUIExample/CMakeLists.txt b/appli/wxContourGUIExample/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c65e969
--- /dev/null
@@ -0,0 +1,20 @@
+
+IF(WIN32)
+  #MESSAGE("WIN32")
+  ADD_EXECUTABLE(wxContourGUIExample WIN32 wxContourGUIExample.cxx)  
+  SET_TARGET_PROPERTIES(wxContourGUIExample PROPERTIES LINK_FLAGS /subsystem:console )
+ELSE(WIN32)
+  ADD_EXECUTABLE(wxContourGUIExample wxContourGUIExample)
+ENDIF(WIN32)
+
+TARGET_LINK_LIBRARIES( wxContourGUIExample
+                                               creaImageIO     
+                                               Interface_Icons_NDimensions_lib
+                                               Interface_ManagerContour_NDimensions_lib
+                                               kernel_ManagerContour_NDimensions_lib
+                                               NDimensionsEnvironment
+                                               maracasVisuLib
+                                               vtkImaging  vtkGraphics vtkRendering vtkFiltering vtkCommon
+                                          )
+
+INSTALL_TARGETS(/bin/ wxContourGUIExample )
diff --git a/appli/wxContourGUIExample/wxContourGUIExample.cxx b/appli/wxContourGUIExample/wxContourGUIExample.cxx
new file mode 100644 (file)
index 0000000..39e109f
--- /dev/null
@@ -0,0 +1,206 @@
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+
+
+#include "wxContourGUIExample.h"
+#include "wxContourMainFrame.h"
+#include "OutlineModelManager.h"
+#include "wxContourEventHandler.h"
+
+#include "wxContourMainPanel.h"
+
+#include "vtkMetaImageReader.h"
+#include <map>
+#include "vtkImageData.h"
+#include "OutlineModelBuilder.h"
+#include "ContourThing.h"
+#include "AxeThing.h"
+#include "ImageSourceThing.h"
+#include "ImageSectionThing.h"
+#include "SomeEnvironment.h"
+#include "ReaderEnvironment.h"
+
+#include "wx/artprov.h"
+#include <wx/filedlg.h>
+
+
+#include "interfMainPanel.h"
+
+#include <creaImageIOWxGimmickDialog.h>
+
+#include <creaVtkBasicSlicer.h>
+
+wxContourMainFrame* wxTheApplication::frame = 0;
+//----------------------------------------------------------------------------------------------------------------
+// This macro implements the entry point (main function) for the application
+//----------------------------------------------------------------------------------------------------------------
+
+IMPLEMENT_APP( wxTheApplication );
+
+wxContourGUIExample :: wxContourGUIExample(const wxString& title, const wxPoint& pos, const wxSize& size)
+: wxFrame((wxFrame *) NULL, -1, title, pos, size)
+{
+       
+}
+
+bool wxTheApplication :: OnInit()
+{
+       
+//-------------------------------------------------------------
+// Doing what is done by the bbtk boxes 
+       /*vtkMetaImageReader *reader = vtkMetaImageReader::New();
+//     reader->SetFileName( "data\\hola.mhd" );
+//     reader->SetFileName( "C:/Program Files/bbtk-1.0/data/vtk/img02.maracas.mhd" );
+//     reader->SetFileName( "C:/Program Files/bbtk-1.0/data/vtk/test01.maracas.mhd" );
+//     reader->SetFileName( "C:/download/Elise/Elise_IRM_Helium/A/test01b.maracas.mhd" );
+       
+       wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.mhd"), wxOPEN );
+       if (dialog.ShowModal() == wxID_OK)
+       {
+               std::string filename = (const char *)(dialog.GetPath().mb_str());
+               reader->SetFileName( filename.c_str() );
+       } else {
+               reader->SetFileName( "data\\hola.mhd" );
+//             Halt(0);
+       }
+
+       reader->Update();*/
+
+       wxInitAllImageHandlers();
+
+   int image_type = GIMMICK_3D_IMAGE_SELECTION;
+   int threads = 1;
+
+   creaImageIO::WxGimmickDialog w(0,
+                                 -1,
+                                 _T("WxGimmickDialog test"),
+                                 wxDefaultPosition,
+                                 wxSize(1200,800),
+                                 image_type,
+                                 threads);
+   w.ShowModal();
+   
+   vtkImageData* selectedimage=NULL;
+       if(w.GetReturnCode() == wxID_OK){
+
+       std::vector<std::string> s;
+       w.GetSelectedFiles(s);
+       std::vector<std::string>::iterator i;
+          for (i=s.begin();i!=s.end();++i){
+                  std::cout << *i << std::endl;
+          }
+               
+          std::cout << "$$$$ "<<std::endl;
+       std::vector<vtkImageData*> images;
+       w.GetSelectedImages(images);
+          selectedimage = images[0];
+       //crea::VtkBasicSlicer(images.front());
+       //images.front()->Delete();
+
+       }else if (w.GetReturnCode() == wxID_CANCEL){
+          vtkMetaImageReader *reader = vtkMetaImageReader::New();
+          reader->SetFileName( "data/hola.mhd" );
+          reader->Update();
+       selectedimage = reader->GetOutput();
+       }else{        
+               return TRUE;
+       }   
+
+       std::string conceptsFN                  =  "data/holaConceptsFile.cf";
+       std::string imageSourcesFN              = "data/holaImagesInstantsFile.of";
+       std::string imageSectionsFN             = "";
+       std::string axeThingsFN                 = "";
+
+       std::map<std::string, ImageSourceThing *> * sourcesMap          = new std::map<std::string, ImageSourceThing *>();
+       std::map<std::string, ImageSectionThing *>* sectionsMap         = new std::map<std::string, ImageSectionThing *>();
+       std::map<std::string, AxeThing *>* axesMap                                      = new std::map<std::string, AxeThing *>();
+       std::map<std::string, ContourThing *>* outlinesMap                      = new std::map<std::string, ContourThing *>();  
+
+       ImageSourceThing * thing                                                                        = new ImageSourceThing(selectedimage);
+       sourcesMap->insert(std::pair<std::string, ImageSourceThing *>( "Source Image 1", thing));
+
+       OutlineModelBuilder * _builder                                                          = new OutlineModelBuilder( conceptsFN );
+       _builder->buildImageSource_Envornment( imageSourcesFN, sourcesMap );
+       _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap );         
+       _builder->buildAxe_Envornment(axeThingsFN, axesMap );
+       _builder->buildCountour_Envornment( imageSectionsFN, outlinesMap );
+       
+//-------------------------------------------------------------
+
+       /*frame = new wxContourMainFrame(_builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(),  _builder->getContourEnv(),NULL, wxID_ANY, wxT("ROI Application Sample"), wxPoint(50,50), wxSize(800, 600)); 
+       frame->Show(TRUE);*/
+
+       //Creating the evtHandler of the panels
+       wxContourEventHandler * eventHandler = new wxContourEventHandler();
+
+       //Creating the window that will show the panels
+//JCP 21 - 10 - 08
+       //wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 -  Use limited to the research team (Creatis-LRMN)"), wxPoint(50,50), wxSize(800, 600) );
+       wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 "), wxPoint(50,50), wxSize(800, 600) );
+       frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(""), wxPoint(50,50), wxSize(800, 600) ); 
+                                                                       
+       //frame = new wxContourMainFrame( NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 17 Oct 2008 -  Use limited to the research team (Creatis-LRMN)"), wxPoint(50,50), wxSize(800, 600) ); 
+       frame1->CreateStatusBar();
+//JCP 21 - 10 - 08
+       //Getting the parent for the panels ( using aui )
+       wxAuiNotebook * parent = frame->createNotebook();
+
+       //Creating the objects to manage
+       OutlineModelManager             * modelManager                          = new OutlineModelManager( _builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(),  _builder->getContourEnv() );
+
+       wxInstantChooserPanel   * instantPanel                          = new wxInstantChooserPanel( parent, "Instant Chooser", true );
+       ImageSourceThing                * imageSource = modelManager->getImageSourceThingByKeyName( "Source Image 1" );
+       wxContourViewPanel              * theViewPanel                          = new wxContourViewPanel( imageSource->getSourceImage(), parent );      
+       //wxContour_ButtonsBar  * buttons                                       = new wxContour_ButtonsBar(frame, -1, wxDefaultPosition, wxDefaultSize);
+
+       eventHandler->setModelManager( modelManager );
+       eventHandler->setViewPanel( theViewPanel );
+       eventHandler->setInstantChooserPanel( instantPanel );
+       //eventHandler->setButtonsBar( buttons );
+       //JCP 17 - 10 - 08
+       //buttons->Show(false);
+       //JCP 17 - 10 - 08
+       bool successConfiuration = eventHandler->configureEventsHandling();
+
+       frame->setViewPanel( theViewPanel );
+       frame->setInstantChooserPanel( instantPanel );
+       //JCP 17 - 10 - 08
+//     frame->setButtonsBar( buttons );
+       //JCP 17 - 10 - 08
+       successConfiuration &= frame->configurePanels( parent );
+
+       //JCP 17 - 10 - 08
+       //buttons->Show(false);
+       //JCP 17 - 10 - 08
+
+
+       //frame->Show(TRUE);
+       frame1->Show(TRUE);
+       /*JCP 17 - 10 - 08
+       if ( successConfiuration )
+       {
+               frame->Show(TRUE);
+       }*/
+       
+//     SetTopWindow(frame);
+
+//JCP -- new Interface
+       interfMainPanel* pannew = interfMainPanel::getInstance(frame1, eventHandler);
+
+       //pannew->addContourCheckBox("contour1");
+       //pannew->addContourCheckBox("contour3");
+       //pannew->addContourCheckBox("contour2");
+       //pannew->addContourCheckBox("contour4");
+//JCP -- new Interface
+
+
+       return TRUE;
+}
+
+int main(int argc, char* argv[])                                       
+  {                                                                    
+    return WinMain(::GetModuleHandle(NULL), NULL,                      
+                  ::GetCommandLine(), SW_SHOWNORMAL);                  
+  }            
+
diff --git a/appli/wxContourGUIExample/wxContourGUIExample.h b/appli/wxContourGUIExample/wxContourGUIExample.h
new file mode 100644 (file)
index 0000000..b61ccb6
--- /dev/null
@@ -0,0 +1,49 @@
+
+#ifndef __EXAMPLE_CONTOUR_GUI__
+#define __EXAMPLE_CONTOUR_GUI__
+
+
+// ----------------------------------------------------------------------------
+// wx headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// ----------------------------------------------------------------------------
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <string.h>
+#include "wxContourMainFrame.h"
+
+
+class wxContourGUIExample : public wxFrame
+{
+public:
+       wxContourGUIExample/*(wxWindow *parent,wxString title);*/(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+    void OnBtnRun(wxCommandEvent& event);
+       
+private:
+       
+       wxStaticText            * stResult;
+
+       wxButton                        * btn;
+               
+       //DECLARE_CLASS(wxContourGUIExample)    
+
+};
+
+
+class wxTheApplication : public wxApp
+{
+public:
+    bool OnInit();
+private:
+       static wxContourMainFrame * frame;
+       
+};
+
+#endif 
diff --git a/bbtk/CMakeLists.txt b/bbtk/CMakeLists.txt
new file mode 100644 (file)
index 0000000..92d1fa4
--- /dev/null
@@ -0,0 +1,170 @@
+#===========================================================================
+# CMAKE SETTINGS FOR BUILDING A BBTK PACKAGE
+#===========================================================================
+
+#===========================================================================
+# THE NAME OF THE BBTK PACKAGE
+SET(BBTK_PACKAGE_NAME CreaContour)
+#===========================================================================
+
+
+
+#===========================================================================
+# IF IT IS A STANDALONE PROJECT UNCOMMENT NEXT LINE TO DECLARE YOUR PROJECT
+# PROJECT(bb${BBTK_PACKAGE_NAME})
+#===========================================================================
+
+#===========================================================================
+# PACKAGE AUTHOR
+# !!! NO COMMA ALLOWED !!!
+SET(${BBTK_PACKAGE_NAME}_AUTHOR "car-prie@uniandes.edu.co")
+#===========================================================================
+
+#===========================================================================
+# PACKAGE DESCRIPTION
+SET(${BBTK_PACKAGE_NAME}_DESCRIPTION "This package contains the module ndimensions ")
+#===========================================================================
+
+#===========================================================================
+# PACKAGE VERSION NUMBER 
+SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION 1)
+SET(${BBTK_PACKAGE_NAME}_MINOR_VERSION 0)
+SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION 0)
+#===========================================================================
+
+
+#===========================================================================
+# UNCOMMENT EACH LIBRARY NEEDED (WILL BE FOUND AND USED AUTOMATICALLY)
+ SET(${BBTK_PACKAGE_NAME}_USE_VTK  ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_ITK  ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_GDCM ON)
+# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
+ SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
+#===========================================================================
+
+#===========================================================================
+# LIST HERE THE OTHER bbtk PACKAGES NEEDED
+# (WILL BE FOUND AND USED AUTOMATICALLY)
+SET(${BBTK_PACKAGE_NAME}_USE_PACKAGES 
+  # std
+  # wx
+  # itk
+  # vtk
+  # ...
+  )
+#===========================================================================
+
+#===========================================================================
+# THE SOURCES OF THE PACKAGE
+# EITHER UNCOMMENT NEXT LINE TO COMPILE ALL .cxx OF THE src DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_CXX ON)
+# ... OR LIST THE FILES TO COMPILE MANUALLY :
+#SET(${BBTK_PACKAGE_NAME}_SOURCES
+# LIST HERE THE FILES TO COMPILE TO BUILD THE LIB
+# E.G. TO COMPILE "toto.cxx" ADD "toto" (NO EXTENSION)
+# THE PATH MUST BE RELATIVE TO THE src FOLDER
+#    )
+#===========================================================================
+
+#===========================================================================
+# THE xml SOURCES OF THE PACKAGE
+# EITHER UNCOMMENT NEXT LINE TO bbfy ALL .xml OF THE src DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_XML ON)
+# ... OR LIST THE FILES TO COMPILE MANUALLY :
+#SET(${BBTK_PACKAGE_NAME}_XML_SOURCES
+# LIST HERE THE FILES TO bbfy TO BUILD THE LIB
+# E.G. TO bbfy "toto.xml" ADD "toto" (NO EXTENSION)
+# THE PATH MUST BE RELATIVE TO THE src FOLDER
+#    )
+#===========================================================================
+
+#===========================================================================
+# THE SCRIPT-DEFINED BOXES OF THE PACKAGE (bbs)
+# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/boxes DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_BOXES ON)
+# ... OR LIST THE FILES TO INCLUDE MANUALLY :
+# SET(${BBTK_PACKAGE_NAME}_BBS_BOXES
+# LIST HERE THE bbs FILES TO INCLUDE 
+# E.G. TO INCLUDE "boxes/bbtoto.bbs" ADD "boxes/bbtoto" (NO EXTENSION)
+# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
+#)
+#===========================================================================
+
+#===========================================================================
+# THE SCRIPT-DEFINED APPLICATIONS OF THE PACKAGE (bbs)
+# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/appli DIRECTORY :
+SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_APPLI ON)
+# ... OR LIST THE FILES TO INCLUDE MANUALLY :
+# SET(${BBTK_PACKAGE_NAME}_BBS_APPLI
+# LIST HERE THE bbs FILES TO INCLUDE 
+# E.G. TO INCLUDE "appli/testToto.bbs" ADD "appli/testToto" (NO EXTENSION)
+# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
+#)
+#===========================================================================
+#===========================================================================
+##  FIND_PATH(NewInterface NAME CMakeList.txt
+##  PATHS
+##      D:/CreaContour/Desarrollo/ndimensionsInterfaz
+##   DOC "New Interface path"
+##  )
+##  IF(NOT NewInterface)
+##   MESSAGE(FATAL_ERROR "New Interface not found")
+##  ENDIF(NOT NewInterface)
+##  set (New_Interface ${NewInterface})
+#===========================================================================
+SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS
+  # LIST HERE YOUR ADDITIONAL INCLUDE DIRECTORIES 
+  # EXCEPT :
+  #  - src
+  #  - bbtk dirs
+  #  - automatically handled libraries or packages : wx, vtk... (see above)
+  #  - the dirs automatically set by other libraries found by FIND_PACKAGE     
+  
+  )
+  ##SUBDIRS( ${New_Interface} )
+#===========================================================================
+
+#===========================================================================
+SET(${BBTK_PACKAGE_NAME}_LIBS 
+  # LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST
+  # EXCEPT : the same libs than for INCLUDE_DIRS 
+       Interface_ManagerContour_NDimensions_lib
+       Interface_Icons_NDimensions_lib
+       kernel_ManagerContour_NDimensions_lib
+       NDimensionsEnvironment
+       maracasVisuLib
+       vtkImaging  vtkGraphics vtkRendering vtkFiltering vtkCommon
+  )
+#===========================================================================
+
+
+#===========================================================================
+# IF NEEDED : UNCOMMENT NEXT LINE 
+# AND LIST ADDITIONNAL DIRECTORIES 
+# IN WHICH TO LOOK FOR LIBRARIES TO LINK AGAINST
+#LINK_DIRECTORIES(../lib/Interface_ManagerContour_NDimensions)
+#===========================================================================
+
+#===========================================================================
+# SET TO TRUE TO HAVE INFORMATION ON LIBRARIES FOUND DURING CMAKE CONFIGURE
+SET(FIND_PACKAGE_VERBOSE TRUE)
+#===========================================================================
+
+#===========================================================================
+# END OF USER SECTION
+#===========================================================================
+
+
+
+
+
+#===========================================================================
+# Include configuration script
+INCLUDE(Configure.cmake)
+#===========================================================================
+
+#===========================================================================
+# EOF
+#===========================================================================
+
diff --git a/bbtk/Configure.cmake b/bbtk/Configure.cmake
new file mode 100644 (file)
index 0000000..946aaf6
--- /dev/null
@@ -0,0 +1,73 @@
+#-----------------------------------------------------------------------------
+# DOES THE USER WANT TO BUILD THE PACKAGE ?
+OPTION(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME} 
+  "Build the bbtk package ${BBTK_PACKAGE_NAME} ?" OFF)
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+IF(BBTK_CORE_PACKAGE)
+  IF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+    SWITCH_ON_IF_BUILD_ALL(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+  ENDIF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+ENDIF(BBTK_CORE_PACKAGE)
+#-----------------------------------------------------------------------------
+
+
+#-----------------------------------------------------------------------------
+# IF THE USER HAS CHOSEN TO BUILD THE PACKAGE
+IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+  #---------------------------------------------------------------------------
+  
+  #===========================================================================
+  # If the package is not a "core" bbtk package (included into the toolkit)
+  # then we have to find (and use) bbtk 
+  IF(NOT BBTK_CORE_PACKAGE)
+    #-------------------------------------------------------------------------
+    # Find and use the Black Box Toolkit
+    # Search BBTK
+    FIND_PACKAGE(BBTK)
+    # If bbtk found
+    IF(BBTK_FOUND)
+      INCLUDE(${BBTK_USE_FILE})
+      SET(BBTK_PACKAGE_LIBS 
+       ${BBTK_PACKAGE_LIBS}
+       ${BBTK_LIBRARIES})
+      MARK_AS_ADVANCED(BBTK_DIR)
+    ENDIF(BBTK_FOUND)
+  ENDIF(NOT BBTK_CORE_PACKAGE)
+    
+  #===========================================================================
+  # Include package configuration cmake script from bbtk dir
+  INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage.cmake)
+  #===========================================================================
+  
+  
+  #---------------------------------------------------------------------------
+ELSE(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+  #-------------------------------------------------------------------------
+  
+  #-----------------------------------------------------------------------
+  IF(BBTK_CORE_PACKAGE)
+    #-----------------------------------------------------------------------
+    # If package deps in global deps : reset global deps
+    IF(${BBTK_PACKAGE_NAME}_IN_DEPS)
+      SET(BBTK_PACKAGES_DEPS "" CACHE INTERNAL 
+       "bbtk packages dependencies" FORCE)
+      #    STRING(REPLACE "${${BBTK_PACKAGE_NAME}_DEPS};"
+      #      "" TEMP
+      #      ${BBTK_PACKAGES_DEPS})
+      #    
+      #    SET(BBTK_PACKAGES_DEPS ${TEMP}
+      #      CACHE INTERNAL "bbtk packages dependencies" FORCE)
+    ENDIF(${BBTK_PACKAGE_NAME}_IN_DEPS)
+    #-----------------------------------------------------------------------
+    
+    #-----------------------------------------------------------------------
+    # Remove the package include scripts to avoid loading it by include * 
+    FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbs)
+    FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}-appli.bbs)
+    #-----------------------------------------------------------------------
+  ENDIF(BBTK_CORE_PACKAGE)
+  
+  #-------------------------------------------------------------------------
+ENDIF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
diff --git a/bbtk/PackageConfig.cmake.in b/bbtk/PackageConfig.cmake.in
new file mode 100644 (file)
index 0000000..0ade94b
--- /dev/null
@@ -0,0 +1,27 @@
+#========================================================================
+# BBTK package configuration 
+# ** DO NOT REMOVE **
+SET(BBTK_PACKAGE_NAME                 @BBTK_PACKAGE_NAME@)
+SET(@BBTK_PACKAGE_NAME@_USE_VTK       @BBTK_PACKAGE_USE_VTK@)
+SET(@BBTK_PACKAGE_NAME@_USE_ITK       @BBTK_PACKAGE_USE_ITK@)
+SET(@BBTK_PACKAGE_NAME@_USE_GDCM      @BBTK_PACKAGE_USE_GDCM@)
+SET(@BBTK_PACKAGE_NAME@_USE_GSMIS     @BBTK_PACKAGE_USE_GSMIS@)
+SET(@BBTK_PACKAGE_NAME@_USE_WXWIDGETS @BBTK_PACKAGE_USE_WXWIDGETS@)
+SET(@BBTK_PACKAGE_NAME@_USE_PACKAGES  @BBTK_PACKAGE_USE_PACKAGES@)
+SET(@BBTK_PACKAGE_NAME@_AUTHOR        "@BBTK_PACKAGE_AUTHOR@") 
+SET(@BBTK_PACKAGE_NAME@_DESCRIPTION   "@BBTK_PACKAGE_DESCRIPTION@")
+SET(@BBTK_PACKAGE_NAME@_MAJOR_VERSION @BBTK_PACKAGE_MAJOR_VERSION@)
+SET(@BBTK_PACKAGE_NAME@_MINOR_VERSION @BBTK_PACKAGE_MINOR_VERSION@) 
+SET(@BBTK_PACKAGE_NAME@_BUILD_VERSION @BBTK_PACKAGE_BUILD_VERSION@)
+SET(@BBTK_PACKAGE_NAME@_INCLUDE_DIRS  @BBTK_PACKAGE_INCLUDE_DIRS@)
+SET(@BBTK_PACKAGE_NAME@_LIBS          @BBTK_PACKAGE_LIBS@)
+# A BBTK PACKAGE NEEDS BBTK
+FIND_PACKAGE(BBTK REQUIRED)
+# BBTK Package configuration file inclusion
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_PackageConfig.cmake)
+# End of BBTK package configuration 
+#========================================================================
+
+#========================================================================
+# INSERT YOUR CUSTOM CONFIG HERE 
+#========================================================================
diff --git a/bbtk/README.txt b/bbtk/README.txt
new file mode 100644 (file)
index 0000000..96e622f
--- /dev/null
@@ -0,0 +1,52 @@
+This is a void bbtk package structure.
+
+You should have this file tree :
+
+.
+|-- CMakeLists.txt
+|-- Configure.cmake
+|-- PackageConfig.cmake.in
+|-- README.txt
+|-- UsePackage.cmake.in
+|-- bbs
+|   |-- CMakeLists.txt
+|   |-- appli
+|   `-- boxes
+|-- data
+|   `-- CMakeLists.txt
+|-- doc
+|   |-- CMakeLists.txt
+|   |-- bbdoc
+|   |   |-- CMakeLists.txt
+|   |   `-- header.html.in
+|   `-- doxygen
+|       |-- CMakeLists.txt
+|       |-- DoxyMainPage.txt.in
+|       `-- Doxyfile.txt.in
+`-- src
+    `-- CMakeLists.txt
+
+To use it :
+
+* Edit the root CMakeLists.txt file to customize your package build settings
+  (instructions inside the file)
+
+* Put your c++/xml boxes sources in 'src' 
+  Use the convention : If the name of your package is PACK and the name of your box is BOX then name the source files bbPACKBOX.{h|cxx|xml}
+
+* Put your script-defined boxes in 'bbs/boxes'. 
+  Use the convention : If the name of your box is 'Box' then call the file 'bbBox.bbs'
+
+* Put your script-defined applications in 'bbs/appli'. 
+
+* Put your data in 'data'
+
+* You can customize the header of your package html doc by editing the file 'doc/bbdoc/header.html.in'. You must put html code in this file (or edit it with an html editor). You can include images or links to other html pages. The images and pages must be put in the folder 'doc/bbdoc' and will be properly installed. The same way, you can link to these images or pages in your boxes descriptions without giving any path. If you create subdirs for your material then you have to install the materials yourself by editing the CMakeLists.txt and links must use path with are relative to 'doc/bbdoc'.
+
+* You can customize the main page of your doxygen doc by editing the file 'doc/doxygen/DoxyMainPage.txt.in'.
+
+* Advanced settings : you can add custom cmake settings for your package installation process by CMakeCreateFindPackage in the files PackageConfig.cmake.in and UsePackage.cmake.in (see CMakeCreateFindPackage doc).
+
+THAT'S ALL FOLKS !
+
+
diff --git a/bbtk/UsePackage.cmake.in b/bbtk/UsePackage.cmake.in
new file mode 100644 (file)
index 0000000..2ecb206
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT REMOVE :
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_UsePackage.cmake)
+
+# INSERT YOUR CUSTOM USE HERE 
diff --git a/bbtk/bbs/CMakeLists.txt b/bbtk/bbs/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2c0eb7c
--- /dev/null
@@ -0,0 +1,4 @@
+
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_bbs.cmake)
+
+
diff --git a/bbtk/bbs/appli/README.txt b/bbtk/bbs/appli/README.txt
new file mode 100644 (file)
index 0000000..cd535ec
--- /dev/null
@@ -0,0 +1 @@
+bbs files ...
diff --git a/bbtk/bbs/boxes/README.txt b/bbtk/bbs/boxes/README.txt
new file mode 100644 (file)
index 0000000..cd535ec
--- /dev/null
@@ -0,0 +1 @@
+bbs files ...
diff --git a/bbtk/data/CMakeLists.txt b/bbtk/data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..eb2556d
--- /dev/null
@@ -0,0 +1,4 @@
+#===========================================================================
+# Include package data configuration cmake script from bbtk dir
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_data.cmake)
+#===========================================================================
diff --git a/bbtk/doc/CMakeLists.txt b/bbtk/doc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..033496e
--- /dev/null
@@ -0,0 +1,5 @@
+#===========================================================================
+# Include package doc configuration cmake script
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc.cmake)
+#===========================================================================
+
diff --git a/bbtk/doc/bbdoc/CMakeLists.txt b/bbtk/doc/bbdoc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..86ca574
--- /dev/null
@@ -0,0 +1,2 @@
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc_bbdoc.cmake)
+
diff --git a/bbtk/doc/bbdoc/header.html.in b/bbtk/doc/bbdoc/header.html.in
new file mode 100644 (file)
index 0000000..28c72c2
--- /dev/null
@@ -0,0 +1,12 @@
+
+<h1>bbtk package <b>@BBTK_PACKAGE_NAME@</b></h1>
+
+<p>
+Version <b>@BBTK_PACKAGE_MAJOR_VERSION@.@BBTK_PACKAGE_MINOR_VERSION@.@BBTK_PACKAGE_BUILD_VERSION@</b> - 
+by <b>@BBTK_PACKAGE_AUTHOR@</b>
+
+<p>
+@BBTK_PACKAGE_DESCRIPTION@
+
+<p>
+ <a href="../../doxygen/@BBTK_PACKAGE_NAME@/index.html">Doxygen documentation</a> of the source code
diff --git a/bbtk/doc/doxygen/CMakeLists.txt b/bbtk/doc/doxygen/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0194111
--- /dev/null
@@ -0,0 +1 @@
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc_doxygen.cmake)
diff --git a/bbtk/doc/doxygen/DoxyMainPage.txt.in b/bbtk/doc/doxygen/DoxyMainPage.txt.in
new file mode 100644 (file)
index 0000000..9909a5c
--- /dev/null
@@ -0,0 +1,14 @@
+/**
+ * \mainpage bbtk package @BBTK_PACKAGE_NAME@
+
+\htmlonly 
+
+<p>Version 
+<b>@BBTK_PACKAGE_MAJOR_VERSION@.@BBTK_PACKAGE_MINOR_VERSION@.@BBTK_PACKAGE_BUILD_VERSION@</b> - 
+by <b>@BBTK_PACKAGE_AUTHOR@</b>
+<p>
+@BBTK_PACKAGE_DESCRIPTION@
+
+\endhtmlonly
+
+ */
diff --git a/bbtk/doc/doxygen/Doxyfile.txt.in b/bbtk/doc/doxygen/Doxyfile.txt.in
new file mode 100644 (file)
index 0000000..6b4211a
--- /dev/null
@@ -0,0 +1,764 @@
+# Doxyfile 1.2.14
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+PROJECT_NAME           = @DOXYGEN_PROJECT_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+PROJECT_NUMBER         = @PROJECT_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+OUTPUT_DIRECTORY       = @DOXYGEN_OUTPUT@
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
+# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+EXTRACT_LOCAL_CLASSES  = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+HIDE_UNDOC_CLASSES     = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited 
+# members of a class in the documentation of that class as if those members were 
+# ordinary class members. Constructors, destructors and assignment operators of 
+# the base classes will not be shown.
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+INTERNAL_DOCS          = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+CASE_SENSE_NAMES       = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+SHORT_NAMES            = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file.
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+JAVADOC_AUTOBRIEF      = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+TAB_SIZE               = 8
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+GENERATE_BUGLIST       = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+ALIASES                = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consist of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+MAX_INITIALIZER_LINES  = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, then doxygen will generate warnings 
+# for error documented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+WARN_LOGFILE           = @DOXYGEN_LOGFILE@
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+INPUT                  = @DOXYGEN_INPUT@
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
+# *.h++ *.idl *.odl
+FILE_PATTERNS          = *.h *.cxx *.txx
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+EXCLUDE                = @DOXYGEN_EXCLUDE@
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories 
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+EXAMPLE_PATTERNS       = *.cxx
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse.
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+INLINE_SOURCES         = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+REFERENCES_RELATION    = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+COLS_IN_ALPHA_INDEX    = 3
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+HTML_OUTPUT            = @DOXYGEN_HTML_OUTPUT@
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the Html help documentation and to the tree view.
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, 
+# or Internet explorer 4.0+). Note that for large projects the tree generation 
+# can take a very long time. In such cases it is better to disable this feature. 
+# Windows users are probably better off using the HTML help feature.
+GENERATE_TREEVIEW      = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+LATEX_OUTPUT           = latex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+PREDEFINED             = @DOXYGEN_DOC_PREDEFINED@
+                        
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line and do not end with a semicolon. Such function macros are typically 
+# used for boiler-plate code, and will confuse the parser if not removed.
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off. Note that this 
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is 
+# recommended to install and use dot, since it yield more powerful graphs.
+CLASS_DIAGRAMS         = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+HAVE_DOT               = @DOXYGEN_HAVE_DOT@
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+COLLABORATION_GRAPH    = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+TEMPLATE_RELATIONS     = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+HIDE_UNDOC_RELATIONS   = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+GRAPHICAL_HIERARCHY    = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are gif, jpg, and png
+# If left blank gif will be used.
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+DOT_PATH               = "@DOXYGEN_DOT_PATH@"
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermedate dot files that are used to generate 
+# the various graphs.
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+SEARCHENGINE           = NO
diff --git a/bbtk/src/CMakeLists.txt b/bbtk/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e2d2a11
--- /dev/null
@@ -0,0 +1,5 @@
+#---------------------------------------------------------------------------
+# Include src configuration cmake script
+INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_src.cmake)
+#---------------------------------------------------------------------------
+
diff --git a/bbtk/src/bbCreaContournDimensions.cxx b/bbtk/src/bbCreaContournDimensions.cxx
new file mode 100644 (file)
index 0000000..4277911
--- /dev/null
@@ -0,0 +1,103 @@
+#include "bbCreaContournDimensions.h"
+#include "bbCreaContourPackage.h"
+namespace bbCreaContour
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(CreaContour,nDimensions)
+BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox);
+void nDimensions::Process()
+{
+       double **vectx, **vecty, **vectz;
+       std::vector<int> size;
+       vtkImageData *mask, *value;
+
+
+//     eventHandler->getValuesXYZ(vectx, vecty, vectz, &size); 
+//     eventHandler->getMaskValue(mask, value);
+
+    bbSetOutputX(vectx);
+       bbSetOutputY(vecty);
+       bbSetOutputZ(vectz);
+       bbSetOutputSizeContour(size);
+       bbSetOutputMask(mask);
+       bbSetOutputValue(value);
+}
+void nDimensions::CreateWidget()
+{
+       std::string s = "data";
+       
+       std::string conceptsFN                  =  s + "/holaConceptsFile.cf";
+       std::string imageSourcesFN              = s + "/holaImagesInstantsFile.of";
+       std::string imageSectionsFN             = "";
+       std::string axeThingsFN                 = "";
+
+       std::map<std::string, ImageSourceThing *> * sourcesMap          = new std::map<std::string, ImageSourceThing *>();
+       std::map<std::string, ImageSectionThing *>* sectionsMap         = new std::map<std::string, ImageSectionThing *>();
+       std::map<std::string, AxeThing *>* axesMap                                      = new std::map<std::string, AxeThing *>();
+       std::map<std::string, ContourThing *>* outlinesMap                      = new std::map<std::string, ContourThing *>();  
+
+
+       vtkImageData* img = bbGetInputIn();
+       if(img==NULL){
+               vtkMetaImageReader *reader = vtkMetaImageReader::New();
+               reader->SetFileName( "data/hola.mhd" );
+               reader->Update();
+               img = reader->GetOutput();
+       }
+
+       ImageSourceThing * thing                                                                        = new ImageSourceThing(img);
+       sourcesMap->insert(std::pair<std::string, ImageSourceThing *>( "Source Image 1", thing));
+
+       OutlineModelBuilder * _builder                                                          = new OutlineModelBuilder( conceptsFN, s );
+       _builder->buildImageSource_Envornment( imageSourcesFN, sourcesMap );
+       _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap );         
+       _builder->buildAxe_Envornment(axeThingsFN, axesMap );
+       _builder->buildCountour_Envornment( imageSectionsFN, outlinesMap );
+       
+       frame = new wxContourMainFrame( bbGetWxParent(), wxID_ANY, wxString(""), wxPoint(50,50), wxSize(800, 600) ); 
+                                                                       
+       wxAuiNotebook * parent = frame->createNotebook();
+
+       OutlineModelManager             * modelManager                          = new OutlineModelManager( _builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(),  _builder->getContourEnv() );
+
+       wxInstantChooserPanel   * instantPanel                          = new wxInstantChooserPanel( parent, "Instant Chooser", true );
+       ImageSourceThing                * imageSource = modelManager->getImageSourceThingByKeyName( "Source Image 1" );
+       wxContourViewPanel              * theViewPanel                          = new wxContourViewPanel( imageSource->getSourceImage(), parent );      
+       
+       eventHandler = new wxContourEventHandler();
+       eventHandler->setModelManager( modelManager );
+       eventHandler->setViewPanel( theViewPanel );
+       eventHandler->setInstantChooserPanel( instantPanel );
+
+       bool successConfiuration = eventHandler->configureEventsHandling();
+
+       frame->setViewPanel( theViewPanel );
+       frame->setInstantChooserPanel( instantPanel );
+
+       successConfiuration &= frame->configurePanels( parent );
+
+
+       interfMainPanel* pannew = interfMainPanel::getInstance(frame, eventHandler, s+"/Icons");
+
+   bbSetOutputWidget( frame ); 
+
+    
+  
+}
+void nDimensions::bbUserConstructor()
+{
+
+}
+void nDimensions::bbUserCopyConstructor()
+{
+
+}
+void nDimensions::bbUserDestructor()
+{
+
+}
+}
+// EO namespace bbCreaContour
+
+
diff --git a/bbtk/src/bbCreaContournDimensions.h b/bbtk/src/bbCreaContournDimensions.h
new file mode 100644 (file)
index 0000000..2e9dd04
--- /dev/null
@@ -0,0 +1,85 @@
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbCreaContournDimensions_h_INCLUDED__
+#define __bbCreaContournDimensions_h_INCLUDED__
+#include "bbtkWxBlackBox.h"
+
+#include "wxContourMainFrame.h"
+#include "OutlineModelManager.h"
+#include "wxContourEventHandler.h"
+#include "wxContourMainPanel.h"
+#include <map>
+#include "vtkImageData.h"
+#include "OutlineModelBuilder.h"
+#include "ContourThing.h"
+#include "AxeThing.h"
+#include "ImageSourceThing.h"
+#include "ImageSectionThing.h"
+#include "SomeEnvironment.h"
+#include "ReaderEnvironment.h"
+
+#include "wx/artprov.h"
+#include <wx/filedlg.h>
+#include "interfMainPanel.h"
+
+#include <vtkImageData.h>
+#include <vtkMetaImageReader.h>
+
+namespace bbCreaContour
+{
+
+class /*BBTK_EXPORT*/ nDimensions
+ : 
+   public bbtk::WxBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(nDimensions,bbtk::WxBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+  BBTK_DECLARE_INPUT(WorkDir,std::string);
+  BBTK_DECLARE_INPUT(In,vtkImageData*);
+  BBTK_PROCESS(Process);
+  void Process();
+  BBTK_CREATE_WIDGET(CreateWidget);
+  void CreateWidget();
+
+  BBTK_DECLARE_OUTPUT(Mask,vtkImageData*);
+  BBTK_DECLARE_OUTPUT(Value,vtkImageData*);
+  BBTK_DECLARE_OUTPUT(X,double**);
+  BBTK_DECLARE_OUTPUT(Y,double**);
+  BBTK_DECLARE_OUTPUT(Z,double**);
+  BBTK_DECLARE_OUTPUT(SizeContour,std::vector <int>);
+
+private:
+       wxContourMainFrame* frame;
+       wxContourEventHandler * eventHandler;
+
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(nDimensions,bbtk::WxBlackBox);
+BBTK_NAME("nDimensions");
+BBTK_AUTHOR("car-prie@uniandes.edu.co");
+BBTK_DESCRIPTION("With a given image, the box shows the ndimension application");
+BBTK_CATEGORY("__CategoryBlackBox__");
+BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
+BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
+
+BBTK_OUTPUT(nDimensions,Mask,"Mask of the contours",vtkImageData*,"");
+BBTK_OUTPUT(nDimensions,Value,"Value of the contours",vtkImageData*,"");
+BBTK_OUTPUT(nDimensions,X,"Vector of vectors that contains the X coordinates of each contour",double**,"");
+BBTK_OUTPUT(nDimensions,Y,"Vector of vectors that contains the Y coordinates of each contour",double**,"");
+BBTK_OUTPUT(nDimensions,Z,"Vector of vectors that contains the Z coordinates of each contour",double**,"");
+BBTK_OUTPUT(nDimensions,SizeContour,"Vector of vectors that contains the Z coordinates of each contour",std::vector <int>,"");
+
+
+BBTK_END_DESCRIBE_BLACK_BOX(nDimensions);
+}
+// EO namespace bbCreaContour
+
+#endif // __bbCreaContournDimensions_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
diff --git a/lib/AdditionalUsenDimensions.cmake.in b/lib/AdditionalUsenDimensions.cmake.in
new file mode 100644 (file)
index 0000000..bdf20d7
--- /dev/null
@@ -0,0 +1,2 @@
+INCLUDE(${crea_USE_FILE})
+
diff --git a/lib/AdditionalnDimensionsConfig.cmake.in b/lib/AdditionalnDimensionsConfig.cmake.in
new file mode 100644 (file)
index 0000000..35ae10d
--- /dev/null
@@ -0,0 +1,2 @@
+# We have to find crea
+FIND_PACKAGE(crea REQUIRED)
\ No newline at end of file
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..feb4d9c
--- /dev/null
@@ -0,0 +1,3 @@
+SUBDIRS(Interface_ManagerContour_NDimensions)
+SUBDIRS(Interface_Icons_NDimensions)
+SUBDIRS(kernel_ManagerContour_NDimensions)
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/CMakeLists.txt b/lib/Interface_Icons_NDimensions/CMakeLists.txt
new file mode 100644 (file)
index 0000000..db29a56
--- /dev/null
@@ -0,0 +1,62 @@
+#----------------------------------------------------------------------------
+# SET THE NAME OF YOUR LIBRARY
+SET ( LIBRARY_NAME   Interface_Icons_NDimensions_lib  )
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# CREATES A USER OPTION IN CMAKE
+OPTION ( BUILD_${LIBRARY_NAME}  "Build ${LIBRARY_NAME} library ?" ON)
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+IF ( BUILD_${LIBRARY_NAME} )
+#----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # BUILD LIBRARY
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY HEADERS (TO BE INSTALLED)
+  # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE:
+  FILE(GLOB ${LIBRARY_NAME}_HEADERS *.h)
+  # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND
+  #  SET ( ${LIBRARY_NAME}_HEADERS
+  #
+  #    )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY SOURCES (TO BE COMPILED)
+  # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
+  FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc *.h)
+  # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
+  #  SET ( ${LIBRARY_NAME}_SOURCES 
+  #   
+  #    )
+  #----------------------------------------------------------------------------
+  
+  #----------------------------------------------------------------------------
+  # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH)
+  SET ( ${LIBRARY_NAME}_LINK_LIBRARIES 
+    ${crea_LIBRARIES}
+    ${WXWIDGETS_LIBRARIES}
+    ${VTK_LIBRARIES}
+    #    ${ITK_LIBRARIES}
+    #    ${GDCM_LIBRARIES}
+    #    ${BOOST_LIBRARIES}
+    )
+  #----------------------------------------------------------------------------
+
+  
+  #----------------------------------------------------------------------------
+  # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL
+  #CREA_ADD_LIBRARY( ${LIBRARY_NAME} )
+  #----------------------------------------------------------------------------
+
+  ADD_LIBRARY(${LIBRARY_NAME} STATIC  ${${LIBRARY_NAME}_SOURCES})
+  # LINK
+  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES})
+
+  #---------------------------------------------------------------------------
+ENDIF ( BUILD_${LIBRARY_NAME} )
diff --git a/lib/Interface_Icons_NDimensions/interfDeleteMenu.cxx b/lib/Interface_Icons_NDimensions/interfDeleteMenu.cxx
new file mode 100644 (file)
index 0000000..bc4b1c7
--- /dev/null
@@ -0,0 +1,37 @@
+#include "interfDeleteMenu.h"
+
+interfDeleteMenu::interfDeleteMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
+       : interfMenuBar(parent, sizex, sizey)
+{
+       this->datadir = datdir;
+       initButtons(evtHandler);
+}
+
+void interfDeleteMenu::initButtons(wxEvtHandler* evtHandler) {
+
+       std::vector<std::string> path, nom;
+       std::vector<wxObjectEventFunction> funct;
+
+       path.push_back(datadir + "/DeleteContour.png");
+       nom.push_back("Delete the selected contour");
+       funct.push_back(wxCommandEventHandler(wxContourEventHandler::onDeleteContour));
+
+       path.push_back(datadir + "/DeleteAllContourSlide.png");
+       nom.push_back("Delete all contours in the current slide");
+       funct.push_back(wxCommandEventHandler(wxContourEventHandler::onDeleteContoursActSlice));
+
+       path.push_back(datadir + "/DeleteAll.png");
+       nom.push_back("Delete all contours in all slides");
+       funct.push_back(wxCommandEventHandler(wxContourEventHandler::onDeleteAllContours));
+
+    this->addButtons(path, nom);
+
+       this->setVectorFunction(funct); 
+       this->connectEvents(evtHandler);
+
+}
+
+interfDeleteMenu::~interfDeleteMenu()
+{
+}
+
diff --git a/lib/Interface_Icons_NDimensions/interfDeleteMenu.h b/lib/Interface_Icons_NDimensions/interfDeleteMenu.h
new file mode 100644 (file)
index 0000000..9c2f5f3
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __interfDeleteMenuH__
+#define __interfDeleteMenuH__
+
+#include <wx/wx.h>
+#include "interfMenuBar.h"
+
+class interfDeleteMenu 
+       : public interfMenuBar
+{
+public:
+       interfDeleteMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir = "data/Icons");          
+       ~interfDeleteMenu();
+
+    virtual void initButtons(wxEvtHandler* evtHandler) ;
+       
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfEditMenu.cxx b/lib/Interface_Icons_NDimensions/interfEditMenu.cxx
new file mode 100644 (file)
index 0000000..d566f3e
--- /dev/null
@@ -0,0 +1,55 @@
+#include "interfEditMenu.h"
+
+
+interfEditMenu::interfEditMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
+       : interfMenuBar(parent, sizex, sizey)
+{
+       this->datadir = datdir;
+       eventHandler = evtHandler;
+       initButtons(this);
+}
+
+void interfEditMenu::initButtons(wxEvtHandler* evtHandler) {
+
+       std::vector<std::string> path, nom;
+       std::vector<wxObjectEventFunction> funct;
+
+       path.push_back(datadir + "/copy.png");
+       nom.push_back("Copy the selected contour");
+       funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
+
+       path.push_back(datadir + "/paste.png");
+       nom.push_back("Paste the copied contour");
+       funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
+
+       path.push_back(datadir + "/undo.png");
+       nom.push_back("Undo");
+       funct.push_back((wxObjectEventFunction) &interfEditMenu:: onUndo);
+
+       path.push_back(datadir + "/redo.png");
+       nom.push_back("Redo");
+       funct.push_back((wxObjectEventFunction) &interfEditMenu:: onRedo);
+
+    this->addButtons(path, nom);
+       this->setVectorFunction(funct);
+
+       this->setButtonName(0, wxContour_ActionCommnadsID::COPY_TOOL);
+       this->setButtonName(1, wxContour_ActionCommnadsID::PASTE_TOOL);
+       this->setButtonName(2, '-');
+       this->setButtonName(3, '-');
+
+       this->connectEvents(evtHandler);
+
+}
+
+void interfEditMenu::onUndo(wxCommandEvent& event){
+       ((wxContourEventHandler*)this->eventHandler)->onUNDO();
+}
+void interfEditMenu::onRedo(wxCommandEvent& event){
+       ((wxContourEventHandler*)this->eventHandler)->onREDO();
+}
+
+interfEditMenu::~interfEditMenu()
+{
+}
+
diff --git a/lib/Interface_Icons_NDimensions/interfEditMenu.h b/lib/Interface_Icons_NDimensions/interfEditMenu.h
new file mode 100644 (file)
index 0000000..cedc600
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __interfEditMenuH__
+#define __interfEditMenuH__
+
+#include <wx/wx.h>
+#include "interfMenuBar.h"
+
+class interfEditMenu 
+       : public interfMenuBar
+{
+public:
+       interfEditMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir = "data/Icons");            
+       ~interfEditMenu();
+
+    virtual void initButtons(wxEvtHandler* evtHandler) ;
+
+       void onUndo(wxCommandEvent& event);
+       void onRedo(wxCommandEvent& event);
+       
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfIOMenu.cxx b/lib/Interface_Icons_NDimensions/interfIOMenu.cxx
new file mode 100644 (file)
index 0000000..4884a6a
--- /dev/null
@@ -0,0 +1,37 @@
+#include "interfIOMenu.h"
+
+interfIOMenu::interfIOMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
+       : interfMenuBar(parent, sizex, sizey)
+{
+       this->datadir = datdir;
+       eventHandler = evtHandler;
+       initButtons(this);
+}
+
+void interfIOMenu::initButtons(wxEvtHandler* evtHandler) {
+
+       std::vector<std::string> path, nom;
+       std::vector<wxObjectEventFunction> funct;
+
+       path.push_back(datadir + "/Open.png");
+       nom.push_back("Open a previously saved file that contains contours information");
+       funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
+
+       path.push_back(datadir + "/Save.png");
+       nom.push_back("Save all contours created");
+       funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
+
+       this->addButtons(path, nom);
+       this->setVectorFunction(funct);
+
+       this->setButtonName(0, wxContour_ActionCommnadsID::OPEN_TOOL);
+       this->setButtonName(1, wxContour_ActionCommnadsID::SAVE_TOOL);
+
+       this->connectEvents(evtHandler);
+
+}
+
+interfIOMenu::~interfIOMenu()
+{
+}
+
diff --git a/lib/Interface_Icons_NDimensions/interfIOMenu.h b/lib/Interface_Icons_NDimensions/interfIOMenu.h
new file mode 100644 (file)
index 0000000..ce3bd5c
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef __interfIOMenuH__
+#define __interfIOMenuH__
+
+#include <wx/wx.h>
+#include "interfMenuBar.h"
+
+class interfIOMenu 
+       : public interfMenuBar
+{
+public:
+       interfIOMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir = "data/Icons");              
+       ~interfIOMenu();
+
+    virtual void initButtons(wxEvtHandler* evtHandler) ;
+
+       void interfIOMenu :: onActionButtonPressed( wxCommandEvent& event );
+
+private:
+       //wxEvtHandler* eventHandler;
+       
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx
new file mode 100644 (file)
index 0000000..edf9fc2
--- /dev/null
@@ -0,0 +1,375 @@
+#include "interfMainPanel.h"
+
+
+#include "interfNewContourMenu.h"
+#include "interfIOMenu.h"
+#include "interfEditMenu.h"
+#include "interfDeleteMenu.h"
+#include "interfToolsMenu.h"
+#include "interfToolsSpreadPanel.h"
+#include "interfMenuBar.h"
+#include "interfSegmentationMenu.h"
+
+
+interfMainPanel* interfMainPanel::interfmainpanel=NULL;
+
+interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir)
+: wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN)
+{
+
+       PANEL = "New Contour";
+       PANEL1 = "I/O";
+       PANEL2 = "Edit";
+       PANEL3 = "Delete";
+       PANEL4 = "Tools";  
+       PANEL5 = "Segmentation";
+
+       splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(""));
+       
+       sizey = sizey/8;
+       currentWindow = NULL;
+
+       wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);      
+       toolpanel->SetSizer(flexsizer, true);
+       toolpanel->SetAutoLayout( true );
+
+       wxButton* b = getButton(toolpanel);
+       b->SetClientData(&PANEL);
+       wxButton* b1 = getButton(toolpanel);
+       b1->SetClientData(&PANEL1);
+       wxButton* b2 = getButton(toolpanel);
+       b2->SetClientData(&PANEL2);
+       wxButton* b3 = getButton(toolpanel);
+       b3->SetClientData(&PANEL3);
+       wxButton* b4 = getButton(toolpanel);
+       b4->SetClientData(&PANEL4);
+       wxButton* b5 = getButton(toolpanel);
+       b5->SetClientData(&PANEL5);
+
+       wxPanel* mentex = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex2 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex3 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex4 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       
+       menubar = new interfNewContourMenu(mentex, sizex, sizey, evtHandler, datadir);          
+       menubar1 = new interfIOMenu(mentex1, sizex, sizey, evtHandler, datadir);        
+       menubar2 = new interfEditMenu(mentex2, sizex, sizey, evtHandler, datadir);      
+       menubar3 = new interfDeleteMenu(mentex3, sizex, sizey, evtHandler, datadir);    
+       menubar4 = new interfToolsMenu(mentex4, sizex,sizey, evtHandler, datadir);
+       menubar5 = new interfSegmentationMenu(mentex5, sizex,sizey, evtHandler, datadir);
+               
+       statictext = getText(mentex, PANEL);    
+       statictext1 = getText(mentex1, PANEL1); 
+       statictext2 = getText(mentex2, PANEL2); 
+       statictext3 = getText(mentex3, PANEL3); 
+       statictext4 = getText(mentex4, PANEL4); 
+       statictext5 = getText(mentex5, PANEL5); 
+       
+       flexsizer->Add(b, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE);
+
+       flexsizer->Add(b1, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE);
+       
+       flexsizer->Add(b2, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE);
+       
+       flexsizer->Add(b3, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE);
+       
+       flexsizer->Add(b4, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE);
+
+       flexsizer->Add(b5, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex5, menubar5,statictext5), wxFIXED_MINSIZE);
+
+       toolpanel->Update();
+       toolpanel->Layout();
+
+       infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(""));
+       wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);      
+       infoPanel->SetSizer(infosizer, true);
+       infoPanel->SetAutoLayout( true );       
+               
+       splitterwindow->Initialize(toolpanel);
+       splitterwindow->SplitHorizontally(toolpanel, infoPanel);        
+               
+       Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b4->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b5->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+
+       this->Layout();
+       /*sizey = sizey/8;
+       currentWindow = NULL;
+
+       PANEL = "New Contour";
+       PANEL1 = "I/O";
+       PANEL2 = "Edit";
+       PANEL3 = "Delete";
+       PANEL4 = "Tools";   
+
+       
+       wxPanel* toolpanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,2,2);      
+       toolpanel->SetSizer(flexsizer, true);
+       toolpanel->SetAutoLayout( true );
+
+       wxButton* b = getButton(toolpanel);
+       b->SetClientData(&PANEL);
+       wxButton* b1 = getButton(toolpanel);
+       b1->SetClientData(&PANEL1);
+       wxButton* b2 = getButton(toolpanel);
+       b2->SetClientData(&PANEL2);
+       wxButton* b3 = getButton(toolpanel);
+       b3->SetClientData(&PANEL3);
+       wxButton* b4 = getButton(toolpanel);
+       b4->SetClientData(&PANEL4);
+
+
+       wxPanel* mentex = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex2 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex3 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* mentex4 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       
+       menubar = new interfNewContourMenu(mentex, sizex, sizey, evtHandler);           
+       menubar1 = new interfIOMenu(mentex1, sizex, sizey, evtHandler); 
+       menubar2 = new interfEditMenu(mentex2, sizex, sizey, evtHandler);       
+       menubar3 = new interfDeleteMenu(mentex3, sizex, sizey, evtHandler);     
+       menubar4 = new interfToolsMenu(mentex4, sizex,sizey, evtHandler);
+               
+//             this->initializeToolsPanel(mentex4, sizex, sizey, evtHandler);          
+
+       statictext = getText(mentex, PANEL);    
+       statictext1 = getText(mentex1, PANEL1); 
+       statictext2 = getText(mentex2, PANEL2); 
+       statictext3 = getText(mentex3, PANEL3); 
+       statictext4 = getText(mentex4, PANEL4);
+       
+       
+
+       flexsizer->Add(b, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE);
+
+       flexsizer->Add(b1, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE);
+       
+       flexsizer->Add(b2, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE);
+       
+       flexsizer->Add(b3, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE);
+       
+       flexsizer->Add(b4, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE);
+
+       toolpanel->Layout();
+
+       infoPanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(""));
+       wxFlexGridSizer* infosizer = new wxFlexGridSizer(5,2,2,2);      
+       infoPanel->SetSizer(infosizer, true);
+       infoPanel->SetAutoLayout( true );       
+       
+
+
+       wxFlexGridSizer* mainsizer = new wxFlexGridSizer(1);    
+       this->SetSizer(mainsizer, true);
+       this->SetAutoLayout( true );
+
+
+       mainsizer->Add(toolpanel,wxEXPAND);
+       mainsizer->Add(new wxSplitterWindow(this,-1, wxDefaultPosition, wxDefaultSize, wxSP_3DBORDER, wxString("")), wxEXPAND); 
+       mainsizer->Add(infoPanel, wxEXPAND);
+
+       
+       Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b4->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+
+       this->Layout();*/
+
+}
+
+interfMainPanel::~interfMainPanel(void)
+{
+}
+
+interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler, std::string datadir){       
+
+       wxFrame* newframe = new wxFrame(parent, -1, wxT("New Interface"), wxPoint(1,1), wxSize(380,750),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
+                                                                                                                                                                               
+       if(interfmainpanel == NULL){
+               interfmainpanel = new interfMainPanel(newframe, 380, 750, evtHandler, datadir);
+       }
+
+       newframe->Show(TRUE);
+       return interfmainpanel;
+}
+
+interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler){    
+
+       wxFrame* newframe = new wxFrame(parent, -1, wxT("New Interface"), wxPoint(1,1), wxSize(380,750),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+
+       if(interfmainpanel == NULL){
+               interfmainpanel = new interfMainPanel(newframe, 380, 750, evtHandler);
+       }
+
+       newframe->Show(TRUE);
+       return interfmainpanel;
+}
+
+interfMainPanel* interfMainPanel::getInstance(){       
+
+       return interfmainpanel;
+}
+
+
+wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler){
+
+
+       wxPanel* panel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN, wxString("Spread"));
+
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2)       ;
+       panel->SetSizer(flexsizer, true);
+       panel->SetAutoLayout( true );
+
+       interfToolsMenu* menu = new interfToolsMenu(panel, sizex, sizey, evtHandler);
+       toolspread = new interfToolsSpreadPanel(panel, sizex, 300, evtHandler);
+
+       flexsizer->Add(menu, wxFIXED_MINSIZE);
+       flexsizer->Add(toolspread, wxFIXED_MINSIZE);
+       
+       panel->Layout();        
+       
+
+       return panel;
+}
+
+
+/**
+**     Adds a new checkbox to the scrolledwindow using the checkboxsizer
+**     @Params id of contour
+**     
+**/
+void interfMainPanel::addContourCheckBox(std::string id){
+       toolspread->addContourCheckBox(id);
+}
+
+/**
+**     Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
+**     @Params id of contour
+**     
+**/
+void interfMainPanel::removeContourCheckBox(std::string id){
+       toolspread->removeContourCheckBox(id);
+}
+
+void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event ){
+       wxButton* b = (wxButton*)event.GetEventObject();
+       wxPanel* dmenu;
+       wxStaticText* text;
+       std::string dstring = *((std::string*) b->GetClientData());
+       int sizechange=0;
+
+
+       if(dstring==PANEL){
+               dmenu = menubar;
+               text = statictext;
+       }else if( dstring==PANEL1){
+               dmenu = menubar1;       
+               text = statictext1;
+       }else if(dstring==PANEL2){
+               dmenu = menubar2;
+               text = statictext2;
+       }else if(dstring==PANEL3){
+               dmenu = menubar3;
+               text = statictext3;
+       }else if(dstring==PANEL4){
+               dmenu = menubar4;
+               text = statictext4;
+       }else if(dstring==PANEL5){
+               dmenu = menubar5;
+               text = statictext5;
+       }
+
+       if(b->GetLabel() == "+" ){
+               dmenu->Show(true);
+               sizechange = 1;
+               b->SetLabel("-");
+       }else{
+               dmenu->Show(false);             
+               sizechange = -1;
+               b->SetLabel("+");
+       }       
+       
+       sizechange *= dmenu->GetSize().GetHeight();
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+sizechange);
+       
+       this->Layout();
+       this->Refresh();
+}
+
+wxStaticText* interfMainPanel::getText(wxWindow* parent, std::string nom){
+       return new wxStaticText(parent, -1, wxString(nom), wxDefaultPosition, 
+                                                       wxDefaultSize, wxALIGN_CENTRE, wxString(nom));
+}
+
+wxButton* interfMainPanel::getButton(wxWindow* parent){
+       wxButton* b = new wxButton(parent, -1, wxString("-"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, 
+                                                               wxDefaultValidator, wxString("-"));     
+       return b;
+}
+
+wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text){
+
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);      
+       parent->SetSizer(flexsizer, true);
+       parent->SetAutoLayout( true );
+
+       flexsizer->Add(text, wxFLEX_GROWMODE_ALL);
+       flexsizer->Add(panel, wxFLEX_GROWMODE_ALL);
+
+       parent->Layout();
+       return (wxPanel*)parent;
+       
+}
+
+/**
+**     Shows the panel in the 
+**/
+void interfMainPanel::showPanel(wxWindow* panel){
+
+       wxSizer* sizer = infoPanel->GetSizer();
+
+       if(currentWindow != NULL){
+               currentWindow->Hide();
+               sizer->Remove(currentWindow);
+       }       
+       sizer->Add(panel);
+    currentWindow = panel;
+       currentWindow->Show(true);
+
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
+
+       this->Layout();
+       this->Refresh();
+
+}
+
+/**
+**     Gets the Information panel
+**/
+wxPanel* interfMainPanel::getInfoPanel(){
+       return infoPanel;
+}
diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h
new file mode 100644 (file)
index 0000000..8cec369
--- /dev/null
@@ -0,0 +1,136 @@
+#pragma once
+
+#include <wx/wx.h>
+#include "wxContourEventHandler.h"
+
+#include "interfNewContourMenu.h"
+#include "interfIOMenu.h"
+#include "interfEditMenu.h"
+#include "interfDeleteMenu.h"
+#include "interfToolsMenu.h"
+#include "interfToolsSpreadPanel.h"
+#include "interfMenuBar.h"
+
+#include <wx/treebook.h>
+#include <wx/sizer.h>
+#include <wx/button.h>
+#include <wx/stattext.h>
+#include <wx/splitter.h>
+#include <wx/statline.h>
+
+class interfMainPanel : public wxPanel {
+
+public:
+       
+       interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
+       ~interfMainPanel(void);
+
+       /**     This method should be called the first time by the parent class
+       **      in creates all the panels the first time
+       **/
+       static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler, std::string datadir);
+       /**     This method should be called the first time by the parent class
+       **      in creates all the panels the first time
+       **/
+       static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler);
+       /**
+       **      Gets the instance of the class
+       **/
+       static interfMainPanel* getInstance();
+
+
+       /**
+       **      Adds a new checkbox to the scrolledwindow using the checkboxsizer
+       **      @Params id of contour
+       **      
+       **/
+       void addContourCheckBox(std::string id);
+
+       /**
+       **      Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
+       **      @Params id of contour
+       **      
+       **/
+       void removeContourCheckBox(std::string id);
+
+
+       /**
+       **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
+       **      of the button corresponding to the method that has to be executed,
+       **      it uses attribute eventHandler to call the methods define by the application.
+       **      see setEventHandler(wxEventHandler*)
+       **/
+       void onActionButtonPressed1( wxCommandEvent& event );
+
+       /**
+       **      Shows the panel in the 
+       **/
+       void showPanel(wxWindow* panel);
+       /**
+       **      Gets the Information panel
+       **/
+       wxPanel* getInfoPanel();
+       
+
+private:
+       
+
+       static interfMainPanel* interfmainpanel;
+
+
+       wxPanel* menubar;
+       wxPanel* menubar1;
+       wxPanel* menubar2;
+       wxPanel* menubar3;
+       wxPanel* menubar4;
+       wxPanel* menubar5;
+
+       wxWindow* currentWindow;
+       wxSplitterWindow* splitterwindow;
+
+       wxPanel* infoPanel;
+
+       wxStaticText* statictext;
+       wxStaticText* statictext1;
+       wxStaticText* statictext2;
+       wxStaticText* statictext3;
+       wxStaticText* statictext4;
+       wxStaticText* statictext5;
+
+       std::string PANEL;
+       std::string PANEL1;
+       std::string PANEL2;
+       std::string PANEL3;
+       std::string PANEL4;
+       std::string PANEL5;
+
+       
+       //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
+       //list of contours
+       interfToolsSpreadPanel* toolspread;
+
+       /**
+       **      This method initializes the tools panel, with the bar and the panel where the contours can be added
+       **      and removed.
+       **      @params size of the buttons panel
+       **      @params sizey of the buttons panel
+       **      @params evtHandler this is the class in charge of responding to the events of the buttons
+       **/
+       wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
+
+       /**
+       **      initialize a statictext component of the interface
+       **/
+       wxStaticText* getText(wxWindow* parent, std::string nom);
+       /**
+       ** initializes a button with data
+       **/
+       wxButton* getButton(wxWindow* parent);
+       /**
+       ** Puts the panel button and the text int the sizer
+       **/
+       wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
+
+       
+       
+};
diff --git a/lib/Interface_Icons_NDimensions/interfMenuBar.h b/lib/Interface_Icons_NDimensions/interfMenuBar.h
new file mode 100644 (file)
index 0000000..86a011a
--- /dev/null
@@ -0,0 +1,188 @@
+#ifndef __interfMENUBARH__
+#define __interfMENUBARH__
+
+#include <wx/wx.h>
+#include <vector>
+#include <wx/image.h>
+#include <wx/bitmap.h>
+#include <wx/bmpbuttn.h>
+#include <wx/stattext.h>
+#include <wx/sizer.h>
+
+//#include "interfMainPanel.h"
+#include "wxContourEventHandler.h"
+
+
+class interfMenuBar :
+       public wxPanel
+{
+public:
+       interfMenuBar(wxWindow * parent, int sizex, int sizey)
+               : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN){
+               //this initialice all the handlers to load any type of image, in this case the png handler is needed
+               wxInitAllImageHandlers();
+               
+                               
+       }
+       //~interfMenuBar();
+
+       virtual void initButtons(wxEvtHandler* evtHandler) = 0;
+
+       /**
+       ** This method add a series of button in a line, it uses the method getbutton to create the button
+       ** and static text to create the text, it also initialice the flexgridsizer to add the buttons and
+       ** the text into the panel
+       ** @param vector path, this parameter contains the path of the images to include in the path
+       ** @param vector nom, this parameter contains the names corresponding to each path of image given
+       **/
+    virtual void addButtons(std::vector<std::string> vpath, std::vector<std::string> vnom){
+               
+               int sizex = 80;
+               int sizey = 80;
+       
+               flexsizer = new wxFlexGridSizer(2,vpath.size(),2,2);    
+               this->SetSizer(flexsizer, true);
+               this->SetAutoLayout( true );
+               
+               //first row of the sizer, the buttons are being added
+               for(int i = 0; i < vpath.size();i++){
+                       std::string p = vpath[i];
+                       wxBitmapButton* bitmapbutton = this->getButton(p, sizex, sizey);
+                       flexsizer->Add(bitmapbutton,wxFIXED_MINSIZE);
+                       
+               }
+               //second row of the sizer, the names are being added
+               
+               for(int i = 0; i < vnom.size(); i++){
+                       //sizex = vectbutton[i]->GetSize().GetWidth();
+                       std::string n = vnom[i];
+                       vectbutton[i]->SetToolTip(wxString(n));
+                       //wxStaticText* statictext = getText(n, sizex, 15);
+                       //flexsizer->Add(statictext, wxEXPAND |wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTRE_HORIZONTAL|wxSHAPED);
+               }
+               this->Layout();
+       }
+
+       /**
+       **  This method creates the button with the given image and returns it
+       ** @param string imgpath is the string containing the path to the image of the button being created
+       ** @param int x indicates the x coordinate where the button should be located
+       ** @param int y indicates the y coordinate where the button should be located
+       **/
+
+       virtual wxBitmapButton* getButton(std::string imgpath, int sizex, int sizey){
+               vectimgpath.push_back(imgpath);
+                               
+               
+               wxBitmap* bitmap = new wxBitmap(imgpath, wxBITMAP_TYPE_PNG);
+
+               //wxSize(sizex,sizey)
+               wxBitmapButton* bitmapbutton = new wxBitmapButton(this, -1, *bitmap, wxDefaultPosition, wxDefaultSize,
+                                                                                       wxBU_AUTODRAW, wxDefaultValidator, wxString(""));
+
+               vectbutton.push_back(bitmapbutton);
+               return bitmapbutton;
+       }
+
+       /**
+       **      This method create the static text with the given string and returns it, it also push it back into 
+       **      the vector nom
+       **      @param string nom  text wich will be added to the statictext
+       **      @param int sizex   size of the text
+       **      @param int sizey   size of the text
+       **/
+       virtual wxStaticText* getText(std::string nom, int sizex, int sizey){
+               vectnom.push_back(nom);
+               return new wxStaticText(this, -1, wxString(nom), wxDefaultPosition, 
+                                                               wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom));
+       }
+    /**
+       **      Sets the vector funcion, this vector must contain a function for each button created
+       **      they must be ordered in the same way as the vector that contains the image path
+       **      and name of the button. See addButton(<vect>, <vect>)
+       **/
+       virtual void setVectorFunction(std::vector<wxObjectEventFunction> vectf){
+               for(int i = 0; i < vectf.size();i++){
+                       vectfunct.push_back(vectf[i]);
+               }               
+       }
+
+       /**
+       **      This method connect the events seted in the vector vectfunct
+       **      each function must have a button to relate with, see function setVectorFunction()
+       **/
+       virtual void connectEvents(wxEvtHandler* evtHandler){   
+
+               for(int i = 0; i < vectbutton.size();i++){
+                       Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,evtHandler);
+               }
+       }
+
+       /**
+       **      This method connect the events seted in the vector vectfunct
+       **      each function must have a button to relate with, see function setVectorFunction()
+       **/
+       virtual void connectEvents(){   
+
+               for(int i = 0; i < vectbutton.size();i++){
+                       Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,vecthand[i]);
+               }
+       }
+
+       /**
+       **      Sets the name of the button, this is used to relate the name of the button to a specific command
+       **      @params int i   index in the array of buttons use fuction setVectorFuncion(<vect>) to set the vector
+       **                      first
+       **      @params const char      name of the button see wxContour_ActionCommandsID.h to view the commands
+       **/
+       virtual void setButtonName(int i, const char c){
+               if(i < vectbutton.size()){
+                       vectbutton[i]->SetName(c);
+               }
+       }
+
+       /**
+       **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
+       **      of the button corresponding to the method that has to be executed,
+       **      it uses attribute eventHandler to call the methods define by the application.
+       **      see setEventHandler(wxEventHandler*)
+       **/
+       void onActionButtonPressed( wxCommandEvent& event )
+       {
+               if(eventHandler!=NULL)
+               {
+                       std::string theStr = std::string( ((wxButton *)event.GetEventObject())->GetName().ToAscii());
+                       const char * toolCommand = theStr.c_str();
+                       event.SetId( GetId() );
+                       event.SetEventObject( this );
+                       event.SetClientData( (void *) toolCommand);
+                       eventHandler->ProcessEvent( event );
+               }
+       }
+
+       virtual void setEventHandlers(std::vector<wxEvtHandler*> hand){
+
+               for(int i = 0; i < hand.size();i++){
+                       vecthand.push_back(hand[i]);
+               }
+       }
+       
+private:
+       std::vector<std::string> vectimgpath;
+       std::vector<std::string> vectnom;
+       
+       std::vector<wxButton*> vectbutton;
+       std::vector<wxObjectEventFunction> vectfunct;
+       std::vector<wxEvtHandler*> vecthand;
+
+       wxFlexGridSizer* flexsizer;
+
+protected:
+       wxEvtHandler* eventHandler;
+       std::string datadir;
+
+       
+
+};
+
+#endif
diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx
new file mode 100644 (file)
index 0000000..5b12bd3
--- /dev/null
@@ -0,0 +1,69 @@
+#include "interfNewContourMenu.h"
+
+
+interfNewContourMenu::interfNewContourMenu(wxWindow * parent, int sizex, int sizey, wxEvtHandler* evtHandler, std::string datdir)
+       : interfMenuBar(parent, sizex, sizey)
+{
+       this->datadir = datdir;
+       eventHandler = (wxContourEventHandler*)evtHandler;
+
+       panBull = NULL;
+       created = false;
+
+       initButtons(evtHandler);        
+}
+
+void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) {
+
+       std::vector<std::string> path, nom;
+       std::vector<wxObjectEventFunction> funct;
+       std::vector<wxEvtHandler*> hand;
+       
+       path.push_back(datadir + "/Spline.png");
+       nom.push_back("Create a contour using splines");        
+       funct.push_back(wxCommandEventHandler(wxContourEventHandler::onCreateContourSpline));
+       hand.push_back(evtHandler);
+
+       path.push_back(datadir+"/Rectangle.png");
+       nom.push_back("Create a contour using the basic shape of a rectangle");
+       funct.push_back(wxCommandEventHandler(wxContourEventHandler::onCreateContourRectangle));
+       hand.push_back(evtHandler);
+
+       path.push_back(datadir + "/Circle.png");
+       nom.push_back("Create a contour using the basic shape of a Circle");
+       funct.push_back(wxCommandEventHandler(wxContourEventHandler::onCreateContourCircle));
+       hand.push_back(evtHandler);
+
+       path.push_back(datadir + "/bullseye.png");
+       nom.push_back("Create a contour using the bulls eye");
+       funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourBullseye);
+       hand.push_back(this);
+
+    this->addButtons(path, nom);
+
+       this->setVectorFunction(funct); 
+       this->setEventHandlers(hand);   
+       this->connectEvents();
+
+}
+
+
+
+interfNewContourMenu::~interfNewContourMenu()
+{
+}
+
+void interfNewContourMenu::onCreateContourBullseye(wxEvtHandler* evtHandler){
+
+
+       if(!created){
+
+               panBull = new PanelBullEyeOptions(interfMainPanel::getInstance()->getInfoPanel(), 
+                                                               wxSize(100,200));
+               created = true;
+       }
+       eventHandler->createContourBullsEye(panBull);
+       interfMainPanel::getInstance()->showPanel(panBull);
+
+}
+
diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.h b/lib/Interface_Icons_NDimensions/interfNewContourMenu.h
new file mode 100644 (file)
index 0000000..2806bc3
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __interfNEWCONTOURMENUH__
+#define __interfNEWCONTOURMENUH__
+
+#include <wx/wx.h>
+#include "interfMenuBar.h"
+#include "interfMainPanel.h"
+
+#include <wxContourEventHandler.h>
+
+class interfNewContourMenu 
+       : public interfMenuBar
+{
+public:
+       interfNewContourMenu(wxWindow * parent, int sizex, int sizey, wxEvtHandler* evtHandler, std::string datadir = "data/Icons");            
+       ~interfNewContourMenu();
+
+    
+    virtual void initButtons(wxEvtHandler* evtHandler) ;
+
+       void onCreateContourBullseye(wxEvtHandler* evtHandler);
+
+       
+
+private:
+       wxContourEventHandler* eventHandler;
+       PanelBullEyeOptions* panBull;
+       bool created;
+       
+       
+       
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx
new file mode 100644 (file)
index 0000000..fb5e8ea
--- /dev/null
@@ -0,0 +1,119 @@
+#include "interfSegmentationMenu.h"
+#include "interfMainPanel.h"
+
+interfSegmentationMenu::interfSegmentationMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
+       : interfMenuBar(parent, sizex, sizey)
+{
+       this->datadir = datdir;
+       contourevent = (wxContourEventHandler*)evtHandler;
+       infoWin = NULL;
+       configPanel = NULL;
+       segmentPanel = NULL;
+       spreadPanel = NULL;
+       segmentPanelITK = NULL;
+       
+       eventHandler = evtHandler;
+
+       initButtons(this);
+}
+
+void interfSegmentationMenu::initButtons(wxEvtHandler* evtHandler) {
+
+       std::vector<std::string> path, nom;
+       std::vector<wxObjectEventFunction> funct;
+
+       path.push_back(datadir + "/Segmentation.png");
+       nom.push_back("Find shapes by automatic segmentation");
+       funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSegmentationPressed);
+
+       path.push_back(datadir + "/ITK.png");
+       nom.push_back("Find shapes by automatic segmentation with ITK");
+       funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSegmentationPressedITK);
+
+       path.push_back(datadir + "/snake.png");
+       nom.push_back("Find shapes using border snake interaction");
+       funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSnakePressed);
+
+       this->addButtons(path, nom);    
+       this->setVectorFunction(funct);
+
+       this->connectEvents(evtHandler);
+          
+
+}
+
+interfSegmentationMenu::~interfSegmentationMenu()
+{
+}
+
+/**
+       **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
+       **      of the button corresponding to the method that has to be executed,
+       **      it uses attribute eventHandler to call the methods define by the application.
+       **      see setEventHandler(wxEventHandler*)
+       **/
+
+
+void  interfSegmentationMenu::onSegmentationPressed(wxCommandEvent& event){
+    if(segmentPanel == NULL){
+               segmentPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(""));
+                       
+
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               segmentPanel->SetSizer(flexsizer, true);
+               segmentPanel->SetAutoLayout( true );    
+               segmentPanel->SetEventHandler(this->contourevent);
+               
+               wxPanel* panel = contourevent->getSegmentationPanel(segmentPanel);
+       
+
+               wxStaticText* stattext = new wxStaticText(segmentPanel, -1, wxString("   Automatic Segmentation   "), wxDefaultPosition,
+                       wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(""));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panel, wxEXPAND);
+               segmentPanel->Layout();
+       }
+       interfMainPanel::getInstance()->showPanel(segmentPanel);
+       contourevent->showAxis(true);
+       axisshown = true;
+}
+
+
+void interfSegmentationMenu::hideAxis(){
+       if(axisshown){
+               axisshown = false;
+               contourevent->showAxis(axisshown);
+       }
+}
+
+void  interfSegmentationMenu::onSegmentationPressedITK(wxCommandEvent& event){
+    if(segmentPanelITK == NULL){
+               segmentPanelITK = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(""));
+                       
+
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               segmentPanelITK->SetSizer(flexsizer, true);
+               segmentPanelITK->SetAutoLayout( true ); 
+               segmentPanelITK->SetEventHandler(this->contourevent);
+               
+               wxPanel* panel = contourevent->getSegmentationPanelITK(segmentPanelITK);
+       
+
+               wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString("   Automatic ITK Segmentation   "), wxDefaultPosition,
+                       wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(""));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panel, wxEXPAND);
+               segmentPanelITK->Layout();
+       }
+       interfMainPanel::getInstance()->showPanel(segmentPanelITK);
+       //contourevent->showAxis(true);
+       //axisshown = true;
+}
+
+void  interfSegmentationMenu::onSnakePressed(wxCommandEvent& event){
+    
+       contourevent->onSnakePressed(this);
+
+}
diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationMenu.h b/lib/Interface_Icons_NDimensions/interfSegmentationMenu.h
new file mode 100644 (file)
index 0000000..7dfbdb1
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef __interfSegmentationMenuH__
+#define __interfSegmentationMenuH__
+
+#include <wx/wx.h>
+
+
+#include "interfMenuBar.h"
+
+class interfSegmentationMenu 
+       : public interfMenuBar
+{
+public:
+       interfSegmentationMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir = "data/Icons");            
+       ~interfSegmentationMenu();
+
+    virtual void initButtons(wxEvtHandler* evtHandler) ;
+
+       /**
+       **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
+       **      of the button corresponding to the method that has to be executed,
+       **      it uses attribute eventHandler to call the methods define by the application.
+       **      see setEventHandler(wxEventHandler*)
+       **/
+       
+       void  onSegmentationPressed(wxCommandEvent& event);
+
+       void  onSegmentationPressedITK(wxCommandEvent& event);
+
+       void  onSnakePressed(wxCommandEvent& event);
+
+private:
+
+       wxContourEventHandler* contourevent;
+       wxPanel* configPanel;
+       wxWindow* infoWin;
+       wxPanel* segmentPanel;
+       wxPanel* spreadPanel;
+       wxPanel* segmentPanelITK;
+       bool axisshown;
+
+       void hideAxis();
+       
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx
new file mode 100644 (file)
index 0000000..6671269
--- /dev/null
@@ -0,0 +1,152 @@
+#include "interfToolsMenu.h"
+#include "interfMainPanel.h"
+
+interfToolsMenu::interfToolsMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
+       : interfMenuBar(parent, sizex, sizey)
+{
+       this->datadir = datdir;
+       contourevent = (wxContourEventHandler*)evtHandler;
+       infoWin = NULL;
+       configPanel = NULL;
+       segmentPanel = NULL;
+       spreadPanel = NULL;
+       segmentPanelITK = NULL;
+       
+       eventHandler = evtHandler;
+
+       initButtons(this);
+}
+
+void interfToolsMenu::initButtons(wxEvtHandler* evtHandler) {
+
+       std::vector<std::string> path, nom;
+       std::vector<wxObjectEventFunction> funct;
+
+       path.push_back(datadir + "/Spread.png");
+       nom.push_back("The selected contour will spread through all slides");
+       funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
+
+       path.push_back(datadir + "/Spread1.png");
+       nom.push_back("Select more than one contour and find the contours between them");
+       funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onSpreadPressed);
+
+       
+       path.push_back(datadir + "/info.png");
+       nom.push_back("Information of the contours in the scene");
+       funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onInformationPressed);
+
+       path.push_back(datadir + "/pignon.png");
+       nom.push_back("Configuration of the window");
+       funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onConfigurationPressed);
+
+       this->addButtons(path, nom);    
+       this->setVectorFunction(funct);
+
+       this->setButtonName(0, wxContour_ActionCommnadsID::CHANGE_TOOL);
+
+       this->connectEvents(evtHandler);
+          
+
+}
+
+interfToolsMenu::~interfToolsMenu()
+{
+}
+
+/**
+       **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
+       **      of the button corresponding to the method that has to be executed,
+       **      it uses attribute eventHandler to call the methods define by the application.
+       **      see setEventHandler(wxEventHandler*)
+       **/
+void interfToolsMenu::onRigidPressed(wxCommandEvent& event){
+       
+}
+
+void  interfToolsMenu::onSpreadPressed(wxCommandEvent& event){
+
+
+       if(spreadPanel==NULL){
+
+               spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(""));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               spreadPanel->SetSizer(flexsizer, true);
+               spreadPanel->SetAutoLayout( true );     
+               spreadPanel->SetEventHandler(this->contourevent);
+               
+               wxPanel* panel = contourevent->getSpreadPanel(spreadPanel);
+       
+
+               wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString("   Automatic Spread   "), wxDefaultPosition,
+                       wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(""));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panel, wxEXPAND);
+               spreadPanel->Layout();
+       }       
+       interfMainPanel::getInstance()->showPanel(spreadPanel);
+       hideAxis();
+}
+
+
+void  interfToolsMenu::onInformationPressed(wxCommandEvent& event){
+
+       if(infoWin ==NULL){
+               infoWin                                         = new wxFrame (interfMainPanel::getInstance()->getInfoPanel(), -1,_T("  Spread  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
+               infoWin->SetSize( wxSize(500,450) );
+               
+               wxSize sizepanel(200,300);
+               wxPanel *panel                                                                  = contourevent->getInformationPanel(infoWin);
+
+               wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
+               sizerPanel -> Add( panel->GetSizer()            , 1, wxEXPAND ,0);
+
+               infoWin->SetSizer( sizerPanel );
+               infoWin->SetAutoLayout( true );
+               infoWin->Layout();
+
+               infoWin->Show();                
+
+       }else {
+
+               if (infoWin->IsShown()==true)
+               {
+                       infoWin->Show(false);
+               } else  {
+                       contourevent->FillGridWithContoursInformation();
+                       infoWin->Show(true);
+               }
+       }       
+}
+
+void  interfToolsMenu::onConfigurationPressed(wxCommandEvent& event){
+
+       if(configPanel == NULL){
+               configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(""));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               configPanel->SetSizer(flexsizer, true);
+               configPanel->SetAutoLayout( true );     
+               configPanel->SetEventHandler(this->contourevent);
+               
+               wxPanel* panel = contourevent->getConfigurationPanel(configPanel);
+
+               wxStaticText* stattext = new wxStaticText(configPanel, -1, wxString("   Interface Configuration   "), wxDefaultPosition,
+                       wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(""));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+
+               flexsizer->Add(panel, wxEXPAND);
+               configPanel->Layout();
+
+       }
+       interfMainPanel::getInstance()->showPanel(configPanel);
+
+       hideAxis();
+}
+
+void interfToolsMenu::hideAxis(){
+       if(axisshown){
+               axisshown = false;
+               contourevent->showAxis(axisshown);
+       }
+}
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.h b/lib/Interface_Icons_NDimensions/interfToolsMenu.h
new file mode 100644 (file)
index 0000000..e12e9dd
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef __interfToolsMenuH__
+#define __interfToolsMenuH__
+
+#include <wx/wx.h>
+
+
+#include "interfMenuBar.h"
+
+class interfToolsMenu 
+       : public interfMenuBar
+{
+public:
+       interfToolsMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir = "data/Icons");           
+       ~interfToolsMenu();
+
+    virtual void initButtons(wxEvtHandler* evtHandler) ;
+
+       /**
+       **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
+       **      of the button corresponding to the method that has to be executed,
+       **      it uses attribute eventHandler to call the methods define by the application.
+       **      see setEventHandler(wxEventHandler*)
+       **/
+       void onRigidPressed(wxCommandEvent& event);
+
+       void  onSpreadPressed(wxCommandEvent& event);
+
+       void  onInformationPressed(wxCommandEvent& event);
+
+       void  onConfigurationPressed(wxCommandEvent& event);
+
+       
+private:
+
+       wxContourEventHandler* contourevent;
+       wxPanel* configPanel;
+       wxWindow* infoWin;
+       wxPanel* segmentPanel;
+       wxPanel* spreadPanel;
+       wxPanel* segmentPanelITK;
+       bool axisshown;
+
+       void hideAxis();
+       
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.cxx b/lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.cxx
new file mode 100644 (file)
index 0000000..73e94ef
--- /dev/null
@@ -0,0 +1,120 @@
+#include "interfToolsSpreadPanel.h"
+
+interfToolsSpreadPanel::interfToolsSpreadPanel(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler)       
+       : wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_THEME){
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(3,1,2,2);      
+       this->SetSizer(flexsizer, true);
+       this->SetAutoLayout( true );
+
+       resetbuttxt = initializeButton("data/Icons/reset.png", "Reset");
+
+       wxFlexGridSizer* flexsizer1 = new wxFlexGridSizer(1,2,2,2);     
+       radiobox = initializeRadioBox();
+       addremovecont = initializeAddRemoveContour();   
+       flexsizer1->Add(radiobox,wxFIXED_MINSIZE);
+       flexsizer1->Add(addremovecont,wxEXPAND | wxALIGN_CENTRE_VERTICAL);
+
+       gobuttxt = initializeButton("data/Icons/Go.png", "Go"); 
+
+       flexsizer->Add(resetbuttxt, wxFIXED_MINSIZE);
+       flexsizer->Add(flexsizer1, wxFIXED );
+       flexsizer->Add(gobuttxt, wxFIXED_MINSIZE);
+       
+       
+       this->Layout();
+       
+}
+
+
+interfToolsSpreadPanel::~interfToolsSpreadPanel()
+{
+}
+
+wxPanel* interfToolsSpreadPanel::initializeRadioBox(){
+       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxString lstOptions[3];
+       lstOptions[0]="A";
+       lstOptions[1]="B";
+       lstOptions[2]="C";
+       wxRadioBox* _spreadMethodRadiobox       = new wxRadioBox(panel, -1, "Method", wxDefaultPosition, wxSize(45,80), 3 , lstOptions,  3, wxRA_SPECIFY_ROWS);
+       _spreadMethodRadiobox->SetSelection(2);
+       return panel;
+}
+
+wxPanel* interfToolsSpreadPanel::initializeButton(std::string path, std::string nom){
+                       
+
+       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1,2,2,2);      
+       panel->SetSizer(flexsizer, true);
+       panel->SetAutoLayout( true );
+       
+       wxBitmap* bitmap = new wxBitmap(path, wxBITMAP_TYPE_PNG);
+
+       wxBitmapButton* bitmapbutton = new wxBitmapButton(panel, -1, *bitmap, wxDefaultPosition, wxDefaultSize,
+                                                                               wxBU_AUTODRAW, wxDefaultValidator, wxString(""));
+
+       
+       wxStaticText* statictext = new wxStaticText(panel, -1, wxString(nom), wxDefaultPosition, 
+                                                               wxDefaultSize, wxALIGN_CENTRE, wxString(nom));
+
+       
+       flexsizer->Add(bitmapbutton, wxFIXED_MINSIZE);
+       flexsizer->Add(statictext, wxALIGN_CENTRE_VERTICAL | wxALIGN_CENTER_HORIZONTAL |wxEXPAND);
+
+       panel->Layout();
+       
+       return panel;
+}
+
+wxPanel* interfToolsSpreadPanel::initializeAddRemoveContour(){
+       
+       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE |wxVSCROLL , wxString(""));
+
+       scrollwin = new wxScrolledWindow(panel, -1, wxDefaultPosition, wxSize(80,50), wxVSCROLL, wxString(""));
+
+       checkboxsizer = new wxFlexGridSizer(0,1,2,2);   
+
+
+       scrollwin->SetSizer(checkboxsizer, true);
+       scrollwin->SetAutoLayout( false );
+       //scrollwin->SetInitialSize(wxSize(200,200));
+
+       
+       return panel;
+}
+
+void interfToolsSpreadPanel::addContourCheckBox(std::string id){
+
+
+       wxCheckBox* check = new wxCheckBox(scrollwin, -1, wxString(id), wxDefaultPosition, wxDefaultSize, 0,
+                                                       wxDefaultValidator, wxString(id));
+
+       checkvect.push_back(id);
+
+       checkboxsizer->Add(check, wxFIXED_MINSIZE | wxALIGN_LEFT );
+       scrollwin->Layout();
+       checkboxsizer->Layout();
+
+}
+
+void interfToolsSpreadPanel::removeContourCheckBox(std::string id){
+
+       int index=-1;
+       for(int i = 0; i < checkvect.size(); i++){
+               std::string temp = checkvect[i];
+               if(id == temp){
+                       index = i;
+               }
+       }
+       if( index != -1){
+               if(checkboxsizer->Remove(index)){
+                       checkboxsizer->Layout();
+               }else{
+            throw "The checkbox could not be removed";
+               }
+       }
+}
+
+
diff --git a/lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.h b/lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.h
new file mode 100644 (file)
index 0000000..a0ffdb7
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef __interfToolsSpreadPanelH__
+#define __interfToolsSpreadPanelH__
+
+#include <wx/wx.h>
+#include <wx/radiobox.h>
+#include <wx/sizer.h>
+#include <wx/stattext.h>
+#include <wx/scrolwin.h>
+#include <wx/list.h>
+
+
+#include "interfMenuBar.h"
+
+class interfToolsSpreadPanel 
+       : public wxPanel
+{
+public:
+       interfToolsSpreadPanel(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler);               
+       ~interfToolsSpreadPanel();
+
+       /**
+       **      Adds a new checkbox to the scrolledwindow using the checkboxsizer
+       **      @Params id of contour
+       **      
+       **/
+       void addContourCheckBox(std::string id);
+
+       /**
+       **      Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
+       **      @Params id of contour
+       **      
+       **/
+       void removeContourCheckBox(std::string id);
+
+private:
+       wxPanel* resetbuttxt;
+       wxPanel* gobuttxt;
+       wxPanel* radiobox;
+       wxPanel* addremovecont;
+//Atributes for managing the events of adding and removing the checkbox
+       wxScrolledWindow* scrollwin;
+       wxFlexGridSizer* checkboxsizer;
+       std::vector<std::string> checkvect;
+       
+
+
+       /**
+       **      initializes the radio box to display the options of the spread method.
+       **/
+       wxPanel* initializeRadioBox();
+
+       /**
+       **      initializes the button and the text to be displayed
+       **      it returns a panel with both components
+       **      @param Path of the image to be used in the button
+       **      @param nom      text to be displayed at right of the button
+       **/
+       wxPanel* initializeButton(std::string path, std::string nom);
+
+       /**
+       **      initializes the panel that has all the contours that exist in the interface
+       **      every time a contour is added into the scene, it must be added into this panel
+       **      for all the contours it must exist a check box beside the contour.
+       **      This checkbox controls the contours that are going to be used in the spread function.
+       **/
+
+       wxPanel* initializeAddRemoveContour();
+
+       
+
+
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/CMakeLists.txt b/lib/Interface_ManagerContour_NDimensions/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6c3c395
--- /dev/null
@@ -0,0 +1,62 @@
+#----------------------------------------------------------------------------
+# SET THE NAME OF YOUR LIBRARY
+SET ( LIBRARY_NAME   Interface_ManagerContour_NDimensions_lib  )
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# CREATES A USER OPTION IN CMAKE
+OPTION ( BUILD_${LIBRARY_NAME}  "Build ${LIBRARY_NAME} library ?" ON)
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+IF ( BUILD_${LIBRARY_NAME} )
+#----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # BUILD LIBRARY
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY HEADERS (TO BE INSTALLED)
+  # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE:
+  FILE(GLOB ${LIBRARY_NAME}_HEADERS *.h)
+  # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND
+  #  SET ( ${LIBRARY_NAME}_HEADERS
+  #
+  #    )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY SOURCES (TO BE COMPILED)
+  # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
+  FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc *.h)
+  # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
+  #  SET ( ${LIBRARY_NAME}_SOURCES 
+  #   
+  #    )
+  #----------------------------------------------------------------------------
+  #----------------------------------------------------------------------------
+  # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH)
+  SET ( ${LIBRARY_NAME}_LINK_LIBRARIES
+       #kernel_ManagerContour_NDimensions_lib
+    ${crea_LIBRARIES}
+    ${WXWIDGETS_LIBRARIES}
+    ${VTK_LIBRARIES}
+    #    ${ITK_LIBRARIES}
+    #    ${GDCM_LIBRARIES}
+    #    ${BOOST_LIBRARIES}
+    )
+  #----------------------------------------------------------------------------
+
+  
+  #----------------------------------------------------------------------------
+  # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL
+  #CREA_ADD_LIBRARY( ${LIBRARY_NAME} )
+  #----------------------------------------------------------------------------
+
+  ADD_LIBRARY(${LIBRARY_NAME} STATIC  ${${LIBRARY_NAME}_SOURCES})
+  # LINK
+  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES})
+
+  #---------------------------------------------------------------------------
+ENDIF ( BUILD_${LIBRARY_NAME} )
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/ConceptDataWrap.cxx b/lib/Interface_ManagerContour_NDimensions/ConceptDataWrap.cxx
new file mode 100644 (file)
index 0000000..8f58218
--- /dev/null
@@ -0,0 +1,126 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ConceptDataWrap.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ConceptDataWrap.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+ConceptDataWrap :: ConceptDataWrap(std::string theName)
+       {
+               _minValue = -1;
+               _maxValue = -1;
+               _minShow = -1;
+               _maxShow = -1;
+               _actual = -1;
+               _name = theName;
+       }
+
+       ConceptDataWrap :: ~ConceptDataWrap()
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Sets the data concept values and name
+       * @param theName The name of the concept 
+       * @param minRepresent The minRepresent value of the concept 
+       * @param maxRepresent The maxRepresent value of the concept 
+       * @param minShowed The minShowed value of the concept 
+       * @param maxShowed The maxShowed value of the concept 
+       * @param actualShow The actualShow value of the concept 
+       */
+       void ConceptDataWrap :: fillData( std::string theName, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
+       {
+               _name = theName;
+               _minValue = minRepresent;
+               _maxValue = maxRepresent;
+               _minShow = minShowed;
+               _maxShow = maxShowed;
+               _actual = actualShow;
+       }
+
+
+       std::string ConceptDataWrap :: getName()
+       {
+               return _name;
+       }
+
+       int ConceptDataWrap :: getMinShowedValue()
+       {
+               return _minShow;
+       }
+
+       int ConceptDataWrap :: getMaxShowedValue()
+       {
+               return _maxShow;
+       }
+
+       void ConceptDataWrap :: setMinValue(int theMin)
+       {
+               _minValue = theMin;
+       }
+
+       int  ConceptDataWrap :: getMinValue()
+       {
+               return _minValue;
+       }
+
+       void ConceptDataWrap :: setMaxValue(int theMax)
+       {
+               _maxValue = theMax;
+       }
+
+       int  ConceptDataWrap :: getMaxValue()
+       {
+               return _maxValue;
+       }
+
+       void ConceptDataWrap :: setActualValue(int theActual)
+       {
+               _actual = theActual;
+       }
+
+       int  ConceptDataWrap :: getActualValue()
+       {
+               return _actual;
+       }
+
+       bool ConceptDataWrap :: isEmpty()
+       {
+               return _actual == -1;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/ConceptDataWrap.h b/lib/Interface_ManagerContour_NDimensions/ConceptDataWrap.h
new file mode 100644 (file)
index 0000000..40fd49d
--- /dev/null
@@ -0,0 +1,95 @@
+#ifndef __ConceptDataWrap_h_INCLUDED_H__
+#define __ConceptDataWrap_h_INCLUDED_H__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream> 
+#include <string>
+
+/** file ConceptDataWrap.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class ConceptDataWrap {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       ConceptDataWrap(std::string theName = "");
+
+       ~ConceptDataWrap();
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Sets the data concept values and name
+       * @param theName The name of the concept 
+       * @param minRepresent The minRepresent value of the concept 
+       * @param maxRepresent The maxRepresent value of the concept 
+       * @param minShowed The minShowed value of the concept 
+       * @param maxShowed The maxShowed value of the concept 
+       * @param actualShow The actualShow value of the concept 
+       */
+       void fillData( std::string theName, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
+
+       std::string getName();
+
+       int getMinShowedValue();
+
+       int getMaxShowedValue();
+
+       void setMinValue(int theMin);
+
+       int getMinValue();
+
+       void setMaxValue(int theMax);
+
+       int getMaxValue();
+
+       void setActualValue(int theActual);
+
+       int getActualValue();
+
+       bool isEmpty( );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       int _minValue;
+
+       int _maxValue;
+
+       int _minShow;
+
+       int _maxShow;
+
+       int _actual;
+
+       std::string _name;
+
+
+};
+#endif // __ConceptDataWrap_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/ContourWrap_ViewControl.cxx b/lib/Interface_ManagerContour_NDimensions/ContourWrap_ViewControl.cxx
new file mode 100644 (file)
index 0000000..3ca65b9
--- /dev/null
@@ -0,0 +1,91 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ContourWrap_ViewControl.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       ContourWrap_ViewControl :: ContourWrap_ViewControl(manualContourBaseControler * contourControl, manualViewBaseContour  * manualViewContour)
+       {
+               setControler( contourControl );
+               setViewer ( manualViewContour );
+       }
+
+       ContourWrap_ViewControl :: ~ContourWrap_ViewControl()
+       {
+
+       }
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       manualContourBaseControler * ContourWrap_ViewControl :: getControler()
+       {
+               return m_controler;
+       }
+
+       manualViewBaseContour  * ContourWrap_ViewControl :: getViewer()
+       {
+               return m_viewer;
+       }
+
+
+       void ContourWrap_ViewControl :: setControler(manualContourBaseControler * contourControl)
+       {
+               m_controler = contourControl;
+       }
+
+       void ContourWrap_ViewControl :: setViewer(manualViewBaseContour  * viewContour) 
+       {
+               m_viewer = viewContour;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/ContourWrap_ViewControl.h b/lib/Interface_ManagerContour_NDimensions/ContourWrap_ViewControl.h
new file mode 100644 (file)
index 0000000..4b7ec0c
--- /dev/null
@@ -0,0 +1,93 @@
+#ifndef __ContourWrap_ViewControl_h_INCLUDED_H__
+#define __ContourWrap_ViewControl_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <manualContour.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+
+/** file wxVtkBaseView_SceneManager.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class ContourWrap_ViewControl{
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       ContourWrap_ViewControl(manualContourBaseControler * contourControl, manualViewBaseContour  * manualViewContour);
+
+       ~ContourWrap_ViewControl();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       manualContourBaseControler * getControler();
+
+       manualViewBaseContour  * getViewer();
+
+
+       void setControler(manualContourBaseControler * contourControl);
+
+       void setViewer(manualViewBaseContour  * viewContour) ;
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+       manualContourBaseControler * m_controler;
+
+       manualViewBaseContour  * m_viewer;
+
+};
+#endif // __ContourWrap_ViewControl_HEADER_FILE__
+
diff --git a/lib/Interface_ManagerContour_NDimensions/PerformingOperation.cxx b/lib/Interface_ManagerContour_NDimensions/PerformingOperation.cxx
new file mode 100644 (file)
index 0000000..9b592f7
--- /dev/null
@@ -0,0 +1,121 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "PerformingOperation.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file PerformingOperation.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       PerformingOperation :: PerformingOperation()
+       {
+               _startCommand = '\0';
+               _endCommand = '\0';
+       }
+
+       PerformingOperation :: ~PerformingOperation()
+       {
+               reset();
+       }
+               
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes PerformingOperation :: getters and PerformingOperation :: setters
+       //------------------------------------------------------------------------------------------------------------
+
+       void PerformingOperation :: setStartOperationInstantVector( std::vector<int> instantData )
+       {
+               for (int i =0; i< instantData.size(); i++)
+               {
+                       _startOperationInstantVector.push_back( instantData[i] );
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       std::vector<int> PerformingOperation :: getStartOperationInstantVector( )
+       {
+               return _startOperationInstantVector;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void PerformingOperation :: setEndOperationInstantVector( std::vector<int> instantData )
+       {
+               for (int i =0; i< instantData.size(); i++)
+               {
+                       _endOperationInstantVector.push_back( instantData[i] );
+               }               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       std::vector<int> PerformingOperation :: getEndOperationInstantVector( )
+       {
+               return _endOperationInstantVector;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       char PerformingOperation :: getStartCommand()
+       {
+               return _startCommand;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void PerformingOperation :: setStartCommand( char theCommand )
+       {
+               _startCommand = theCommand;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       char PerformingOperation :: getEndCommand()
+       {
+               return _endCommand;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void PerformingOperation :: setEndCommand( char theCommand )
+       {
+               _endCommand = theCommand;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       std::vector<std::string> PerformingOperation:: getKeyNamesOperationElems(  )
+       {
+               return _keyNamesOperationElems;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void PerformingOperation:: setKeyNamesOperationElems( std::vector<std::string> dataVector)
+       {
+               _keyNamesOperationElems = dataVector;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void PerformingOperation :: reset()
+       {
+               _startCommand = '\0';
+               _endCommand = '\0';
+               _startOperationInstantVector.clear();
+               _endOperationInstantVector.clear();
+               _keyNamesOperationElems.clear();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
diff --git a/lib/Interface_ManagerContour_NDimensions/PerformingOperation.h b/lib/Interface_ManagerContour_NDimensions/PerformingOperation.h
new file mode 100644 (file)
index 0000000..565350b
--- /dev/null
@@ -0,0 +1,86 @@
+#ifndef __PerformingOperation_h_INCLUDED_H__
+#define __PerformingOperation_h_INCLUDED_H__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <vector>
+
+
+/** file PerformingOperation.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class PerformingOperation {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       PerformingOperation();
+
+       ~PerformingOperation();
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       void setStartOperationInstantVector( std::vector<int> instantData );
+
+       std::vector<int> getStartOperationInstantVector( );
+
+       void setEndOperationInstantVector( std::vector<int> instantData );
+
+       std::vector<int> getEndOperationInstantVector( );
+
+       char getStartCommand();
+
+       void setStartCommand( char theCommand );
+
+       char getEndCommand();
+
+       void setEndCommand( char theCommand );
+
+       std::vector<std::string> getKeyNamesOperationElems( );
+
+       void setKeyNamesOperationElems( std::vector<std::string> dataVector);
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void reset();
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+       std::vector<int>  _startOperationInstantVector;
+
+       std::vector<int>  _endOperationInstantVector;
+
+       std::vector<std::string> _keyNamesOperationElems;
+
+       char _startCommand;
+
+       char _endCommand;
+
+};
+#endif // __PerformingOperation_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/__wxContourEventHandler.cxx__ b/lib/Interface_ManagerContour_NDimensions/__wxContourEventHandler.cxx__
new file mode 100644 (file)
index 0000000..a78be78
--- /dev/null
@@ -0,0 +1,2803 @@
+
+
+/*  Diagrama de Secuaencia de cambiar un instante
+wxContourEventHandler :: changeInstant()
+       OutlineModelManager :: ->setInstant( _actualInstant );
+               OutlineModelManager :: updateToActualInstant()
+                 OutlineModelManager :: getOutlinesAtInstant(Instant * anInstant, bool ifAnnotate)
+                   OutlineModelManager :: annotateOutlinesWrap(std::vector<std::string> kNamesVector, std::vector<ContourThing **> theOutlinesVector)
+       wxContourEventHandler :: updateInstantOutlines()
+               OutlineModelManager :: getActualInstantOutlines ()
+               wxVtkBaseView_SceneManager :: addToScene( std::vector< std::string> theKeyNameVector, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+                       wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+                               wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf
+                                       MAP  find
+                          void wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+
+*/
+
+
+/*!
+ \mainpage NDimension with wxWidgets and maracas
+
+ \section intro Introduction
+
+ This is the introduction. 
+
+
+
+  \dot
+
+
+digraph example_0 {
+       graph [ ratio=fill];
+    node [shape=record, fontname=Helvetica, fontsize=10];
+
+       _wxContourGUIExample                    [ label="wxContourGUIExample"                   URL="\ref wxContourGUIExample"];
+       _wxContourEventHandler                  [ label="wxContourEventHandler"                 URL="\ref wxContourEventHandler"];
+
+       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
+       _wxInstantChooserPanel                  [ label="wxInstantChooserPanel"                 URL="\ref wxInstantChooserPanel"];
+       _wxContourViewPanel                             [ label="wxContourViewPanel"                    URL="\ref wxContourViewPanel"];
+       _wxContour_ButtonsBar                   [ label="wxContour_ButtonsBar"                  URL="\ref wxContour_ButtonsBar"];       
+       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
+       _wxVtkBaseView_SceneManager             [ label="wxVtkBaseView_SceneManager"    URL="\ref wxVtkBaseView_SceneManager"];
+       _SomeEnvironment                                [ label="SomeEnvironment"                               URL="\ref SomeEnvironment"];
+               
+
+       _wxContourGUIExample                    ->      _wxContourEventHandler                  [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _wxInstantChooserPanel                  [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _wxContourViewPanel                             [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _wxContour_ButtonsBar                   [ arrowhead="open", style="dashed" ];
+       _wxContourViewPanel                             ->      wxMaracas_N_ViewersWidget               [ arrowhead="open", style="dashed" ];
+       _wxContourEventHandler                  ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
+       _wxContourEventHandler                  ->      _wxVtkBaseView_SceneManager             [ arrowhead="open", style="dashed" ];
+       _OutlineModelManager                    ->      _SomeEnvironment                                [ arrowhead="open", style="dashed" ];
+       
+}
+
+\enddot
+
+
+
+*/
+
+
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContourEventHandler.h"
+#include <wx/filedlg.h>
+#include <wx/spinctrl.h>
+#include <iostream>
+#include <fstream>
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxContourEventHandler.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "wxContour_ActionCommnadsID.h"
+#include "NameWrapper.h"
+#include "ConceptDataWrap.h"
+#include "OutlineGroup.h"
+
+#include <manualContour.h>
+#include "Contour/ContourExtractData.h"
+#include "ImageSourceThing.h"
+
+#include "vtkImageData.h"
+#include <vtkContourFilter.h>
+#include <vtkCleanPolyData.h>
+#include <vtkPolyDataConnectivityFilter.h>         
+#include <vtkStripper.h>
+#include <vtkImageReslice.h>
+#include <vtkMetaImageWriter.h>
+#include <vtkImageMapToWindowLevelColors.h>
+
+
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+PanelBullEyeOptions::PanelBullEyeOptions (wxWindow * parent, wxSize size) :
+                wxPanel(parent, -1, wxDefaultPosition, size)
+{
+
+       _maxLevels              = 5;
+       _maxSections    = 10;
+       wxSize sizepanel(190,300);
+       wxPanel *panel = this;
+
+
+       wxString lstOptions[2];
+       lstOptions[0]="General options";
+       lstOptions[1]="Detail options";
+       _radioboxBullEyeGenOpt  = new wxRadioBox(panel, -1, "General/Detail options", wxDefaultPosition, wxSize(200,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
+       _radioboxBullEyeGenOpt->SetSelection(0);
+
+       _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) );
+       _spinctrlBullEyeNumOfCrowns->SetRange(1,_maxLevels);
+       _spinctrlBullEyeNumOfCrowns->SetValue(3);
+
+       _spinctrlBullEyeNumOfSec = new wxSpinCtrl( panel , -1,_T("A"),wxDefaultPosition, wxSize(40,20) );
+       _spinctrlBullEyeNumOfSec->SetRange(1,_maxSections);
+       _spinctrlBullEyeNumOfSec->SetValue(5);
+
+
+       _sliderBullEyeAngle = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+       wxFlexGridSizer * sizerGeneralOptions                           = new wxFlexGridSizer(10);
+
+       wxFlexGridSizer * sizerGeneralOptionsA                          = new wxFlexGridSizer(1);
+       wxFlexGridSizer * sizerGeneralOptionsB                          = new wxFlexGridSizer(1);
+       wxFlexGridSizer * sizerGeneralOptionsC                          = new wxFlexGridSizer(1);
+       sizerGeneralOptionsA -> Add( new wxStaticText(panel,-1,_T("Crowns")) , 1, wxGROW );
+       sizerGeneralOptionsA -> Add( _spinctrlBullEyeNumOfCrowns , 1/*, wxGROW*/ );
+       sizerGeneralOptionsB -> Add( new wxStaticText(panel,-1,_T("Sections")) , 1, wxGROW );
+       sizerGeneralOptionsB -> Add( _spinctrlBullEyeNumOfSec , 1/*, wxGROW*/ );
+       sizerGeneralOptionsC -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
+       sizerGeneralOptionsC -> Add( _sliderBullEyeAngle , 1/*, wxGROW*/ );
+
+       sizerGeneralOptions -> Add( sizerGeneralOptionsA  , 1/*, wxGROW*/ );
+       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
+       sizerGeneralOptions -> Add( sizerGeneralOptionsB  , 1/*, wxGROW*/ );
+       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
+       sizerGeneralOptions -> Add( sizerGeneralOptionsC  , 1/*, wxGROW*/ );
+
+
+       wxSpinCtrl      *tmpSpinSection;
+       wxSlider        *tmpSliderRadio;
+       wxSlider        *tmpSliderAng;
+
+       wxFlexGridSizer * sizerDetailOptions                            = new wxFlexGridSizer(6);
+
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("Crown ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  Sections  ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Radio %")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
+
+       wxString tmpwxstring;
+       int i;
+       for (i=0;i<_maxLevels;i++){
+               tmpSpinSection = new wxSpinCtrl( panel  , -1,_T(""),wxDefaultPosition, wxSize(40,20) );
+               tmpSliderRadio = new wxSlider( panel    , -1 ,0,0,100, wxDefaultPosition, wxSize(110,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               tmpSliderAng   = new wxSlider( panel    , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+               tmpSpinSection ->SetRange(1,_maxSections);
+
+               tmpwxstring.Printf(_T("  %d.  "),i+1);
+               sizerDetailOptions -> Add( new wxStaticText(panel,-1,tmpwxstring) , 1, wxGROW );
+               sizerDetailOptions -> Add( tmpSpinSection, 1 );
+               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+               sizerDetailOptions -> Add( tmpSliderRadio, 1, wxGROW );
+               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+               sizerDetailOptions -> Add( tmpSliderAng, 1, wxGROW );
+
+               tmpSpinSection  -> SetValue(5);
+               tmpSliderRadio  -> SetValue( 100-(double)((i)*100.0/_maxLevels) );
+               tmpSliderAng    -> SetValue(0);
+               
+               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
+               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_CHANGED  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
+
+               _lstBullEyeDetailNumOfSec.push_back( tmpSpinSection );
+               _lstBullEyeDetailRadio.push_back( tmpSliderRadio );
+               _lstBullEyeDetailAngle.push_back( tmpSliderAng );
+
+       } //for
+
+       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( _radioboxBullEyeGenOpt , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye general options --")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add(  sizerGeneralOptions , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye detail options --")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add(  sizerDetailOptions  , 1, wxGROW );
+
+       Connect( _radioboxBullEyeGenOpt->GetId(),       wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 
+       Connect( _spinctrlBullEyeNumOfCrowns->GetId(),  wxEVT_COMMAND_TEXT_UPDATED              , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
+       
+       panel->SetSizer( sizer );
+       panel->SetSize( sizepanel );
+       panel->SetAutoLayout( true );
+       panel->Layout();
+
+       RefreshPanel();
+
+}
+
+//------------------------------------------------------------------------------------------------------------
+PanelBullEyeOptions::~PanelBullEyeOptions() 
+{
+}
+
+//------------------------------------------------------------------------------------------------------------
+void PanelBullEyeOptions::onRefreshPanel( wxCommandEvent& event )
+{
+       RefreshPanel();
+}
+
+//------------------------------------------------------------------------------------------------------------
+void PanelBullEyeOptions::RefreshPanel()
+{
+       int i;
+       bool ok;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0){
+               for (i=0; i<_maxLevels; i++)
+               {
+                       _lstBullEyeDetailNumOfSec[i]    -> Enable(false);
+                       _lstBullEyeDetailRadio[i]               -> Enable(false);
+                       _lstBullEyeDetailAngle[i]               -> Enable(false);
+               } // for
+       } else {
+               int spinSelec = _spinctrlBullEyeNumOfCrowns->GetValue(); 
+               for (i=0; i<_maxLevels; i++)
+               {
+                       ok = (i < spinSelec);
+                       _lstBullEyeDetailNumOfSec[i]    -> Enable(ok);
+                       _lstBullEyeDetailRadio[i]               -> Enable(ok);
+                       _lstBullEyeDetailAngle[i]               -> Enable(ok);
+
+                       if (i>0){
+                               if (_lstBullEyeDetailRadio[i]->GetValue() > _lstBullEyeDetailRadio[i-1]->GetValue())
+                               {
+                                       _lstBullEyeDetailRadio[i]->SetValue( _lstBullEyeDetailRadio[i-1]->GetValue() );
+                               } 
+                       }// if i>0
+               } // for
+       } // if
+}
+
+//------------------------------------------------------------------------------------------------------------
+int PanelBullEyeOptions::GetNumberOfCrowns()
+{
+       return this->_spinctrlBullEyeNumOfCrowns->GetValue();
+}
+
+//------------------------------------------------------------------------------------------------------------
+int PanelBullEyeOptions::GetNumberOfSections(int nCrown)
+{
+       int result;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
+       { 
+               result = this->_spinctrlBullEyeNumOfSec->GetValue();
+       } else {
+               result = this->_lstBullEyeDetailNumOfSec[nCrown]->GetValue();
+       }
+       return result;
+}
+
+//------------------------------------------------------------------------------------------------------------
+int PanelBullEyeOptions::GetRadioOfCrown(int nCrown)
+{
+       int result;
+       double sizeCrowns;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
+       { 
+               sizeCrowns = (double)( this->_spinctrlBullEyeNumOfCrowns->GetValue() );
+               result = 100.0 * (nCrown+1)/sizeCrowns ;
+       } else {
+               result = this->_lstBullEyeDetailRadio[nCrown]->GetValue();
+       }
+       return result;
+}
+
+//------------------------------------------------------------------------------------------------------------
+double PanelBullEyeOptions::GetAngOfCrownSection(int nCrown,int section)
+{
+       double angle;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
+       { 
+               angle = this->_sliderBullEyeAngle->GetValue();
+       } else {
+               angle = this->_lstBullEyeDetailAngle[nCrown]->GetValue();
+       }
+       double numOfSec = (double)GetNumberOfSections(nCrown);
+       double deltaSec = GetAngDeltaOfCrownSection(nCrown);
+       return angle + section*deltaSec ;
+}
+
+//------------------------------------------------------------------------------------------------------------
+double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
+{
+       double numOfSec = (double)GetNumberOfSections(nCrown);
+       return 360.0/numOfSec;
+}
+
+
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       wxContourEventHandler ::wxContourEventHandler()
+               :wxEvtHandler()
+       {
+        _creatingContoursActive                        = false;
+               _theViewPanel                                   = NULL;
+               _modelManager                                   = NULL;
+               _instantPanel                                   = NULL;
+               _buttonsBar                                             = NULL;
+               _gridPanel                                              = NULL; 
+               _drawToolsPanel                                 = NULL;
+               _operationsToolsPanel                   = NULL;
+               _autoFormsPanel                                 = NULL; 
+               _standardToolsPanel                             = NULL;
+               _editionToolsPanel                              = NULL;
+               _listViewPanel                                  = NULL;
+               _sceneManager                                   = NULL;
+               _actualInstant                                  = NULL;
+               _performingOperation                    = new PerformingOperation();
+
+               // EED Interface and Spread
+               _spreadFrame                                    = NULL;
+               _segmentationFrame                              = NULL;
+               _contourPropagation                             = NULL;
+               _createContourFrame                             = NULL;
+               _deleteFrame                                    = NULL;
+               _InformationContourFrame                = NULL;
+               _interfaceConfigurationFrame    = NULL;
+               _TestFrame                                              = NULL;
+               _wxtextctrlTest                                 = NULL;
+               _panelBullEyeOptions                    = NULL;
+
+               fileNameContourROI                              = "";
+               _numberOfVariablesStatistics=6+1;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       wxContourEventHandler :: ~ wxContourEventHandler()
+       {
+               delete _actualInstant;
+               /*delete _theViewPanel;         
+               delete _instantPanel;
+               delete _buttonsBar;
+               delete _actualInstant;  
+               */       
+               delete _sceneManager;
+               delete _performingOperation;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       // Configuration methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       bool wxContourEventHandler :: configureEventsHandling()
+       {
+               bool configured = true;
+
+               return configured;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events 
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onProcessMessage( wxCommandEvent& event )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onActionButtonPressed( wxCommandEvent& event )
+       {
+               const char buttonTool = *(char *)event.GetClientData();
+               executeActionCommand( buttonTool );             
+       }
+       //------------------------------------------------------------------------------------------------------------          
+       void wxContourEventHandler :: onChangedDeep ( wxCommandEvent& event )
+       {
+               double val = _theViewPanel->getCurrentDeep();
+               _instantPanel->setConceptValue( "Axe Depth", (int)val );
+               _theViewPanel->setActualVertical( (int)val );
+               changeInstant();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onChangeInstant( wxCommandEvent& event )
+       {               
+               ConceptDataWrap * dataConcept = NULL; 
+               if ( _theViewPanel->GetId() == event.GetId() )
+               {
+                       dataConcept = (ConceptDataWrap *)event.GetClientData();
+                       int value = dataConcept->getActualValue();
+                       _instantPanel->setConceptValue( dataConcept->getName(), value );
+               }
+               else
+               {
+                       dataConcept = _instantPanel->getLastConceptData();
+                       if( dataConcept->getName().compare( _theViewPanel->getVerticalConceptName() ) )
+                       {
+                               _theViewPanel->setActualVertical( dataConcept->getActualValue());
+                               //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
+                       }
+                       else if( dataConcept->getName().compare( _theViewPanel->getHorizontalConceptName() ) || _instantPanel->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
+                       {
+                               _theViewPanel->setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
+                       }
+               }       
+               changeInstant();
+       }
+       //------------------------------------------------------------------------------------------------------------
+               
+       void wxContourEventHandler :: onCreateMultipleROI( wxCommandEvent& event )
+       {
+               _creatingContoursActive = !_creatingContoursActive;
+               if( _creatingContoursActive )
+               {                       
+                       createContour();
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onCreateROI( wxCommandEvent& event )
+       {
+               if( _creatingContoursActive )
+               {                       
+                       createContour();
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onStopCreateROI( wxCommandEvent& event )
+       {
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onDeleterROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSelectROI( wxCommandEvent& event )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+
+       void wxContourEventHandler :: onUnSelectROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onManualHidedROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onManualShowedROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onEditingROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onMovingROI( wxCommandEvent& event )
+       {
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Model management methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler::onSpreadReset( wxCommandEvent& event )
+       {
+               _wxtextctrlSpread->SetValue("");
+               _contourPropagation->resetAppend();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSpreadAdd( wxCommandEvent& event )
+       {
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
+
+               if (vecX.size()!=0){
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int i,size=vecZ.size();
+                       int actualSlice = tempVector[1];
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               vecZ[i] = actualSlice;
+                       } // for
+
+                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
+                       wxString newstring;
+                       newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
+                       _wxtextctrlSpread->SetValue(newstring);
+               } // if 
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSpreadGo( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
+               int typeofcontour = 1;
+               manualContourModel *manModelContour;
+               std::vector<double> vecCtrlPointX;
+               std::vector<double> vecCtrlPointY;
+               std::vector<double> vecCtrlPointZ;
+               double  minZ,maxZ;
+               int z,j,sizeCtrPt;
+//             double idTmp;
+               int idTmp;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+//             tempVector[1];
+
+               _contourPropagation->getMaxMinZ(&minZ,&maxZ);
+//JSTG_16-07-08_----------------------------------------------------------------
+               //_contourPropagation->setInterpolationNumber(maxZ-minZ+1);
+               _contourPropagation->setInterpolationNumber(100);
+               _contourPropagation->CalculeSplinePropagation();
+
+               double          totalZ = maxZ-minZ+1;
+               double          porcent;
+               wxString        tmpString;
+//--------------------------------------------------------------------
+               for ( z=minZ ; z<=maxZ ; z++ )
+               {
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , (int)(z-minZ+1), (int)totalZ,z );
+                       _staticTextSpread->SetLabel(tmpString);
+
+                       if (_contourPropagation->ifSliceKeyContourExist(z)==false)
+                       {
+                               manModelContour = factoryManualContourModel( typeofcontour );
+                               idTmp = _contourPropagation->FindIdWithZ(z);
+                               if (typeMethodFindCtrlPoints==0) // Initial Points
+                               {   
+                                       _contourPropagation->GetInitialControlPoints( idTmp , &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
+                               } 
+                               if (typeMethodFindCtrlPoints==1)  // Automatique Method
+                               {
+                                       _contourPropagation->GetControlPoints( idTmp  ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
+                               }
+                               if (typeMethodFindCtrlPoints==2)  // sampling
+                               {
+                                       _contourPropagation->GetControlPoints( idTmp , 20.0 ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
+                               }
+       //--------------------------------------------------------------------
+                               sizeCtrPt = vecCtrlPointX.size();
+                               for (j=0 ; j<sizeCtrPt ; j++)
+                               {
+       //JSTG_16-07-08_----------------------------------------------------------------
+                                       manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , -900  );
+       //--------------------------------------------------------------------
+                               } // for j
+
+                               tempVector[1]=z;
+                               std::string theName;
+                               theName = _modelManager->createOutline( manModelContour, tempVector );
+                               bool addedModel = theName.compare("") != 0;
+                               if( addedModel )
+                               {
+                                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                                       this->_theViewPanel->getSpacing(spc);                                   
+                                       //Adding the manualContourControler to interface objects structure
+                                       //Adding the manualViewContour to interface objects structure           
+                                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                                       _sceneManager->configureViewControlTo( theName, manModelContour,spc,typeofcontour ) ;
+                               } // if addedModel
+                       }// ifSliceKeyContourExist
+               } // for z
+               _staticTextSpread->SetLabel("   ");
+               RefreshInterface();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSpread( )
+       {
+               if (_spreadFrame==NULL)
+               {
+                       _contourPropagation                     = new ContourPropagation();
+                       _spreadFrame                            = new wxFrame (_theViewPanel, -1,_T("  Spread  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       wxSize sizepanel(250,400);
+                       _spreadFrame->SetSize( sizepanel );
+                       wxPanel *panel                          = new wxPanel(_spreadFrame,-1);
+
+                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
+                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
+
+                       wxString lstOptions[3];
+                       lstOptions[0]="A";
+                       lstOptions[1]="B";
+                       lstOptions[2]="C";
+                       _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+                       _spreadMethodRadiobox->SetSelection(2);
+
+                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxSize(80,35));
+                       _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
+
+                       _wxtextctrlSpread           = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
+
+                       _spreadFrame->SetEventHandler( this );
+                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
+                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadAdd ); 
+                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadGo ); 
+
+                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+                       sizer -> Add( spreadResetBtn            , 1, wxGROW );
+                       sizer -> Add( spreadAddBtn                      , 1, wxGROW );
+                       sizer -> Add( _spreadMethodRadiobox     , 1, wxGROW );
+                       sizer -> Add( spreadGoBtn                       , 1, wxGROW );
+                       sizer -> Add( _staticTextSpread         , 1, wxGROW );
+                       sizer -> Add( _wxtextctrlSpread         , 1, wxGROW );
+
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _spreadFrame->Show();
+               } else {
+                       if (_spreadFrame->IsShown()==true)
+                       {
+                               _spreadFrame->Show(false);
+                       } else  {
+                               _spreadFrame->Show(true);
+                       }
+               }
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSegmentationAllSlice( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               int                                     x                                       = this->_theViewPanel->GetX();
+               int                                     y                                       = this->_theViewPanel->GetY();
+               int z,minZ,maxZ;
+               double porcent; 
+               wxString tmpString;
+               minZ=_mbarrange->GetStart();
+               maxZ=_mbarrange->GetEnd();
+               double totalZ = maxZ-minZ+1;
+               for( z=minZ ; z<=maxZ ; z++ )
+               {
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
+                       _staticTextSegmentation->SetLabel(tmpString);
+                       SegmentationOneSlice( x,y,z );
+               }
+               _staticTextSegmentation->SetLabel("   ");
+               RefreshInterface();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSegmentationOneSlice( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               int                                     x                                       = this->_theViewPanel->GetX();
+               int                                     y                                       = this->_theViewPanel->GetY();
+               int                                     z                                       = this->_theViewPanel->GetZ();
+               SegmentationOneSlice( x,y,z );
+               RefreshInterface();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::SegmentationOneSlice( int x, int y, int z )
+       {               
+               int typeofcontour = 1;
+               //--Extracting Contour
+               vtkImageData    *imagedata      = _sceneManager->GetImageData();
+//             double                  *range          = imagedata->GetScalarRange();  
+//             double                  thr                     = 1;
+               int                             isovalue        = _isovalue->GetValue();
+               int                             sampling        = _sampling->GetValue();
+
+               vtkImageReslice *imageReslice = vtkImageReslice::New();
+//EED
+//             double spc[3];
+//             imagedata->GetSpacing(spc);
+//             x = x*spc[0];
+//             y = y*spc[1];
+//             z = z*spc[3];
+
+               imageReslice->SetInput( imagedata );
+               imageReslice->SetInformationInput(imagedata);
+               imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
+               imageReslice->SetResliceAxesOrigin(0,0,z);
+               imageReslice->SetOutputDimensionality(2);
+               imageReslice->SetInterpolationModeToLinear();
+
+               imagedata = imageReslice->GetOutput();
+               imagedata->Update();
+               imagedata->UpdateInformation();
+
+               vtkContourFilter* cntVTK = vtkContourFilter::New( );
+               cntVTK->SetInput( imagedata );
+
+               cntVTK->SetNumberOfContours( 1 );
+               //cntVTK->SetValue( 0, vmin );
+//             cntVTK->SetValue( 0, (range[1]*thr/100) );
+               cntVTK->SetValue( 1, isovalue );
+       //      cntVTK->SetValue( 1, vmax );
+               cntVTK->Update( );
+               cntVTK->UpdateInformation();
+                       
+               vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
+               cpd->SetInput( cntVTK->GetOutput( ) );
+               cpd->ConvertLinesToPointsOff( );
+               cpd->Update( );
+               cpd->UpdateInformation();
+
+               vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
+               conn->SetExtractionModeToClosestPointRegion( );
+               //conn->SetMaxRecursionDepth( 3000 );
+                       
+               conn->SetInput( cpd->GetOutput( ) );
+                       
+               conn->SetClosestPoint( x, y, 0 );
+               conn->Update( );
+               conn->UpdateInformation();
+                       
+               vtkCleanPolyData* cpd2 = vtkCleanPolyData::New( );
+               cpd2->SetInput( conn->GetOutput( ) );
+               cpd2->Update();
+               cpd2->UpdateInformation();
+
+               vtkStripper* vtkstripper = vtkStripper::New( );
+               vtkstripper->SetInput( cpd2->GetOutput() );
+               vtkstripper->Update();
+               vtkstripper->UpdateInformation();
+
+
+               vtkPolyData* polyDataResult =  vtkstripper->GetOutput();
+
+               polyDataResult->Update( );
+               polyDataResult->UpdateInformation();
+
+/* EED
+ofstream myfile;
+myfile.open ("c:/temp/example.txt");
+myfile << "\n";
+polyDataResult->Print(myfile);
+myfile << "-------------------------------------\n";
+polyDataResult->GetLines()->Print(myfile);
+myfile.close();
+*/
+
+               cntVTK          -> Delete();
+               cpd2            -> Delete();
+               cpd                     -> Delete();
+               conn            -> Delete();
+
+
+//--Calculating control points
+
+               std::vector<double> vecX;
+               std::vector<double> vecY;
+               std::vector<double> vecZ;
+
+               std::vector<double> vecCtrlPointX;
+               std::vector<double> vecCtrlPointY;
+               std::vector<double> vecCtrlPointZ;
+
+
+               double *p;
+               int ii,size=polyDataResult->GetNumberOfPoints();
+               int id;
+               for (ii=1;ii<=size;ii++)
+               {
+                       id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
+                       p       = polyDataResult->GetPoint(id);
+                       double x=p[0];
+                       double y=p[1];
+                       vecX.push_back( p[0] );
+                       vecY.push_back( p[1] );
+                       vecZ.push_back( -900 );
+//                     vecZ.push_back( p[2] );
+               }
+
+
+               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+
+//PROOFS
+               if (methodRadiobox->GetSelection()==0){
+                       extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+               if (methodRadiobox->GetSelection()==1){
+                       extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+               if (methodRadiobox->GetSelection()==2){
+                       extractcontrolpoints2d->SetSamplingControlPoints( sampling );
+                       extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+
+               //--Adding contour to the system
+
+               std::vector<int> actualInstantVector;
+               _instantPanel->getInstant( actualInstantVector );
+               actualInstantVector[1]=z;
+
+               int j,sizeCtrPt = vecCtrlPointX.size();
+               manualContourModel *manModelContour =  factoryManualContourModel( typeofcontour );
+               manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
+               if (sizeCtrPt>=3){
+                       for (j=0 ; j<sizeCtrPt ; j++)
+                       {
+                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
+                       } // for
+                       std::string theName;
+                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+                       bool addedModel = theName.compare("") != 0;
+                       if( addedModel )
+                       {
+                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                               this->_theViewPanel->getSpacing(spc);                                   
+                               //Adding the manualContourControler to interface objects structure
+                               //Adding the manualViewContour to interface objects structure           
+                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                               _sceneManager->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
+                       }       // if addedModel
+               } // if sizeCtrPt
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onAutomatiqueSegmentation( )
+       {
+               if (_segmentationFrame==NULL)
+               {
+                       int sizeZ = _sceneManager->GetImageDataSizeZ();
+                       double range[2];
+                       _sceneManager->GetImageDataRange(range);
+
+                        wxSize sizePanel( 300, 470);
+                       _segmentationFrame                                      =  new wxFrame (_theViewPanel, -1,_T("  Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       _segmentationFrame->SetSize( sizePanel );
+                       wxPanel *panel                                          = new wxPanel(_segmentationFrame,-1);
+                       wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
+                       wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
+                       _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+                       _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+                       wxString lstOptions[3];
+                       lstOptions[0]="A";
+                       lstOptions[1]="B";
+                       lstOptions[2]="C";
+                       methodRadiobox                                          = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+                       methodRadiobox->SetSelection(2);
+                       _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
+
+
+                       _mbarrange                                      =  new mBarRange(panel,70, 65);
+                       _mbarrange->SetMin(0);
+                       _mbarrange->SetStart(0);
+
+                       _mbarrange-> SetOrientation( true );
+                       _mbarrange-> setActiveStateTo(true);
+                       _mbarrange-> setVisibleLabels( true );
+                       _mbarrange-> setDeviceEndMargin(10);
+                       _mbarrange-> setRepresentedValues( 0 , sizeZ );
+                       _mbarrange-> setDeviceBlitStart(10,10); 
+                       _mbarrange-> setIfWithActualDrawed( false );
+                       _mbarrange-> SetStart( 0 );
+                       _mbarrange-> SetEnd( sizeZ );  
+
+
+//                     _segmentationFrame->SetEventHandler( this );
+                       segmentationOneSliceBtn->SetEventHandler( this );
+                       segmentationAllSliceBtn->SetEventHandler( this );
+                       Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSlice ); 
+                       Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSlice ); 
+
+                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+                       sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
+                       sizer -> Add( _isovalue , 1, wxGROW );
+                       sizer -> Add( methodRadiobox , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
+                       sizer -> Add( _sampling , 1, wxGROW );
+                       sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+                       sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
+                       sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
+                       sizer -> Add( _mbarrange  , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizePanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _segmentationFrame->Show(true);
+                       this->_theViewPanel->SetVisibleAxis(true);
+                       this->_theViewPanel->Refresh();
+               } else {
+                       if (_segmentationFrame->IsShown()==true)
+                       {
+                               _segmentationFrame->Show(false);
+                               this->_theViewPanel->SetVisibleAxis(false);
+                               this->_theViewPanel->Refresh();
+                       } else  {
+                               _segmentationFrame->Show(true);
+                               this->_theViewPanel->SetVisibleAxis(true);
+                               this->_theViewPanel->Refresh();
+                       }
+               }
+       }
+
+       void wxContourEventHandler :: onInterfaceTestFrame( )
+       {
+               if (_TestFrame==NULL)
+               {
+                       _contourPropagation                     = new ContourPropagation();
+                       _TestFrame                                      = new wxFrame (_theViewPanel, -1,_T("  Test Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       wxSize sizepanel(200,300);
+                       _TestFrame->SetSize( sizepanel );
+                       wxPanel *panel                          = new wxPanel(_TestFrame,-1);
+                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
+                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
+                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("GoA"),wxDefaultPosition, wxSize(80,35));
+                       _wxtextctrlTest                         = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
+
+                       _TestFrame->SetEventHandler( this );
+                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestReset ); 
+                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestAdd ); 
+                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestGo ); 
+
+                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+                       sizer -> Add( spreadResetBtn    , 1, wxGROW );
+                       sizer -> Add( spreadAddBtn              , 1, wxGROW );
+                       sizer -> Add( spreadGoBtn               , 1, wxGROW );
+                       sizer -> Add( _wxtextctrlTest , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _TestFrame->Show();
+               } else {
+                       if (_TestFrame->IsShown()==true)
+                       {
+                               _TestFrame->Show(false);
+                       } else  {
+                               _TestFrame->Show(true);
+                       }
+               }
+       }
+
+       void wxContourEventHandler::onTestReset( wxCommandEvent& event )
+       {
+               _wxtextctrlTest->SetValue("");
+               _contourPropagation->resetAppend();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onTestAdd( wxCommandEvent& event )
+       {
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
+
+               if (vecX.size()!=0){
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int i,size=vecZ.size();
+                       int actualSlice = tempVector[1];
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               vecZ[i] = actualSlice;
+                       } // for
+
+                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
+                       wxString newstring;
+                       newstring.Printf("%s %d -",_wxtextctrlTest->GetValue(), actualSlice );
+                       _wxtextctrlTest->SetValue(newstring);
+               } // if 
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onTestGo( wxCommandEvent& event )
+       {
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               std::vector<int> size; 
+
+               std::vector<double> vecCtrlPointX;
+               std::vector<double> vecCtrlPointY;
+               std::vector<double> vecCtrlPointZ;
+
+               //Getting the points of the actual contour      
+
+               _contourPropagation->GetKeyContours(&vecX , &vecY , &vecZ, &size);
+               for(int i = 0; i < vecX.size();i++){
+                       vecZ[i] = -900;
+               }
+
+               /*std::vector<double> vecX1; 
+               std::vector<double> vecY1; 
+               std::vector<double> vecZ1;
+               _sceneManager->GetPointsOfActualContour( &vecX1 , &vecY1 , &vecZ1 );
+
+               std::ofstream file1;
+        file1.open( "Temp.txt" );      
+               if(file1.is_open())
+               {
+                       for(int i = 0; i < vecX.size(); i++){
+                               file1<<vecX[i] <<" X1 "<< vecX1[i] <<" Y "<<vecY[i] <<" Y1 "<< vecY1[i]  <<" Z "<<vecZ[i] <<" Z1 "<< vecZ1[i]<<std::endl;
+                               
+                       }
+                       file1.close();
+               }*/     
+                       
+               
+
+               //Setting the points of the contour 
+
+               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+
+               //Getting the control points of the contour by method A
+
+               extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               
+               std::vector<int> actualInstantVector;
+               _instantPanel->getInstant( actualInstantVector );
+               actualInstantVector[1]= this->_theViewPanel->GetZ();
+
+               //Adding the Contour to the scene
+
+               manualContourModel *manModelContour = new manualContourModel();
+               int j,sizeCtrPt = vecCtrlPointX.size();
+               if (sizeCtrPt>=3){
+                       for (j=0 ; j<sizeCtrPt ; j++)
+                       {
+                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
+                       } // for
+                       std::string theName;
+                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+                       bool addedModel = theName.compare("") != 0;
+                       if( addedModel )
+                       {
+                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                               this->_theViewPanel->getSpacing(spc);                                   
+                               //Adding the manualContourControler to interface objects structure
+                               //Adding the manualViewContour to interface objects structure           
+                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                               _sceneManager->configureViewControlTo( theName, manModelContour,spc,1 ) ;
+                       }       // if addedModel
+               } // if sizeCtrPt
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::FillGridWithContoursInformation()
+       {
+               wxString tempString;
+               _grid->ClearGrid();
+               _grid->SetColLabelValue(0, _T("A") );
+               _grid->SetColLabelValue(1, _T("B") );
+               _grid->SetColLabelValue(2, _T("C") );
+               _grid->SetColLabelValue(3, _T("D") );
+               _grid->SetColLabelValue(4, _T("E") );
+               _grid->SetColLabelValue(5, _T("F") );
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               int z,sizeZ = _sceneManager->GetImageDataSizeZ();
+               int ii,sizeLstContourThings;
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+
+                       sizeLstContourThings = lstContourThings.size();
+                       tempString.Printf("%d - %d",z, sizeLstContourThings);
+                       _grid->SetRowLabelValue(z, tempString );
+
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               tempString = (*contourthing)->getName().c_str() ;
+                               _grid->SetCellValue( z, ii, tempString );
+                       }
+               }
+
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       std::vector<manualContourModel*> wxContourEventHandler::ExploseEachModel( std::vector<manualContourModel*> lstManConMod )
+       {
+               std::vector<manualContourModel*> lstTmp;
+               std::vector<manualContourModel*> lstResult;
+               int j,jSize;
+               int i,iSize=lstManConMod.size();
+               for (i=0;i<iSize;i++)
+               {
+                       lstTmp = lstManConMod[i]->ExploseModel();
+                       jSize=lstTmp.size();
+                       for (j=0;j<jSize;j++)
+                       {
+                               lstResult.push_back( lstTmp[j] );
+                       }
+               }
+               return lstResult;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onExtractInformation( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               int maxContourGroup     =       0;
+
+               _grid->ClearGrid();
+
+               ContourExtractData      *contourextractdata = new ContourExtractData();
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+               std::vector<double> pLstValue;
+               std::vector<double> pLstValuePosX;
+               std::vector<double> pLstValuePosY;
+               std::vector<double> pLstValuePosZ;
+
+               int             resultSize; 
+               int             resultGrayRangeCount;
+               double  resultMin; 
+               double  resultMax;
+               double  resultAverage;
+               double  resultStandardeviation;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+               wxString tmpString;
+
+
+               if (_informationRadiobox->GetSelection()==0 ) // actual slice
+               {
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int actualSlice = tempVector[1];
+                       minZ    = actualSlice;
+                       maxZ    = actualSlice;
+               }
+               if (_informationRadiobox->GetSelection()==1 ) // slice range
+               {
+                       minZ    = _mbarrangeSliceInformation->GetStart();
+                       maxZ    = _mbarrangeSliceInformation->GetEnd();
+               }
+               if (_informationRadiobox->GetSelection()==2 ) // All slices
+               {
+                       minZ    = 0;
+                       maxZ    = sizeZ-1;
+               }
+
+               totalZ  = maxZ-minZ+1;
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=minZ ; z<=maxZ ; z++ )
+               {
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+                       wxString tempString;
+                       tempString.Printf("%d - %d",z, sizeLstContourThings);
+                       _grid->SetRowLabelValue(z, tempString );
+//EED004
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                               if ( maxContourGroup<sizeContourGroup ) 
+                               {
+                                       maxContourGroup=sizeContourGroup;
+                               }
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                               maxContourGroup=1;
+                       }
+
+                       int tmpIntA;
+
+
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+                               pLstValue.clear();
+                               pLstValuePosX.clear();
+                               pLstValuePosY.clear();
+                               pLstValuePosZ.clear();
+                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                                                                                                                       &pLstValuePosX,
+                                                                                                                       &pLstValuePosY,
+                                                                                                                       &pLstValuePosZ);
+                               // Statistics of each slice.
+                               contourextractdata->Statistics( &pLstValue,
+                                                                                               _mbarrangeRangeInformation->GetStart(),
+                                                                                               _mbarrangeRangeInformation->GetEnd(),
+                                                                                               &resultGrayRangeCount, 
+                                                                                               &resultSize, 
+                                                                                               &resultMin, 
+                                                                                               &resultMax,
+                                                                                               &resultAverage,
+                                                                                               &resultStandardeviation);
+                               if (_grid->GetNumberCols()<_numberOfVariablesStatistics*(iContourGroup+1)  )
+                               {
+                                       _grid->AppendCols(_numberOfVariablesStatistics);
+                               }
+
+                               tmpIntA=_numberOfVariablesStatistics*iContourGroup ;
+
+                               tempString.Printf("%d",resultSize);
+                               _grid->SetCellValue( z, tmpIntA + 0, tempString );
+                               tempString.Printf("%d",resultGrayRangeCount);
+                               _grid->SetCellValue( z, tmpIntA + 1, tempString );
+                               tempString.Printf("%f",resultMin);
+                               _grid->SetCellValue( z, tmpIntA + 2, tempString );
+                               tempString.Printf("%f",resultMax);
+                               _grid->SetCellValue( z, tmpIntA + 3, tempString );
+                               tempString.Printf("%f",resultAverage);
+                               _grid->SetCellValue( z, tmpIntA + 4, tempString );
+                               tempString.Printf("%f",resultStandardeviation);
+                               _grid->SetCellValue( z, tmpIntA + 5, tempString );
+
+                       } // for iContourGroup
+               } // for z
+
+               int iTitleGroup;
+               wxString tmpTitleString;
+               int tmpIntB;
+               for ( iTitleGroup=0 ; iTitleGroup<maxContourGroup ; iTitleGroup++ )
+               {
+                       tmpIntB =_numberOfVariablesStatistics*iTitleGroup;
+                       tmpTitleString.Printf(_T("%d-Size Data"),iTitleGroup);
+                       _grid->SetColLabelValue( tmpIntB + 0, tmpTitleString );
+                       _grid->SetColLabelValue( tmpIntB + 1, _T("Size Range") );
+                       _grid->SetColLabelValue( tmpIntB + 2, _T("Min") );
+                       _grid->SetColLabelValue( tmpIntB + 3, _T("Max") );
+                       _grid->SetColLabelValue( tmpIntB + 4, _T("Average") );
+                       _grid->SetColLabelValue( tmpIntB + 5, _T("St.Dev.") );
+                       _grid->SetColLabelValue( tmpIntB + 6, _T(" ") );
+               }
+
+               _staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::SaveValuesXYZ(std::string directory,std::string namefile)
+       {
+               wxBusyCursor wait;
+               ContourExtractData      *contourextractdata = new ContourExtractData();
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+               std::vector<double> pLstValue;
+               std::vector<double> pLstValuePosX;
+               std::vector<double> pLstValuePosY;
+               std::vector<double> pLstValuePosZ;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+               wxString tmpString;
+               minZ    = 0;// _mbarrange->GetStart();
+               maxZ    = sizeZ;//_mbarrange->GetEnd();
+               totalZ  = maxZ-minZ+1;
+
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+//EED004
+
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                       }
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+                               pLstValue.clear();
+                               pLstValuePosX.clear();
+                               pLstValuePosY.clear();
+                               pLstValuePosZ.clear();
+                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                                                                                                                       &pLstValuePosX,
+                                                                                                                       &pLstValuePosY,
+                                                                                                                       &pLstValuePosZ);
+
+                               wxString filename;
+                               filename.Printf("%s\\%s-slice%d-cont%d.txt",directory.c_str(),namefile.c_str(),z,iContourGroup);
+                               FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
+                               fprintf(pFile,"value \t x \t y \t z\n"  );
+                               int iLstValue,sizeLstValue=pLstValue.size();
+                               for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
+                               {
+                                       fprintf(pFile,"%f\t %f\t %f\t %f\n", (float)pLstValue[iLstValue] , (float)pLstValuePosX[iLstValue], (float)pLstValuePosY[iLstValue], (float)z );
+                               }
+                               fclose(pFile);
+                       } // for  iContourGroup
+               } // for z
+               _staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::SaveImageResult(std::string directory,std::string namefile)
+       {
+               wxBusyCursor wait;
+               ContourExtractData      *contourextractdata = new ContourExtractData( true );
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               if (typeContourGroup==3)
+               {
+                       typeContourGroup=1;
+               }
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+
+               wxString tmpString;
+
+               minZ    = 0;// _mbarrange->GetStart();
+               maxZ    = sizeZ;//_mbarrange->GetEnd();
+               totalZ  = maxZ-minZ+1;
+
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                       }
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+
+//                             for (ii=0 ; ii<sizeLstContourThings ; ii++)
+//                             {
+//                                     ContourThing **contourthing = lstContourThings[ii];
+//                                     lstManConMod.push_back( (*contourthing)->getModel() );
+//                             }
+//                             contourextractdata->SetLstManualContourModel( lstManConMod );
+
+                               contourextractdata->CalculateImageResult(); // with actual Z
+
+                       } // for  iContourGroup
+               } // for z
+
+
+               wxString filename;
+               filename.Printf("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z);
+
+// Image Value
+               vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
+               writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
+               writerValueImage->SetFileName( (const char *)filename.mb_str() );
+               writerValueImage->SetFileDimensionality( 3 );
+               writerValueImage->Write( );
+
+// Image Mask
+               filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z);
+               vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
+               writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
+               writerMaskImage->SetFileName( (const char *)filename.mb_str() );
+               writerMaskImage->SetFileDimensionality( 3 );
+               writerMaskImage->Write( );
+
+               _staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onInformationContourLabels( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               FillGridWithContoursInformation();
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSaveResults( wxCommandEvent& event )
+       {
+               wxFileDialog dialog(_InformationContourFrame, _T("Choose a file"), _T(""), _T(""), _T("*.txt"), wxSAVE );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       onExtractInformation( event );
+                       std::string directory=(const char *)(dialog.GetDirectory().mb_str());
+                       std::string namefile=(const char *)(dialog.GetFilename().mb_str());
+
+                       SaveValuesXYZ( directory , namefile );
+                       SaveImageResult( directory , namefile );
+
+                       std::string filename = (const char *)(dialog.GetPath().mb_str() );
+                       FILE *pFile=fopen(filename.c_str(),"w+");
+
+                       int sizeZ = _sceneManager->GetImageDataSizeZ();
+
+                       wxString tmpString;
+                       int i,j,maxX,maxY=sizeZ;
+                       maxX=this->_grid->GetNumberCols();
+
+                       int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
+                       for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
+                       {
+                               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.char_str() );
+                       }
+                       fprintf(pFile,"\n" );
+
+
+
+                       for ( j=0; j<maxY ; j++)
+                       {
+                               fprintf(pFile,"%d\t" , j );
+                               for (i=0 ; i<maxX ; i++){
+                                       tmpString = _grid->GetCellValue( j , i );
+                                       fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
+                               } // for i
+                               fprintf(pFile,"\n"  );
+                       } // for j
+
+                       fclose(pFile);
+               } // if  ShowModal
+
+
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onInformationContourFrame()
+       {
+               if (_InformationContourFrame==NULL)
+               {
+                       _InformationContourFrame                                                = new wxFrame (_theViewPanel, -1,_T("  Information  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
+                       _InformationContourFrame->SetSize( wxSize(500,450) );
+                       wxSize sizepanel(200,300);
+                       wxPanel *panel                                                                  = new wxPanel(_InformationContourFrame,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
+
+                       wxString lstOptions[4];
+                       lstOptions[0]=_T("Actual Slice");
+                       lstOptions[1]=_T("Range Slices");
+                       lstOptions[2]=_T("All Slices");
+                       _informationRadiobox                                                    = new wxRadioBox(panel, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+
+                       wxString lstOptContOperation[5];
+                       lstOptContOperation[0]=_T("AND");
+                       lstOptContOperation[1]=_T("OR");
+                       lstOptContOperation[2]=_T("XOR");
+                       lstOptContOperation[3]=_T("ALL");
+                       _radiolstboxContourGroup                                                = new wxRadioBox(panel, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
+
+                       wxButton *informationContourLabelsBtn                   = new wxButton(panel,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
+                       informationContourLabelsBtn->SetEventHandler( this );
+                       Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onInformationContourLabels ); 
+
+                       wxButton *statisticsContourBtn                                  = new wxButton(panel,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
+                       statisticsContourBtn->SetEventHandler( this );
+                       Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onExtractInformation ); 
+
+                       wxButton *saveResultsBtn                                                = new wxButton(panel,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
+                       saveResultsBtn->SetEventHandler( this );
+                       Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSaveResults ); 
+
+
+                       int sizeZ = this->_sceneManager->GetImageDataSizeZ();                   
+                       _mbarrangeSliceInformation                                      =  new mBarRange(panel,65,65);
+                       _mbarrangeSliceInformation->SetMin(0);
+                       _mbarrangeSliceInformation->SetStart(0);
+                       _mbarrangeSliceInformation-> SetOrientation( true );
+                       _mbarrangeSliceInformation-> setActiveStateTo(true);
+                       _mbarrangeSliceInformation-> setVisibleLabels( true );
+                       _mbarrangeSliceInformation-> setDeviceEndMargin(10);
+                       _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
+                       _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); 
+                       _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
+                       _mbarrangeSliceInformation-> SetStart( 0 );
+                       _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );  
+
+
+                       double range[2];
+                       this->_sceneManager->GetImageDataRange(range);
+                       _mbarrangeRangeInformation                                      =  new mBarRange(panel,65,65);
+                       _mbarrangeRangeInformation->SetMin(0);
+                       _mbarrangeRangeInformation->SetStart(0);
+                       _mbarrangeRangeInformation-> SetOrientation( true );
+                       _mbarrangeRangeInformation-> setActiveStateTo(true);
+                       _mbarrangeRangeInformation-> setVisibleLabels( true );
+                       _mbarrangeRangeInformation-> setDeviceEndMargin(10);
+                       _mbarrangeRangeInformation-> setRepresentedValues( range[0] , range[1] );
+                       _mbarrangeRangeInformation-> setDeviceBlitStart(10,10); 
+                       _mbarrangeRangeInformation-> setIfWithActualDrawed( false );
+                       _mbarrangeRangeInformation-> SetStart( range[0] );
+                       _mbarrangeRangeInformation-> SetEnd( range[1] );  
+
+
+                       _staticTextInformation                                                  = new wxStaticText(panel,-1,_T("    "));
+
+
+//                     wxButton *XXXXXXXBtn                    = new wxButton(panel,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
+//                     XXXXXXXBtn->SetEventHandler( this );
+//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
+
+
+                       _grid = new wxGrid( panel,
+                       wxID_ANY,
+                       wxPoint( 0, 0 ),
+                       wxSize( 100, 100 ) );
+
+                       int i,gridCol=10,gridRow=sizeZ;
+                       _grid->CreateGrid( 0, 0 );
+                       _grid->AppendRows(gridRow);
+                       _grid->AppendCols(gridCol);
+
+                       for (i=0;i<gridRow;i++)
+                       {
+                               _grid->SetRowLabelValue(i, _T(" ") );
+                       }
+//                     _grid->SetColLabelSize(0);
+
+
+                       FillGridWithContoursInformation();
+
+                       wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
+                       sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
+                       sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
+
+                       wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
+                       sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
+                       sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
+                       sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
+
+                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+                       sizer->AddGrowableCol(0);
+                       sizer->AddGrowableRow(7);
+                       sizer->Add( sizerA                                              , 1, wxALL              , 0 );
+                       sizer->Add( new wxStaticText(panel              ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
+                       sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
+                       sizer->Add( new wxStaticText(panel              ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
+                       sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
+                       sizer->Add( sizerB                                              , 1, wxALL              , 0 );
+                       sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
+                       sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
+
+
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( wxSize(1500,1500) );
+                       //panel->SetBackgroundColour( wxColour(100,100,100) );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+
+                       wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
+                       sizerPanel -> Add( panel                , 1, wxEXPAND ,0);
+                       _InformationContourFrame->SetSizer( sizerPanel );
+                       _InformationContourFrame->SetAutoLayout( true );
+                       _InformationContourFrame->Layout();
+
+                       _InformationContourFrame->Show();
+               } else {
+                       if (_InformationContourFrame->IsShown()==true)
+                       {
+                               _InformationContourFrame->Show(false);
+                       } else  {
+                               FillGridWithContoursInformation();
+                               _InformationContourFrame->Show(true);
+                       }
+               }
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSpreadInDepth( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Union_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Combination_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onCopyOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+        _performingOperation->reset();
+               _performingOperation->setStartCommand( (char)wxContour_ActionCommnadsID::COPY_TOOL );
+               _performingOperation->setStartOperationInstantVector( tempVector );
+               _performingOperation->setKeyNamesOperationElems( keyNamesVector );
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onPasteOutlines( )
+       {
+               char theStartCommand = _performingOperation->getStartCommand();
+               if (  theStartCommand == wxContour_ActionCommnadsID::COPY_TOOL )
+               {
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       _performingOperation->setEndOperationInstantVector ( tempVector );
+                       std::vector<std::string> elems = _performingOperation->getKeyNamesOperationElems();
+                       int i,size = elems.size();                      
+                       for( i=0; i<size; i++ )
+                       {                               
+                               createCopyContourOf( elems[i], tempVector, i>0 );
+                       }
+               }
+               int fin = 0;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onShowOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onHideOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSelectOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               //if( keyNamesVector.empty() )
+               {
+                       _sceneManager->drawSelectionROI( );
+               }
+               /*else
+               {
+                       int ok = keyNamesVector.size();
+                       _sceneManager->selectObjects( keyNamesVector );
+                       std::string name = keyNamesVector[0];                   
+               }*/
+               /*
+               _sceneManager->drawSelectionROI( );
+               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
+               int ok = currentSelection.size();
+               _sceneManager->selectObjects( currentSelection );*/
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onEditOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onREDO()
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onUNDO()
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: deleteContour( std::string theKeyName )
+       {
+               manualContourModel                      * cModel;
+               manualViewBaseContour           * cViewer;
+               manualContourBaseControler      * cControler;
+
+               ContourWrap_ViewControl *conwrapviewControl =  _sceneManager->getContourWrap_ViewControlOf( theKeyName );
+               cControler      = conwrapviewControl->getControler();
+               int ispartofstaticlst= _modelManager->IsPartOfStaticList(theKeyName);
+               if ((cControler!=NULL) && (cControler->IsEditable()==false)  && (ispartofstaticlst==-1) )
+               {
+                       _sceneManager->removeFromScene( theKeyName );
+                       cModel          = _modelManager->getOutlineByKeyName(theKeyName)->getModel();
+                       _modelManager->removeOutline( theKeyName );
+                       cViewer         = conwrapviewControl->getViewer();
+                       _sceneManager->removeWrap( theKeyName );
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxContourEventHandler::deleteContours() \n" );
+//fprintf(ff,"    %s %p\n",keyNamesVector[i].c_str(),  cControler );
+//fclose(ff);
+                       delete cModel;
+                       delete cViewer;
+                       delete cControler;
+               } // if editable
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: deleteContours( std::vector<std::string> & keyNamesVector )
+       {
+               int i,size=keyNamesVector.size();
+               for (i=0;i<size;i++)
+               {
+                       deleteContour( keyNamesVector[i] );
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: deleteAllContours(  )
+       {               
+               wxBusyCursor wait;
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+               int minZ = _mbarrangeDeleteAll->GetStart();
+               int maxZ = _mbarrangeDeleteAll->GetEnd();
+               int z;
+               int ii,sizeLstContourThings;
+               
+               if ( (minZ==0) && (maxZ==_mbarrangeDeleteAll->GetMax() ))
+               {
+                       _sceneManager->removeSceneContours( );
+                       _modelManager->removeAllOutlines();
+                       _sceneManager->removeAllOutlines();
+
+               } else {
+                       for ( z=minZ ; z<=maxZ ; z++)
+                       {
+                               tempVector[1]=z;
+                               Instant instant(&tempVector);
+                               std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+
+                               sizeLstContourThings = lstContourThings.size();
+                               for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                               {
+                                       ContourThing **contourthing = lstContourThings[ii];
+                                       deleteContour( (*contourthing)->getName() );
+                               } //for ii
+                       }// for z
+               } // if 
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::openContours( FILE *pFile, bool staticContour )
+       {
+               char tmp[255];
+               fscanf(pFile,"%s",tmp); // NumberOfContours 
+               fscanf(pFile,"%s",tmp); // ##
+               int numberOfContours = atoi(tmp);  
+
+               std::vector<int> instantVector;
+               int typeContourModel;
+               manualContourModel *manModelContour;
+               int typeView;
+
+               int i;
+               for (i=0;i<numberOfContours;i++)
+               {
+                       instantVector.clear();
+                       fscanf(pFile,"%s",tmp); // Instant
+
+                       fscanf(pFile,"%s",tmp); // 1
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 2
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 3
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 4
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 5
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 6
+                       instantVector.push_back( atoi(tmp) );
+
+
+                       fscanf(pFile,"%s",tmp); // TypeContourModel
+                       fscanf(pFile,"%s",tmp); // ##
+                       typeContourModel = atoi(tmp);
+
+                       manModelContour =  factoryManualContourModel(typeContourModel);
+                       manModelContour->Open(pFile);
+
+                       fscanf(pFile,"%s",tmp); // TypeView
+                       fscanf(pFile,"%s",tmp); // ##
+                       typeView = atoi(tmp);  
+
+
+//                     if (typeView==1) 
+//                     {
+//                     }
+
+
+                       std::string theName;
+                       theName = _modelManager->createOutline( manModelContour, instantVector );
+                       bool addedModel = theName.compare("") != 0;
+                       if( addedModel )
+                       {
+                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                               this->_theViewPanel->getSpacing(spc);                                   
+                               //Adding the manualContourControler to interface objects structure
+                               //Adding the manualViewContour to interface objects structure           
+                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                               _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeView) ;
+                       }       
+
+                       if (staticContour==true)
+                       {
+                               Instant instant(&instantVector);
+                               changeContourOfManager( theName , &instant );
+                       }
+
+               }// for  numberOfContours
+
+
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::openFileWithContours()
+       {
+               char tmp[255];
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+                       FILE *pFile=fopen(fileNameContourROI.c_str(),"r+");
+
+                       fscanf(pFile,"%s",tmp); // --CreaContour--
+
+                       fscanf(pFile,"%s",tmp); // Version
+                       fscanf(pFile,"%s",tmp); // 1.0.1
+                       std::string version(tmp);
+
+                       openContours(pFile,false);
+                       if (version!="1.0.0"){
+                               openContours(pFile,true);
+                       }
+//                       _sceneManager->openFileWithContours(ff);
+
+                       fclose(pFile);
+               }
+               _sceneManager->removeSceneContours();
+               changeInstant();
+               //updateInstantOutlines();
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::saveFileWithContours( std::string filename )
+       {
+               FILE *pFile=fopen(filename.c_str(),"w+");
+               std::vector< std::string > lstNameThings;
+               int i,sizeLstNameThings; 
+
+               fprintf(pFile,"--CreaContour--\n");
+               fprintf(pFile,"Version %s\n", "1.0.1" );
+
+               // Normal Contours
+               lstNameThings           = _modelManager->GetLstNameThings();
+               sizeLstNameThings       = lstNameThings.size(); 
+               fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
+               for (i=0 ; i<sizeLstNameThings ; i++) 
+               {
+                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
+                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
+               }// for i
+
+               //-- Contours Statics 
+               lstNameThings           = _modelManager->GetLstNameThingsStatic();
+               sizeLstNameThings       = lstNameThings.size(); 
+               fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
+               for (i=0 ; i<sizeLstNameThings ; i++) 
+               {
+                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
+                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
+               }// for i
+               fclose(pFile);
+       }
+
+
+       //----------------------------------------------------------
+
+       void wxContourEventHandler::saveFileWithContours()
+       {
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+                       saveFileWithContours( fileNameContourROI );
+               } // if  ShowModal
+       } 
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: saveFileWithContoursAutomatique()
+       {
+               if (fileNameContourROI=="")
+               {
+                       saveFileWithContours();
+               } else {
+                       saveFileWithContours(fileNameContourROI);
+               }
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
+       {
+               std::string cloneName = _modelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
+               manualContourModel * manualModel = _modelManager->getOutlineByKeyName( cloneName )->getModel();
+               _sceneManager->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       manualContourModel * wxContourEventHandler::factoryManualContourModel(int typeContour)
+       {       
+               manualContourModel *manModelContour=NULL;
+
+               // spline
+               if (typeContour==0)
+               {
+                       manModelContour = new manualContourModel();
+               }
+
+               // spline
+               if (typeContour==1)
+               {
+                       manModelContour = new manualContourModel();
+               }
+
+               // rectangle
+               if (typeContour==2)
+               {
+                       manModelContour = new manualContourModelRoi();
+               }
+
+               // circle
+               if (typeContour==3)
+               {
+                       manModelContour = new manualContourModelCircle();
+               }
+
+               // BullEye / star
+               if (typeContour==4)
+               {
+                       manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
+                       manModelContour = manModelContourBullEye;
+                       if (_panelBullEyeOptions!=NULL){
+                               int iCrown,sizeCrowns,iSector,sizeSectors;
+                               double radioA,radioB,ang,angDelta ;
+                               sizeCrowns = _panelBullEyeOptions->GetNumberOfCrowns();
+                               for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
+                               {
+                                       sizeSectors = _panelBullEyeOptions->GetNumberOfSections(iCrown);
+                                       radioB  = _panelBullEyeOptions->GetRadioOfCrown(iCrown);
+                                       if (iCrown==sizeCrowns-1)
+                                       {
+                                               radioA  = 0;
+                                       } else {
+                                               radioA  = _panelBullEyeOptions->GetRadioOfCrown(iCrown+1);
+                                       }
+                                       radioA=radioA/100.0;
+                                       radioB=radioB/100.0;
+                                       for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
+                                       {
+                                               ang             = _panelBullEyeOptions->GetAngOfCrownSection(iCrown,iSector);
+                                               angDelta= _panelBullEyeOptions->GetAngDeltaOfCrownSection(iCrown);                                      
+                                               manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
+                                       } // for iSector
+                               } // for iCrown
+                       } // if _panelBullEyeOptions
+               }// if typeContour==4
+
+               return manModelContour;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: createContour( int typeContour )
+       {
+               //Creating the manualContourModel and including in the model
+               manualContourModel * manModelContour = factoryManualContourModel(typeContour);
+               std::vector<int> instantVector;
+               _instantPanel->getInstant( instantVector );
+               std::string theName;
+               theName= _modelManager->createOutline( manModelContour, instantVector );
+               bool addedModel = theName.compare("") != 0;
+               if( addedModel )
+               {
+                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                       this->_theViewPanel->getSpacing(spc);                                   
+                       //Adding the manualContourControler to interface objects structure
+                       //Adding the manualViewContour to interface objects structure           
+                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                       _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
+               }       
+
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxContourEventHandler::createContour() \n" );
+//fprintf(ff,"    %s\n %p ",theName.c_str() ,  );
+//fclose(ff);
+
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: setModelManager( OutlineModelManager * theModelManager )
+       {
+               _modelManager = theModelManager;
+               _workSpace = _modelManager->getContourWorkspace();
+       }
+       //------------------------------------------------------------------------------------------------------------  
+       void wxContourEventHandler :: setViewPanel(  wxContourViewPanel * theViewPanel )
+       {
+               _theViewPanel = theViewPanel;
+               _theViewPanel->setWxEventHandler( this );
+
+               double spc[3];
+               this->_theViewPanel->getSpacing(spc);
+               _sceneManager           = new wxVtkBaseView_SceneManager ( this->_theViewPanel->getWxVtkBaseView(), this, spc  );
+               
+               Connect( _theViewPanel->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
+        Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateMultipleROI );
+               Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateROI );
+               Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onStopCreateROI );
+               Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangedDeep );
+               Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler :: onActionButtonPressed ); 
+
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel )
+       {
+               _instantPanel = theInstantChooserPanel;
+               _instantPanel->setWxEventHandler( this );
+
+               Connect( _instantPanel->GetId(), wxINSTANT_CHOOSER_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
+
+               std::vector<int> vect;
+               _instantPanel->getInstant( vect );
+               _actualInstant = new Instant( &vect );
+
+               if( _modelManager!=NULL )
+               {               
+                       std::vector<std::string> conceptNameVect;
+                       std::vector<int> conceptSizeVect;
+                       _modelManager-> getConceptsInformation(conceptNameVect, conceptSizeVect);
+                       int i=0;
+                       int max = conceptNameVect.size();                       
+                       for( ; i<max; i++)
+                       {
+                               if( conceptNameVect[i].compare("Axe Depth") == 0 )
+                               {
+                                       _instantPanel->addConcept( conceptNameVect[i], 0, conceptSizeVect[i], 1);
+                               } else {
+                                       _instantPanel->addConcept( conceptNameVect[i], 1, conceptSizeVect[i], 1);
+                               } // if
+                       } // for                
+               } else {
+                       //Should be configured later, or abort program, because Model -NEEDS- to be added before chooserPanel
+               }
+               if( _theViewPanel!=NULL )
+               {
+                       double val = _theViewPanel->getCurrentDeep();
+                       _instantPanel->setConceptValue( "Axe Depth", (int)val );
+                       ConceptDataWrap * data = _instantPanel->getConceptDataOf( "Axe Depth" );
+                       changeInstant();                        
+                       _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(),  data->getMaxShowedValue(), data->getActualValue() );                      
+               } else {
+                       //Should be configured later, or abort program, because ViewPanel -NEEDS- to be added before chooserPanel
+               }// if
+       } 
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
+       {
+               _buttonsBar = theButtonsBar;
+               _buttonsBar->setWxEventHandler( this );
+               Connect( _buttonsBar->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler:: onActionButtonPressed );               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setGrid(  wxContour_Grid * theGridPanel )
+       {
+               _gridPanel = theGridPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
+       {
+               _drawToolsPanel = theDrawToolsPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
+       {       
+               _operationsToolsPanel = theOperationsToolsPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
+       {
+               _autoFormsPanel = theAutoFormsPanel;
+       }
+
+       void wxContourEventHandler :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
+       {
+               _standardToolsPanel= theStandardToolsPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
+       {
+               _editionToolsPanel =  theEditionToolsPanel;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
+       {
+               _listViewPanel = theListViewPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onDeleteContour( wxCommandEvent& event )
+       {
+               int i,size=_sceneManager->getSelectedObjects().size();
+               for(i=0;i<size;i++)
+               {
+                       std::string keyName             = _sceneManager->getSelectedObjects()[i];
+                       int ispartofstaticlist  = this->_modelManager->IsPartOfStaticList( keyName );
+                       if ( ispartofstaticlist>=0 )
+                       {
+                               std::vector<int> tempVector;
+                               _instantPanel->getInstant( tempVector );
+                               Instant instant(&tempVector);
+                               this->_modelManager->ChangeContourOfList(keyName, &instant);
+                       }
+               }
+
+               std::vector<std::string> lstKeyName;
+               std::vector<std::string> lstKeyNameActualSlice;
+               std::vector<std::string> lstKeyNameToBeErase;
+
+               lstKeyNameToBeErase             = _sceneManager->getSelectedObjects();
+               lstKeyNameActualSlice   = _sceneManager->GetlstContoursNameActualSlice();
+               int k,kSize=lstKeyNameToBeErase.size();
+               int j,jSize=lstKeyNameActualSlice.size();
+               bool ok;
+               for (k=0;k<kSize; k++)
+               {
+                       ok=false;
+                       for (j=0;j<jSize; j++)
+                       {
+                               if (lstKeyNameToBeErase[k]==lstKeyNameActualSlice[j])
+                               { 
+                                       ok=true;
+                               }
+                       } // for j
+                       if (ok==true)
+                       {
+                               lstKeyName.push_back( lstKeyNameToBeErase[k] );
+                       } // if ok
+               } // for k
+
+               deleteContours( lstKeyName );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onDeleteContoursActSlice( wxCommandEvent& event )
+       {
+               deleteContours( _sceneManager->GetlstContoursNameActualSlice() );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onDeleteAllContours( wxCommandEvent& event )        
+       {
+               deleteAllContours(  );
+       }
+
+               //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onDeleteFrame( )
+       {
+               if (_deleteFrame==NULL)
+               {
+                       _deleteFrame                                            = new wxFrame (_theViewPanel, -1,_T("  Delete Contour "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       int width=300;
+                       wxSize sizepanel(width,230);
+                       _deleteFrame->SetSize( sizepanel );
+                       wxPanel *panel                                          = new wxPanel(_deleteFrame,-1);
+                       wxButton *deleteContourBtn                      = new wxButton(panel,-1,_T("Delete contour selected"),wxDefaultPosition, wxSize(width-10,35) );
+                       wxButton *deleteContoursActSliceBtn     = new wxButton(panel,-1,_T("Delete contours of actual slice"),wxDefaultPosition, wxSize(width-10,35));
+                       wxButton *deleteAllContoursBtn          = new wxButton(panel,-1,_T("Delete all contours"),wxDefaultPosition, wxSize(width-10,35));
+
+                       int sizeZ = _sceneManager->GetImageDataSizeZ();
+                       _mbarrangeDeleteAll                                     =  new mBarRange(panel,70, 65);
+                       _mbarrangeDeleteAll->SetMin(0);
+                       _mbarrangeDeleteAll->SetStart(0);
+
+                       _mbarrangeDeleteAll-> SetOrientation( true );
+                       _mbarrangeDeleteAll-> setActiveStateTo(true);
+                       _mbarrangeDeleteAll-> setVisibleLabels( true );
+                       _mbarrangeDeleteAll-> setDeviceEndMargin(10);
+                       _mbarrangeDeleteAll-> setRepresentedValues( 0 , sizeZ );
+                       _mbarrangeDeleteAll-> setDeviceBlitStart(10,10); 
+                       _mbarrangeDeleteAll-> setIfWithActualDrawed( false );
+                       _mbarrangeDeleteAll-> SetStart( 0 );
+                       _mbarrangeDeleteAll-> SetEnd( sizeZ );  
+
+
+                       _deleteFrame->SetEventHandler( this );
+                       Connect( deleteContourBtn->GetId()                      ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContour ); 
+                       Connect( deleteContoursActSliceBtn->GetId()     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContoursActSlice ); 
+                       Connect( deleteAllContoursBtn->GetId()          ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteAllContours ); 
+
+                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+                       sizer -> Add( deleteContourBtn                          , 1, wxGROW );
+                       sizer -> Add( deleteContoursActSliceBtn         , 1, wxGROW );
+                       sizer -> Add( deleteAllContoursBtn                      , 1, wxGROW );
+                       sizer -> Add( _mbarrangeDeleteAll                       , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _deleteFrame->Show(true);
+               } else {
+                       if (_deleteFrame->IsShown()==true)
+                       {
+                               _deleteFrame->Show(false);
+                       } else  {
+                               _deleteFrame->Show(true);
+                       }
+               }
+       }
+
+
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourSpline( wxCommandEvent& event )
+{
+       createContour( 1 );
+}
+
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourRectangle( wxCommandEvent& event )
+{
+       createContour( 2 );
+}
+
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourCircle( wxCommandEvent& event )
+{
+       createContour( 3 );
+}
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourBullEye( wxCommandEvent& event )
+{
+       createContour( 4 );
+}
+
+
+
+//------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onCreateContourFrame( )
+       {
+               if (_createContourFrame==NULL)
+               {
+                       _createContourFrame                                             = new wxFrame (_theViewPanel, -1,_T("  New Contour  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
+                       wxSize sizepanel(490,600);
+                       _createContourFrame->SetSize( sizepanel );
+                       wxPanel *panel                                          = new wxPanel(_createContourFrame,-1);
+                       wxButton *newContourSplineBtn           = new wxButton(panel,-1,_T("Interpolation B-spline (close)"),wxDefaultPosition, wxSize(180,35) );
+                       newContourSplineBtn->SetToolTip(_T("CTRL-N"));
+                       wxButton *newContourRectangleBtn        = new wxButton(panel,-1,_T("Rectangle"),wxDefaultPosition, wxSize(180,35));
+                       wxButton *newContourCircleBtn           = new wxButton(panel,-1,_T("Circle"),wxDefaultPosition, wxSize(180,35));
+                       wxButton *newContourStarBtn                     = new wxButton(panel,-1,_T("Bull eye"),wxDefaultPosition, wxSize(180,35));
+
+                       _panelBullEyeOptions = new PanelBullEyeOptions(panel, wxSize(100,200));
+
+                       _createContourFrame->SetEventHandler( this );
+                       Connect( newContourSplineBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourSpline    ); 
+                       Connect( newContourRectangleBtn->GetId()        ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourRectangle ); 
+                       Connect( newContourCircleBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourCircle    ); 
+                       Connect( newContourStarBtn->GetId()                     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourBullEye   ); 
+
+                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+                       sizer -> Add( newContourSplineBtn                       , 1, wxGROW );
+                       sizer -> Add( newContourRectangleBtn            , 1, wxGROW );
+                       sizer -> Add( newContourCircleBtn                       , 1, wxGROW );
+                       sizer -> Add( newContourStarBtn                         , 1, wxGROW );
+                       sizer -> Add( _panelBullEyeOptions                      , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _createContourFrame->Show(true);
+               } else {
+                       if (_createContourFrame->IsShown()==true)
+                       {
+                               _createContourFrame->Show(false);
+                       } else  {
+                               _createContourFrame->Show(true);
+                       }
+               }
+       }
+
+
+//------------------------------------------------------------------------
+void wxContourEventHandler::RefreshInterface()
+{
+       changeInstant();
+       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+       wxvtk2dbaseview->Refresh();
+}
+
+//------------------------------------------------------------------------
+void wxContourEventHandler::onWidthOfContour(wxScrollEvent& event){
+       _sceneManager->removeSceneContours();
+       double width = (double)_withOfContourLine->GetValue() / 2.0;
+       _sceneManager->SetWidthContour( width );
+
+       RefreshInterface();
+}
+
+//------------------------------------------------------------------------
+
+void wxContourEventHandler::onBrigthnessColorWindowLevel(wxScrollEvent& event){
+       int colorwindow                         = _brithtnessColorLevel->GetValue();
+       int windowlevel                         = _brithtnessWindowLevel->GetValue();
+       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+       imageviewer->SetColorWindow(colorwindow);
+       imageviewer->SetColorLevel(windowlevel);        
+//     wxvtk2dbaseview->Refresh();
+       RefreshInterface();
+}
+
+void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
+{
+       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+       if (_interpolationCheckBox->GetValue()==true)
+       {
+               imageviewer->GetImageActor()->InterpolateOn();
+       } else {
+               imageviewer->GetImageActor()->InterpolateOff();
+       }
+       RefreshInterface();
+}
+
+
+//------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onInterfaceConfigurationFrame( )
+       {
+               if (_interfaceConfigurationFrame==NULL)
+               {
+                       _interfaceConfigurationFrame                    = new wxFrame (_theViewPanel, -1,_T(" Interface Configuration "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       wxSize sizepanel(190,400);
+                       _interfaceConfigurationFrame->SetSize( sizepanel );
+                       wxPanel *panel                                                  = new wxPanel(_interfaceConfigurationFrame,-1);
+                       _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+                       double range[2];
+                       this->_sceneManager->GetImageDataRange(range);
+
+                       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+                       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+                       int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
+                       int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();      
+
+                       _brithtnessWindowLevel                                  = new wxSlider(panel, -1, windowlevel , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+                       _brithtnessColorLevel                                   = new wxSlider(panel, -1, colorwindow , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+                       _interpolationCheckBox = new wxCheckBox(panel, -1, _T("Image interpolation") );
+                       _interpolationCheckBox->SetValue(true);
+
+                       _interfaceConfigurationFrame->SetEventHandler( this );
+
+                       Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
+                       Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
+
+                       Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+                       Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+                       Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+                       Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+                       Connect( _interpolationCheckBox->GetId()        ,       wxEVT_COMMAND_CHECKBOX_CLICKED    , (wxObjectEventFunction) &wxContourEventHandler::OnInterpolation             );
+
+                       wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
+                       sizer -> Add( new wxStaticText(panel,-1,_T("Contour width"))  , 1, wxGROW );
+                       sizer -> Add( _withOfContourLine                , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T("Brightness of the image"))  , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T("--Window level--"))  , 1, wxGROW );
+                       sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T("--Color level--"))  , 1, wxGROW );
+                       sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+                       sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _interfaceConfigurationFrame->Show(true);
+               } else {
+                       if (_interfaceConfigurationFrame->IsShown()==true)
+                       {
+                               _interfaceConfigurationFrame->Show(false);
+                       } else  {
+                               _interfaceConfigurationFrame->Show(true);
+                       }
+               }
+       }
+
+
+       
+
+//------------------------------------------------------------------
+       void wxContourEventHandler :: changeContourOfManager(std::string keyName, Instant *instant)
+       {
+               this->_modelManager->ChangeContourOfList(keyName, instant);
+       }
+
+//------------------------------------------------------------------
+       void wxContourEventHandler :: changeContoursOfManager(  std::vector<std::string> & keyNamesVector  )
+       {
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+               Instant instant(&tempVector);
+
+               int i , size=keyNamesVector.size();
+               for ( i=0 ; i<size ; i++ )
+               {
+                       changeContourOfManager(keyNamesVector[i], &instant);
+               } // i
+       }
+
+
+//------------------------------------------------------------------
+       void wxContourEventHandler :: executeActionCommand( const char  toolCommand )
+       {
+               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
+               int elementsSelected = currentSelection.size();
+               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_TOOL) )
+               {
+                       onCreateContourFrame();
+               }
+               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_CONTOUR_KEY) )
+               {
+                       createContour();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_TOOL )
+               {
+                       onDeleteFrame( );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_KEY )
+               {
+                       deleteContours( currentSelection );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_TOOL )
+               {
+                       saveFileWithContours(  );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_KEY )
+               {
+                       saveFileWithContoursAutomatique(  );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::OPEN_TOOL )
+               {
+                       openFileWithContours(  );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::CHANGE_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               changeContoursOfManager( currentSelection );
+                       }
+
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::HIDE_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onHideOutlines( currentSelection );
+                       }                       
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SHOW_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onShowOutlines( currentSelection );
+                       }
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::COPY_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onCopyOutlines( currentSelection );
+                       }
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::PASTE_TOOL )
+               {
+                       onPasteOutlines(  );                    
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SPREAD_TOOL )
+               {
+                               onSpread();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::AUTOMATIQUESEGMENTATION_TOOL )
+               {
+                       onAutomatiqueSegmentation(  );                  
+               }
+
+               else if( toolCommand == wxContour_ActionCommnadsID::SELECT_TOOL )
+               {
+                       onSelectOutlines( currentSelection );
+                       
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::EDIT_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onEditOutlines( currentSelection );
+                       }
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::UNDO_TOOL )
+               {
+                       onUNDO();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::REDO_TOOL )
+               {
+                       onREDO();
+               }               
+               else if( toolCommand == wxContour_ActionCommnadsID::INFORMATIONCONTOUR_TOOL )
+               {
+                       onInformationContourFrame();
+               }               
+               else if( toolCommand == wxContour_ActionCommnadsID::INTERFACECONFIGURATION_TOOL )
+               {
+                       onInterfaceConfigurationFrame();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::TEST_TOOL )
+               {
+                       onInterfaceTestFrame();
+               }               
+
+
+       }
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Getting information methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+   
+       void wxContourEventHandler :: updateInstantOutlines()
+       {
+               std::vector<NameWrapper *> namesWrapping = _modelManager->getActualInstantOutlines();
+               int size = namesWrapping.size();
+               _sceneManager->removeSceneContours();
+               for( int i=0; i<size; i++)
+               {                       
+                       _sceneManager->addToScene(namesWrapping[i]->getKeyName(), true, true, true, false, false );
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: updateInstantImageData()
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: updateInstantAxes()
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------  
+       void wxContourEventHandler :: changeInstant()
+       {
+               std::vector<int> instantVect;
+               _instantPanel->getInstant( instantVect );
+               Instant * theInstant = new Instant ( &instantVect );
+               //if( !theInstant->isEquals( _actualInstant ))
+               {       
+                       //Setting the actual instant
+                       _actualInstant = theInstant;
+                       _modelManager->setInstant( _actualInstant );
+                       
+                       updateInstantOutlines();
+                       updateInstantImageData();
+                       updateInstantAxes();
+
+                       //Searching the elements at the specified instant
+
+                       /*
+                       std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
+                       iter = contours_ViewControl->find("Outline 0");
+                       (iter->second)->getViewer()->RemoveCompleteContourActor();*/
+               }
+       }
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxConceptControl.cxx b/lib/Interface_ManagerContour_NDimensions/wxConceptControl.cxx
new file mode 100644 (file)
index 0000000..0ba4484
--- /dev/null
@@ -0,0 +1,255 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxConceptControl.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+//IMPLEMENT_CLASS(wxConceptControl, wxScrolledWindow)
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+
+DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxConceptControl :: wxConceptControl(wxWindow *parent, bool orientation, int minV, int maxV,  int actualV, std::string &aConceptName, std::string elementsDef )
+       :wxPanel(parent, -1, wxDefaultPosition, parent->GetSize(), wxTAB_TRAVERSAL)
+       {
+
+               minValue = minV;
+               maxValue = maxV;
+               
+               showLabels = true;
+
+               wxFlexGridSizer* sizer = new wxFlexGridSizer (1, 3, 15, 15);
+
+               conceptName = new wxStaticText(this, -1, wxString(aConceptName.c_str(),wxConvUTF8), wxDefaultPosition, wxSize(90,20), wxALIGN_CENTRE );         
+               sizer->Add( conceptName, 0, wxALIGN_CENTRE |wxALIGN_CENTER_HORIZONTAL);
+               
+               if(orientation)
+               {
+                       sizer->AddGrowableCol(1);
+                       conceptSlider = new wxSlider(this, -1, actualV, minV, maxV, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL| wxSL_AUTOTICKS | wxSL_LABELS, wxDefaultValidator, wxString(aConceptName.c_str(),wxConvUTF8));                    
+               }
+               else
+               {                       
+                       sizer->AddGrowableRow(1);
+                       conceptSlider = new wxSlider(this, -1, actualV, minV, maxV, wxDefaultPosition, wxDefaultSize, wxSL_LEFT| wxSL_AUTOTICKS | wxSL_LABELS, wxDefaultValidator, wxString(aConceptName.c_str(),wxConvUTF8) );                 
+               }
+               sizer->Add(conceptSlider, 0, wxGROW |wxALL );           
+               createElements( sizer, elementsDef );
+               SetSizer( sizer );
+
+               Connect( conceptSlider->GetId(), wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(wxConceptControl::onSliderTrack));//(wxObjectEventFunction) &wxConceptControl :: onSliderRelease ); 
+               Connect( conceptSlider->GetId(),  wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(wxConceptControl::onSliderRelease));//(wxObjectEventFunction) &wxConceptControl :: onSliderTrack );     
+
+               this->SetAutoLayout( true );
+               this->Layout(); 
+       }
+
+       wxConceptControl :: ~wxConceptControl()
+       {
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       
+
+       void wxConceptControl ::onUpdateUICheckBox( wxCommandEvent& event )
+       {
+               lastUpdate = (wxCheckBox * ) event.GetEventObject();
+               std::string groupId = std::string(lastUpdate->GetName().ToAscii());
+               event.SetClientData( (void *) atoi(groupId.c_str()) );
+               event.SetId( GetId() );
+               event.SetEventObject( this );
+               GetEventHandler()->ProcessEvent( event );
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxConceptControl :: onSliderTrack( wxScrollEvent& event )
+       {
+               
+       }
+  
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxConceptControl :: onSliderRelease( wxScrollEvent& event )
+       {
+       //      if( !resolutionChange )
+               sendEnvent( wxEVT_CONCEPT_RELEASE );            
+       }
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxConceptControl :: sendEnvent(WXTYPE theEventType)
+       {
+               wxCommandEvent cevent( theEventType, GetId() );
+               cevent.SetEventObject( this );
+               GetEventHandler()->ProcessEvent( cevent );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       std::string wxConceptControl :: getName()
+       {
+               return std::string(conceptName->GetLabel().ToAscii());  //wxString to std::string convertor ?
+       }
+
+       int wxConceptControl :: getMinShowedValue()
+       {
+               return conceptSlider->GetMin();
+       }
+
+       int wxConceptControl :: getMaxShowedValue()
+       {
+               return conceptSlider->GetMax();
+       }
+
+       void wxConceptControl :: setMinValue(int theMin)
+       {
+               minValue = theMin;
+       }
+
+       int  wxConceptControl :: getMinValue()
+       {
+               return minValue;
+       }
+
+       void wxConceptControl :: setMaxValue(int theMax)
+       {
+               maxValue = theMax;
+       }
+
+       int  wxConceptControl :: getMaxValue()
+       {
+               return maxValue;
+       }
+
+       void wxConceptControl :: setActualValue(int theActual)
+       {
+               conceptSlider->SetValue(theActual);
+       }
+
+       int  wxConceptControl :: getActualValue()
+       {
+               return conceptSlider->GetValue();
+       }
+
+       void wxConceptControl :: setShowLables(bool ifShowCondition)
+       {
+               showLabels = ifShowCondition;
+               //TODO -----UPDATE the slider too!!
+       }
+
+       
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxConceptControl :: clearCheckAt( int position )
+       {
+               checkBoxes[position]->SetValue( false );
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool wxConceptControl :: getIfChecked( int position )
+       {
+               return checkBoxes[position]->GetValue();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxConceptControl :: setRange(int minShow, int maxShow)
+       {
+               /*
+               if( minShow < minVal )
+                       minShow = minVal;
+               if( maxShow > maxVal )
+                       maxShow = maxVal;
+               */
+               conceptSlider->SetRange(minShow, maxShow);
+               int actual = getActualValue();
+               if( actual<minShow )
+                       conceptSlider->SetValue( minShow );
+               else if( actual>maxShow )
+                       conceptSlider->SetValue( maxShow );             
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxConceptControl :: reset()
+       {
+               conceptSlider->SetRange(minValue, maxValue);
+               conceptSlider->SetValue(minValue);
+               int i, size = checkBoxes.size();
+               for(i=0; i<size; i++)
+               {
+                       (checkBoxes[i])->SetValue( false );
+               }
+               size = textBoxes.size();
+               for ( i =0; i<size; i++)
+               {
+                       textBoxes[i]->Clear();
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       void wxConceptControl :: createElements(wxSizer *sizer , std::string elementsDef )
+       {
+               const char * elements = elementsDef.c_str();
+               int elementsNum = elementsDef.size();
+               wxFlexGridSizer* checkSizer = new wxFlexGridSizer (1, elementsNum, 5, 5);
+               int i,ckecks = 0;
+               for( i = 0;*elements!= 0; elements++)
+               {                       
+                       char a = *elements;     
+                       if( a == 67 || a == 99 )// Including C:67 or c:99 as a checkBox (ASCII)
+                       {
+                               createCheckBoxAndAddToSizer( checkSizer, "", -1, ckecks);
+                               ckecks++;
+                       }
+                       else if ( a == 84 || a==116 )// Including T:84 or t t:116 as textCtrl (ASCII)
+                       {
+
+                       }
+                       i++;
+               }
+               sizer->Add(checkSizer, 0, wxGROW |wxALL );      
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       wxCheckBox * wxConceptControl :: createCheckBoxAndAddToSizer(wxSizer *sizer, std::string label, wxWindowID id,int groupID)
+       {
+               char buffer[33];
+               itoa( groupID, buffer, 10);
+               wxCheckBox *checkbox = new wxCheckBox( this, -1, wxString(  label.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxString( buffer, wxConvUTF8) );
+               sizer->Add(checkbox, 0, wxLEFT | wxRIGHT, 5);
+               sizer->Add(0, 2, 0, wxGROW); 
+               checkBoxes.push_back( checkbox );
+               Connect( checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) (wxCommandEventFunction) &wxConceptControl::onUpdateUICheckBox );
+
+               return checkbox;                
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       /*wxCheckBox * wxConceptControl :: createCheckBoxAndAddToSizer(wxSizer *sizer, std::string label, wxWindowID id,int groupID)
+       {
+               wxCheckBox *checkbox = new wxCheckBox(this, -1, wxString(  label.c_str(), wxConvUTF8));
+               sizer->Add(checkbox, 0, wxLEFT | wxRIGHT, 5);
+               sizer->Add(0, 2, 0, wxGROW);            
+               return checkbox;                
+       }*/
+       
+   
diff --git a/lib/Interface_ManagerContour_NDimensions/wxConceptControl.h b/lib/Interface_ManagerContour_NDimensions/wxConceptControl.h
new file mode 100644 (file)
index 0000000..deedb5a
--- /dev/null
@@ -0,0 +1,147 @@
+#ifndef __wxConceptControl_h_INCLUDED_H__
+#define __wxConceptControl_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <vector>
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()
+
+/** file wxConceptControl.h */
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+
+class wxConceptControl : public wxPanel {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxConceptControl(wxWindow *parent, bool orientation, int minV, int maxV, int actualV, std::string &aConceptName, std::string elementsDef = "");
+
+       ~wxConceptControl();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       
+       void onUpdateUICheckBox(wxCommandEvent& event);
+
+       void OnCheckOrRadioBox(wxCommandEvent& event);
+
+       void onSliderTrack(wxScrollEvent& event);
+       
+       void onSliderRelease(wxScrollEvent& event);
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       std::string getName();
+
+       int getMinShowedValue();
+
+       int getMaxShowedValue();
+
+       void setMinValue(int theMin);
+
+       int getMinValue();
+
+       void setMaxValue(int theMax);
+
+       int getMaxValue();
+
+       void setActualValue(int theActual);
+
+       int getActualValue();
+
+       void setShowLables(bool ifShowCondition);
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void clearCheckAt( int position );
+
+       bool getIfChecked( int position );
+
+       void setRange(int minShow, int maxShow);
+
+       void reset();
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       void createElements( wxSizer *sizer, std::string elementsDef );
+       
+       wxCheckBox * createCheckBoxAndAddToSizer(wxSizer *sizer, std::string label, wxWindowID id, int groupID);
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+
+       wxSlider * conceptSlider;
+
+       //std::string conceptName;
+
+       wxStaticText            * conceptName;
+
+       std::vector<wxTextCtrl *> textBoxes;
+
+       std::vector<wxCheckBox *> checkBoxes;
+
+       wxCheckBox * lastUpdate;
+
+       int minValue;
+
+       int maxValue;
+
+       bool showLabels;
+
+
+       //DECLARE_CLASS(wxConceptControl)
+
+
+       // any class wishing to process wxWindows events must use this macro
+//     DECLARE_EVENT_TABLE()
+
+};
+#endif // __wxConceptControl__
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.cxx
new file mode 100644 (file)
index 0000000..78d56c3
--- /dev/null
@@ -0,0 +1,3674 @@
+
+
+/*  Diagrama de Secuaencia de cambiar un instante
+wxContourEventHandler :: changeInstant()
+       OutlineModelManager :: ->setInstant( _actualInstant );
+               OutlineModelManager :: updateToActualInstant()
+                 OutlineModelManager :: getOutlinesAtInstant(Instant * anInstant, bool ifAnnotate)
+                   OutlineModelManager :: annotateOutlinesWrap(std::vector<std::string> kNamesVector, std::vector<ContourThing **> theOutlinesVector)
+       wxContourEventHandler :: updateInstantOutlines()
+               OutlineModelManager :: getActualInstantOutlines ()
+               wxVtkBaseView_SceneManager :: addToScene( std::vector< std::string> theKeyNameVector, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+                       wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+                               wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf
+                                       MAP  find
+                          void wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+
+*/
+
+
+/*!
+ \mainpage NDimension with wxWidgets and maracas
+
+ \section intro Introduction
+
+ This is the introduction. 
+
+
+
+  \dot
+
+
+digraph example_0 {
+       graph [ ratio=fill];
+    node [shape=record, fontname=Helvetica, fontsize=10];
+
+       _wxContourGUIExample                    [ label="wxContourGUIExample"                   URL="\ref wxContourGUIExample"];
+       _wxContourEventHandler                  [ label="wxContourEventHandler"                 URL="\ref wxContourEventHandler"];
+
+       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
+       _wxInstantChooserPanel                  [ label="wxInstantChooserPanel"                 URL="\ref wxInstantChooserPanel"];
+       _wxContourViewPanel                             [ label="wxContourViewPanel"                    URL="\ref wxContourViewPanel"];
+       _wxContour_ButtonsBar                   [ label="wxContour_ButtonsBar"                  URL="\ref wxContour_ButtonsBar"];       
+       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
+       _wxVtkBaseView_SceneManager             [ label="wxVtkBaseView_SceneManager"    URL="\ref wxVtkBaseView_SceneManager"];
+       _SomeEnvironment                                [ label="SomeEnvironment"                               URL="\ref SomeEnvironment"];
+               
+
+       _wxContourGUIExample                    ->      _wxContourEventHandler                  [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _wxInstantChooserPanel                  [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _wxContourViewPanel                             [ arrowhead="open", style="dashed" ];
+       _wxContourGUIExample                    ->      _wxContour_ButtonsBar                   [ arrowhead="open", style="dashed" ];
+       _wxContourViewPanel                             ->      wxMaracas_N_ViewersWidget               [ arrowhead="open", style="dashed" ];
+       _wxContourEventHandler                  ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
+       _wxContourEventHandler                  ->      _wxVtkBaseView_SceneManager             [ arrowhead="open", style="dashed" ];
+       _OutlineModelManager                    ->      _SomeEnvironment                                [ arrowhead="open", style="dashed" ];
+       
+}
+
+\enddot
+
+
+
+*/
+
+
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContourEventHandler.h"
+#include <wx/filedlg.h>
+#include <wx/spinctrl.h>
+#include <iostream>
+#include <fstream>
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxContourEventHandler.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "wxContour_ActionCommnadsID.h"
+#include "NameWrapper.h"
+#include "ConceptDataWrap.h"
+#include "OutlineGroup.h"
+
+#include <manualContour.h>
+#include "Contour/ContourExtractData.h"
+#include "ImageSourceThing.h"
+
+#include "vtkImageData.h"
+#include <vtkContourFilter.h>
+#include <vtkCleanPolyData.h>
+#include <vtkPolyDataConnectivityFilter.h>         
+#include <vtkStripper.h>
+#include <vtkImageReslice.h>
+#include <vtkMetaImageWriter.h>
+#include <vtkImageMapToWindowLevelColors.h>
+
+
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+PanelBullEyeOptions::PanelBullEyeOptions (wxWindow * parent, wxSize size) :
+                wxPanel(parent, -1, wxDefaultPosition, size)
+{
+
+       _maxLevels              = 5;
+       _maxSections    = 10;
+       wxSize sizepanel(190,300);
+       wxPanel *panel = this;
+
+
+       wxString lstOptions[2];
+       lstOptions[0]="General options";
+       lstOptions[1]="Detail options";
+       _radioboxBullEyeGenOpt  = new wxRadioBox(panel, -1, "General/Detail options", wxDefaultPosition, wxSize(200,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
+       _radioboxBullEyeGenOpt->SetSelection(0);
+
+       _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) );
+       _spinctrlBullEyeNumOfCrowns->SetRange(1,_maxLevels);
+       _spinctrlBullEyeNumOfCrowns->SetValue(3);
+
+       _spinctrlBullEyeNumOfSec = new wxSpinCtrl( panel , -1,_T("A"),wxDefaultPosition, wxSize(40,20) );
+       _spinctrlBullEyeNumOfSec->SetRange(1,_maxSections);
+       _spinctrlBullEyeNumOfSec->SetValue(5);
+
+
+       _sliderBullEyeAngle = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+       wxFlexGridSizer * sizerGeneralOptions                           = new wxFlexGridSizer(10);
+
+       wxFlexGridSizer * sizerGeneralOptionsA                          = new wxFlexGridSizer(1);
+       wxFlexGridSizer * sizerGeneralOptionsB                          = new wxFlexGridSizer(1);
+       wxFlexGridSizer * sizerGeneralOptionsC                          = new wxFlexGridSizer(1);
+       sizerGeneralOptionsA -> Add( new wxStaticText(panel,-1,_T("Crowns")) , 1, wxGROW );
+       sizerGeneralOptionsA -> Add( _spinctrlBullEyeNumOfCrowns , 1/*, wxGROW*/ );
+       sizerGeneralOptionsB -> Add( new wxStaticText(panel,-1,_T("Sections")) , 1, wxGROW );
+       sizerGeneralOptionsB -> Add( _spinctrlBullEyeNumOfSec , 1/*, wxGROW*/ );
+       sizerGeneralOptionsC -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
+       sizerGeneralOptionsC -> Add( _sliderBullEyeAngle , 1/*, wxGROW*/ );
+
+       sizerGeneralOptions -> Add( sizerGeneralOptionsA  , 1/*, wxGROW*/ );
+       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
+       sizerGeneralOptions -> Add( sizerGeneralOptionsB  , 1/*, wxGROW*/ );
+       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
+       sizerGeneralOptions -> Add( sizerGeneralOptionsC  , 1/*, wxGROW*/ );
+
+
+       wxSpinCtrl      *tmpSpinSection;
+       wxSlider        *tmpSliderRadio;
+       wxSlider        *tmpSliderAng;
+
+       wxFlexGridSizer * sizerDetailOptions                            = new wxFlexGridSizer(6);
+
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("Crown ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  Sections  ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Radio %")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
+
+       wxString tmpwxstring;
+       int i;
+       for (i=0;i<_maxLevels;i++){
+               tmpSpinSection = new wxSpinCtrl( panel  , -1,_T(""),wxDefaultPosition, wxSize(40,20) );
+               tmpSliderRadio = new wxSlider( panel    , -1 ,0,0,100, wxDefaultPosition, wxSize(110,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               tmpSliderAng   = new wxSlider( panel    , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+               tmpSpinSection ->SetRange(1,_maxSections);
+
+               tmpwxstring.Printf(_T("  %d.  "),i+1);
+               sizerDetailOptions -> Add( new wxStaticText(panel,-1,tmpwxstring) , 1, wxGROW );
+               sizerDetailOptions -> Add( tmpSpinSection, 1 );
+               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+               sizerDetailOptions -> Add( tmpSliderRadio, 1, wxGROW );
+               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
+               sizerDetailOptions -> Add( tmpSliderAng, 1, wxGROW );
+
+               tmpSpinSection  -> SetValue(5);
+               tmpSliderRadio  -> SetValue( 100-(double)((i)*100.0/_maxLevels) );
+               tmpSliderAng    -> SetValue(0);
+               
+               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
+               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_CHANGED  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
+
+               _lstBullEyeDetailNumOfSec.push_back( tmpSpinSection );
+               _lstBullEyeDetailRadio.push_back( tmpSliderRadio );
+               _lstBullEyeDetailAngle.push_back( tmpSliderAng );
+
+       } //for
+
+       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( _radioboxBullEyeGenOpt , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye general options --")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add(  sizerGeneralOptions , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye detail options --")) , 1, wxGROW );
+       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
+       sizer -> Add(  sizerDetailOptions  , 1, wxGROW );
+
+       Connect( _radioboxBullEyeGenOpt->GetId(),       wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 
+       Connect( _spinctrlBullEyeNumOfCrowns->GetId(),  wxEVT_COMMAND_TEXT_UPDATED              , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
+       
+       panel->SetSizer( sizer );
+       panel->SetSize( sizepanel );
+       panel->SetAutoLayout( true );
+       panel->Layout();
+
+       RefreshPanel();
+
+}
+
+//------------------------------------------------------------------------------------------------------------
+PanelBullEyeOptions::~PanelBullEyeOptions() 
+{
+}
+
+//------------------------------------------------------------------------------------------------------------
+void PanelBullEyeOptions::onRefreshPanel( wxCommandEvent& event )
+{
+       RefreshPanel();
+}
+
+//------------------------------------------------------------------------------------------------------------
+void PanelBullEyeOptions::RefreshPanel()
+{
+       int i;
+       bool ok;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0){
+               for (i=0; i<_maxLevels; i++)
+               {
+                       _lstBullEyeDetailNumOfSec[i]    -> Enable(false);
+                       _lstBullEyeDetailRadio[i]               -> Enable(false);
+                       _lstBullEyeDetailAngle[i]               -> Enable(false);
+               } // for
+       } else {
+               int spinSelec = _spinctrlBullEyeNumOfCrowns->GetValue(); 
+               for (i=0; i<_maxLevels; i++)
+               {
+                       ok = (i < spinSelec);
+                       _lstBullEyeDetailNumOfSec[i]    -> Enable(ok);
+                       _lstBullEyeDetailRadio[i]               -> Enable(ok);
+                       _lstBullEyeDetailAngle[i]               -> Enable(ok);
+
+                       if (i>0){
+                               if (_lstBullEyeDetailRadio[i]->GetValue() > _lstBullEyeDetailRadio[i-1]->GetValue())
+                               {
+                                       _lstBullEyeDetailRadio[i]->SetValue( _lstBullEyeDetailRadio[i-1]->GetValue() );
+                               } 
+                       }// if i>0
+               } // for
+       } // if
+}
+
+//------------------------------------------------------------------------------------------------------------
+int PanelBullEyeOptions::GetNumberOfCrowns()
+{
+       return this->_spinctrlBullEyeNumOfCrowns->GetValue();
+}
+
+//------------------------------------------------------------------------------------------------------------
+int PanelBullEyeOptions::GetNumberOfSections(int nCrown)
+{
+       int result;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
+       { 
+               result = this->_spinctrlBullEyeNumOfSec->GetValue();
+       } else {
+               result = this->_lstBullEyeDetailNumOfSec[nCrown]->GetValue();
+       }
+       return result;
+}
+
+//------------------------------------------------------------------------------------------------------------
+int PanelBullEyeOptions::GetRadioOfCrown(int nCrown)
+{
+       int result;
+       double sizeCrowns;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
+       { 
+               sizeCrowns = (double)( this->_spinctrlBullEyeNumOfCrowns->GetValue() );
+               result = 100.0 * (nCrown+1)/sizeCrowns ;
+       } else {
+               result = this->_lstBullEyeDetailRadio[nCrown]->GetValue();
+       }
+       return result;
+}
+
+//------------------------------------------------------------------------------------------------------------
+double PanelBullEyeOptions::GetAngOfCrownSection(int nCrown,int section)
+{
+       double angle;
+       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
+       { 
+               angle = this->_sliderBullEyeAngle->GetValue();
+       } else {
+               angle = this->_lstBullEyeDetailAngle[nCrown]->GetValue();
+       }
+       double numOfSec = (double)GetNumberOfSections(nCrown);
+       double deltaSec = GetAngDeltaOfCrownSection(nCrown);
+       return angle + section*deltaSec ;
+}
+
+//------------------------------------------------------------------------------------------------------------
+double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
+{
+       double numOfSec = (double)GetNumberOfSections(nCrown);
+       return 360.0/numOfSec;
+}
+
+
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       wxContourEventHandler ::wxContourEventHandler()
+               :wxEvtHandler()
+       {
+        _creatingContoursActive                        = false;
+               _theViewPanel                                   = NULL;
+               _modelManager                                   = NULL;
+               _instantPanel                                   = NULL;
+               _buttonsBar                                             = NULL;
+               _gridPanel                                              = NULL; 
+               _drawToolsPanel                                 = NULL;
+               _operationsToolsPanel                   = NULL;
+               _autoFormsPanel                                 = NULL; 
+               _standardToolsPanel                             = NULL;
+               _editionToolsPanel                              = NULL;
+               _listViewPanel                                  = NULL;
+               _sceneManager                                   = NULL;
+               _actualInstant                                  = NULL;
+               _performingOperation                    = new PerformingOperation();
+
+               // EED Interface and Spread
+               _spreadFrame                                    = NULL;
+               _segmentationFrame                              = NULL;
+               _contourPropagation                             = NULL;
+               _createContourFrame                             = NULL;
+               _deleteFrame                                    = NULL;
+               _InformationContourFrame                = NULL;
+               _interfaceConfigurationFrame    = NULL;
+               _TestFrame                                              = NULL;
+               _wxtextctrlTest                                 = NULL;
+               _panelBullEyeOptions                    = NULL;
+
+               fileNameContourROI                              = "";
+               _numberOfVariablesStatistics=6+1;
+
+               inundo = 0;
+               inredo = 0;
+               stundoredo = "data/temp";
+               mkdir(stundoredo.c_str());
+               stundoredo += "/cont";
+       }
+       //------------------------------------------------------------------------------------------------------------
+       wxContourEventHandler :: ~ wxContourEventHandler()
+       {
+               delete _actualInstant;
+               /*delete _theViewPanel;         
+               delete _instantPanel;
+               delete _buttonsBar;
+               delete _actualInstant;  
+               */       
+               delete _sceneManager;
+               delete _performingOperation;
+
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       // Configuration methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       bool wxContourEventHandler :: configureEventsHandling()
+       {
+               bool configured = true;
+
+               return configured;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events 
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onProcessMessage( wxCommandEvent& event )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onActionButtonPressed( wxCommandEvent& event )
+       {
+               const char buttonTool = *(char *)event.GetClientData();
+               executeActionCommand( buttonTool );             
+       }
+       //------------------------------------------------------------------------------------------------------------          
+       void wxContourEventHandler :: onChangedDeep ( wxCommandEvent& event )
+       {
+               double val = _theViewPanel->getCurrentDeep();
+               _instantPanel->setConceptValue( "Axe Depth", (int)val );
+               _theViewPanel->setActualVertical( (int)val );
+               changeInstant();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onChangeInstant( wxCommandEvent& event )
+       {               
+               ConceptDataWrap * dataConcept = NULL; 
+               if ( _theViewPanel->GetId() == event.GetId() )
+               {
+                       dataConcept = (ConceptDataWrap *)event.GetClientData();
+                       int value = dataConcept->getActualValue();
+                       _instantPanel->setConceptValue( dataConcept->getName(), value );
+               }
+               else
+               {
+                       dataConcept = _instantPanel->getLastConceptData();
+                       if( dataConcept->getName().compare( _theViewPanel->getVerticalConceptName() ) )
+                       {
+                               _theViewPanel->setActualVertical( dataConcept->getActualValue());
+                               //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
+                       }
+                       else if( dataConcept->getName().compare( _theViewPanel->getHorizontalConceptName() ) || _instantPanel->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
+                       {
+                               _theViewPanel->setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
+                       }
+               }       
+               changeInstant();
+       }
+       //------------------------------------------------------------------------------------------------------------
+               
+       void wxContourEventHandler :: onCreateMultipleROI( wxCommandEvent& event )
+       {
+               _creatingContoursActive = !_creatingContoursActive;
+               if( _creatingContoursActive )
+               {                       
+                       createContour();
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onCreateROI( wxCommandEvent& event )
+       {
+               if( _creatingContoursActive )
+               {                       
+                       createContour();
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onStopCreateROI( wxCommandEvent& event )
+       {
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onDeleterROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSelectROI( wxCommandEvent& event )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+
+       void wxContourEventHandler :: onUnSelectROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onManualHidedROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onManualShowedROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onEditingROI( wxCommandEvent& event )
+       {
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: onMovingROI( wxCommandEvent& event )
+       {
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Model management methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler::onSpreadReset( wxCommandEvent& event )
+       {
+               _wxtextctrlSpread->SetValue("");
+               _contourPropagation->resetAppend();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSpreadAdd( wxCommandEvent& event )
+       {
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
+
+               if (vecX.size()!=0){
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int i,size=vecZ.size();
+                       int actualSlice = tempVector[1];
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               vecZ[i] = actualSlice;
+                       } // for
+
+                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
+                       wxString newstring;
+                       newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
+                       _wxtextctrlSpread->SetValue(newstring);
+               } // if 
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSpreadGo( wxCommandEvent& event )
+       {
+
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+
+               wxBusyCursor wait;
+               int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
+               int typeofcontour = 1;
+               manualContourModel *manModelContour;
+               std::vector<double> vecCtrlPointX;
+               std::vector<double> vecCtrlPointY;
+               std::vector<double> vecCtrlPointZ;
+               double  minZ,maxZ;
+               int z,j,sizeCtrPt;
+//             double idTmp;
+               int idTmp;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+//             tempVector[1];
+
+               _contourPropagation->getMaxMinZ(&minZ,&maxZ);
+//JSTG_16-07-08_----------------------------------------------------------------
+               //_contourPropagation->setInterpolationNumber(maxZ-minZ+1);
+               _contourPropagation->setInterpolationNumber(100);
+               _contourPropagation->CalculeSplinePropagation();
+
+               double          totalZ = maxZ-minZ+1;
+               double          porcent;
+               wxString        tmpString;
+//--------------------------------------------------------------------
+               for ( z=(int)minZ ; z<=(int)maxZ ; z++ )
+               {
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , (int)(z-minZ+1), (int)totalZ,z );
+                       _staticTextSpread->SetLabel(tmpString);
+
+                       if (_contourPropagation->ifSliceKeyContourExist(z)==false)
+                       {
+                               manModelContour = factoryManualContourModel( typeofcontour );
+                               idTmp = _contourPropagation->FindIdWithZ(z);
+                               if (typeMethodFindCtrlPoints==0) // Initial Points
+                               {   
+                                       _contourPropagation->GetInitialControlPoints( idTmp , &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
+                               } 
+                               if (typeMethodFindCtrlPoints==1)  // Automatique Method
+                               {
+                                       _contourPropagation->GetControlPoints( idTmp  ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
+                               }
+                               if (typeMethodFindCtrlPoints==2)  // sampling
+                               {
+                                       _contourPropagation->GetControlPoints( idTmp , 20.0 ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
+                               }
+       //--------------------------------------------------------------------
+                               sizeCtrPt = vecCtrlPointX.size();
+                               for (j=0 ; j<sizeCtrPt ; j++)
+                               {
+       //JSTG_16-07-08_----------------------------------------------------------------
+                                       manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , -900  );
+       //--------------------------------------------------------------------
+                               } // for j
+
+                               tempVector[1]=z;
+                               std::string theName;
+                               theName = _modelManager->createOutline( manModelContour, tempVector );
+                               bool addedModel = theName.compare("") != 0;
+                               if( addedModel )
+                               {
+                                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                                       this->_theViewPanel->getSpacing(spc);                                   
+                                       //Adding the manualContourControler to interface objects structure
+                                       //Adding the manualViewContour to interface objects structure           
+                                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                                       _sceneManager->configureViewControlTo( theName, manModelContour,spc,typeofcontour ) ;
+                               } // if addedModel
+                       }// ifSliceKeyContourExist
+               } // for z
+               _staticTextSpread->SetLabel("   ");
+               //RefreshInterface();
+
+
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSpread( )
+       {
+               if (_spreadFrame==NULL)
+               {
+                       
+                       _spreadFrame                            = new wxFrame (_theViewPanel, -1,_T(" Spread "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       
+                       wxSize sizepanel(250,400);
+                       _spreadFrame->SetSize( sizepanel );
+                       _spreadFrame->SetEventHandler( this );
+                       wxPanel *panel                          = getSpreadPanel(_spreadFrame);
+                       panel->SetSize(sizepanel);
+                       /**new wxPanel(_spreadFrame,-1);
+
+                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
+                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
+
+                       wxString lstOptions[3];
+                       lstOptions[0]="A";
+                       lstOptions[1]="B";
+                       lstOptions[2]="C";
+                       _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+                       _spreadMethodRadiobox->SetSelection(2);
+
+                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxSize(80,35));
+                       _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
+
+                       _wxtextctrlSpread           = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
+
+                       _spreadFrame->SetEventHandler( this );
+                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
+                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadAdd ); 
+                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadGo ); 
+
+                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+                       sizer -> Add( spreadResetBtn            , 1, wxGROW );
+                       sizer -> Add( spreadAddBtn                      , 1, wxGROW );
+                       sizer -> Add( _spreadMethodRadiobox     , 1, wxGROW );
+                       sizer -> Add( spreadGoBtn                       , 1, wxGROW );
+                       sizer -> Add( _staticTextSpread         , 1, wxGROW );
+                       sizer -> Add( _wxtextctrlSpread         , 1, wxGROW );
+
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();**/
+                       _spreadFrame->Show();
+               } else {
+                       if (_spreadFrame->IsShown()==true)
+                       {
+                               _spreadFrame->Show(false);
+                       } else  {
+                               _spreadFrame->Show(true);
+                       }
+               }
+       }
+
+       wxPanel* wxContourEventHandler::getSpreadPanel(wxWindow* parent){
+               //wxPanel *panel                                = new wxPanel(parent,-1);
+
+               _contourPropagation                     = new ContourPropagation();
+
+               wxPanel *panel                                                  = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString(""));
+
+               wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize );
+               wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxDefaultSize);
+
+               wxString lstOptions[3];
+               lstOptions[0]="A";
+               lstOptions[1]="B";
+               lstOptions[2]="C";
+               _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxDefaultSize, 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+               _spreadMethodRadiobox->SetSelection(2);
+
+               wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxDefaultSize);
+               _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
+
+               _wxtextctrlSpread           = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
+
+               
+               Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
+               Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadAdd ); 
+               Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadGo ); 
+
+               wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+               sizer -> Add( spreadResetBtn            , 1, wxGROW );
+               sizer -> Add( spreadAddBtn                      , 1, wxGROW );
+               sizer -> Add( _spreadMethodRadiobox     , 1, wxGROW );
+               sizer -> Add( spreadGoBtn                       , 1, wxGROW );
+               sizer -> Add( _staticTextSpread         , 1, wxGROW );
+               sizer -> Add( _wxtextctrlSpread         , 1, wxGROW );
+
+
+               panel->SetSizer( sizer );
+               //panel->SetSize( wxDefaultSize );
+               panel->SetAutoLayout( true );
+               panel->Layout();
+               return panel;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSegmentationAllSlice( wxCommandEvent& event )
+       {
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+               
+               wxBusyCursor wait;
+               int                                     x                                       = this->_theViewPanel->GetX();
+               int                                     y                                       = this->_theViewPanel->GetY();
+               int z,minZ,maxZ;
+               double porcent; 
+               wxString tmpString;
+               minZ=_mbarrange->GetStart();
+               maxZ=_mbarrange->GetEnd();
+               double totalZ = maxZ-minZ+1;
+               for( z=minZ ; z<=maxZ ; z++ )
+               {
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
+                       _staticTextSegmentation->SetLabel(tmpString);
+                       SegmentationOneSlice( x,y,z );
+               }
+               _staticTextSegmentation->SetLabel("   ");
+               RefreshInterface();
+
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSegmentationOneSlice( wxCommandEvent& event )
+       {
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+               
+               wxBusyCursor wait;
+               int                                     x                                       = this->_theViewPanel->GetX();
+               int                                     y                                       = this->_theViewPanel->GetY();
+               int                                     z                                       = this->_theViewPanel->GetZ();
+               SegmentationOneSlice( x,y,z );
+               RefreshInterface();
+
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::SegmentationOneSlice( int x, int y, int z )
+       {               
+               int typeofcontour = 1;
+               //--Extracting Contour
+               vtkImageData    *imagedata      = _sceneManager->GetImageData();
+//             double                  *range          = imagedata->GetScalarRange();  
+//             double                  thr                     = 1;
+               int                             isovalue        = _isovalue->GetValue();
+               int                             sampling        = _sampling->GetValue();
+
+               vtkImageReslice *imageReslice = vtkImageReslice::New();
+//EED
+//             double spc[3];
+//             imagedata->GetSpacing(spc);
+//             x = x*spc[0];
+//             y = y*spc[1];
+//             z = z*spc[3];
+
+               imageReslice->SetInput( imagedata );
+               imageReslice->SetInformationInput(imagedata);
+               imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
+               imageReslice->SetResliceAxesOrigin(0,0,z);
+               imageReslice->SetOutputDimensionality(2);
+               imageReslice->SetInterpolationModeToLinear();
+
+               imagedata = imageReslice->GetOutput();
+               imagedata->Update();
+               imagedata->UpdateInformation();
+
+               vtkContourFilter* cntVTK = vtkContourFilter::New( );
+               cntVTK->SetInput( imagedata );
+
+               cntVTK->SetNumberOfContours( 1 );
+               //cntVTK->SetValue( 0, vmin );
+//             cntVTK->SetValue( 0, (range[1]*thr/100) );
+               cntVTK->SetValue( 1, isovalue );
+       //      cntVTK->SetValue( 1, vmax );
+               cntVTK->Update( );
+               cntVTK->UpdateInformation();
+                       
+               vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
+               cpd->SetInput( cntVTK->GetOutput( ) );
+               cpd->ConvertLinesToPointsOff( );
+               cpd->Update( );
+               cpd->UpdateInformation();
+
+               vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
+               conn->SetExtractionModeToClosestPointRegion( );
+               //conn->SetMaxRecursionDepth( 3000 );
+                       
+               conn->SetInput( cpd->GetOutput( ) );
+                       
+               conn->SetClosestPoint( x, y, 0 );
+               conn->Update( );
+               conn->UpdateInformation();
+                       
+               vtkCleanPolyData* cpd2 = vtkCleanPolyData::New( );
+               cpd2->SetInput( conn->GetOutput( ) );
+               cpd2->Update();
+               cpd2->UpdateInformation();
+
+               vtkStripper* vtkstripper = vtkStripper::New( );
+               vtkstripper->SetInput( cpd2->GetOutput() );
+               vtkstripper->Update();
+               vtkstripper->UpdateInformation();
+
+
+               vtkPolyData* polyDataResult =  vtkstripper->GetOutput();
+
+               polyDataResult->Update( );
+               polyDataResult->UpdateInformation();
+
+/* EED
+ofstream myfile;
+myfile.open ("c:/temp/example.txt");
+myfile << "\n";
+polyDataResult->Print(myfile);
+myfile << "-------------------------------------\n";
+polyDataResult->GetLines()->Print(myfile);
+myfile.close();
+*/
+
+               cntVTK          -> Delete();
+               cpd2            -> Delete();
+               cpd                     -> Delete();
+               conn            -> Delete();
+
+
+//--Calculating control points
+
+               std::vector<double> vecX;
+               std::vector<double> vecY;
+               std::vector<double> vecZ;
+
+               std::vector<double> vecCtrlPointX;
+               std::vector<double> vecCtrlPointY;
+               std::vector<double> vecCtrlPointZ;
+
+
+               double *p;
+               int ii,size=polyDataResult->GetNumberOfPoints();
+               int id;
+               for (ii=1;ii<=size;ii++)
+               {
+                       id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
+                       p       = polyDataResult->GetPoint(id);
+                       double x=p[0];
+                       double y=p[1];
+                       vecX.push_back( p[0] );
+                       vecY.push_back( p[1] );
+                       vecZ.push_back( -900 );
+//                     vecZ.push_back( p[2] );
+               }
+
+
+               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+
+//PROOFS
+               if (methodRadiobox->GetSelection()==0){
+                       extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+               if (methodRadiobox->GetSelection()==1){
+                       extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+               if (methodRadiobox->GetSelection()==2){
+                       extractcontrolpoints2d->SetSamplingControlPoints( sampling );
+                       extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+
+               //--Adding contour to the system
+
+               std::vector<int> actualInstantVector;
+               _instantPanel->getInstant( actualInstantVector );
+               actualInstantVector[1]=z;
+
+               int j,sizeCtrPt = vecCtrlPointX.size();
+               manualContourModel *manModelContour =  factoryManualContourModel( typeofcontour );
+               manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
+               if (sizeCtrPt>=3){
+                       for (j=0 ; j<sizeCtrPt ; j++)
+                       {
+                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
+                       } // for
+                       std::string theName;
+                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+                       bool addedModel = theName.compare("") != 0;
+                       if( addedModel )
+                       {
+                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                               this->_theViewPanel->getSpacing(spc);                                   
+                               //Adding the manualContourControler to interface objects structure
+                               //Adding the manualViewContour to interface objects structure           
+                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                               _sceneManager->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
+                       }       // if addedModel
+               } // if sizeCtrPt
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onAutomatiqueSegmentation( )
+       {
+               if (_segmentationFrame==NULL)
+               {
+                       //JCP 13-10-09
+                       /*int sizeZ = _sceneManager->GetImageDataSizeZ();
+                       double range[2];
+                       _sceneManager->GetImageDataRange(range);*/
+                       //JCP 13-10-09
+
+                        wxSize sizePanel( 300, 470);
+                       _segmentationFrame                                      =  new wxFrame (_theViewPanel, -1,_T("  Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       _segmentationFrame->SetSize( sizePanel );
+                       wxPanel *panel                                          = getSegmentationPanel(_segmentationFrame);
+                               /*new wxPanel(_segmentationFrame,-1);
+                       wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
+                       wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
+                       _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+                       _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+                       wxString lstOptions[3];
+                       lstOptions[0]="A";
+                       lstOptions[1]="B";
+                       lstOptions[2]="C";
+                       methodRadiobox                                          = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+                       methodRadiobox->SetSelection(2);
+                       _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
+
+
+                       _mbarrange                                      =  new mBarRange(panel,70, 65);
+                       _mbarrange->SetMin(0);
+                       _mbarrange->SetStart(0);
+
+                       _mbarrange-> SetOrientation( true );
+                       _mbarrange-> setActiveStateTo(true);
+                       _mbarrange-> setVisibleLabels( true );
+                       _mbarrange-> setDeviceEndMargin(10);
+                       _mbarrange-> setRepresentedValues( 0 , sizeZ );
+                       _mbarrange-> setDeviceBlitStart(10,10); 
+                       _mbarrange-> setIfWithActualDrawed( false );
+                       _mbarrange-> SetStart( 0 );
+                       _mbarrange-> SetEnd( sizeZ );  
+
+
+//                     _segmentationFrame->SetEventHandler( this );
+                       segmentationOneSliceBtn->SetEventHandler( this );
+                       segmentationAllSliceBtn->SetEventHandler( this );
+                       Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSlice ); 
+                       Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSlice ); 
+
+                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+                       sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
+                       sizer -> Add( _isovalue , 1, wxGROW );
+                       sizer -> Add( methodRadiobox , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
+                       sizer -> Add( _sampling , 1, wxGROW );
+                       sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
+                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+                       sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
+                       sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
+                       sizer -> Add( _mbarrange  , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizePanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();*/
+
+                       this->_theViewPanel->SetVisibleAxis(true);
+                       this->_theViewPanel->Refresh();
+                       _segmentationFrame->Show(true);
+//JCP 13-10-09 View the method getSegmentationPanel(), this two methods where moved to getSegmentationPanel
+                       //this->_theViewPanel->SetVisibleAxis(true);
+                       //this->_theViewPanel->Refresh();
+               } else {
+                       if (_segmentationFrame->IsShown()==true)
+                       {
+                               _segmentationFrame->Show(false);
+                               this->_theViewPanel->SetVisibleAxis(false);
+                               this->_theViewPanel->Refresh();
+                       } else  {
+                               _segmentationFrame->Show(true);
+                               this->_theViewPanel->SetVisibleAxis(true);
+                               this->_theViewPanel->Refresh();
+                       }
+               }
+       }
+
+       void wxContourEventHandler::showAxis(bool show){
+               this->_theViewPanel->SetVisibleAxis(show);
+               this->_theViewPanel->Refresh();
+       }
+       wxPanel* wxContourEventHandler::getSegmentationPanel(wxWindow* parent){
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               double range[2];
+               _sceneManager->GetImageDataRange(range);
+
+               wxPanel *panel                                          = new wxPanel(parent,-1);
+               wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
+               wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
+               _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               wxString lstOptions[3];
+               lstOptions[0]="A";
+               lstOptions[1]="B";
+               lstOptions[2]="C";
+               methodRadiobox                                          = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+               methodRadiobox->SetSelection(2);
+               _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
+
+
+               _mbarrange                                      =  new mBarRange(panel,70, 65);
+               _mbarrange->SetMin(0);
+               _mbarrange->SetStart(0);
+
+               _mbarrange-> SetOrientation( true );
+               _mbarrange-> setActiveStateTo(true);
+               _mbarrange-> setVisibleLabels( true );
+               _mbarrange-> setDeviceEndMargin(10);
+               _mbarrange-> setRepresentedValues( 0 , sizeZ );
+               _mbarrange-> setDeviceBlitStart(10,10); 
+               _mbarrange-> setIfWithActualDrawed( false );
+               _mbarrange-> SetStart( 0 );
+               _mbarrange-> SetEnd( sizeZ );  
+
+
+//                     _segmentationFrame->SetEventHandler( this );
+               segmentationOneSliceBtn->SetEventHandler( this );
+               segmentationAllSliceBtn->SetEventHandler( this );
+               Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSlice ); 
+               Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSlice ); 
+
+               wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+               sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
+               sizer -> Add( _isovalue , 1, wxGROW );
+               sizer -> Add( methodRadiobox , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
+               sizer -> Add( _sampling , 1, wxGROW );
+               sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
+               sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
+               sizer -> Add( _mbarrange  , 1, wxGROW );
+
+               panel->SetSizer( sizer );
+//             panel->SetSize( sizePanel );
+               panel->SetSize( wxDefaultSize );
+               panel->SetAutoLayout( true );
+               panel->Layout();
+               
+               return panel;
+       }
+       void wxContourEventHandler :: onInterfaceTestFrame( )
+       {
+               if (_TestFrame==NULL)
+               {
+                       _contourPropagation                     = new ContourPropagation();
+                       _TestFrame                                      = new wxFrame (_theViewPanel, -1,_T("  Test Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       wxSize sizepanel(200,300);
+                       _TestFrame->SetSize( sizepanel );
+                       wxPanel *panel                          = new wxPanel(_TestFrame,-1);
+                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
+                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
+                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("GoA"),wxDefaultPosition, wxSize(80,35));
+                       _wxtextctrlTest                         = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
+
+                       _TestFrame->SetEventHandler( this );
+                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestReset ); 
+                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestAdd ); 
+                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestGo ); 
+
+                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+                       sizer -> Add( spreadResetBtn    , 1, wxGROW );
+                       sizer -> Add( spreadAddBtn              , 1, wxGROW );
+                       sizer -> Add( spreadGoBtn               , 1, wxGROW );
+                       sizer -> Add( _wxtextctrlTest , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _TestFrame->Show();
+               } else {
+                       if (_TestFrame->IsShown()==true)
+                       {
+                               _TestFrame->Show(false);
+                       } else  {
+                               _TestFrame->Show(true);
+                       }
+               }
+       }
+
+       void wxContourEventHandler::onTestReset( wxCommandEvent& event )
+       {
+               _wxtextctrlTest->SetValue("");
+               _contourPropagation->resetAppend();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onTestAdd( wxCommandEvent& event )
+       {
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
+
+               if (vecX.size()!=0){
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int i,size=vecZ.size();
+                       int actualSlice = tempVector[1];
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               vecZ[i] = actualSlice;
+                       } // for
+
+                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
+                       wxString newstring;
+                       newstring.Printf("%s %d -",_wxtextctrlTest->GetValue(), actualSlice );
+                       _wxtextctrlTest->SetValue(newstring);
+               } // if 
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onTestGo( wxCommandEvent& event )
+       {
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               std::vector<int> size; 
+
+               std::vector<double> vecCtrlPointX;
+               std::vector<double> vecCtrlPointY;
+               std::vector<double> vecCtrlPointZ;
+
+               //Getting the points of the actual contour      
+
+               _contourPropagation->GetKeyContours(&vecX , &vecY , &vecZ, &size);
+               for(int i = 0; i < vecX.size();i++){
+                       vecZ[i] = -900;
+               }
+
+               /*std::vector<double> vecX1; 
+               std::vector<double> vecY1; 
+               std::vector<double> vecZ1;
+               _sceneManager->GetPointsOfActualContour( &vecX1 , &vecY1 , &vecZ1 );
+
+               std::ofstream file1;
+        file1.open( "Temp.txt" );      
+               if(file1.is_open())
+               {
+                       for(int i = 0; i < vecX.size(); i++){
+                               file1<<vecX[i] <<" X1 "<< vecX1[i] <<" Y "<<vecY[i] <<" Y1 "<< vecY1[i]  <<" Z "<<vecZ[i] <<" Z1 "<< vecZ1[i]<<std::endl;
+                               
+                       }
+                       file1.close();
+               }*/     
+                       
+               
+
+               //Setting the points of the contour 
+
+               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+
+               //Getting the control points of the contour by method A
+
+               extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               
+               std::vector<int> actualInstantVector;
+               _instantPanel->getInstant( actualInstantVector );
+               actualInstantVector[1]= this->_theViewPanel->GetZ();
+
+
+
+
+
+               //Adding the Contour to the scene
+
+               manualContourModel *manModelContour = new manualContourModel();
+               int j,sizeCtrPt = vecCtrlPointX.size();
+               if (sizeCtrPt>=3){
+                       for (j=0 ; j<sizeCtrPt ; j++)
+                       {
+                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
+                       } // for
+                       std::string theName;
+                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+                       bool addedModel = theName.compare("") != 0;
+                       if( addedModel )
+                       {
+                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                               this->_theViewPanel->getSpacing(spc);                                   
+                               //Adding the manualContourControler to interface objects structure
+                               //Adding the manualViewContour to interface objects structure           
+                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                               _sceneManager->configureViewControlTo( theName, manModelContour,spc,1 ) ;
+                       }       // if addedModel
+               } // if sizeCtrPt
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::FillGridWithContoursInformation()
+       {
+               wxString tempString;
+               _grid->ClearGrid();
+               _grid->SetColLabelValue(0, _T("A") );
+               _grid->SetColLabelValue(1, _T("B") );
+               _grid->SetColLabelValue(2, _T("C") );
+               _grid->SetColLabelValue(3, _T("D") );
+               _grid->SetColLabelValue(4, _T("E") );
+               _grid->SetColLabelValue(5, _T("F") );
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               int z,sizeZ = _sceneManager->GetImageDataSizeZ();
+               int ii,sizeLstContourThings;
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+
+                       sizeLstContourThings = lstContourThings.size();
+                       tempString.Printf("%d - %d",z, sizeLstContourThings);
+                       _grid->SetRowLabelValue(z, tempString );
+
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               tempString = (*contourthing)->getName().c_str() ;
+                               _grid->SetCellValue( z, ii, tempString );
+                       }
+               }
+
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       std::vector<manualContourModel*> wxContourEventHandler::ExploseEachModel( std::vector<manualContourModel*> lstManConMod )
+       {
+               std::vector<manualContourModel*> lstTmp;
+               std::vector<manualContourModel*> lstResult;
+               int j,jSize;
+               int i,iSize=lstManConMod.size();
+               for (i=0;i<iSize;i++)
+               {
+                       lstTmp = lstManConMod[i]->ExploseModel();
+                       jSize=lstTmp.size();
+                       for (j=0;j<jSize;j++)
+                       {
+                               lstResult.push_back( lstTmp[j] );
+                       }
+               }
+               return lstResult;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onExtractInformation( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               int maxContourGroup     =       0;
+
+               _grid->ClearGrid();
+
+               ContourExtractData      *contourextractdata = new ContourExtractData();
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+               std::vector<double> pLstValue;
+               std::vector<double> pLstValuePosX;
+               std::vector<double> pLstValuePosY;
+               std::vector<double> pLstValuePosZ;
+
+               int             resultSize; 
+               int             resultGrayRangeCount;
+               double  resultMin; 
+               double  resultMax;
+               double  resultAverage;
+               double  resultStandardeviation;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+               wxString tmpString;
+
+
+               if (_informationRadiobox->GetSelection()==0 ) // actual slice
+               {
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int actualSlice = tempVector[1];
+                       minZ    = actualSlice;
+                       maxZ    = actualSlice;
+               }
+               if (_informationRadiobox->GetSelection()==1 ) // slice range
+               {
+                       minZ    = _mbarrangeSliceInformation->GetStart();
+                       maxZ    = _mbarrangeSliceInformation->GetEnd();
+               }
+               if (_informationRadiobox->GetSelection()==2 ) // All slices
+               {
+                       minZ    = 0;
+                       maxZ    = sizeZ-1;
+               }
+
+               totalZ  = maxZ-minZ+1;
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=minZ ; z<=maxZ ; z++ )
+               {
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+                       wxString tempString;
+                       tempString.Printf("%d - %d",z, sizeLstContourThings);
+                       _grid->SetRowLabelValue(z, tempString );
+//EED004
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                               if ( maxContourGroup<sizeContourGroup ) 
+                               {
+                                       maxContourGroup=sizeContourGroup;
+                               }
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                               maxContourGroup=1;
+                       }
+
+                       int tmpIntA;
+
+
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+                               pLstValue.clear();
+                               pLstValuePosX.clear();
+                               pLstValuePosY.clear();
+                               pLstValuePosZ.clear();
+                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                                                                                                                       &pLstValuePosX,
+                                                                                                                       &pLstValuePosY,
+                                                                                                                       &pLstValuePosZ);
+                               // Statistics of each slice.
+                               contourextractdata->Statistics( &pLstValue,
+                                                                                               _mbarrangeRangeInformation->GetStart(),
+                                                                                               _mbarrangeRangeInformation->GetEnd(),
+                                                                                               &resultGrayRangeCount, 
+                                                                                               &resultSize, 
+                                                                                               &resultMin, 
+                                                                                               &resultMax,
+                                                                                               &resultAverage,
+                                                                                               &resultStandardeviation);
+                               if (_grid->GetNumberCols()<_numberOfVariablesStatistics*(iContourGroup+1)  )
+                               {
+                                       _grid->AppendCols(_numberOfVariablesStatistics);
+                               }
+
+                               tmpIntA=_numberOfVariablesStatistics*iContourGroup ;
+
+                               tempString.Printf("%d",resultSize);
+                               _grid->SetCellValue( z, tmpIntA + 0, tempString );
+                               tempString.Printf("%d",resultGrayRangeCount);
+                               _grid->SetCellValue( z, tmpIntA + 1, tempString );
+                               tempString.Printf("%f",resultMin);
+                               _grid->SetCellValue( z, tmpIntA + 2, tempString );
+                               tempString.Printf("%f",resultMax);
+                               _grid->SetCellValue( z, tmpIntA + 3, tempString );
+                               tempString.Printf("%f",resultAverage);
+                               _grid->SetCellValue( z, tmpIntA + 4, tempString );
+                               tempString.Printf("%f",resultStandardeviation);
+                               _grid->SetCellValue( z, tmpIntA + 5, tempString );
+
+                       } // for iContourGroup
+               } // for z
+
+               int iTitleGroup;
+               wxString tmpTitleString;
+               int tmpIntB;
+               for ( iTitleGroup=0 ; iTitleGroup<maxContourGroup ; iTitleGroup++ )
+               {
+                       tmpIntB =_numberOfVariablesStatistics*iTitleGroup;
+                       tmpTitleString.Printf(_T("%d-Size Data"),iTitleGroup);
+                       _grid->SetColLabelValue( tmpIntB + 0, tmpTitleString );
+                       _grid->SetColLabelValue( tmpIntB + 1, _T("Size Range") );
+                       _grid->SetColLabelValue( tmpIntB + 2, _T("Min") );
+                       _grid->SetColLabelValue( tmpIntB + 3, _T("Max") );
+                       _grid->SetColLabelValue( tmpIntB + 4, _T("Average") );
+                       _grid->SetColLabelValue( tmpIntB + 5, _T("St.Dev.") );
+                       _grid->SetColLabelValue( tmpIntB + 6, _T(" ") );
+               }
+
+               _staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::SaveValuesXYZ(std::string directory,std::string namefile)
+       {
+               wxBusyCursor wait;
+               ContourExtractData      *contourextractdata = new ContourExtractData();
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+               std::vector<double> pLstValue;
+               std::vector<double> pLstValuePosX;
+               std::vector<double> pLstValuePosY;
+               std::vector<double> pLstValuePosZ;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+               wxString tmpString;
+               minZ    = 0;// _mbarrange->GetStart();
+               maxZ    = sizeZ;//_mbarrange->GetEnd();
+               totalZ  = maxZ-minZ+1;
+
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+//EED004
+
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                       }
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+                               pLstValue.clear();
+                               pLstValuePosX.clear();
+                               pLstValuePosY.clear();
+                               pLstValuePosZ.clear();
+                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                                                                                                                       &pLstValuePosX,
+                                                                                                                       &pLstValuePosY,
+                                                                                                                       &pLstValuePosZ);
+
+                               wxString filename;
+                               filename.Printf("%s\\%s-slice%d-cont%d.txt",directory.c_str(),namefile.c_str(),z,iContourGroup);
+                               FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
+                               fprintf(pFile,"value \t x \t y \t z\n"  );
+                               int iLstValue,sizeLstValue=pLstValue.size();
+                               for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
+                               {
+                                       fprintf(pFile,"%f\t %f\t %f\t %f\n", (float)pLstValue[iLstValue] , (float)pLstValuePosX[iLstValue], (float)pLstValuePosY[iLstValue], (float)z );
+                               }
+                               fclose(pFile);
+                       } // for  iContourGroup
+               } // for z
+               _staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::SaveImageResult(std::string directory,std::string namefile)
+       {
+               wxBusyCursor wait;
+               ContourExtractData      *contourextractdata = new ContourExtractData( true );
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               if (typeContourGroup==3)
+               {
+                       typeContourGroup=1;
+               }
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+
+               wxString tmpString;
+
+               minZ    = 0;// _mbarrange->GetStart();
+               maxZ    = sizeZ;//_mbarrange->GetEnd();
+               totalZ  = maxZ-minZ+1;
+
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                       }
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+
+//                             for (ii=0 ; ii<sizeLstContourThings ; ii++)
+//                             {
+//                                     ContourThing **contourthing = lstContourThings[ii];
+//                                     lstManConMod.push_back( (*contourthing)->getModel() );
+//                             }
+//                             contourextractdata->SetLstManualContourModel( lstManConMod );
+
+                               contourextractdata->CalculateImageResult(); // with actual Z
+
+                       } // for  iContourGroup
+               } // for z
+
+
+               wxString filename;
+               filename.Printf("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z);
+
+// Image Value
+               vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
+               writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
+               writerValueImage->SetFileName( (const char *)filename.mb_str() );
+               writerValueImage->SetFileDimensionality( 3 );
+               writerValueImage->Write( );
+
+// Image Mask
+               filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z);
+               vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
+               writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
+               writerMaskImage->SetFileName( (const char *)filename.mb_str() );
+               writerMaskImage->SetFileDimensionality( 3 );
+               writerMaskImage->Write( );
+
+               _staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onInformationContourLabels( wxCommandEvent& event )
+       {
+               wxBusyCursor wait;
+               FillGridWithContoursInformation();
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onSaveResults( wxCommandEvent& event )
+       {
+               wxFileDialog dialog(_InformationContourFrame, _T("Choose a file"), _T(""), _T(""), _T("*.txt"), wxSAVE );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       onExtractInformation( event );
+                       std::string directory=(const char *)(dialog.GetDirectory().mb_str());
+                       std::string namefile=(const char *)(dialog.GetFilename().mb_str());
+
+                       SaveValuesXYZ( directory , namefile );
+                       SaveImageResult( directory , namefile );
+
+                       std::string filename = (const char *)(dialog.GetPath().mb_str() );
+                       FILE *pFile=fopen(filename.c_str(),"w+");
+
+                       int sizeZ = _sceneManager->GetImageDataSizeZ();
+
+                       wxString tmpString;
+                       int i,j,maxX,maxY=sizeZ;
+                       maxX=this->_grid->GetNumberCols();
+
+                       int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
+                       for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
+                       {
+                               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.char_str() );
+                       }
+                       fprintf(pFile,"\n" );
+
+
+
+                       for ( j=0; j<maxY ; j++)
+                       {
+                               fprintf(pFile,"%d\t" , j );
+                               for (i=0 ; i<maxX ; i++){
+                                       tmpString = _grid->GetCellValue( j , i );
+                                       fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
+                               } // for i
+                               fprintf(pFile,"\n"  );
+                       } // for j
+
+                       fclose(pFile);
+               } // if  ShowModal
+
+
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onInformationContourFrame()
+       {
+               if (_InformationContourFrame==NULL)
+               {
+                       _InformationContourFrame                                                = new wxFrame (_theViewPanel, -1,_T("  Information  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
+                       _InformationContourFrame->SetSize( wxSize(500,450) );
+                       wxSize sizepanel(200,300);
+                       wxPanel *panel                                                                  = getInformationPanel(_InformationContourFrame);
+//JCP 13-10-09  Grouping the panel in a method
+                       /*new wxPanel(_InformationContourFrame,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
+
+                       wxString lstOptions[4];
+                       lstOptions[0]=_T("Actual Slice");
+                       lstOptions[1]=_T("Range Slices");
+                       lstOptions[2]=_T("All Slices");
+                       _informationRadiobox                                                    = new wxRadioBox(panel, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+
+                       wxString lstOptContOperation[5];
+                       lstOptContOperation[0]=_T("AND");
+                       lstOptContOperation[1]=_T("OR");
+                       lstOptContOperation[2]=_T("XOR");
+                       lstOptContOperation[3]=_T("ALL");
+                       _radiolstboxContourGroup                                                = new wxRadioBox(panel, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
+
+                       wxButton *informationContourLabelsBtn                   = new wxButton(panel,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
+                       informationContourLabelsBtn->SetEventHandler( this );
+                       Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onInformationContourLabels ); 
+
+                       wxButton *statisticsContourBtn                                  = new wxButton(panel,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
+                       statisticsContourBtn->SetEventHandler( this );
+                       Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onExtractInformation ); 
+
+                       wxButton *saveResultsBtn                                                = new wxButton(panel,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
+                       saveResultsBtn->SetEventHandler( this );
+                       Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSaveResults ); 
+
+
+                       int sizeZ = this->_sceneManager->GetImageDataSizeZ();                   
+                       _mbarrangeSliceInformation                                      =  new mBarRange(panel,65,65);
+                       _mbarrangeSliceInformation->SetMin(0);
+                       _mbarrangeSliceInformation->SetStart(0);
+                       _mbarrangeSliceInformation-> SetOrientation( true );
+                       _mbarrangeSliceInformation-> setActiveStateTo(true);
+                       _mbarrangeSliceInformation-> setVisibleLabels( true );
+                       _mbarrangeSliceInformation-> setDeviceEndMargin(10);
+                       _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
+                       _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); 
+                       _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
+                       _mbarrangeSliceInformation-> SetStart( 0 );
+                       _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );  
+
+
+                       double range[2];
+                       this->_sceneManager->GetImageDataRange(range);
+                       _mbarrangeRangeInformation                                      =  new mBarRange(panel,65,65);
+                       _mbarrangeRangeInformation->SetMin(0);
+                       _mbarrangeRangeInformation->SetStart(0);
+                       _mbarrangeRangeInformation-> SetOrientation( true );
+                       _mbarrangeRangeInformation-> setActiveStateTo(true);
+                       _mbarrangeRangeInformation-> setVisibleLabels( true );
+                       _mbarrangeRangeInformation-> setDeviceEndMargin(10);
+                       _mbarrangeRangeInformation-> setRepresentedValues( range[0] , range[1] );
+                       _mbarrangeRangeInformation-> setDeviceBlitStart(10,10); 
+                       _mbarrangeRangeInformation-> setIfWithActualDrawed( false );
+                       _mbarrangeRangeInformation-> SetStart( range[0] );
+                       _mbarrangeRangeInformation-> SetEnd( range[1] );  
+
+
+                       _staticTextInformation                                                  = new wxStaticText(panel,-1,_T("    "));
+
+
+//                     wxButton *XXXXXXXBtn                    = new wxButton(panel,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
+//                     XXXXXXXBtn->SetEventHandler( this );
+//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
+
+
+                       _grid = new wxGrid( panel,
+                       wxID_ANY,
+                       wxPoint( 0, 0 ),
+                       wxSize( 100, 100 ) );
+
+                       int i,gridCol=10,gridRow=sizeZ;
+                       _grid->CreateGrid( 0, 0 );
+                       _grid->AppendRows(gridRow);
+                       _grid->AppendCols(gridCol);
+
+                       for (i=0;i<gridRow;i++)
+                       {
+                               _grid->SetRowLabelValue(i, _T(" ") );
+                       }
+//                     _grid->SetColLabelSize(0);
+
+
+                       FillGridWithContoursInformation();
+
+                       wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
+                       sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
+                       sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
+
+                       wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
+                       sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
+                       sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
+                       sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
+
+                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+                       sizer->AddGrowableCol(0);
+                       sizer->AddGrowableRow(7);
+                       sizer->Add( sizerA                                              , 1, wxALL              , 0 );
+                       sizer->Add( new wxStaticText(panel              ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
+                       sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
+                       sizer->Add( new wxStaticText(panel              ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
+                       sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
+                       sizer->Add( sizerB                                              , 1, wxALL              , 0 );
+                       sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
+                       sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
+
+
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( wxSize(1500,1500) );
+                       //panel->SetBackgroundColour( wxColour(100,100,100) );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();*/
+
+                       wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
+
+//                     sizerPanel->AddGrowableCol(0);
+//                     sizerPanel->AddGrowableRow(0);
+
+//JCP 14-10-09
+                       //sizerPanel -> Add( sizer              , 1, wxEXPAND ,0);
+                       sizerPanel -> Add( panel->GetSizer()            , 1, wxEXPAND ,0);
+//JCP 14-10-09
+
+
+
+                       _InformationContourFrame->SetSizer( sizerPanel );
+                       _InformationContourFrame->SetAutoLayout( true );
+                       _InformationContourFrame->Layout();
+
+                       _InformationContourFrame->Show();
+               } else {
+                       if (_InformationContourFrame->IsShown()==true)
+                       {
+                               _InformationContourFrame->Show(false);
+                       } else  {
+                               FillGridWithContoursInformation();
+                               _InformationContourFrame->Show(true);
+                       }
+               }
+       }
+
+       wxPanel* wxContourEventHandler::getInformationPanel(wxWindow* parent){
+        wxPanel *panel                                                                 = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
+
+               wxString lstOptions[4];
+               lstOptions[0]=_T("Actual Slice");
+               lstOptions[1]=_T("Range Slices");
+               lstOptions[2]=_T("All Slices");
+               _informationRadiobox                                                    = new wxRadioBox(panel, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+
+               wxString lstOptContOperation[5];
+               lstOptContOperation[0]=_T("AND");
+               lstOptContOperation[1]=_T("OR");
+               lstOptContOperation[2]=_T("XOR");
+               lstOptContOperation[3]=_T("ALL");
+               _radiolstboxContourGroup                                                = new wxRadioBox(panel, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
+
+               wxButton *informationContourLabelsBtn                   = new wxButton(panel,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
+               informationContourLabelsBtn->SetEventHandler( this );
+               Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onInformationContourLabels ); 
+
+               wxButton *statisticsContourBtn                                  = new wxButton(panel,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
+               statisticsContourBtn->SetEventHandler( this );
+               Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onExtractInformation ); 
+
+               wxButton *saveResultsBtn                                                = new wxButton(panel,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
+               saveResultsBtn->SetEventHandler( this );
+               Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSaveResults ); 
+
+
+               int sizeZ = this->_sceneManager->GetImageDataSizeZ();                   
+               _mbarrangeSliceInformation                                      =  new mBarRange(panel,65,65);
+               _mbarrangeSliceInformation->SetMin(0);
+               _mbarrangeSliceInformation->SetStart(0);
+               _mbarrangeSliceInformation-> SetOrientation( true );
+               _mbarrangeSliceInformation-> setActiveStateTo(true);
+               _mbarrangeSliceInformation-> setVisibleLabels( true );
+               _mbarrangeSliceInformation-> setDeviceEndMargin(10);
+               _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
+               _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); 
+               _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
+               _mbarrangeSliceInformation-> SetStart( 0 );
+               _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );  
+
+
+               double range[2];
+               this->_sceneManager->GetImageDataRange(range);
+               _mbarrangeRangeInformation                                      =  new mBarRange(panel,65,65);
+               _mbarrangeRangeInformation->SetMin(0);
+               _mbarrangeRangeInformation->SetStart(0);
+               _mbarrangeRangeInformation-> SetOrientation( true );
+               _mbarrangeRangeInformation-> setActiveStateTo(true);
+               _mbarrangeRangeInformation-> setVisibleLabels( true );
+               _mbarrangeRangeInformation-> setDeviceEndMargin(10);
+               _mbarrangeRangeInformation-> setRepresentedValues( range[0] , range[1] );
+               _mbarrangeRangeInformation-> setDeviceBlitStart(10,10); 
+               _mbarrangeRangeInformation-> setIfWithActualDrawed( false );
+               _mbarrangeRangeInformation-> SetStart( range[0] );
+               _mbarrangeRangeInformation-> SetEnd( range[1] );  
+
+
+               _staticTextInformation                                                  = new wxStaticText(panel,-1,_T("    "));
+
+
+//                     wxButton *XXXXXXXBtn                    = new wxButton(panel,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
+//                     XXXXXXXBtn->SetEventHandler( this );
+//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
+
+
+               _grid = new wxGrid( panel,
+                    wxID_ANY,
+                    wxPoint( 0, 0 ),
+                    wxSize( 100, 100 ) );
+
+               int i,gridCol=10,gridRow=sizeZ;
+               _grid->CreateGrid( 0, 0 );
+               _grid->AppendRows(gridRow);
+               _grid->AppendCols(gridCol);
+
+               for (i=0;i<gridRow;i++)
+               {
+                       _grid->SetRowLabelValue(i, _T(" ") );
+               }
+//                     _grid->SetColLabelSize(0);
+
+
+               FillGridWithContoursInformation();
+
+               wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
+               sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
+               sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
+
+               wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
+               sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
+               sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
+               sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
+
+               wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+               sizer->AddGrowableCol(0);
+               sizer->AddGrowableRow(7);
+               sizer->Add( sizerA                                              , 1, wxALL              , 0 );
+               sizer->Add( new wxStaticText(panel              ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
+               sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
+               sizer->Add( new wxStaticText(panel              ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
+               sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
+               sizer->Add( sizerB                                              , 1, wxALL              , 0 );
+               sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
+               sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
+
+
+
+               panel->SetSizer( sizer );
+               panel->SetSize( wxSize(1500,1500) );
+               //panel->SetBackgroundColour( wxColour(100,100,100) );
+               panel->SetAutoLayout( true );
+               panel->Layout();
+               return panel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSpreadInDepth( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Union_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Combination_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onCopyOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+        _performingOperation->reset();
+               _performingOperation->setStartCommand( (char)wxContour_ActionCommnadsID::COPY_TOOL );
+               _performingOperation->setStartOperationInstantVector( tempVector );
+               _performingOperation->setKeyNamesOperationElems( keyNamesVector );
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onPasteOutlines( )
+       {
+               char theStartCommand = _performingOperation->getStartCommand();
+               if (  theStartCommand == wxContour_ActionCommnadsID::COPY_TOOL )
+               {
+                       //JCP 20-10-08 Undo redo implementation
+                       saveState();
+                       //JCP 20-10-08 Undo redo implementation
+
+
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       _performingOperation->setEndOperationInstantVector ( tempVector );
+                       std::vector<std::string> elems = _performingOperation->getKeyNamesOperationElems();
+                       int i,size = elems.size();                      
+                       for( i=0; i<size; i++ )
+                       {                               
+                               createCopyContourOf( elems[i], tempVector, i>0 );
+                       }
+
+                       
+               }
+               int fin = 0;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onShowOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onHideOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onSelectOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               //if( keyNamesVector.empty() )
+               {
+                       _sceneManager->drawSelectionROI( );
+               }
+               /*else
+               {
+                       int ok = keyNamesVector.size();
+                       _sceneManager->selectObjects( keyNamesVector );
+                       std::string name = keyNamesVector[0];                   
+               }*/
+               /*
+               _sceneManager->drawSelectionROI( );
+               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
+               int ok = currentSelection.size();
+               _sceneManager->selectObjects( currentSelection );*/
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onEditOutlines( std::vector<std::string> & keyNamesVector )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: deleteContour( std::string theKeyName )
+       {
+               manualContourModel                      * cModel;
+               manualViewBaseContour           * cViewer;
+               manualContourBaseControler      * cControler;
+
+               ContourWrap_ViewControl *conwrapviewControl =  _sceneManager->getContourWrap_ViewControlOf( theKeyName );
+               cControler      = conwrapviewControl->getControler();
+               int ispartofstaticlst= _modelManager->IsPartOfStaticList(theKeyName);
+               if ((cControler!=NULL) && (cControler->IsEditable()==false)  && (ispartofstaticlst==-1) )
+               {
+                       _sceneManager->removeFromScene( theKeyName );
+                       cModel          = _modelManager->getOutlineByKeyName(theKeyName)->getModel();
+                       _modelManager->removeOutline( theKeyName );
+                       cViewer         = conwrapviewControl->getViewer();
+                       _sceneManager->removeWrap( theKeyName );
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxContourEventHandler::deleteContours() \n" );
+//fprintf(ff,"    %s %p\n",keyNamesVector[i].c_str(),  cControler );
+//fclose(ff);
+                       delete cModel;
+                       delete cViewer;
+                       delete cControler;
+               } // if editable
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: deleteContours( std::vector<std::string> & keyNamesVector )
+       {
+               int i,size=keyNamesVector.size();
+               for (i=0;i<size;i++)
+               {
+                       deleteContour( keyNamesVector[i] );
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: deleteAllContours(  )
+       {               
+               wxBusyCursor wait;
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+//JCP --08-09-2008 When using a diferent interface the _mbarrangeDeleteAll might not be initialize
+//             the values in GetStart and GetEnd will then not be initialize also.
+//             We use instead the values given when initializing the _deletepanel.
+
+               //int minZ = _mbarrangeDeleteAll->GetStart();
+               //int maxZ = _mbarrangeDeleteAll->GetEnd();
+               int minZ, maxZ;
+               
+               minZ = 0;
+               maxZ = _sceneManager->GetImageDataSizeZ();
+               
+//JCP --08-09-2008
+               
+               _sceneManager->removeSceneContours( );
+                       _modelManager->removeAllOutlines();
+                       _sceneManager->removeAllOutlines();
+//JCP --08-09-2008
+               /*
+               if ( (minZ==0) && (maxZ==_mbarrangeDeleteAll->GetMax() ))
+               {
+                       _sceneManager->removeSceneContours( );
+                       _modelManager->removeAllOutlines();
+                       _sceneManager->removeAllOutlines();
+
+               } else {
+                       for ( z=minZ ; z<=maxZ ; z++)
+                       {
+                               tempVector[1]=z;
+                               Instant instant(&tempVector);
+                               std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+
+                               sizeLstContourThings = lstContourThings.size();
+                               for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                               {
+                                       ContourThing **contourthing = lstContourThings[ii];
+                                       deleteContour( (*contourthing)->getName() );
+                               } //for ii
+                       }// for z
+               } // if 
+       JCP --08-09-2008 */
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::openContours( FILE *pFile, bool staticContour )
+       {
+               char tmp[255];
+               fscanf(pFile,"%s",tmp); // NumberOfContours 
+               fscanf(pFile,"%s",tmp); // ##
+               int numberOfContours = atoi(tmp);  
+
+               std::vector<int> instantVector;
+               int typeContourModel;
+               manualContourModel *manModelContour;
+               int typeView;
+
+               int i;
+               for (i=0;i<numberOfContours;i++)
+               {
+                       instantVector.clear();
+                       fscanf(pFile,"%s",tmp); // Instant
+
+                       fscanf(pFile,"%s",tmp); // 1
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 2
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 3
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 4
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 5
+                       instantVector.push_back( atoi(tmp) );
+                       fscanf(pFile,"%s",tmp); // 6
+                       instantVector.push_back( atoi(tmp) );
+
+
+                       fscanf(pFile,"%s",tmp); // TypeContourModel
+                       fscanf(pFile,"%s",tmp); // ##
+                       typeContourModel = atoi(tmp);
+
+                       manModelContour =  factoryManualContourModel(typeContourModel);
+                       manModelContour->Open(pFile);
+
+                       fscanf(pFile,"%s",tmp); // TypeView
+                       fscanf(pFile,"%s",tmp); // ##
+                       typeView = atoi(tmp);  
+
+
+//                     if (typeView==1) 
+//                     {
+//                     }
+
+
+                       std::string theName;
+                       theName = _modelManager->createOutline( manModelContour, instantVector );
+                       bool addedModel = theName.compare("") != 0;
+                       if( addedModel )
+                       {
+                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                               this->_theViewPanel->getSpacing(spc);                                   
+                               //Adding the manualContourControler to interface objects structure
+                               //Adding the manualViewContour to interface objects structure           
+                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                               _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeView) ;
+                       }       
+
+                       if (staticContour==true)
+                       {
+                               Instant instant(&instantVector);
+                               changeContourOfManager( theName , &instant );
+                       }
+
+               }// for  numberOfContours
+
+
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::openFileWithContours()
+       {
+               char tmp[255];
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+                       FILE *pFile=fopen(fileNameContourROI.c_str(),"r+");
+
+                       fscanf(pFile,"%s",tmp); // --CreaContour--
+
+                       fscanf(pFile,"%s",tmp); // Version
+                       fscanf(pFile,"%s",tmp); // 1.0.1
+                       std::string version(tmp);
+
+                       openContours(pFile,false);
+                       if (version!="1.0.0"){
+                               openContours(pFile,true);
+                       }
+//                       _sceneManager->openFileWithContours(ff);
+
+                       fclose(pFile);
+               }
+               _sceneManager->removeSceneContours();
+               changeInstant();
+               //updateInstantOutlines();
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::saveFileWithContours( std::string filename )
+       {
+               FILE *pFile=fopen(filename.c_str(),"w+");
+               std::vector< std::string > lstNameThings;
+               int i,sizeLstNameThings; 
+
+               fprintf(pFile,"--CreaContour--\n");
+               fprintf(pFile,"Version %s\n", "1.0.1" );
+
+               // Normal Contours
+               lstNameThings           = _modelManager->GetLstNameThings();
+               sizeLstNameThings       = lstNameThings.size(); 
+               fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
+               for (i=0 ; i<sizeLstNameThings ; i++) 
+               {
+                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
+                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
+               }// for i
+
+               //-- Contours Statics 
+               lstNameThings           = _modelManager->GetLstNameThingsStatic();
+               sizeLstNameThings       = lstNameThings.size(); 
+               fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
+               for (i=0 ; i<sizeLstNameThings ; i++) 
+               {
+                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
+                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
+               }// for i
+               fclose(pFile);
+       }
+
+
+       //----------------------------------------------------------
+
+       void wxContourEventHandler::saveFileWithContours()
+       {
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+                       saveFileWithContours( fileNameContourROI );
+               } // if  ShowModal
+       } 
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: saveFileWithContoursAutomatique()
+       {
+               if (fileNameContourROI=="")
+               {
+                       saveFileWithContours();
+               } else {
+                       saveFileWithContours(fileNameContourROI);
+               }
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
+       {
+               std::string cloneName = _modelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
+               manualContourModel * manualModel = _modelManager->getOutlineByKeyName( cloneName )->getModel();
+               _sceneManager->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       manualContourModel * wxContourEventHandler::factoryManualContourModel(int typeContour)
+       {       
+               manualContourModel *manModelContour=NULL;
+
+               // spline
+               if (typeContour==0)
+               {
+                       manModelContour = new manualContourModel();
+               }
+
+               // spline
+               if (typeContour==1)
+               {
+                       manModelContour = new manualContourModel();
+               }
+
+               // rectangle
+               if (typeContour==2)
+               {
+                       manModelContour = new manualContourModelRoi();
+               }
+
+               // circle
+               if (typeContour==3)
+               {
+                       manModelContour = new manualContourModelCircle();
+               }
+
+               // BullEye / star
+               if (typeContour==4)
+               {
+                       manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
+                       manModelContour = manModelContourBullEye;
+                       if (_panelBullEyeOptions!=NULL){
+                               int iCrown,sizeCrowns,iSector,sizeSectors;
+                               double radioA,radioB,ang,angDelta ;
+                               sizeCrowns = _panelBullEyeOptions->GetNumberOfCrowns();
+                               for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
+                               {
+                                       sizeSectors = _panelBullEyeOptions->GetNumberOfSections(iCrown);
+                                       radioB  = _panelBullEyeOptions->GetRadioOfCrown(iCrown);
+                                       if (iCrown==sizeCrowns-1)
+                                       {
+                                               radioA  = 0;
+                                       } else {
+                                               radioA  = _panelBullEyeOptions->GetRadioOfCrown(iCrown+1);
+                                       }
+                                       radioA=radioA/100.0;
+                                       radioB=radioB/100.0;
+                                       for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
+                                       {
+                                               ang             = _panelBullEyeOptions->GetAngOfCrownSection(iCrown,iSector);
+                                               angDelta= _panelBullEyeOptions->GetAngDeltaOfCrownSection(iCrown);                                      
+                                               manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
+                                       } // for iSector
+                               } // for iCrown
+                       } // if _panelBullEyeOptions
+               }// if typeContour==4
+
+               return manModelContour;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: createContour( int typeContour )
+       {
+               //Creating the manualContourModel and including in the model
+               manualContourModel * manModelContour = factoryManualContourModel(typeContour);
+               std::vector<int> instantVector;
+               _instantPanel->getInstant( instantVector );
+               std::string theName;
+               theName= _modelManager->createOutline( manModelContour, instantVector );
+               bool addedModel = theName.compare("") != 0;
+               if( addedModel )
+               {
+                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                       this->_theViewPanel->getSpacing(spc);                                   
+                       //Adding the manualContourControler to interface objects structure
+                       //Adding the manualViewContour to interface objects structure           
+                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                       _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
+               }       
+
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxContourEventHandler::createContour() \n" );
+//fprintf(ff,"    %s\n %p ",theName.c_str() ,  );
+//fclose(ff);
+
+
+       }
+       manualContourModel * wxContourEventHandler::factoryManualContourModel(PanelBullEyeOptions* panel){
+
+               manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
+               manualContourModel *manModelContour=NULL;
+               manModelContour = manModelContourBullEye;
+               if (panel!=NULL){
+                       int iCrown,sizeCrowns,iSector,sizeSectors;
+                       double radioA,radioB,ang,angDelta ;
+                       sizeCrowns = panel->GetNumberOfCrowns();
+                       for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
+                       {
+                               sizeSectors = panel->GetNumberOfSections(iCrown);
+                               radioB  = panel->GetRadioOfCrown(iCrown);
+                               if (iCrown==sizeCrowns-1)
+                               {
+                                       radioA  = 0;
+                               } else {
+                                       radioA  = panel->GetRadioOfCrown(iCrown+1);
+                               }
+                               radioA=radioA/100.0;
+                               radioB=radioB/100.0;
+                               for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
+                               {
+                                       ang             = panel->GetAngOfCrownSection(iCrown,iSector);
+                                       angDelta= panel->GetAngDeltaOfCrownSection(iCrown);                                     
+                                       manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
+                               } // for iSector
+                       } // for iCrown
+               } // if _panelBullEyeOptions
+               
+               return manModelContour;
+       }
+
+       void wxContourEventHandler :: createContourBullsEye(PanelBullEyeOptions* panel )
+       {
+               //Creating the manualContourModel and including in the model
+               manualContourModel * manModelContour = factoryManualContourModel(panel );
+               std::vector<int> instantVector;
+               _instantPanel->getInstant( instantVector );
+               std::string theName;
+               theName= _modelManager->createOutline( manModelContour, instantVector );
+               bool addedModel = theName.compare("") != 0;
+               if( addedModel )
+               {
+                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+                       this->_theViewPanel->getSpacing(spc);                                   
+                       //Adding the manualContourControler to interface objects structure
+                       //Adding the manualViewContour to interface objects structure           
+                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+                       _sceneManager->configureViewControlTo( theName, manModelContour,spc , 4) ;
+               }       
+
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxContourEventHandler::createContour() \n" );
+//fprintf(ff,"    %s\n %p ",theName.c_str() ,  );
+//fclose(ff);
+
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: setModelManager( OutlineModelManager * theModelManager )
+       {
+               _modelManager = theModelManager;
+               _workSpace = _modelManager->getContourWorkspace();
+       }
+       //------------------------------------------------------------------------------------------------------------  
+       void wxContourEventHandler :: setViewPanel(  wxContourViewPanel * theViewPanel )
+       {
+               _theViewPanel = theViewPanel;
+               _theViewPanel->setWxEventHandler( this );
+
+               double spc[3];
+               this->_theViewPanel->getSpacing(spc);
+               _sceneManager           = new wxVtkBaseView_SceneManager ( this->_theViewPanel->getWxVtkBaseView(), this, spc  );
+               
+               Connect( _theViewPanel->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
+        Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateMultipleROI );
+               Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateROI );
+               Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onStopCreateROI );
+               Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangedDeep );
+               Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler :: onActionButtonPressed ); 
+
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel )
+       {
+               _instantPanel = theInstantChooserPanel;
+               _instantPanel->setWxEventHandler( this );
+
+               Connect( _instantPanel->GetId(), wxINSTANT_CHOOSER_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
+
+               std::vector<int> vect;
+               _instantPanel->getInstant( vect );
+               _actualInstant = new Instant( &vect );
+
+               if( _modelManager!=NULL )
+               {               
+                       std::vector<std::string> conceptNameVect;
+                       std::vector<int> conceptSizeVect;
+                       _modelManager-> getConceptsInformation(conceptNameVect, conceptSizeVect);
+                       int i=0;
+                       int max = conceptNameVect.size();                       
+                       for( ; i<max; i++)
+                       {
+                               if( conceptNameVect[i].compare("Axe Depth") == 0 )
+                               {
+                                       _instantPanel->addConcept( conceptNameVect[i], 0, conceptSizeVect[i], 1);
+                               } else {
+                                       _instantPanel->addConcept( conceptNameVect[i], 1, conceptSizeVect[i], 1);
+                               } // if
+                       } // for                
+               } else {
+                       //Should be configured later, or abort program, because Model -NEEDS- to be added before chooserPanel
+               }
+               if( _theViewPanel!=NULL )
+               {
+                       double val = _theViewPanel->getCurrentDeep();
+                       _instantPanel->setConceptValue( "Axe Depth", (int)val );
+                       ConceptDataWrap * data = _instantPanel->getConceptDataOf( "Axe Depth" );
+                       changeInstant();                        
+                       _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(),  data->getMaxShowedValue(), data->getActualValue() );                      
+               } else {
+                       //Should be configured later, or abort program, because ViewPanel -NEEDS- to be added before chooserPanel
+               }// if
+       } 
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
+       {
+               _buttonsBar = theButtonsBar;
+               _buttonsBar->setWxEventHandler( this );
+               Connect( _buttonsBar->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler:: onActionButtonPressed );               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setGrid(  wxContour_Grid * theGridPanel )
+       {
+               _gridPanel = theGridPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
+       {
+               _drawToolsPanel = theDrawToolsPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
+       {       
+               _operationsToolsPanel = theOperationsToolsPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
+       {
+               _autoFormsPanel = theAutoFormsPanel;
+       }
+
+       void wxContourEventHandler :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
+       {
+               _standardToolsPanel= theStandardToolsPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
+       {
+               _editionToolsPanel =  theEditionToolsPanel;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
+       {
+               _listViewPanel = theListViewPanel;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onDeleteContour( wxCommandEvent& event )
+       {
+               
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+
+
+               int i,size=_sceneManager->getSelectedObjects().size();
+               for(i=0;i<size;i++)
+               {
+                       std::string keyName             = _sceneManager->getSelectedObjects()[i];
+                       int ispartofstaticlist  = this->_modelManager->IsPartOfStaticList( keyName );
+                       if ( ispartofstaticlist>=0 )
+                       {
+                               std::vector<int> tempVector;
+                               _instantPanel->getInstant( tempVector );
+                               Instant instant(&tempVector);
+                               this->_modelManager->ChangeContourOfList(keyName, &instant);
+                       }
+               }
+
+               std::vector<std::string> lstKeyName;
+               std::vector<std::string> lstKeyNameActualSlice;
+               std::vector<std::string> lstKeyNameToBeErase;
+
+               lstKeyNameToBeErase             = _sceneManager->getSelectedObjects();
+               lstKeyNameActualSlice   = _sceneManager->GetlstContoursNameActualSlice();
+               int k,kSize=lstKeyNameToBeErase.size();
+               int j,jSize=lstKeyNameActualSlice.size();
+               bool ok;
+               for (k=0;k<kSize; k++)
+               {
+                       ok=false;
+                       for (j=0;j<jSize; j++)
+                       {
+                               if (lstKeyNameToBeErase[k]==lstKeyNameActualSlice[j])
+                               { 
+                                       ok=true;
+                               }
+                       } // for j
+                       if (ok==true)
+                       {
+                               lstKeyName.push_back( lstKeyNameToBeErase[k] );
+                       } // if ok
+               } // for k
+
+               deleteContours( lstKeyName );
+
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onDeleteContoursActSlice( wxCommandEvent& event )
+       {
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+               deleteContours( _sceneManager->GetlstContoursNameActualSlice() );
+
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler::onDeleteAllContours( wxCommandEvent& event )        
+       {
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+               deleteAllContours(  );
+
+               
+       }
+
+               //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onDeleteFrame( )
+       {
+               if (_deleteFrame==NULL)
+               {
+                       _deleteFrame                                            = new wxFrame (_theViewPanel, -1,_T("  Delete Contour "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       int width=300;
+                       wxSize sizepanel(width,230);
+                       _deleteFrame->SetSize( sizepanel );
+                       wxPanel *panel                                          = new wxPanel(_deleteFrame,-1);
+                       wxButton *deleteContourBtn                      = new wxButton(panel,-1,_T("Delete contour selected"),wxDefaultPosition, wxSize(width-10,35) );
+                       wxButton *deleteContoursActSliceBtn     = new wxButton(panel,-1,_T("Delete contours of actual slice"),wxDefaultPosition, wxSize(width-10,35));
+                       wxButton *deleteAllContoursBtn          = new wxButton(panel,-1,_T("Delete all contours"),wxDefaultPosition, wxSize(width-10,35));
+
+                       int sizeZ = _sceneManager->GetImageDataSizeZ();
+                       _mbarrangeDeleteAll                                     =  new mBarRange(panel,70, 65);
+                       _mbarrangeDeleteAll->SetMin(0);
+                       _mbarrangeDeleteAll->SetStart(0);
+
+                       _mbarrangeDeleteAll-> SetOrientation( true );
+                       _mbarrangeDeleteAll-> setActiveStateTo(true);
+                       _mbarrangeDeleteAll-> setVisibleLabels( true );
+                       _mbarrangeDeleteAll-> setDeviceEndMargin(10);
+                       _mbarrangeDeleteAll-> setRepresentedValues( 0 , sizeZ );
+                       _mbarrangeDeleteAll-> setDeviceBlitStart(10,10); 
+                       _mbarrangeDeleteAll-> setIfWithActualDrawed( false );
+                       _mbarrangeDeleteAll-> SetStart( 0 );
+                       _mbarrangeDeleteAll-> SetEnd( sizeZ );  
+
+
+                       _deleteFrame->SetEventHandler( this );
+                       Connect( deleteContourBtn->GetId()                      ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContour ); 
+                       Connect( deleteContoursActSliceBtn->GetId()     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContoursActSlice ); 
+                       Connect( deleteAllContoursBtn->GetId()          ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteAllContours ); 
+
+                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+                       sizer -> Add( deleteContourBtn                          , 1, wxGROW );
+                       sizer -> Add( deleteContoursActSliceBtn         , 1, wxGROW );
+                       sizer -> Add( deleteAllContoursBtn                      , 1, wxGROW );
+                       sizer -> Add( _mbarrangeDeleteAll                       , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _deleteFrame->Show(true);
+               } else {
+                       if (_deleteFrame->IsShown()==true)
+                       {
+                               _deleteFrame->Show(false);
+                       } else  {
+                               _deleteFrame->Show(true);
+                       }
+               }
+       }
+
+
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourSpline( wxCommandEvent& event )
+{
+       
+       //JCP 20-10-08 Undo redo implementation
+       saveState();
+       //JCP 20-10-08 Undo redo implementation
+       createContour( 1 );
+
+       
+
+}
+
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourRectangle( wxCommandEvent& event )
+{
+       
+       //JCP 20-10-08 Undo redo implementation
+       saveState();
+       //JCP 20-10-08 Undo redo implementation 
+       createContour( 2 );
+
+       
+}
+
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourCircle( wxCommandEvent& event )
+{
+       //JCP 20-10-08 Undo redo implementation
+       saveState();
+       //JCP 20-10-08 Undo redo implementation 
+       createContour( 3 );
+
+       
+}
+//------------------------------------------------------------------------------------------------------------
+void wxContourEventHandler::onCreateContourBullEye( wxCommandEvent& event )
+{
+       //JCP 20-10-08 Undo redo implementation
+       saveState();
+       //JCP 20-10-08 Undo redo implementation
+       createContour( 4 );
+
+       
+       
+}
+
+
+
+//------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onCreateContourFrame( )
+       {
+               if (_createContourFrame==NULL)
+               {
+                       _createContourFrame                                             = new wxFrame (_theViewPanel, -1,_T("  New Contour  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
+                       wxSize sizepanel(490,600);
+                       _createContourFrame->SetSize( sizepanel );
+                       wxPanel *panel                                          = new wxPanel(_createContourFrame,-1);
+                       wxButton *newContourSplineBtn           = new wxButton(panel,-1,_T("Interpolation B-spline (close)"),wxDefaultPosition, wxSize(180,35) );
+                       newContourSplineBtn->SetToolTip(_T("CTRL-N"));
+                       wxButton *newContourRectangleBtn        = new wxButton(panel,-1,_T("Rectangle"),wxDefaultPosition, wxSize(180,35));
+                       wxButton *newContourCircleBtn           = new wxButton(panel,-1,_T("Circle"),wxDefaultPosition, wxSize(180,35));
+                       wxButton *newContourStarBtn                     = new wxButton(panel,-1,_T("Bull eye"),wxDefaultPosition, wxSize(180,35));
+
+                       _panelBullEyeOptions = new PanelBullEyeOptions(panel, wxSize(100,200));
+
+                       _createContourFrame->SetEventHandler( this );
+                       Connect( newContourSplineBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourSpline    ); 
+                       Connect( newContourRectangleBtn->GetId()        ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourRectangle ); 
+                       Connect( newContourCircleBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourCircle    ); 
+                       Connect( newContourStarBtn->GetId()                     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourBullEye   ); 
+
+                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+                       sizer -> Add( newContourSplineBtn                       , 1, wxGROW );
+                       sizer -> Add( newContourRectangleBtn            , 1, wxGROW );
+                       sizer -> Add( newContourCircleBtn                       , 1, wxGROW );
+                       sizer -> Add( newContourStarBtn                         , 1, wxGROW );
+                       sizer -> Add( _panelBullEyeOptions                      , 1, wxGROW );
+
+                       panel->SetSizer( sizer );
+                       panel->SetSize( sizepanel );
+                       panel->SetAutoLayout( true );
+                       panel->Layout();
+                       _createContourFrame->Show(true);
+               } else {
+                       if (_createContourFrame->IsShown()==true)
+                       {
+                               _createContourFrame->Show(false);
+                       } else  {
+                               _createContourFrame->Show(true);
+                       }
+               }
+       }
+
+
+//------------------------------------------------------------------------
+void wxContourEventHandler::RefreshInterface()
+{
+       changeInstant();
+       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+       wxvtk2dbaseview->Refresh();
+}
+
+//------------------------------------------------------------------------
+void wxContourEventHandler::onWidthOfContour(wxScrollEvent& event){
+       _sceneManager->removeSceneContours();
+       double width = (double)_withOfContourLine->GetValue() / 2.0;
+       _sceneManager->SetWidthContour( width );
+
+       RefreshInterface();
+}
+
+//------------------------------------------------------------------------
+
+void wxContourEventHandler::onBrigthnessColorWindowLevel(wxScrollEvent& event){
+       int colorwindow                         = _brithtnessColorLevel->GetValue();
+       int windowlevel                         = _brithtnessWindowLevel->GetValue();
+       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+       imageviewer->SetColorWindow(colorwindow);
+       imageviewer->SetColorLevel(windowlevel);        
+//     wxvtk2dbaseview->Refresh();
+       RefreshInterface();
+}
+
+void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
+{
+       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+       if (_interpolationCheckBox->GetValue()==true)
+       {
+               imageviewer->GetImageActor()->InterpolateOn();
+       } else {
+               imageviewer->GetImageActor()->InterpolateOff();
+       }
+       RefreshInterface();
+}
+
+
+//------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onInterfaceConfigurationFrame( )
+       {
+               if (_interfaceConfigurationFrame==NULL)
+               {
+                       _interfaceConfigurationFrame                    = new wxFrame (_theViewPanel, -1,_T(" Interface Configuration "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+                       wxSize sizepanel(190,400);
+                       _interfaceConfigurationFrame->SetSize( sizepanel );
+                       _interfaceConfigurationFrame->SetEventHandler( this );
+                       wxPanel* panel = getConfigurationPanel(_interfaceConfigurationFrame);
+                       panel->SetSize(sizepanel);
+                       _interfaceConfigurationFrame->Show(true);
+               } else {
+                       if (_interfaceConfigurationFrame->IsShown()==true)
+                       {
+                               _interfaceConfigurationFrame->Show(false);
+                       } else  {
+                               _interfaceConfigurationFrame->Show(true);
+                       }
+               }
+       }
+
+
+       //**JCP 13-10-08
+
+       wxPanel* wxContourEventHandler :: getConfigurationPanel(wxWindow* parent){
+               
+               /*wxPanel *panel                                                        = new wxPanel(parent,-1);
+               _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+               double range[2];
+               this->_sceneManager->GetImageDataRange(range);
+
+               wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+               vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+               int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
+               int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();      
+
+               _brithtnessWindowLevel                                  = new wxSlider(panel, -1, windowlevel , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               _brithtnessColorLevel                                   = new wxSlider(panel, -1, colorwindow , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+               _interpolationCheckBox = new wxCheckBox(panel, -1, _T("Image interpolation") );
+               _interpolationCheckBox->SetValue(true);
+
+               _interfaceConfigurationFrame->SetEventHandler( this );
+
+               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
+               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
+
+               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _interpolationCheckBox->GetId()        ,       wxEVT_COMMAND_CHECKBOX_CLICKED    , (wxObjectEventFunction) &wxContourEventHandler::OnInterpolation             );
+
+               wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
+               sizer -> Add( new wxStaticText(panel,-1,_T("Contour width"))  , 1, wxGROW );
+               sizer -> Add( _withOfContourLine                , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("Brightness of the image"))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("--Window level--"))  , 1, wxGROW );
+               sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("--Color level--"))  , 1, wxGROW );
+               sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
+
+               panel->SetSizer( sizer );
+               //JCP 13-10-08
+               //panel->SetSize( sizepanel );
+               //13-10-08
+               panel->SetAutoLayout( true );
+               panel->Layout();
+
+               return panel;*/
+
+               wxPanel *panel                                                  = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString(""));
+               _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+               double range[2];
+               this->_sceneManager->GetImageDataRange(range);
+
+               wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
+               vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+               int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
+               int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();      
+
+               _brithtnessWindowLevel                                  = new wxSlider(panel, -1, windowlevel , 1, range[1], wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               _brithtnessColorLevel                                   = new wxSlider(panel, -1, colorwindow , 1, range[1], wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+               _interpolationCheckBox = new wxCheckBox(panel, -1, _T("Image interpolation") );
+               _interpolationCheckBox->SetValue(true);         
+
+               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
+               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
+
+               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
+               Connect( _interpolationCheckBox->GetId()        ,       wxEVT_COMMAND_CHECKBOX_CLICKED    , (wxObjectEventFunction) &wxContourEventHandler::OnInterpolation             );
+
+               wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
+               sizer -> Add( new wxStaticText(panel,-1,_T("Contour width"))  , 1, wxGROW );
+               sizer -> Add( _withOfContourLine                , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("Brightness of the image"))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("--Window level--"))  , 1, wxGROW );
+               sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("--Color level--"))  , 1, wxGROW );
+               sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
+
+               panel->SetSizer( sizer );
+               //JCP 13-10-08
+               //panel->SetSize( sizepanel );
+               //13-10-08
+               panel->SetAutoLayout( true );
+               panel->Layout();
+
+               return panel;
+       }
+
+//**JCP 13-10-08
+
+       
+
+//------------------------------------------------------------------
+       void wxContourEventHandler :: changeContourOfManager(std::string keyName, Instant *instant)
+       {
+               this->_modelManager->ChangeContourOfList(keyName, instant);
+       }
+
+//------------------------------------------------------------------
+       void wxContourEventHandler :: changeContoursOfManager(  std::vector<std::string> & keyNamesVector  )
+       {
+
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+               Instant instant(&tempVector);
+
+               int i , size=keyNamesVector.size();
+               for ( i=0 ; i<size ; i++ )
+               {
+                       changeContourOfManager(keyNamesVector[i], &instant);
+               } // i
+
+               
+       }
+
+
+//------------------------------------------------------------------
+       void wxContourEventHandler :: executeActionCommand( const char  toolCommand )
+       {
+               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
+               int elementsSelected = currentSelection.size();
+               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_TOOL) )
+               {
+                       onCreateContourFrame();
+               }
+               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_CONTOUR_KEY) )
+               {
+                       createContour();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_TOOL )
+               {
+                       onDeleteFrame( );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_KEY )
+               {
+                       deleteContours( currentSelection );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_TOOL )
+               {
+                       saveFileWithContours(  );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_KEY )
+               {
+                       saveFileWithContoursAutomatique(  );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::OPEN_TOOL )
+               {
+                       openFileWithContours(  );
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::CHANGE_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               changeContoursOfManager( currentSelection );
+                       }
+
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::HIDE_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onHideOutlines( currentSelection );
+                       }                       
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SHOW_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onShowOutlines( currentSelection );
+                       }
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::COPY_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onCopyOutlines( currentSelection );
+                       }
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::PASTE_TOOL )
+               {
+                       onPasteOutlines(  );                    
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::SPREAD_TOOL )
+               {
+                               onSpread();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::AUTOMATIQUESEGMENTATION_TOOL )
+               {
+                       onAutomatiqueSegmentation(  );                  
+               }
+
+               else if( toolCommand == wxContour_ActionCommnadsID::SELECT_TOOL )
+               {
+                       onSelectOutlines( currentSelection );
+                       
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::EDIT_TOOL )
+               {
+                       if ( elementsSelected >= 1 )
+                       {
+                               onEditOutlines( currentSelection );
+                       }
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::UNDO_TOOL )
+               {
+                       onUNDO();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::REDO_TOOL )
+               {
+                       onREDO();
+               }               
+               else if( toolCommand == wxContour_ActionCommnadsID::INFORMATIONCONTOUR_TOOL )
+               {
+                       onInformationContourFrame();
+               }               
+               else if( toolCommand == wxContour_ActionCommnadsID::INTERFACECONFIGURATION_TOOL )
+               {
+                       onInterfaceConfigurationFrame();
+               }
+               else if( toolCommand == wxContour_ActionCommnadsID::TEST_TOOL )
+               {
+                       onInterfaceTestFrame();
+               }               
+
+
+       }
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Getting information methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+   
+       void wxContourEventHandler :: updateInstantOutlines()
+       {
+               std::vector<NameWrapper *> namesWrapping = _modelManager->getActualInstantOutlines();
+               int size = namesWrapping.size();
+               _sceneManager->removeSceneContours();
+               for( int i=0; i<size; i++)
+               {                       
+                       _sceneManager->addToScene(namesWrapping[i]->getKeyName(), true, true, true, false, false );
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: updateInstantImageData()
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourEventHandler :: updateInstantAxes()
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------  
+       void wxContourEventHandler :: changeInstant()
+       {
+               std::vector<int> instantVect;
+               _instantPanel->getInstant( instantVect );
+               Instant * theInstant = new Instant ( &instantVect );
+               //if( !theInstant->isEquals( _actualInstant ))
+               {       
+                       //Setting the actual instant
+                       _actualInstant = theInstant;
+                       _modelManager->setInstant( _actualInstant );
+                       
+                       updateInstantOutlines();
+                       updateInstantImageData();
+                       updateInstantAxes();
+
+                       //Searching the elements at the specified instant
+
+                       /*
+                       std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
+                       iter = contours_ViewControl->find("Outline 0");
+                       (iter->second)->getViewer()->RemoveCompleteContourActor();*/
+               }
+       }
+
+       void wxContourEventHandler :: saveState(){
+               
+                       
+               inredo = 0;
+
+               char str[9000];
+               itoa(inundo, str, 10);
+
+               std::string temp = stundoredo + *str + ".roi";
+               saveFileWithContours(temp);
+
+               inundo++;
+       }
+
+       void wxContourEventHandler ::loadState(std::string filename){
+
+               char tmp[255];
+               FILE *pFile=fopen(filename.c_str(),"r+");
+
+               fscanf(pFile,"%s",tmp); // --CreaContour--
+
+               fscanf(pFile,"%s",tmp); // Version
+               fscanf(pFile,"%s",tmp); // 1.0.1
+               std::string version(tmp);
+
+               deleteAllContours();
+
+               openContours(pFile,false);
+               if (version!="1.0.0"){
+                       openContours(pFile,true);
+               }
+
+               fclose(pFile);
+               
+               //_sceneManager->removeSceneContours();
+               //changeInstant();
+
+       }
+void wxContourEventHandler :: onREDO()
+       {
+               if(inredo > 0){
+                       inredo--;
+                       inundo++;
+
+            char str[9000];
+                       itoa(inundo, str, 10);
+
+            
+                       std::string temp = stundoredo + *str + ".roi";
+               
+                       loadState(temp);
+
+                       
+               }
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourEventHandler :: onUNDO()
+       {
+               if(inundo>0){
+                       if(inredo==0){
+
+                               char str[9000];
+                               itoa(inundo, str, 10);
+
+                               std::string temp = stundoredo + *str + ".roi";
+                               saveFileWithContours(temp);                             
+
+                       }
+                       inredo++;
+                       inundo--;
+
+                       char str[9000];
+                       itoa(inundo, str, 10);
+
+            
+                       std::string temp = stundoredo + *str + ".roi";
+               
+                       loadState(temp);
+               }
+       }
+//JCP 21 - 10 - 09
+       void  wxContourEventHandler :: getValuesXYZ(double **vectx, double **vecty, double **vectz, std::vector<int>* size){
+
+
+               wxBusyCursor wait;
+               ContourExtractData      *contourextractdata = new ContourExtractData();
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+               std::vector<double> pLstValue;
+               std::vector<double> pLstValuePosX;
+               std::vector<double> pLstValuePosY;
+               std::vector<double> pLstValuePosZ;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+               wxString tmpString;
+               minZ    = 0;// _mbarrange->GetStart();
+               maxZ    = sizeZ;//_mbarrange->GetEnd();
+               totalZ  = maxZ-minZ+1;
+
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               vectx = new double *[sizeZ];
+               vecty = new double *[sizeZ];
+               vectz = new double *[sizeZ];
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+//EED004
+
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                       }
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+                               pLstValue.clear();
+                               pLstValuePosX.clear();
+                               pLstValuePosY.clear();
+                               pLstValuePosZ.clear();
+                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
+                                                                                                                       &pLstValuePosX,
+                                                                                                                       &pLstValuePosY,
+                                                                                                                       &pLstValuePosZ);
+
+                               
+                               int iLstValue,sizeLstValue=pLstValue.size();
+
+                               //We initialize the pointers
+                               size->push_back(sizeLstValue);
+                               vectx[sizeZ] = new double[sizeLstValue];
+                               vecty[sizeZ] = new double[sizeLstValue];
+                               vectz[sizeZ] = new double[sizeLstValue];
+                               
+                               for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
+                               {
+                                       
+                                       vectx[sizeZ][iLstValue] = pLstValuePosX[iLstValue];
+                                       vecty[sizeZ][iLstValue] = pLstValuePosY[iLstValue];
+                                       vectz[sizeZ][iLstValue] = pLstValuePosZ[iLstValue];
+                                       
+                               }
+                               //The size of the contour is saved
+                               
+                               
+                               
+                               //fclose(pFile);
+                       } // for  iContourGroup
+               } // for z
+               //_staticTextInformation->SetLabel( _T("") );
+               delete contourextractdata;
+
+       }
+
+
+       void  wxContourEventHandler :: getMaskValue(vtkImageData* mask, vtkImageData* value){
+
+
+               wxBusyCursor wait;
+               ContourExtractData      *contourextractdata = new ContourExtractData( true );
+               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
+               if (typeContourGroup==3)
+               {
+                       typeContourGroup=1;
+               }
+               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
+
+               std::vector<manualContourModel*> lstManConMod;
+               std::vector<manualContourModel*> lstManConModTmp;
+               std::vector<manualContourModel*> lstManConModExp;
+
+               std::vector<int> tempVector;
+               _instantPanel->getInstant( tempVector );
+
+               vtkImageData *imagedata = _sceneManager->GetImageData();
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               int z;
+               int ii,sizeLstContourThings;
+
+
+               int minZ,maxZ;
+               double totalZ;
+               double porcent; 
+
+               wxString tmpString;
+
+               minZ    = 0;// _mbarrange->GetStart();
+               maxZ    = sizeZ;//_mbarrange->GetEnd();
+               totalZ  = maxZ-minZ+1;
+
+               contourextractdata->SetImage( imagedata);
+
+       // For each slice..
+               for ( z=0 ; z<sizeZ ; z++)
+               {
+
+                       porcent = 100.0* (z-minZ)/totalZ;
+                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       _staticTextInformation->SetLabel(tmpString);
+
+                       //Extraction data from contours of each slice
+                       contourextractdata->SetZtoBeAnalys( z);
+
+                       tempVector[1]=z;
+                       Instant instant(&tempVector);
+                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
+                       sizeLstContourThings = lstContourThings.size();
+
+                       lstManConMod.clear();
+                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
+                       {
+                               ContourThing **contourthing = lstContourThings[ii];
+                               lstManConMod.push_back( (*contourthing)->getModel() );
+                       }
+                       lstManConModExp =  ExploseEachModel( lstManConMod );
+
+
+                       int iContourGroup,sizeContourGroup;
+                       if (typeContourGroup==3) // contour separete
+                       {
+                               sizeContourGroup=lstManConModExp.size();
+                       } else {  // contour AND OR XOR
+                               sizeContourGroup=1;
+                       }
+
+                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
+                               lstManConModTmp.clear();
+                               if (typeContourGroup==3) // contour separete
+                               {
+                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
+                               } else {  // contour AND OR XOR
+                                       lstManConModTmp = lstManConModExp;
+                               }
+
+                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
+
+
+                               contourextractdata->CalculateImageResult(); // with actual Z
+
+                       } // for  iContourGroup
+               } // for z
+
+
+
+// Image Value
+               value = contourextractdata->GetVtkImageValueResult();
+               
+// Image Mask
+               mask = contourextractdata->GetVtkImageMaskResult();
+               
+               delete contourextractdata;
+
+
+       }
+       wxPanel* wxContourEventHandler::getSegmentationPanelITK(wxWindow* parent){
+
+               int sizeZ = _sceneManager->GetImageDataSizeZ();
+               double range[2];
+               _sceneManager->GetImageDataRange(range);
+
+               wxPanel *panel                                          = new wxPanel(parent,-1);
+               wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
+               wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
+               _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               wxString lstOptions[3];
+               lstOptions[0]="A";
+               lstOptions[1]="B";
+               lstOptions[2]="C";
+               methodRadiobox                                          = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
+               methodRadiobox->SetSelection(2);
+               _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
+
+
+               _mbarrange                                      =  new mBarRange(panel,70, 65);
+               _mbarrange->SetMin(0);
+               _mbarrange->SetStart(0);
+
+               _mbarrange-> SetOrientation( true );
+               _mbarrange-> setActiveStateTo(true);
+               _mbarrange-> setVisibleLabels( true );
+               _mbarrange-> setDeviceEndMargin(10);
+               _mbarrange-> setRepresentedValues( 0 , sizeZ );
+               _mbarrange-> setDeviceBlitStart(10,10); 
+               _mbarrange-> setIfWithActualDrawed( false );
+               _mbarrange-> SetStart( 0 );
+               _mbarrange-> SetEnd( sizeZ );  
+
+
+//                     _segmentationFrame->SetEventHandler( this );
+               segmentationOneSliceBtn->SetEventHandler( this );
+               segmentationAllSliceBtn->SetEventHandler( this );
+               Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSliceITK ); 
+               Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSliceITK ); 
+
+               wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
+               sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
+               sizer -> Add( _isovalue , 1, wxGROW );
+               sizer -> Add( methodRadiobox , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
+               sizer -> Add( _sampling , 1, wxGROW );
+               sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
+               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
+               sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
+               sizer -> Add( _mbarrange  , 1, wxGROW );
+
+               panel->SetSizer( sizer );
+//             panel->SetSize( sizePanel );
+               panel->SetSize( wxDefaultSize );
+               panel->SetAutoLayout( true );
+               panel->Layout();
+               
+               return panel;
+               
+       }
+
+       void wxContourEventHandler::onSegmentationAllSliceITK( wxCommandEvent& event ){
+               //TODO implementar el método para todos los slices ver ayuda en onSegmentationAllSlice
+       }
+       void wxContourEventHandler::onSegmentationOneSliceITK( wxCommandEvent& event ){
+               //TODO implementar el método de segmentación en ITK ver ayuda en onSegmentationOneSlice y el método
+               // SegmentationOneSlice(x, y, z) que es la implementación del método en VTK
+
+               //JCP 20-10-08 Undo redo implementation
+               saveState();
+               //JCP 20-10-08 Undo redo implementation
+               
+               wxBusyCursor wait;
+               int                                     x                                       = this->_theViewPanel->GetX();
+               int                                     y                                       = this->_theViewPanel->GetY();
+               int                                     z                                       = this->_theViewPanel->GetZ();
+               //SegmentationOneSlice( x,y,z );
+               RefreshInterface();
+       }
+       void wxContourEventHandler::onSnakePressed(wxWindow* parent){
+
+               std::vector<double> vecX; 
+               std::vector<double> vecY; 
+               std::vector<double> vecZ; 
+               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
+
+               if (vecX.size()!=0){
+                       std::vector<int> tempVector;
+                       _instantPanel->getInstant( tempVector );
+                       int i,size=vecZ.size();
+                       int actualSlice = tempVector[1];
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               vecZ[i] = actualSlice;
+                       } // for
+
+                       wxDialog* dialog = new wxDialog(parent, -1, wxString("Snake"));
+                       wxPanel* panel = new wxPanel(dialog,-1); 
+                       wxStaticText* sttext = new wxStaticText(panel, -1, wxString("Panel para snake"));
+                       dialog->ShowModal();
+               } // if 
+
+       }
+//JCP 21 - 10 - 09
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.h b/lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.h
new file mode 100644 (file)
index 0000000..72ec7ac
--- /dev/null
@@ -0,0 +1,350 @@
+#ifndef __wxContourEventHandler_h_INCLUDED_H__
+#define __wxContourEventHandler_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/grid.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include "OutlineModelManager.h"
+#include "ContourWorkspace.h"
+#include "wxContourViewPanel.h"
+#include "wxInstantChooserPanel.h"
+#include "wxContour_ButtonsBar.h"
+#include "wxContour_Grid.h"
+#include "wxContour_DrawToolsPanel.h"
+#include "wxContour_OperationsToolsPanel.h"
+#include "wxContour_AutomaticFormsToolsPanel.h"
+#include "wxContour_StandardToolsPanel.h"
+#include "wxContour_EdtionToolsPanel.h"
+#include "wxContour_ListViewPanel.h"
+#include "wxContour_ActionCommnadsID.h"
+#include "PerformingOperation.h"
+
+#include "ContourThing.h"
+#include "AxeThing.h"
+#include "ImageSourceThing.h"
+#include "ImageSectionThing.h"
+#include "InstantMembersNameList.h"
+#include "OutlineGroup.h"
+#include "SomeEnvironment.h"
+#include "ContourWorkspace.h"
+#include "ContourWrap_ViewControl.h"
+#include "Instant.h"
+
+#include "wxVtkBaseView_SceneManager.h"
+
+
+#include "Contour/ContourPropagation.h"
+#include "mBarRange.h"
+
+
+/** file wxContourEventHandler.h */
+
+
+
+class  PanelBullEyeOptions : public wxPanel {
+public:
+       PanelBullEyeOptions(wxWindow* parent, wxSize size);
+       ~PanelBullEyeOptions ();
+       void onRefreshPanel( wxCommandEvent& event );
+       int GetNumberOfCrowns();
+       int GetNumberOfSections(int nCrown);
+       int GetRadioOfCrown(int nCrown);
+       double GetAngOfCrownSection(int nCrown,int section);
+       double GetAngDeltaOfCrownSection(int nCrown);
+protected:
+
+private:
+       int                                                     _maxLevels;
+       int                                                     _maxSections;
+       wxRadioBox                                      *_radioboxBullEyeGenOpt;
+       wxSpinCtrl                                      *_spinctrlBullEyeNumOfCrowns;
+       wxSpinCtrl                                      *_spinctrlBullEyeNumOfSec;
+       wxSlider                                        *_sliderBullEyeAngle;
+       std::vector<wxSpinCtrl *>       _lstBullEyeDetailNumOfSec;
+       std::vector<wxSlider *>         _lstBullEyeDetailRadio;
+       std::vector<wxSlider *>         _lstBullEyeDetailAngle;
+
+
+       
+
+       void RefreshPanel();
+};
+
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContourEventHandler : public wxEvtHandler {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       wxContourEventHandler();
+       ~wxContourEventHandler();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Configuration methods
+       //------------------------------------------------------------------------------------------------------------
+       bool configureEventsHandling();
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       void onProcessMessage( wxCommandEvent& event );
+       void onActionButtonPressed( wxCommandEvent& event );
+       void onChangedDeep ( wxCommandEvent& event );
+       void onChangeInstant( wxCommandEvent& event );
+       void onCreateMultipleROI( wxCommandEvent& event );
+       void onSelectMultipleROI( wxCommandEvent& event );
+       void onCreateROI( wxCommandEvent& event );
+       void onStopCreateROI( wxCommandEvent& event );
+       void onDeleterROI( wxCommandEvent& event );
+       void onSelectROI( wxCommandEvent& event );
+       void onUnSelectROI( wxCommandEvent& event );
+       void onManualHidedROI( wxCommandEvent& event );
+       void onManualShowedROI( wxCommandEvent& event );
+       void onEditingROI( wxCommandEvent& event );
+       void onMovingROI( wxCommandEvent& event );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Model management methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append = false );
+       void createContour( int typeContour=1 );
+       void deleteContour( std::string theKeyName );
+       void deleteContours( std::vector<std::string> & keyNamesVector );       
+       void deleteAllContours(  );     
+       void openContours( FILE *pFile, bool staticContour );
+       void openFileWithContours();
+       void saveFileWithContours();
+       void saveFileWithContours( std::string filename );
+       void saveFileWithContoursAutomatique();
+       void onSpread( );
+       void onSpreadInDepth( std::vector<std::string> & keyNamesVector );
+       void onAutomatiqueSegmentation( );
+       void onOutline_Union_Of( std::vector<std::string> & keyNamesVector );
+       void onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector );
+       void onOutline_Combination_Of( std::vector<std::string> & keyNamesVector );
+       void onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector );
+       void onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector );
+       void onCopyOutlines( std::vector<std::string> & keyNamesVector );
+       void onPasteOutlines(  );
+       void onShowOutlines( std::vector<std::string> & keyNamesVector );
+       void onHideOutlines( std::vector<std::string> & keyNamesVector );
+       void onSelectOutlines( std::vector<std::string> & keyNamesVector );
+       void onEditOutlines( std::vector<std::string> & keyNamesVector );
+       void onREDO();
+       void onUNDO();
+       void changeContourOfManager(std::string keyName, Instant *instant);
+       void changeContoursOfManager(std::vector<std::string> & keyNamesVector);
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       void setModelManager( OutlineModelManager * theModelManager );
+       void setViewPanel(  wxContourViewPanel * theViewPanel );
+       void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
+       void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
+       void setGrid(  wxContour_Grid * theGridPanel );
+       void setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel );
+       void setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theDrawToolsPanel );
+       void setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
+       void setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel );
+       void setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel );
+       void setListViewPanel(  wxContour_ListViewPanel * theListViewPanel );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+       void executeActionCommand( const char  toolCommand );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Getting information methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Responding Spread Tools 
+       //------------------------------------------------------------------------------------------------------------
+       void onSpreadReset( wxCommandEvent& event );
+       void onSpreadAdd( wxCommandEvent& event );
+       void onSpreadGo( wxCommandEvent& event );
+       
+       void onSegmentationAllSlice( wxCommandEvent& event );
+       void onSegmentationOneSlice( wxCommandEvent& event );
+       void SegmentationOneSlice( int x, int y, int z );
+
+
+       void onTest( wxCommandEvent& event );
+       void onTestReset( wxCommandEvent& event );
+       void onTestAdd( wxCommandEvent& event );
+       void onTestGo( wxCommandEvent& event );
+
+
+       void onCreateContourSpline( wxCommandEvent& event );
+       void onCreateContourRectangle( wxCommandEvent& event );
+       void onCreateContourCircle( wxCommandEvent& event );
+       void onCreateContourBullEye( wxCommandEvent& event );
+       void onCreateContourFrame( );
+       void onDeleteFrame( );
+       void onDeleteContour( wxCommandEvent& event );
+       void onDeleteContoursActSlice( wxCommandEvent& event );
+       void onDeleteAllContours( wxCommandEvent& event );
+       void onInformationContourFrame();
+       void onInformationContourLabels( wxCommandEvent& event );
+       void onExtractInformation( wxCommandEvent& event );
+       void onSaveResults( wxCommandEvent& event );
+       void onInterfaceConfigurationFrame();
+       void onWidthOfContour(wxScrollEvent& event);
+       void onBrigthnessColorWindowLevel(wxScrollEvent& event);
+       void OnInterpolation(wxCommandEvent& event);
+
+       void onInterfaceTestFrame();
+
+       void SaveValuesXYZ(std::string directory,std::string namefile);
+       void SaveImageResult(std::string directory,std::string namefile);
+
+/**
+**     JCP 13-10-08 This methods group the diferent kind of panels
+**/
+       wxPanel* getInformationPanel(wxWindow* parent);
+       wxPanel* getConfigurationPanel(wxWindow* parent);
+       wxPanel* getSegmentationPanel(wxWindow* parent);
+       wxPanel* getSegmentationPanelITK(wxWindow* parent);
+       wxPanel* getSpreadPanel(wxWindow* parent);
+       void onSegmentationAllSliceITK( wxCommandEvent& event );
+       void onSegmentationOneSliceITK( wxCommandEvent& event );
+       void onSnakePressed(wxWindow* parent);
+
+       void showAxis(bool show);
+//JCP 13-10-09 Fill grid as public
+       void FillGridWithContoursInformation();
+//JCP 13-10-09
+//JCP 16-10-09
+       void createContourBullsEye(PanelBullEyeOptions* panel );
+
+       //void getValuesXYZ(std::vector<double *>* vectx, std::vector<double*>* vecty, std::vector<double*>* vectz, std::vector<int>* size);
+//JCP 22-10-09
+       /**
+       **      This method gets the information of the contours in each slice
+       **/
+       void getValuesXYZ(double ** vectx, double ** vecty, double ** vectz, std::vector<int>* size);
+       /**
+       **      This method gets the mask and value images generated by the contours
+       **/
+       void getMaskValue(vtkImageData* mask, vtkImageData* value);
+//JCP 22-10-09
+
+//JCP 16-10-09
+
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+       void updateInstantOutlines();
+       void updateInstantImageData();
+       void updateInstantAxes();
+       void changeInstant();
+       void RefreshInterface();
+
+       // EED
+//JCP 13-10-09 must be a public method
+       //void FillGridWithContoursInformation();
+//JCP 13-10-09
+       manualContourModel * factoryManualContourModel(int typeContour);
+       manualContourModel * factoryManualContourModel(PanelBullEyeOptions* panel);
+       std::vector<manualContourModel*> ExploseEachModel( std::vector<manualContourModel*> lstManConMod );
+
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+
+       wxContourViewPanel                                      * _theViewPanel;
+       OutlineModelManager                                     * _modelManager;
+       ContourWorkspace                                        * _workSpace;
+       wxInstantChooserPanel                           * _instantPanel;
+       wxContour_ButtonsBar                            * _buttonsBar;
+
+       wxVtkBaseView_SceneManager                      * _sceneManager;
+       
+       Instant                                                         * _actualInstant;
+       wxContour_Grid                                          * _gridPanel;
+       wxContour_DrawToolsPanel                        * _drawToolsPanel;
+       wxContour_OperationsToolsPanel          * _operationsToolsPanel;
+       wxContour_AutomaticFormsToolsPanel      * _autoFormsPanel; 
+       wxContour_StandardToolsPanel            * _standardToolsPanel;
+       wxContour_EdtionToolsPanel                      * _editionToolsPanel;
+       wxContour_ListViewPanel                         * _listViewPanel;
+
+       /*DECLARE_CLASS(wxContourMainFrame)
+       // any class wishing to process wxWindows events must use this macro
+       DECLARE_EVENT_TABLE()*/
+       bool                                                            _creatingContoursActive;
+       PerformingOperation                                     * _performingOperation;
+
+       // Interface EED
+       wxFrame                                                         *_spreadFrame;
+       wxFrame                                                         *_segmentationFrame;
+       wxFrame                                                         *_createContourFrame;
+       wxFrame                                                         *_deleteFrame;
+       wxFrame                                                         *_InformationContourFrame;
+       wxFrame                                                         *_interfaceConfigurationFrame;
+       wxFrame                                                         *_TestFrame;
+       wxTextCtrl                                                      * _wxtextctrlTest;
+
+       std::string                                                     fileNameContourROI; 
+
+       wxRadioBox                                                      *methodRadiobox;
+       ContourPropagation                                      *_contourPropagation;
+       wxSlider                                                        *_isovalue;
+       wxSlider                                                        *_sampling;
+       wxStaticText                                            *_staticTextSegmentation;
+       mBarRange                                                       *_mbarrange;
+       wxTextCtrl                                                      *_wxtextctrlSpread;
+       wxRadioBox                                                      *_informationRadiobox;
+       wxListCtrl                                                      *_wxlistctrl;
+       wxGrid                                                          *_grid; 
+       wxStaticText                                            *_staticTextInformation;
+       mBarRange                                                       *_mbarrangeSliceInformation;
+       mBarRange                                                       *_mbarrangeRangeInformation;
+       wxSlider                                                        *_withOfContourLine; 
+       wxSlider                                                        *_brithtnessWindowLevel;
+       wxSlider                                                        *_brithtnessColorLevel;
+       mBarRange                                                       *_mbarrangeDeleteAll;
+       wxCheckBox                                                      *_interpolationCheckBox;
+       wxRadioBox                                                      *_spreadMethodRadiobox;
+       wxRadioBox                                                      *_radiolstboxContourGroup;
+       wxStaticText                                            *_staticTextSpread;
+       PanelBullEyeOptions                                     *_panelBullEyeOptions;
+       int                                                                     _numberOfVariablesStatistics;
+
+       int                                                     inundo;
+       int                                                     inredo;
+       std::string                                     stundoredo;
+
+       void                                            saveState();
+       void                                            loadState(std::string filename);
+};
+#endif // __wxContourEventHandler_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
new file mode 100644 (file)
index 0000000..d277065
--- /dev/null
@@ -0,0 +1,180 @@
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContourMainFrame.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------------------------------------------------
+
+
+#include "NameWrapper.h"
+#include "wx/artprov.h"
+#include "ConceptDataWrap.h"
+
+#include <manualContour.h>
+#include "ImageSourceThing.h"
+#include "vtkImageData.h"
+
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxContourMainFrame.cxx */
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+               
+       wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style)
+               //: wxPanel(parent, id, title, pos, size, style)
+               //: wxWindow(parent, id, pos, size, style)
+               : wxPanel(parent, id, pos, size, style)
+       {
+               m_mgr.SetManagedWindow(this);
+               _creatingContoursActive         = false;
+               _theViewPanel                           = NULL;
+               _modelManager                           = NULL;
+               _instantPanel                           = NULL;
+               _buttonsBar                                     = NULL;
+               _gridPanel                                      = NULL; 
+               _drawToolsPanel                         = NULL;
+               _operationsToolsPanel           = NULL;
+               _autoFormsPanel                         = NULL; 
+               _standardToolsPanel                     = NULL;
+               _editionToolsPanel                      = NULL;
+               _listViewPanel                          = NULL;
+               _sceneManager                           = NULL;
+               _actualInstant                          = NULL;
+
+               // set up default notebook style
+               m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
+               m_notebook_theme = 0;   
+       }
+
+       wxContourMainFrame :: ~wxContourMainFrame()
+       {
+                 m_mgr.UnInit();
+                 //El problema al cerrar la aplicacion puede estar asociado 
+                 //a que  wxAUINotebook esta en la aplicacion 
+                 //principal (wxContourGUIExample)tambien
+//EED????              delete _theViewPanel;             
+//EED????              delete _instantPanel;
+//EED????              delete _buttonsBar;
+//EED????              delete _actualInstant;           
+//EED????              delete _sceneManager;
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods using WxAui
+       //------------------------------------------------------------------------------------------------------------
+       //
+       wxAuiNotebook * wxContourMainFrame :: createNotebook()
+       {
+               wxSize client_size = GetClientSize();
+               wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
+               wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
+               return noteBook;
+       }
+       
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods 
+       //------------------------------------------------------------------------------------------------------------
+       bool wxContourMainFrame :: configurePanels(wxAuiNotebook* theNoteBook)
+       {
+               bool configured = _theViewPanel!=NULL;
+                                       
+               configured &= _theViewPanel!=NULL;
+               if( _theViewPanel!=NULL )
+               {
+                       theNoteBook->AddPage( _theViewPanel, wxT("       View       ") );               
+                       m_mgr.Update();
+               }
+
+
+               if( configured )
+               {
+                       theNoteBook->AddPage( _instantPanel, wxT("Instant Page") );
+                       m_mgr.Update();
+               }
+
+               m_mgr.AddPane(theNoteBook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
+               m_mgr.Update();
+               configured &= _buttonsBar!=NULL;
+               if( _buttonsBar!=NULL )
+               {                       
+                       m_mgr.AddPane(_buttonsBar, wxAuiPaneInfo().
+                                       Name(wxT("TB")).Caption(wxT("Buttons Bar")).
+                                       ToolbarPane().Top().
+                                       LeftDockable(  ).RightDockable( false ).CloseButton(false));
+                       m_mgr.Update();
+               }
+               //CreateStatusBar();
+                        
+               SetMinSize(wxSize(300,300));
+               m_mgr.Update();
+               return configured;
+       }
+
+       void wxContourMainFrame :: setNotebook( wxAuiNotebook * noteBook )
+       {
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+
+       void wxContourMainFrame :: setViewPanel(  wxContourViewPanel * theViewPanel )
+       {
+               _theViewPanel = theViewPanel;           
+       }
+
+       void wxContourMainFrame :: setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel )
+       {
+               _instantPanel = theInstantChooserPanel; 
+       }
+
+       void wxContourMainFrame :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
+       {
+               _buttonsBar = theButtonsBar;
+       }
+
+       void wxContourMainFrame :: setGrid(  wxContour_Grid * theGridPanel )
+       {
+               _gridPanel = theGridPanel;
+       }
+
+       void wxContourMainFrame :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
+       {
+               _drawToolsPanel = theDrawToolsPanel;
+       }
+
+       void wxContourMainFrame :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
+       {       
+               _operationsToolsPanel = theOperationsToolsPanel;
+       }
+
+       void wxContourMainFrame :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
+       {
+               _autoFormsPanel = theAutoFormsPanel;
+       }
+
+       void wxContourMainFrame :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
+       {
+               _standardToolsPanel= theStandardToolsPanel;
+       }
+
+       void wxContourMainFrame :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
+       {
+               _editionToolsPanel =  theEditionToolsPanel;
+       }
+
+       void wxContourMainFrame :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
+       {
+               _listViewPanel = theListViewPanel;
+       }
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
new file mode 100644 (file)
index 0000000..04969ff
--- /dev/null
@@ -0,0 +1,185 @@
+#ifndef __wxContourMainFrame_h_INCLUDED_H__
+#define __wxContourMainFrame_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include "wx/aui/aui.h"
+
+#include "ContourThing.h"
+#include "AxeThing.h"
+#include "ImageSourceThing.h"
+#include "ImageSectionThing.h"
+#include "InstantMembersNameList.h"
+#include "OutlineGroup.h"
+#include "SomeEnvironment.h"
+#include "ContourWorkspace.h"
+#include "ContourWrap_ViewControl.h"
+#include "Instant.h"
+
+#include "OutlineModelManager.h"
+#include "wxInstantChooserPanel.h"
+#include "wxContour_ButtonsBar.h"
+#include "wxContour_ControlPanel.h"
+#include "wxContourViewPanel.h"
+#include "wxContour_Grid.h"
+#include "wxContour_DrawToolsPanel.h"
+#include "wxContour_OperationsToolsPanel.h"
+#include "wxContour_AutomaticFormsToolsPanel.h"
+#include "wxContour_StandardToolsPanel.h"
+#include "wxContour_EdtionToolsPanel.h"
+#include "wxContour_ListViewPanel.h"
+
+#include "wxVtkBaseView_SceneManager.h"
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+
+//BEGIN_DECLARE_EVENT_TYPES()
+//END_DECLARE_EVENT_TYPES()
+
+/** file wxContourMainFrame.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+
+class wxContourMainFrame : public wxPanel {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+
+       wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style  = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);
+
+       ~wxContourMainFrame();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       bool configurePanels(wxAuiNotebook * theNoteBook );
+
+       void setNotebook( wxAuiNotebook * theNoteBook );
+
+       wxAuiNotebook * createNotebook();
+
+       void createInstantChooserPanel(wxAuiNotebook * parent);
+
+       void createViewPanel(wxAuiNotebook * parent);
+       
+       void createInstantChooserPanel(wxWindow * parent);
+
+       void createViewPanel(wxWindow * parent);
+               
+       void setViewPanel(  wxContourViewPanel * theViewPanel );
+
+       void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
+
+       void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
+
+       void setGrid(  wxContour_Grid * theGridPanel );
+
+       void setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel );
+
+       void setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theDrawToolsPanel );
+
+       void setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
+
+       void setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel );
+
+       void setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel );
+
+       void setListViewPanel(  wxContour_ListViewPanel * theListViewPanel );
+
+
+       ////------------------------------------------------------------------------------------------------------------
+       //// Methods for capturing events
+       ////------------------------------------------------------------------------------------------------------------
+       
+
+       ////------------------------------------------------------------------------------------------------------------
+       ////  Model management methods
+       ////------------------------------------------------------------------------------------------------------------
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+
+       wxAuiManager m_mgr;
+    /*
+       wxArrayString m_perspectives;
+    wxMenu* m_perspectives_menu;
+       */
+    long m_notebook_style;
+    long m_notebook_theme;
+
+       wxContourViewPanel * _theViewPanel;
+
+       OutlineModelManager * _modelManager;
+
+       wxInstantChooserPanel * _instantPanel;
+
+       wxContour_ButtonsBar * _buttonsBar;
+
+       wxContour_Grid *  _gridPanel;
+
+       wxContour_DrawToolsPanel * _drawToolsPanel;
+
+       wxContour_OperationsToolsPanel * _operationsToolsPanel;
+
+       wxContour_AutomaticFormsToolsPanel * _autoFormsPanel; 
+
+       wxContour_StandardToolsPanel *_standardToolsPanel;
+
+       wxContour_EdtionToolsPanel * _editionToolsPanel;
+
+       wxContour_ListViewPanel * _listViewPanel;
+
+       wxVtkBaseView_SceneManager * _sceneManager;
+
+       Instant * _actualInstant;
+
+       /*DECLARE_CLASS(wxContourMainFrame)
+       // any class wishing to process wxWindows events must use this macro
+       DECLARE_EVENT_TABLE()*/
+       bool _creatingContoursActive;
+
+};
+
+#endif 
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainPanel.h
new file mode 100644 (file)
index 0000000..11c52e0
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef __wxContour_MainPanel__
+#define __wxContour_MainPanel__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+
+BEGIN_DECLARE_EVENT_TYPES()
+END_DECLARE_EVENT_TYPES()
+
+/** file wxContourMainPanel.h */
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+
+class wxContourMainPanel : public wxScrolledWindow {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+
+       DECLARE_CLASS(wxContourMainPanel)
+       // any class wishing to process wxWindows events must use this macro
+       DECLARE_EVENT_TABLE()
+
+};
+
+#endif
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
new file mode 100644 (file)
index 0000000..e83d5b8
--- /dev/null
@@ -0,0 +1,592 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContourViewPanel.h"
+
+
+//----------------------------------------------------------------------------------------------------------------
+// Other includes
+//----------------------------------------------------------------------------------------------------------------
+#include "ConceptDataWrap.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxContourViewPanel.cxx */
+
+//----------------------------------------------------------------------------------------------------------------
+// Throwed Events definition
+//----------------------------------------------------------------------------------------------------------------
+
+DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
+       
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxContourViewPanel :: wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
+       //:wxScrolledWindow(parent, -1, pos, size, style)       
+       :wxPanel(parent, -1, pos, size, style)  
+       /*{
+               
+               showingVID = theShowingImage;
+               int gapH = 20;
+               int gapV = 10;
+               createHorizontalBar(1,80);
+               createVerticalBar(1,200);
+               createViewPanel();
+               
+               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(3,1,0,0);
+               panelSizer->AddSpacer(gapV);
+               panelSizer -> AddGrowableCol(1);
+               panelSizer->Add(theViewPanel, 1, wxEXPAND);
+               panelSizer->AddSpacer(gapV);
+
+               wxFlexGridSizer * downSizer = new wxFlexGridSizer(1,3,gapV,gapH);
+               downSizer->Add(_verticalBar, 1, wxEXPAND);
+               //downSizer->AddSpacer(gapH);
+               downSizer -> AddGrowableCol(1);
+               downSizer->Add(panelSizer, 1, wxEXPAND|wxALL|wxCENTER);
+               //downSizer->AddSpacer(gapH);
+               outSizer = new wxFlexGridSizer(3,1,1,1);
+               outSizer->Add(_horizontalBar, 1, wxEXPAND);
+               outSizer -> AddGrowableRow(1);
+               outSizer -> AddGrowableCol(1);
+               outSizer->Add(downSizer, 1, wxEXPAND);
+               
+               _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV);
+               _horizontalBar->setDeviceEndMargin( gapH+10 );
+               
+               //Connecting the events to the horizontal bar
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
+               
+               //Connecting the events to the vertical bar
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
+               
+                               
+               this->SetAutoLayout( true );
+               SetSizer( outSizer );
+               this->Layout();
+
+               SetSize(900,700);
+               theViewPanel->SetSize(800,600);
+               theViewPanel->GetWindow(1)->SetSize(800,600);
+
+               outSizer->Fit( this );
+               SetBackgroundColour(wxColour(255,0,0));
+               
+       }*/
+       {               
+               theShowingImage->GetSpacing(last_spacing);
+               
+               showingVID = theShowingImage;
+               int gapH = 20;
+               int gapV = 10;
+               _verticalConceptName = "";
+               _horizontalConceptName = "";
+               createHorizontalBar(1,80);
+               createVerticalBar(1,200);
+               createViewPanel();
+               
+               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1, 4, gapV, gapH);
+               panelSizer -> AddGrowableCol(2);
+               panelSizer -> AddGrowableRow(2);
+               panelSizer->Add(_verticalBar, 1, wxGROW);
+               panelSizer->AddSpacer(gapV);
+               panelSizer->Add(theViewPanel, 1, wxGROW);
+               panelSizer->AddSpacer(gapV);
+
+               outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
+               outSizer -> AddGrowableCol(1);
+               outSizer -> AddGrowableRow(1);
+               outSizer->Add( _horizontalBar, 1, wxGROW);
+               outSizer->Add( panelSizer, 1, wxGROW);
+               outSizer->AddSpacer(gapH);
+                                                               
+               _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
+               _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
+               
+               //Connecting the events to the horizontal bar
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
+               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
+               
+               //Connecting the events to the vertical bar
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
+               Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
+               
+               
+               SetSizer( outSizer );
+               this->SetAutoLayout( true );
+               this->Layout();
+
+               //SetSize(1900,1900);
+               //theViewPanel->SetSize(800,600);
+               //theViewPanel->GetWindow(1)->SetSize(800,600);
+
+               //outSizer->Fit( this );        
+       }
+       
+
+       wxContourViewPanel :: ~wxContourViewPanel()
+       {
+               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
+       {
+               _eventHandler = theEventHandler;
+       }
+
+       void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
+       {
+               _horizontalBar = new mBarRange(this, 1500,80);
+               _horizontalBar -> setVisibleLabels (true);
+               _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
+               _horizontalBar -> setActiveStateTo(true);
+               _horizontalBar -> SetActual( horzStart );
+               _horizontalBar -> setDeviceBlitStart (10,10);
+               _horizontalBar -> setDeviceEndMargin (10);
+       }
+
+       void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
+       {
+               _verticalBar = new mBarRange(this, 1500,40);
+               _verticalBar -> SetOrientation(false);
+               _verticalBar -> setVisibleLabels (false);
+               _verticalBar -> setRepresentedValues (vertStart, vertEnd);
+               _verticalBar -> setActiveStateTo(true);
+               _verticalBar -> SetActual( vertStart );
+               _verticalBar -> setDeviceBlitStart (10,10);
+               _verticalBar -> setDeviceEndMargin (10);
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourViewPanel :: createViewPanel()
+       {               
+               std::vector<int> * numViews = new std::vector<int> ();
+               numViews->push_back(2);
+               theViewPanel                                    = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
+               SetVisibleAxis(false);
+
+               theViewPanel->SetBackgroundColour(wxColour(0,0,0));
+
+               theViewPanel->SetSize(800,600);
+               theViewPanel->GetWindow(1)->SetSize(800,600);   
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView() 
+       {
+               return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourViewPanel::SetVisibleAxis(bool ok)
+       {
+               GetwxVtkMPR2DView()->SetVisibleAxis(ok);
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       int wxContourViewPanel::GetX()
+       {
+               return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       int wxContourViewPanel::GetY()
+       {
+               return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       int wxContourViewPanel::GetZ()
+       {
+               return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxContourViewPanel::Refresh()
+       {
+               GetwxVtkMPR2DView()->GetRenWin()->Render();
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events from the horizontal bar
+       //------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Handles the event wxEVT_TSBAR from the horizontal bar 
+       */
+       void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
+       {
+               
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar  
+       */
+       void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
+       {
+               int nxActual_h = getActualHorizontal();
+
+               if (_eventHandler!=NULL)
+               {
+                       //-------------------------------------------------
+                       //  Sending the event of wxINSTANT_CHANGE
+                       //-------------------------------------------------
+                       wxCommandEvent newevent(wxINSTANT_CHANGE,GetId()); 
+                       
+                       ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
+                       cWrap->setActualValue( nxActual_h );
+
+                       newevent.SetClientData( (void *)cWrap );
+                       _eventHandler->ProcessEvent(newevent);
+               }
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_START from the horizontal bar   
+       */
+       void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
+       {
+               int nxStart_h = getStartHorizontal();
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_END from the horizontal bar     
+       */
+       void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
+       {
+               int nxEnd_h = getEndHorizontal();
+       }
+       /**
+       * Handles the event wxEVT_SELECTION_END from the horizontal bar 
+       */
+       void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
+       {
+               
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar   
+       */
+       void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
+       {
+               int nxStart_h = getStartHorizontal();
+               int nxEnd_h = getEndHorizontal();
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events from the vertical bar
+       //------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Handles the event wxEVT_TSBAR from the vertical bar   
+       */
+       void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
+       {
+
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar    
+       */
+       void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
+       {
+               int nxActual_v = getActualVertical();
+
+               if (_eventHandler!=NULL)
+               {
+                       //-------------------------------------------------
+                       //  Sending the event of wxINSTANT_CHANGE
+                       //-------------------------------------------------
+                       wxCommandEvent newevent(wxINSTANT_CHANGE,GetId()); 
+                       
+                       ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
+                       cWrap->setActualValue( nxActual_v );
+
+                       newevent.SetClientData( (void *)cWrap );
+                       _eventHandler->ProcessEvent(newevent);
+               }
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_START from the vertical bar     
+       */
+       void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
+       {
+               int nxStart_v = getStartVertical();
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_END from the vertical bar       
+       */
+       void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
+       {
+               int nxEnd_v = getEndVertical();
+       }
+       /**
+       * Handles the event wxEVT_SELECTION_END from the vertical bar   
+       */
+       void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
+       {
+
+       }
+       /**
+       * Handles the event wxEVT_TSBAR_MOVED from the vertical bar     
+       */
+       void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
+       {
+               int nxStart_v = getStartVertical();
+               int nxEnd_v = getEndVertical();
+       }       
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Sets the represented values of the vertical bar
+       * @param minRepresented In the minimum represented value of the bar
+       * @param maxRepresented In the maximum represented value of the bar
+       */
+       void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
+       {
+               if( _verticalBar != NULL && _useVerticalBar )
+               {
+                       _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
+               }
+       }
+
+       /**
+       * Sets the represented values of the horizontal bar
+       * @param minRepresented In the minimum represented value of the bar
+       * @param maxRepresented In the maximum represented value of the bar
+       */
+       void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
+       {
+               if( _horizontalBar != NULL && _useHorizontalBar )
+               {
+                       _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
+               }
+       }
+       
+       /**
+       * Gets the StartVertical value
+       * @return The StartVertical
+       */
+       int wxContourViewPanel :: getStartVertical()
+       {
+               return _verticalBar->GetActual();
+       }
+       /**
+       * Gets the EndVertical value
+       * @return The EndVertical
+       */
+       int wxContourViewPanel :: getEndVertical()
+       {       
+               return _verticalBar->GetEnd();
+       }
+       /**
+       * Gets the ActualVertical value
+       * @return The ActualVertical
+       */
+       int wxContourViewPanel :: getActualVertical()
+       {
+               return _verticalBar->GetEnd();
+       }
+
+       /**
+       * Sets the StartVertical value
+       * @param nwValue The new value for the StartVertical
+       */
+       void wxContourViewPanel :: setStartVertical( int nwValue )
+       {
+                _verticalBar->SetEnd( nwValue );
+       }
+       /**
+       * Sets the EndVertical value
+       * @param nwValue The new value for the EndVertical
+       */
+       void wxContourViewPanel :: setEndVertical( int nwValue )
+       {
+                _verticalBar->SetEnd( nwValue );
+       }
+       /**
+       * Sets the ActualVertical value
+       * @param nwValue The new value for the ActualVertical
+       */
+       void wxContourViewPanel :: setActualVertical( int nwValue )
+       {
+                _verticalBar->SetActual( nwValue );
+       }
+
+       /**
+       * Gets the StartHorizontal value
+       * @return The StartHorizontal
+       */
+       int wxContourViewPanel :: getStartHorizontal()
+       {
+               return _horizontalBar->GetStart();
+       }
+       /**
+       * Gets the EndHorizontal value
+       * @return The EndHorizontal
+       */
+       int wxContourViewPanel :: getEndHorizontal()
+       {
+               return _horizontalBar->GetEnd();
+       }
+       /**
+       * Gets the ActualHorizontal value
+       * @return The ActualHorizontal
+       */
+       int wxContourViewPanel :: getActualHorizontal()
+       {
+               return _horizontalBar->GetActual();
+       }
+
+       /**
+       * Sets the StartHorizontal value
+       * @param nwValue The new value for the StartHorizontal
+       */
+       void wxContourViewPanel :: setStartHorizontal( int nwValue )
+       {
+               _horizontalBar->SetStart( nwValue );
+       }
+       /**
+       * Sets the EndHorizontal value
+       * @param nwValue The new value for the EndHorizontal
+       */
+       void wxContourViewPanel :: setEndHorizontal( int nwValue )
+       {
+               _horizontalBar->SetEnd( nwValue );
+       }
+       /**
+       * Sets the ActualHorizontal value
+       * @param nwValue The new value for the ActualHorizontal
+       */
+       void wxContourViewPanel :: setActualHorizontal( int nwValue )
+       {
+               _horizontalBar->SetActual( nwValue );
+       }
+       
+       /**
+       * Sets the horizontal concept values and name
+       * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
+       * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
+       * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
+       * @param minShowed The minShowed value of the concept for setting at the horizontal bar
+       * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
+       * @param actualShow The actualShow value of the concept for setting at the horizontal bar
+       */
+       void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
+       {
+               setHorizontalConceptName( theHorizontalConcept );
+               setHorizontalRepresentedValues( minRepresent, maxRepresent );
+               setActualHorizontal( actualShow );
+               setStartHorizontal( minShowed );
+               setEndHorizontal( maxShowed );
+       }
+
+       /**
+       * Sets the vertical concept values and name
+       * @param theVerticalConcept The name of the concept for setting at the vertical bar
+       * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
+       * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
+       * @param minShowed The minShowed value of the concept for setting at the vertical bar
+       * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
+       * @param actualShow The actualShow value of the concept for setting at the vertical bar
+       */
+       void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
+       {
+               setVerticalConceptName( theVerticalConcept );
+               setVerticalRepresentedValues( minRepresent, maxRepresent );
+               setActualVertical( actualShow );
+               setStartVertical( minShowed );
+               setEndVertical( maxShowed );
+       }
+       
+
+       /**
+       * Sets the horizontal concept name
+       * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
+       */
+       void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
+       {
+               _horizontalConceptName = theHorizontalConcept;
+       }
+
+       /**
+       * Gets the horizontal concept name
+       * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
+       */
+       std::string wxContourViewPanel :: getHorizontalConceptName(  )
+       {
+               return _horizontalConceptName;
+       }
+
+       /**
+       * Sets the vertical concept name
+       * @param theVerticalConcept The name of the concept for setting at the vertical bar
+       */
+       void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
+       {
+               _verticalConceptName = theVerticalConcept;
+       }
+
+       /**
+       * Gets the vertical concept name
+       * @return _verticalConceptName The name of the concept for setting at the vertical bar
+       */
+       std::string wxContourViewPanel :: getVerticalConceptName(  )
+       {
+               return _verticalConceptName;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContourViewPanel :: getSpacing( double * spacing  )
+       {
+               spacing[0] = last_spacing[0];
+               spacing[1] = last_spacing[1];
+               spacing[2] = last_spacing[2];
+       }
+
+       wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
+       {
+               return theViewPanel->GetwxVtkBaseView(1);
+       }
+
+       double wxContourViewPanel :: getCurrentDeep()
+       {
+//EED 08/04/2008
+//             return theViewPanel->GetZ(1);
+               return theViewPanel->GetZ();
+       }
+
+       
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h
new file mode 100644 (file)
index 0000000..5c63d1b
--- /dev/null
@@ -0,0 +1,330 @@
+#ifndef __wxContourViewPanel_h_INCLUDED_H__
+#define __wxContourViewPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/scrolwin.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "mBarRange.h"
+#include "wxMaracas_N_ViewersWidget.h"
+#include "vtkImageData.h"
+#include <manualContour.h>
+#include "wxVtkBaseView.h"
+#include <iostream>
+#include <wx/event.h>
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+
+BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE(wxINSTANT_CHANGE,400)
+END_DECLARE_EVENT_TYPES()
+
+
+/** file wxContourViewPanel.h */
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+
+class wxContourViewPanel : public wxPanel {// public wxScrolledWindow {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxContourViewPanel( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos=wxDefaultPosition, const wxSize& size = wxDefaultSize,long style= wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, int vertStart=1, int vertEnd=1, int horzStart=1, int horzEnd=1 );
+
+       ~wxContourViewPanel();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       void setWxEventHandler( wxEvtHandler * theEventHandler );
+
+       void createHorizontalBar(int horzStart, int horzEnd);
+
+       void createVerticalBar(int vertStart, int vertEnd);
+
+       void createViewPanel();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events from the horizontal bar
+       //------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Handles the event wxEVT_TSBAR from the horizontal bar 
+       */
+       void onBarrange_Horizontal(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar  
+       */
+       void onActualChange_Bar_Horizontal(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_START from the horizontal bar   
+       */
+       void onStartChange_Bar_Horizontal(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_END from the horizontal bar     
+       */
+       void onEndChange_Bar_Horizontal(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_SELECTION_END from the horizontal bar 
+       */
+       void onSelectionEnd_Horizontal(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar   
+       */
+       void onMovedBar_Horizontal(wxCommandEvent& event);
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events from the vertical bar
+       //------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Handles the event wxEVT_TSBAR from the vertical bar   
+       */
+       void onBarrange_Vertical(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar    
+       */
+       void onActualChange_Bar_Vertical(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_START from the vertical bar     
+       */
+       void onStartChange_Bar_Vertical(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_END from the vertical bar       
+       */
+       void onEndChange_Bar_Vertical(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_SELECTION_END from the vertical bar   
+       */
+       void onSelectionEnd_Vertical(wxCommandEvent& event);
+       /**
+       * Handles the event wxEVT_TSBAR_MOVED from the vertical bar     
+       */
+       void onMovedBar_Vertical(wxCommandEvent& event);
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Sets the represented values of the vertical bar
+       * @param minRepresented In the minimum represented value of the bar
+       * @param maxRepresented In the maximum represented value of the bar
+       */
+       void setVerticalRepresentedValues( int minRepresented, int maxRepresented );
+
+       /**
+       * Sets the represented values of the horizontal bar
+       * @param minRepresented In the minimum represented value of the bar
+       * @param maxRepresented In the maximum represented value of the bar
+       */
+       void setHorizontalRepresentedValues( int minRepresented, int maxRepresented );
+
+       /**
+       * Gets the StartVertical value
+       * @return The StartVertical
+       */
+       int getStartVertical();
+       /**
+       * Gets the EndVertical value
+       * @return The EndVertical
+       */
+       int getEndVertical();
+       /**
+       * Gets the ActualVertical value
+       * @return The ActualVertical
+       */
+       int getActualVertical();
+
+       /**
+       * Sets the StartVertical value
+       * @param nwValue The new value for the StartVertical
+       */
+       void setStartVertical( int nwValue);
+       /**
+       * Sets the EndVertical value
+       * @param nwValue The new value for the EndVertical
+       */
+       void setEndVertical( int nwValue);
+       /**
+       * Sets the ActualVertical value
+       * @param nwValue The new value for the ActualVertical
+       */
+       void setActualVertical( int nwValue);
+
+       /**
+       * Gets the StartHorizontal value
+       * @return The StartHorizontal
+       */
+       int getStartHorizontal();
+       /**
+       * Gets the EndHorizontal value
+       * @return The EndHorizontal
+       */
+       int getEndHorizontal();
+       /**
+       * Gets the ActualHorizontal value
+       * @return The ActualHorizontal
+       */
+       int getActualHorizontal();
+
+       /**
+       * Sets the StartHorizontal value
+       * @param nwValue The new value for the StartHorizontal
+       */
+       void setStartHorizontal( int nwValue);
+       /**
+       * Sets the EndHorizontal value
+       * @param nwValue The new value for the EndHorizontal
+       */
+       void setEndHorizontal( int nwValue);
+       /**
+       * Sets the ActualHorizontal value
+       * @param nwValue The new value for the ActualHorizontal
+       */
+       void setActualHorizontal( int nwValue);
+
+       /**
+       * Sets the horizontal concept values and name
+       * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
+       * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
+       * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
+       * @param minShowed The minShowed value of the concept for setting at the horizontal bar
+       * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
+       * @param actualShow The actualShow value of the concept for setting at the horizontal bar
+       */
+       void setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow ); 
+
+       /**
+       * Sets the vertical concept values and name
+       * @param theVerticalConcept The name of the concept for setting at the vertical bar
+       * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
+       * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
+       * @param minShowed The minShowed value of the concept for setting at the vertical bar
+       * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
+       * @param actualShow The actualShow value of the concept for setting at the vertical bar
+       */
+       void setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
+       
+       /**
+       * Sets the horizontal concept name
+       * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
+       */
+       void setHorizontalConceptName( std::string theHorizontalConcept );
+
+       /**
+       * Gets the horizontal concept name
+       * @return _horizontalConcept The name of the concept for setting at the horizontal bar
+       */
+       std::string  getHorizontalConceptName(  );
+
+       /**
+       * Sets the vertical concept name
+       * @param theVerticalConcept The name of the concept for setting at the vertical bar
+       */
+       void setVerticalConceptName( std::string theVerticalConcept );
+
+       /**
+       * Gets the vertical concept name
+       * @return _verticalConcept The name of the concept for setting at the vertical bar
+       */
+       std::string  getVerticalConceptName(  );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void getSpacing( double * spacing );
+
+       wxVtkBaseView* getWxVtkBaseView();
+
+       double getCurrentDeep();
+       
+       void    SetVisibleAxis(bool ok);
+       int             GetX();
+       int             GetY();
+       int             GetZ();
+       void    Refresh();
+
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       /*
+       * Represents the outer sizer of the ContourViewPanel
+       */
+       wxFlexGridSizer* outSizer;
+
+       /*
+       * Represents the panel for viewing
+       */
+       wxMaracas_N_ViewersWidget * theViewPanel;
+       /*
+       * Represents the vertical barrange
+       */
+       mBarRange * _verticalBar;
+
+       /*
+       * Represents the horizontal barrange
+       */
+       mBarRange * _horizontalBar;
+
+       vtkImageData * showingVID;      
+
+       std::string _verticalConceptName;
+
+       std::string _horizontalConceptName;
+
+       double last_spacing[3];
+
+       bool _useVerticalBar;
+
+       bool _useHorizontalBar;
+       
+       wxEvtHandler * _eventHandler;
+       
+//EED
+       wxVtkMPR2DView * GetwxVtkMPR2DView();
+
+
+//     DECLARE_CLASS(wxContourViewPanel)
+       // any class wishing to process wxWindows events must use this macro
+       //DECLARE_EVENT_TABLE()
+
+};
+#endif // __wxContour_ViewPanel__
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ActionCommnadsID.h b/lib/Interface_ManagerContour_NDimensions/wxContour_ActionCommnadsID.h
new file mode 100644 (file)
index 0000000..b837306
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef __wxContour_ActionCommnadsID_h_INCLUDED_H__
+#define __wxContour_ActionCommnadsID_h_INCLUDED_H__
+
+//---------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_ActionCommnadsID {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       const static char CREATE_TOOL                                   = 'A'; //Manual contour
+       const static char CREATE_CONTOUR_KEY                    = 'B'; //Manual contour
+       const static char DELETE_TOOL                                   = 'C';
+       const static char DELETE_KEY                                    = 'D';
+       const static char HIDE_TOOL                                             = 'E';
+       const static char SHOW_TOOL                                             = 'F';
+       const static char COPY_TOOL                                             = 'G';
+       const static char PASTE_TOOL                                    = 'H';
+       const static char CHANGE_TOOL                                   = 'I';
+       const static char SPREAD_TOOL                                   = 'J';
+       const static char SELECT_TOOL                                   = 'K';
+       const static char EDIT_TOOL                                             = 'L';
+       const static char UNDO_TOOL                                             = 'M';
+       const static char REDO_TOOL                                             = 'N';
+       const static char CREATE_PREDEFINED_4SIDED              = 'O';
+       const static char SAVE_TOOL                                             = 'P';
+       const static char SAVE_KEY                                              = 'Q';
+       const static char OPEN_TOOL                                             = 'R';
+       const static char AUTOMATIQUESEGMENTATION_TOOL  = 'S';
+       const static char INFORMATIONCONTOUR_TOOL               = 'T';
+       const static char INTERFACECONFIGURATION_TOOL   = 'U';
+       const static char TEST_TOOL                                             = 'V';
+
+       
+};
+#endif // __wxContour_ActionCommnadsID_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_AutomaticFormsToolsPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_AutomaticFormsToolsPanel.cxx
new file mode 100644 (file)
index 0000000..573d8e8
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_AutomaticFormsToolsPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_AutomaticFormsToolsPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_AutomaticFormsToolsPanel.h
new file mode 100644 (file)
index 0000000..b07ec2d
--- /dev/null
@@ -0,0 +1,83 @@
+#ifndef __wxContour_AutomaticFormsToolsPanel_h_INCLUDED_H__
+#define __wxContour_AutomaticFormsToolsPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_AutomaticFormsToolsPanel.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_AutomaticFormsToolsPanel : public wxPanel {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       wxContour_AutomaticFormsToolsPanel();
+
+       ~wxContour_AutomaticFormsToolsPanel();
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_AutomaticFormsToolsPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.cxx
new file mode 100644 (file)
index 0000000..add11a0
--- /dev/null
@@ -0,0 +1,218 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_ButtonsBar.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include "wxContour_ActionCommnadsID.h"
+
+#include "wx/toolbar.h"
+#include "wx/log.h"
+#include "wx/image.h"
+#include "wx/filedlg.h"
+#include "wx/spinctrl.h"
+#include "wx/srchctrl.h"
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       wxContour_ButtonsBar :: wxContour_ButtonsBar( wxWindow* parent, wxWindowID id, const wxPoint& pos , const wxSize& size, long style, const wxString& name )
+       //:wxToolBar(parent, id, pos, size, style, name)
+       :wxPanel( parent, id)//, pos, size, style, name)
+       {
+               //SetToolBitmapSize(wxSize(16,16));
+               
+        _createContour_Button = new wxButton( this, -1, _T("+ New Contour"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::CREATE_TOOL );
+//             _createContour_Button->SetToolTip(_T("CTRL-N"));
+               Connect( _createContour_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _delete_Button = new wxButton( this, -1, _T("+ Delete"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::DELETE_TOOL );
+               _delete_Button->SetToolTip(_T("BACK SPACE or DELETE key"));
+               Connect( _delete_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+/*             
+               _hideContour_Button = new wxButton( this, -1, "Hide Contour", wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::HIDE_TOOL );
+               Connect( _hideContour_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _show_Button = new wxButton( this, -1, _T("Show"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::SHOW_TOOL );
+               Connect( _show_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+*/
+               _copy_Button = new wxButton( this, -1, _T("Copy"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::COPY_TOOL );
+               _copy_Button->SetToolTip(_T("CTRL-C"));
+               Connect( _copy_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _paste_Button = new wxButton( this, -1, _T("Paste"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::PASTE_TOOL );
+               _paste_Button->SetToolTip(_T("CTRL-V"));
+               Connect( _paste_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _change_Button = new wxButton( this, -1, _T("    <-->  "), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::CHANGE_TOOL );
+               _change_Button->SetToolTip(_T("CTRL-K"));
+               Connect( _change_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _save_Button = new wxButton( this, -1, _T("Save"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::SAVE_TOOL );
+               _save_Button->SetToolTip(_T("CTRL-S"));
+               Connect( _save_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _open_Button = new wxButton( this, -1, _T("Open"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::OPEN_TOOL );
+               _open_Button->SetToolTip(_T("CTRL-O"));
+               Connect( _open_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+
+               _spread_Button = new wxButton( this, -1, _T("+ Spread"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::SPREAD_TOOL );
+//             _spread_Button->SetToolTip(_T("CTRL-XXXXXXX"));
+               Connect( _spread_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _automatiqueSegmentation_Button = new wxButton( this, -1, _T("+ Segmentation"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::AUTOMATIQUESEGMENTATION_TOOL );
+//             _automatiqueSegmentation_Button->SetToolTip(_T("CTRL-XXXXXXX"));
+               Connect( _automatiqueSegmentation_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+
+               _informationContour_Button = new wxButton( this, -1, _T("+ Information"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::INFORMATIONCONTOUR_TOOL );
+//             _informationContour_Button->SetToolTip(_T("CTRL-XXXXXXX"));
+               Connect( _informationContour_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _interfaceConfiguration_Button = new wxButton( this, -1, _T("+ Configuration"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::INTERFACECONFIGURATION_TOOL );
+//             _informationContour_Button->SetToolTip(_T("CTRL-XXXXXXX"));
+               Connect( _interfaceConfiguration_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+
+//Test button Methods A-B-C in  Juan Carlos Prieto 22-09-08
+               _interfaceTest_Button = new wxButton( this, -1, _T("+ Test"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::TEST_TOOL );
+//             _informationContour_Button->SetToolTip(_T("CTRL-XXXXXXX"));
+               Connect( _interfaceTest_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+
+/*
+               _spread_Button = new wxButton( this, -1, _T("Spread"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::SPREAD_TOOL );
+               Connect( _spread_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+               _select_Button = new wxButton( this, -1, _T("Select"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::SELECT_TOOL );
+               Connect( _select_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _edit_Button = new wxButton( this, -1, _T("Edit"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::EDIT_TOOL );
+               Connect( _edit_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _undo_Button = new wxButton( this, -1, _T("Undo"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::UNDO_TOOL );
+               Connect( _undo_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+
+               _redo_Button = new wxButton( this, -1, _T("Redo"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommnadsID::REDO_TOOL );
+               Connect( _redo_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+*/
+               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(9);
+               panelSizer -> Add( _createContour_Button, 1, wxGROW );
+/*
+               panelSizer -> Add( _hideContour_Button, 1, wxGROW );
+               panelSizer -> Add( _show_Button, 1, wxGROW );
+*/
+               panelSizer -> Add( _change_Button       , 1, wxGROW );
+               panelSizer -> Add( _copy_Button         , 1, wxGROW );
+               panelSizer -> Add( _paste_Button        , 1, wxGROW );
+               panelSizer -> Add( _delete_Button       , 1, wxGROW );
+               panelSizer -> Add( _save_Button         , 1, wxGROW );
+               panelSizer -> Add( _open_Button         , 1, wxGROW );
+               panelSizer -> Add( _spread_Button       , 1, wxGROW );
+               panelSizer -> Add( _automatiqueSegmentation_Button      , 1, wxGROW );
+               panelSizer -> Add( _informationContour_Button           , 1, wxGROW );
+               panelSizer -> Add( _interfaceConfiguration_Button       , 1, wxGROW );
+               panelSizer -> Add( _interfaceTest_Button        , 1, wxGROW );
+               
+/*
+               panelSizer -> Add( _select_Button, 1, wxGROW );
+               panelSizer -> Add( _edit_Button, 1, wxGROW );
+               panelSizer -> Add( _undo_Button, 1, wxGROW );
+               panelSizer -> Add( _redo_Button, 1, wxGROW );
+*/
+               
+               SetSizer( panelSizer );
+/*
+               this->AddControl( _createContour_Button );
+               AddSeparator();
+               this->AddControl( _hideContour_Button );
+*/
+               SetSize( wxSize( 1500, 80));
+               this->SetAutoLayout( true );
+               this->Layout();         
+       }
+
+       wxContour_ButtonsBar :: ~wxContour_ButtonsBar(  )
+       {
+               _eventHandler = NULL;
+               /*delete        _createContour_Button;
+               delete  _delete_Button;
+               delete  _hideContour_Button;
+               delete  _show_Button;
+               delete  _copy_Button;
+               delete  _paste_Button;
+               delete  _spread_Button;
+               delete  _select_Button;
+               delete  _edit_Button;
+               delete  _undo_Button;
+               delete  _redo_Button;*/         
+       }
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       void wxContour_ButtonsBar :: onActionButtonPressed( wxCommandEvent& event )
+       {
+               if(_eventHandler!=NULL)
+               {
+                       std::string theStr = std::string( ((wxButton *)event.GetEventObject())->GetName().ToAscii());
+                       const char * toolCommand = theStr.c_str();
+                       event.SetId( GetId() );
+                       event.SetEventObject( this );
+                       event.SetClientData( (void *) toolCommand);
+                       _eventHandler->ProcessEvent( event );
+               }
+       }               
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void wxContour_ButtonsBar :: sendEnvent( WXTYPE theEventType )
+       {
+               wxCommandEvent cevent( theEventType, GetId() );
+               cevent.SetEventObject( this );
+               _eventHandler->ProcessEvent( cevent );
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContour_ButtonsBar :: setWxEventHandler( wxEvtHandler * theEventHandler )
+       {
+               _eventHandler = theEventHandler;
+       }
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.h b/lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.h
new file mode 100644 (file)
index 0000000..017c316
--- /dev/null
@@ -0,0 +1,104 @@
+#ifndef __wxContour_ButtonsBar_h_INCLUDED_H__
+#define __wxContour_ButtonsBar_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <wx/event.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_ButtonsBar.h */
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_ButtonsBar : public /*wxToolBar {*/wxPanel {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       wxContour_ButtonsBar( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTB_HORIZONTAL | wxNO_BORDER, const wxString& name = wxPanelNameStr );
+
+       ~wxContour_ButtonsBar(  );
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       
+       void onActionButtonPressed( wxCommandEvent& event);
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       void setWxEventHandler( wxEvtHandler * theEventHandler );
+       
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxEvtHandler * _eventHandler;
+       
+       wxButton * _createContour_Button;
+       wxButton * _delete_Button;
+       wxButton * _hideContour_Button;
+       wxButton * _show_Button;
+       wxButton * _copy_Button;
+       wxButton * _paste_Button;
+       wxButton * _change_Button;
+       wxButton * _spread_Button;
+       wxButton * _select_Button;
+       wxButton * _edit_Button;
+       wxButton * _undo_Button;
+       wxButton * _redo_Button;        
+       wxButton * _save_Button;
+       wxButton * _open_Button;        
+       wxButton * _automatiqueSegmentation_Button;
+       wxButton * _informationContour_Button;
+       wxButton * _interfaceConfiguration_Button;
+       wxButton * _interfaceTest_Button;
+};
+
+#endif // __wxContour_ButtonsBar_HEADER_FILE__
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ControlPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_ControlPanel.cxx
new file mode 100644 (file)
index 0000000..6765669
--- /dev/null
@@ -0,0 +1,76 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_ControlPanel.h"
+
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include "wxContour_ListViewPanel.h"
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       wxContour_ControlPanel :: wxContour_ControlPanel(wxWindow * parent)
+       {
+/*             allContours = new wxContour_ListViewPanel (m_panel, LIST_CTRL, wxDefaultPosition, wxDefaultSize, flags | wxSUNKEN_BORDER | wxLC_EDIT_LABELS);
+               selectedContours = new wxContour_ListViewPanel (m_panel, LIST_CTRL, wxDefaultPosition, wxDefaultSize, flags | wxSUNKEN_BORDER | wxLC_EDIT_LABELS);
+               instantContours = new wxContour_ListViewPanel (m_panel, LIST_CTRL, wxDefaultPosition, wxDefaultSize, flags | wxSUNKEN_BORDER | wxLC_EDIT_LABELS);*/
+       }
+
+       wxContour_ControlPanel :: ~wxContour_ControlPanel()
+       {
+
+       }
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void wxContour_ListViewPanel :: sendEnvent( WXTYPE theEventType )
+       {
+
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ControlPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_ControlPanel.h
new file mode 100644 (file)
index 0000000..e68a623
--- /dev/null
@@ -0,0 +1,89 @@
+#ifndef __wxContour_ControlPanel_h_INCLUDED_H__
+#define __wxContour_ControlPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_ControlPanel.h */
+
+class wxContour_ListViewPanel;
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_ControlPanel : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       wxContour_ControlPanel(wxWindow * parent);
+
+
+       ~wxContour_ControlPanel();
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxContour_ListViewPanel * allContours;
+
+       wxContour_ListViewPanel * selectedContours;
+
+       wxContour_ListViewPanel * instantContours;
+
+};
+#endif // __wxContour_ControlPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_DrawToolsPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_DrawToolsPanel.cxx
new file mode 100644 (file)
index 0000000..217ae84
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_DrawToolsPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_DrawToolsPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_DrawToolsPanel.h
new file mode 100644 (file)
index 0000000..5abcfdd
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef __wxContour_DrawToolsPanel_h_INCLUDED_H__
+#define __wxContour_DrawToolsPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_DrawToolsPanel.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_DrawToolsPanel : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_DrawToolsPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_EdtionToolsPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_EdtionToolsPanel.cxx
new file mode 100644 (file)
index 0000000..4df7601
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_EdtionToolsPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_EdtionToolsPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_EdtionToolsPanel.h
new file mode 100644 (file)
index 0000000..986bae3
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef __wxContour_EdtionToolsPanel_h_INCLUDED_H__
+#define __wxContour_EdtionToolsPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_EdtionToolsPanel.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_EdtionToolsPanel : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_EdtionToolsPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_Grid.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_Grid.cxx
new file mode 100644 (file)
index 0000000..caf07b5
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_Grid.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_Grid.h b/lib/Interface_ManagerContour_NDimensions/wxContour_Grid.h
new file mode 100644 (file)
index 0000000..c87c24f
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef __wxContour_Grid_h_INCLUDED_H__
+#define __wxContour_Grid_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_Grid.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_Grid : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_Grid_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ListViewPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_ListViewPanel.cxx
new file mode 100644 (file)
index 0000000..9ac8a5c
--- /dev/null
@@ -0,0 +1,81 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_ListViewPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "wxContour_ControlPanel.h"
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       wxContour_ListViewPanel ::      wxContour_ListViewPanel(wxWindow *parent,const wxWindowID id, const wxPoint& pos,const wxSize& size,long style)
+     : wxListCtrl(parent, id, pos, size, style), itemsStyle(*wxBLUE, *wxLIGHT_GREY, wxNullFont)        
+       {
+
+       }
+
+       wxContour_ListViewPanel :: ~ wxContour_ListViewPanel()
+       {
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void wxContour_ListViewPanel :: sendEnvent( WXTYPE theEventType )
+       {
+
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxContour_ListViewPanel :: setContainerParent( wxContour_ControlPanel * theBuilder)
+       {
+
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_ListViewPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_ListViewPanel.h
new file mode 100644 (file)
index 0000000..5dd98e8
--- /dev/null
@@ -0,0 +1,130 @@
+#ifndef __wxContour_ListViewPanel_h_INCLUDED_H__
+#define __wxContour_ListViewPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <wx/listctrl.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_ListViewPanel.h */
+
+class wxContour_ControlPanel;
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_ListViewPanel : public wxListCtrl {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       wxContour_ListViewPanel(wxWindow *parent,const wxWindowID id, const wxPoint& pos,const wxSize& size,long style);
+
+       ~wxContour_ListViewPanel();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+        void InsertItemInReportView(int i);
+
+    void OnColClick(wxListEvent& event);
+    void OnColRightClick(wxListEvent& event);
+    void OnColBeginDrag(wxListEvent& event);
+    void OnColDragging(wxListEvent& event);
+    void OnColEndDrag(wxListEvent& event);
+    void OnBeginDrag(wxListEvent& event);
+    void OnBeginRDrag(wxListEvent& event);
+    void OnBeginLabelEdit(wxListEvent& event);
+    void OnEndLabelEdit(wxListEvent& event);
+    void OnDeleteItem(wxListEvent& event);
+    void OnDeleteAllItems(wxListEvent& event);
+
+    void OnGetInfo(wxListEvent& event);
+    void OnSetInfo(wxListEvent& event);
+
+    void OnSelected(wxListEvent& event);
+    void OnDeselected(wxListEvent& event);
+    void OnListKeyDown(wxListEvent& event);
+    void OnActivated(wxListEvent& event);
+    void OnFocused(wxListEvent& event);
+    void OnCacheHint(wxListEvent& event);
+
+    void OnChar(wxKeyEvent& event);
+
+    void OnContextMenu(wxContextMenuEvent& event);
+       void OnRightClick(wxMouseEvent& event);
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       void setContainerParent( wxContour_ControlPanel * theBuilder);
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+
+       void ShowContextMenu(const wxPoint& pos);
+    wxLog *m_logOld;
+    void SetColumnImage(int col, int image);
+
+       /*
+    void LogEvent(const wxListEvent& event, const wxChar *eventName);
+    void LogColEvent(const wxListEvent& event, const wxChar *eventName);
+       */
+
+    virtual wxString OnGetItemText(long item, long column) const;
+    virtual int OnGetItemColumnImage(long item, long column) const;
+    virtual wxListItemAttr *OnGetItemAttr(long item) const;
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       wxContour_ControlPanel * containerParent;
+
+       wxListItemAttr itemsStyle;
+
+};
+#endif // __wxContour_ListViewPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_MenuBar.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_MenuBar.cxx
new file mode 100644 (file)
index 0000000..305fdee
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_MenuBar.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_MenuBar.h b/lib/Interface_ManagerContour_NDimensions/wxContour_MenuBar.h
new file mode 100644 (file)
index 0000000..8540218
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef __wxContour_MenuBar_h_INCLUDED_H__
+#define __wxContour_MenuBar_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_MenuBar.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_MenuBar : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_MenuBar_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_OperationsToolsPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_OperationsToolsPanel.cxx
new file mode 100644 (file)
index 0000000..a8755b1
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_OperationsToolsPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_OperationsToolsPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_OperationsToolsPanel.h
new file mode 100644 (file)
index 0000000..047b210
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef __wxContour_OperationsToolsPanel_h_INCLUDED_H__
+#define __wxContour_OperationsToolsPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_OperationsToolsPanel.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_OperationsToolsPanel : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_OperationsToolsPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_StandardToolsPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContour_StandardToolsPanel.cxx
new file mode 100644 (file)
index 0000000..3bd9074
--- /dev/null
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxContour_StandardToolsPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxConceptControl.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+//DEFINE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE )
+
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
diff --git a/lib/Interface_ManagerContour_NDimensions/wxContour_StandardToolsPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContour_StandardToolsPanel.h
new file mode 100644 (file)
index 0000000..86fe4d9
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef __wxContour_StandardToolsPanel_h_INCLUDED_H__
+#define __wxContour_StandardToolsPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+/*BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_CONCEPT_RELEASE, -1 ) 
+END_DECLARE_EVENT_TYPES()*/
+
+/** file wxContour_StandardToolsPanel.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxContour_StandardToolsPanel : public wxScrolledWindow {
+
+               public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+                       
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType );
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+
+};
+#endif // __wxContour_StandardToolsPanel_HEADER_FILE__
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.cxx
new file mode 100644 (file)
index 0000000..96e77ab
--- /dev/null
@@ -0,0 +1,445 @@
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxInstantChooserPanel.h"
+#include "wxContourMainFrame.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------------------------------------------
+// Throwed Events definition
+//----------------------------------------------------------------------------------------------------------------
+
+
+DEFINE_EVENT_TYPE( wxINSTANT_CHOOSER_CHANGE )
+       
+
+/** @file wxInstantChooserPanel.cxx */
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+
+
+       wxInstantChooserPanel :: wxInstantChooserPanel (wxWindow * parent, std::string title, bool theOrientation, bool resolutionALL,std::string configurationElem, std::string groupConfig )
+       :wxPanel(parent, -1, wxPoint(20,20), wxDefaultSize, wxTAB_TRAVERSAL)
+       {
+               _lastConceptUpdated = NULL;             
+               _concepts = new std::vector<wxConceptControl*>();
+               _resolutionOverALL = resolutionALL;
+               _configuration = configurationElem;
+               //--- groupConfig -> format: ("## ## # ## "), #:any positive integer number, : space needed between the numbers and at the end of the string.
+               setVerticalMaxSelectedNums( groupConfig );
+               
+               //_configuration = "CCCc";
+               //setVerticalMaxSelectedNums( "1 2 3 3 ");//groupConfig );
+
+               SetSize(300,300);
+               _outSizer = new wxFlexGridSizer ( 1, 10, 10);
+               _orientation = theOrientation;
+               initializeResolutionSlider();
+               _actualInstant=new std::map<std::string,int>();
+               
+               wxFlexGridSizer * resolutionSizer = new wxFlexGridSizer( 3,1,10,10 );
+               resolutionSizer->AddSpacer(10);
+               resolutionSizer->Add( _resolutionSlider, 1, wxEXPAND | wxGROW );
+               resolutionSizer->AddSpacer(10);
+               
+               wxFlexGridSizer * sizer = new wxFlexGridSizer( 1,2,10,10 );
+               sizer->Add( _outSizer, 1, wxEXPAND| wxGROW );
+               sizer->Add( resolutionSizer, 1, wxEXPAND | wxGROW );
+               SetSizer( sizer );
+               Connect( wxID_ANY,  wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxInstantChooserPanel:: onChechBoxClicked );               
+
+       }
+
+       wxInstantChooserPanel ::wxInstantChooserPanel (wxWindow * parent,wxWindowID id ,std::string title, const wxPoint& pos, const wxSize& size , bool theOrientation, std::string configurationElem , std::string groupConfig  )
+               :wxPanel(parent, id ,pos, size) 
+       {
+               _lastConceptUpdated = NULL;             
+               _concepts = new std::vector<wxConceptControl*>();
+               _resolutionOverALL = false;
+               _configuration = configurationElem;
+               //--- groupConfig -> format: ("## ## # ## "), #:any positive integer number, : space needed between the numbers and at the end of the string.
+               setVerticalMaxSelectedNums( groupConfig );
+               
+               SetSize(size);
+               _outSizer = new wxFlexGridSizer ( 1, 10, 10);
+               _orientation = theOrientation;
+               initializeResolutionSlider();
+               _actualInstant=new std::map<std::string,int>();
+               wxFlexGridSizer * sizer = new wxFlexGridSizer( 1,2,10,10 );
+               sizer->Add( _outSizer, 1, wxEXPAND| wxGROW );
+               sizer->Add( _resolutionSlider, 1, wxEXPAND | wxGROW );
+               SetSizer( sizer );
+               Connect( wxID_ANY,  wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxInstantChooserPanel:: onChechBoxClicked );               
+       }
+
+       wxInstantChooserPanel :: ~wxInstantChooserPanel()
+       {
+               int size,i;
+               //deleting the _concepts
+               if(_concepts!=NULL)
+               {
+                       size=_concepts->size();
+                       for(i=0; i< size ; i++)
+                               {
+                                       delete (*_concepts)[i];
+                               }
+                       _concepts->clear();
+               }
+               _verticalMaxSelected.clear();
+               //deleting the actual instant
+               _actualInstant->clear();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Adds a concept to the instant managment. PRE: The concept doesn't exists in the included _concepts->
+       * @param aConceptName 
+       * @param minV
+       * @param maxV
+       * @param actualV
+       */
+       void wxInstantChooserPanel :: addConcept(std::string aConceptName, int minV, int maxV, int actualV)
+       {
+               wxConceptControl * nwConcept = new wxConceptControl(this, _orientation, minV, maxV, actualV, aConceptName, _configuration);
+               _concepts->push_back( nwConcept );
+               _lastConceptUpdated = nwConcept;
+               _outSizer->Add(nwConcept, wxEXPAND);
+               Connect(nwConcept->GetId(), wxEVT_CONCEPT_RELEASE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxInstantChooserPanel::onConceptRelease );
+       }
+
+       void wxInstantChooserPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
+       {
+               _eventHandler = theEventHandler;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: onResolutionSlider(wxScrollEvent& event)
+       {
+               std::string lasConcept = _lastConceptUpdated->getName();
+               int value = _lastConceptUpdated->getActualValue();
+               int min = _lastConceptUpdated->getMinValue();
+               int max = _lastConceptUpdated->getMaxValue();
+               int delta = (int) (pow( 2, _resolutionSlider->GetValue() ));
+               int minTmp   = value - delta/2;
+               int maxTmp   = value + delta/2;
+               if (minTmp<min)
+                       {
+                               minTmp = min;   
+                       }
+               if (maxTmp>max)
+                       {
+                               maxTmp = max;
+                       }                       
+               _lastConceptUpdated->setRange( minTmp,maxTmp );
+
+               if (! _resolutionOverALL)
+               {
+                       changeResolutionAtConceptControl( _lastConceptUpdated );
+               }
+               else
+               {
+                       for(int i=0; i<_concepts->size(); i++)
+                       {
+                               changeResolutionAtConceptControl( (*_concepts)[i] );
+                       }
+               }               
+
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: onChechBoxClicked( wxCommandEvent& event )
+       {
+               int groupID = (int)event.GetClientData();
+               wxConceptControl * eventConcept = (wxConceptControl *)event.GetEventObject();
+               if ( eventConcept->getIfChecked( groupID ) )
+               {
+                       int i,size = _concepts->size();
+                       wxConceptControl * aConcept = NULL;
+                       int accum = 0;          
+                       for( i=0; i<size; i++)
+                       {
+                               accum+= (*_concepts)[i]->getIfChecked( groupID ) ? 1 :0;
+                       }               
+                       for( i=0; i<size && _verticalMaxSelected[groupID] < accum; i++)
+                       {
+                               aConcept = (*_concepts)[i]; 
+                               if( aConcept!= eventConcept )
+                               {
+                                       if( aConcept->getIfChecked( groupID ) )
+                                       {       
+                                               aConcept->clearCheckAt( groupID );
+                                               accum--;
+                                       }                                       
+                               }
+                       }                                       
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: onConceptRelease( wxCommandEvent& event )
+       {
+               _lastConceptUpdated = (wxConceptControl*) event.GetEventObject();
+
+               std::vector<int> theInstant;
+        getInstant( theInstant );
+               //-------------------------------------------------
+               //  Sending the event of wxINSTANT_CHOOSER_CHANGE
+               //-------------------------------------------------
+               wxCommandEvent newevent(wxINSTANT_CHOOSER_CHANGE,GetId());  
+               _eventHandler->ProcessEvent(newevent);
+       }
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+               
+       ConceptDataWrap * wxInstantChooserPanel :: getLastConceptData()
+       {
+               ConceptDataWrap * conceptData = new ConceptDataWrap();
+               if( _lastConceptUpdated != NULL)
+               {
+                       conceptData -> fillData( _lastConceptUpdated->getName(), _lastConceptUpdated->getMinValue(), _lastConceptUpdated->getMaxValue(), _lastConceptUpdated->getMinShowedValue(), _lastConceptUpdated->getMaxShowedValue(), _lastConceptUpdated->getActualValue());
+               }
+               return conceptData;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxInstantChooserPanel :: setInstant(std::vector<int> choiceInstant)
+       {               
+               int max = _concepts->size();
+               if( choiceInstant.size() == max )
+               {
+                       int i = 0;
+                       while(i< max)
+                       {
+                               (*_concepts)[i]->setActualValue( choiceInstant[i] );
+                               i++;
+                       }
+               }
+       }
+       
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: getInstant(std::vector<int> & choiceInstant)
+       {
+               if(_concepts!=NULL)
+               {
+                       int i = 0;
+
+                       int size=_concepts->size();
+                       while( i< size )
+                       {
+                               choiceInstant.push_back( ((*_concepts))[i]->getActualValue());
+                               i++;
+                       }
+               }               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: setInstant(std::map<std::string,int>* _actualInstant )
+       {
+               int size,i;
+               size=_concepts->size();
+               std::map<std::string,int>::iterator iteratorActualInstant;
+               wxConceptControl* concepti;
+               std::string nameConcepti;
+               for(i=0;i<size;i++)
+               {
+                       concepti=(*_concepts)[i];
+                       nameConcepti=concepti->getName();
+                       iteratorActualInstant=_actualInstant->find(nameConcepti);
+                       if(iteratorActualInstant!=_actualInstant->end())
+                       {
+                               int actualValue=iteratorActualInstant->second;
+                               concepti->setActualValue(actualValue);
+                       }
+                       nameConcepti.clear();
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       std::map<std::string,int>* wxInstantChooserPanel :: getInstantData()
+       {
+               int size,i=0;   
+               wxConceptControl* concepti;
+               if(_concepts!=NULL)
+               {
+                       bool isEmpty=_actualInstant->empty();
+                       if(!isEmpty) _actualInstant->clear();
+                       size=_concepts->size();
+                       while( i< size )
+                       {
+                               concepti=(*_concepts)[i];
+                               _actualInstant->insert(std::pair<std::string,int>(concepti->getName(),concepti->getActualValue()));
+                               i++;
+                       }
+               }
+               return _actualInstant;          
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: getInstantData(std::map<std::string,int> & choiceInstantData)
+       {
+               int i = 0,size;
+               size=_concepts->size();
+               while(i< size)
+               {
+                       choiceInstantData.insert(std::pair < std::string, int> ((*_concepts)[i]->getName(), (*_concepts)[i]->getActualValue()));
+                       i++;
+               }
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: setResolutionRangeWithLasUpdate()
+       {
+               int minShow = _lastConceptUpdated->getMinShowedValue();
+               int maxShow = _lastConceptUpdated->getMaxShowedValue();
+               _resolutionSlider->SetRange( minShow, maxShow );
+       }
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: refreshConceptLabels()
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: setConfiguration(std::string aConfiguration)
+       {
+               _configuration = aConfiguration;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       std::string wxInstantChooserPanel :: getConfiguration()
+       {
+               return _configuration;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: setResolutionOverAll( bool condition )
+       {
+               _resolutionOverALL = condition;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool wxInstantChooserPanel :: getIfResolutionOverAll()
+       {
+               return _resolutionOverALL;
+       }
+
+   //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: initializeResolutionSlider()
+       {       
+               _resolutionSlider = new wxSlider(this , -1,5,1,8,wxDefaultPosition, wxSize(25,45), wxSL_LEFT | wxSL_AUTOTICKS  );               
+               Connect( _resolutionSlider->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, wxScrollEventHandler(wxInstantChooserPanel::onResolutionSlider));//(wxObjectEventFunction) &wxInstantChooserPanel::onResolutionSlider ); 
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: changeResolutionAtConceptControl( wxConceptControl * theConceptToUpdate )
+       {
+               int value = theConceptToUpdate->getActualValue();
+               int min = theConceptToUpdate->getMinValue();
+               int max = theConceptToUpdate->getMaxValue();
+               int delta = (int) (pow( 2, _resolutionSlider->GetValue() ));
+               int minTmp   = value - delta/2;
+               int maxTmp   = value + delta/2;
+               if (minTmp<min)
+               {
+                       minTmp = min;   
+               }
+               if (maxTmp>max)
+               {
+                       maxTmp = max;
+               }                       
+               theConceptToUpdate->setRange( minTmp,maxTmp );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: setVerticalMaxSelectedNums( std::string groupMaxVertNums )
+       {
+               int endSub;
+               std::string::size_type numberIndex = groupMaxVertNums.find(" ", 0);
+               std::string::size_type start = 0;
+               while( numberIndex != std::string::npos ) 
+               {       
+            endSub = numberIndex;
+                       std::string number = groupMaxVertNums.substr( 0, endSub );
+                       groupMaxVertNums.erase( 0, endSub+1 ); 
+                       int intReturn = atoi(number.c_str());                   
+                       if( intReturn>0 )
+                               _verticalMaxSelected.push_back(intReturn);      
+                       else
+                               _verticalMaxSelected.push_back( 1 );    
+                       start += numberIndex;
+                       numberIndex = groupMaxVertNums.find(" ", endSub);                       
+               }                               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxInstantChooserPanel :: setConceptValue( std::string theConceptName, int theValue )
+       {
+               int i, size = _concepts->size();
+               bool setted = false;
+               for ( i=0; i<size && !setted; i++ )
+               {       
+                       if( (*_concepts)[i]->getName().compare( theConceptName ) == 0 )
+                       {
+                               (*_concepts)[i]->setActualValue( theValue );
+                               setted = true;
+                       }
+               }
+       }
+       
+       //------------------------------------------------------------------------------------------------------------
+       int wxInstantChooserPanel :: getConceptValue( std::string theConceptName )
+       {
+               int i, size = _concepts->size();
+               int value = -1;
+               for ( i=0; i<size && value==-1; i++ )
+               {       
+                       if( (*_concepts)[i]->getName().compare( theConceptName ) == 0 )
+                       {
+                               value = (*_concepts)[i]->getActualValue(  );
+                       }
+               }
+               return value;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       ConceptDataWrap * wxInstantChooserPanel :: getConceptDataOf( std::string theConceptName )
+       {
+               ConceptDataWrap * conceptData = new ConceptDataWrap();
+
+               int i, size = _concepts->size();
+               int value = -1;
+               for ( i=0; i<size && value==-1; i++ )
+               {       
+                       if( (*_concepts)[i]->getName().compare( theConceptName ) == 0 )
+                       {               
+                               conceptData -> fillData( (*_concepts)[i]->getName(), (*_concepts)[i]->getMinValue(), (*_concepts)[i]->getMaxValue(), (*_concepts)[i]->getMinShowedValue(), (*_concepts)[i]->getMaxShowedValue(), (*_concepts)[i]->getActualValue());                    
+                       }
+               }
+               return conceptData;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool wxInstantChooserPanel :: getIfConceptCheckedAt( std::string theConceptName, int atChecksPosition )
+       {
+               bool isChecked = false;
+
+               int i,size = _concepts->size();
+               wxConceptControl * aConcept = NULL;                     
+               for ( i=0; i<size && !isChecked; i++ )
+               {       
+                       if( (*_concepts)[i]->getName().compare( theConceptName ) == 0 )
+                       {               
+                               isChecked = (*_concepts)[i]->getIfChecked( atChecksPosition );
+                       }
+               }
+
+               return isChecked;
+       }
\ No newline at end of file
diff --git a/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h b/lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h
new file mode 100644 (file)
index 0000000..0aceae3
--- /dev/null
@@ -0,0 +1,167 @@
+#ifndef __wxInstantChooserPanel_h_INCLUDED_H__
+#define __wxInstantChooserPanel_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <string>
+#include <vector>
+#include  "wxConceptControl.h"
+#include <map>
+#include "ConceptDataWrap.h"
+#include <wx/event.h>
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+
+BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE(wxINSTANT_CHOOSER_CHANGE,400)
+END_DECLARE_EVENT_TYPES()
+
+
+/** file wxInstantChooserPanel.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+
+class wxInstantChooserPanel : public wxPanel {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+       
+       wxInstantChooserPanel (wxWindow * parent, std::string title, bool theOrientation, bool resolutionALL = false, std::string configurationElem="", std::string groupConfig = "");
+
+       wxInstantChooserPanel (wxWindow * parent,wxWindowID id ,std::string title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, bool theOrientation=true, std::string configurationElem="", std::string groupConfig = "");
+
+       ~wxInstantChooserPanel();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Adds a concept to the instant managment. PRE: The concept doesn't exists in the included _concepts.
+       * @param aConceptName 
+       * @param minV
+       * @param maxV
+       * @param actualV
+       */
+       void addConcept(std::string aConceptName, int minV, int maxV, int actualV);
+
+       void setWxEventHandler( wxEvtHandler * theEventHandler );
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       void onResolutionSlider( wxScrollEvent& event );
+
+       void onChechBoxClicked( wxCommandEvent& event );
+
+       void onConceptRelease( wxCommandEvent& event );
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       ConceptDataWrap * getLastConceptData();
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+       
+       void setInstant(std::vector<int> choiceInstant);
+       
+       void setInstant(std::map<std::string,int>* _actualInstant );
+
+       void getInstant(std::vector<int> & choiceInstant);
+
+       void getInstantData(std::map<std::string,int> & choiceInstantData);
+
+       std::map<std::string,int>* getInstantData();
+
+       void setResolutionRangeWithLasUpdate();
+
+       void refreshConceptLabels();
+
+       void setConfiguration(std::string aConfiguration);
+
+       std::string getConfiguration();
+       
+       void setResolutionOverAll( bool condition );
+
+       bool getIfResolutionOverAll();
+
+       void setConceptValue( std::string theConceptName, int theValue );
+
+       int getConceptValue( std::string theConceptName );
+
+       ConceptDataWrap * getConceptDataOf( std::string theConceptName );
+
+       bool getIfConceptCheckedAt( std::string theConceptName, int atChecksPosition );
+
+       private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+       void initializeResolutionSlider();
+
+       void changeResolutionAtConceptControl( wxConceptControl * theConceptToUpdate );
+
+       void setVerticalMaxSelectedNums( std::string groupMaxVertNums );
+
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+
+       std::vector<wxConceptControl *> * _concepts;
+
+       wxConceptControl * _lastConceptUpdated;
+
+       wxSlider * _resolutionSlider;
+
+       wxFlexGridSizer * _outSizer;
+
+       bool _orientation;
+
+       bool _resolutionOverALL;
+       
+       std::map<std::string,int>* _actualInstant;
+
+       std::vector<int> _verticalMaxSelected;
+       
+       wxEvtHandler * _eventHandler;
+
+       std::string _configuration;
+    
+
+       //DECLARE_CLASS(wxInstantChooserPanel)
+       // any class wishing to process wxWindows events must use this macro
+       //DECLARE_EVENT_TABLE()
+
+};
+
+#endif 
diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx
new file mode 100644 (file)
index 0000000..ab12a96
--- /dev/null
@@ -0,0 +1,1199 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxVtkBaseView_SceneManager.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file wxVtkBaseView_SceneManager.cxx */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include "wxContour_ActionCommnadsID.h"
+
+//------------------------------------------------------------------------------------------------------------
+// Generated events declaration and definition
+//------------------------------------------------------------------------------------------------------------
+
+DEFINE_EVENT_TYPE( wxEVT_START_CREATE_MULT_ROI )       
+DEFINE_EVENT_TYPE( wxEVT_STOP_CREATE_MULT_ROI )        
+DEFINE_EVENT_TYPE( wxEVT_START_CREATE_ROI )
+DEFINE_EVENT_TYPE( wxEVT_STOP_CREATE_ROI )
+DEFINE_EVENT_TYPE( wxEVT_DELETE_ROI )
+DEFINE_EVENT_TYPE( wxEVT_SELECTED_MULT_ROI )   
+DEFINE_EVENT_TYPE( wxEVT_SELECTED_ROI )        
+DEFINE_EVENT_TYPE( wxEVT_UNSLECTED_ROI )       
+DEFINE_EVENT_TYPE( wxEVT_MANUAL_HIDED_ROI )
+DEFINE_EVENT_TYPE( wxEVT_MANUAL_SHOWED_ROI )
+DEFINE_EVENT_TYPE( wxEVT_EDITING_ROI ) 
+DEFINE_EVENT_TYPE( wxEVT_MOVING_ROI )  
+DEFINE_EVENT_TYPE( wxEVT_MOVING_ROI_POINT )    
+DEFINE_EVENT_TYPE( wxEVT_SELECTED_ROI_POINT )  
+DEFINE_EVENT_TYPE( wxEVT_UNSELECTED_ROI_POINT )        
+DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )        
+
+
+       wxVtkBaseView_SceneManager :: wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc )
+       {
+               _widthOfContour                                 = 1.0;
+               _lastInteraction                                = NULL;
+               _lastInteractionName                    = "";
+               _eventHandler                                   = theEventHandler;
+               _leftClickCount                                 = 0;
+               _rigthClickCount                                = 0;
+               
+               _contours_ViewControl                   = new std::map< std::string, ContourWrap_ViewControl * >();
+               _sceneContours_ViewControl              = new std::map< std::string, ContourWrap_ViewControl * >();
+               _workingGroup                                   = new std::map< std::string, ContourWrap_ViewControl * >();
+
+               _creatingMULT_ROI                               = false;
+               _editingROI                                             = false;
+               _toIncludeAtInteractionGroup    = false;
+               _waiting                                                = false;
+               _creatingROI                                    = false;
+               _drawingSelectionROI                    = false;
+
+               _wxVtk_BaseView = theWxBaseViewToManage;
+               if( _wxVtk_BaseView!=NULL )
+               {
+                       vtkInteractorStyleBaseView* theInteractorStyleBaseView = _wxVtk_BaseView->GetInteractorStyleBaseView();
+                       theInteractorStyleBaseView->AddInteractorStyleMaracas( this );
+                       SetVtkInteractorStyleBaseView( theInteractorStyleBaseView );                    
+               }
+               configureSelectionROI( spc );
+       }
+       //------------------------------------------------------------------------------------------------------------
+       wxVtkBaseView_SceneManager :: ~wxVtkBaseView_SceneManager()
+       {
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = _contours_ViewControl->begin(); 
+               int size = _contours_ViewControl->size();
+               for ( int i = 0; i<size; iter++ )
+               {
+                       _contours_ViewControl->erase( iter );
+                       i++;
+               }
+               delete _contours_ViewControl;
+               _contours_ViewControl->clear();         
+               _workingGroup->clear();
+               delete _lastInteraction;
+               delete _workingGroup;
+               delete _contours_ViewControl;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: sendEnvent( WXTYPE theEventType, std::string text )
+       {
+               if ( _eventHandler != NULL )
+               {
+                       wxCommandEvent cevent( theEventType );
+                       cevent.SetString( wxString( text.c_str(), wxConvUTF8) );
+                       _eventHandler->ProcessEvent( cevent );
+               }
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setWxEventHandler( wxEvtHandler * theEventHandler )
+       {
+               _eventHandler = theEventHandler;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setWxVtkViewBase( wxVtkBaseView * theBaseView )
+       {
+               _wxVtk_BaseView = theBaseView;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       wxVtkBaseView * wxVtkBaseView_SceneManager :: getWxVtkViewBase()
+       {
+               return _wxVtk_BaseView;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: configureViewControlTo( std::string theKeyName, manualContourModel * manModelContour, double * spc,int typeContour)
+       {
+               //setControlActiveStateOfALL( false );
+               _creatingROI = true;
+               _waiting = false;       
+               if( _lastInteraction!=NULL )
+               {
+                       _lastInteraction->getControler()->SetEditable( false );
+                       _lastInteraction->getViewer()->Refresh();
+                       _lastInteraction->getControler()->SetActive( false );
+                       this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+               }
+
+
+               manualContourBaseControler *manContourControl;
+               manualViewBaseContour           *manViewerContour;
+
+               // Creating the view manualViewContour and the manualContourControler
+               if (typeContour==1)
+               {
+                       manContourControl       = new manualContourControler();
+                       manViewerContour        = new manualViewContour();
+               }
+
+               if (typeContour==2)
+               {
+                       manContourControl       = new manualRoiControler();
+                       manViewerContour        = new manualViewRoi();
+               }
+
+               if (typeContour==3)
+               {
+                       manContourControl       = new manualCircleControler();
+                       manViewerContour        = new manualViewCircle();
+               }
+
+               if (typeContour==4)
+               {
+                       manContourControl       = new manualRoiControler();
+                       manViewerContour        = new manualViewBullEye();
+               }
+
+
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxVtkBaseView_SceneManager :: configureViewControlTo \n" );
+//fprintf(ff,"    %s %p \n",theKeyName.c_str() , manContourControl );
+//fclose(ff);
+
+
+        _lastInteraction = insertWrap( theKeyName, manContourControl, manViewerContour );
+               _lastInteractionName = theKeyName;
+
+               //Configuring the relations between the contour members representation                  
+               manViewerContour->SetModel( manModelContour );
+               manViewerContour->SetWxVtkBaseView( _wxVtk_BaseView );
+               manViewerContour->SetRange( 2 );
+               manViewerContour->SetZ( 1000 );
+
+               manViewerContour->SetSpacing(spc);
+
+               manViewerContour->SetColorNormalContour(0, 0, 1);
+               manViewerContour->SetColorEditContour(0.5, 0.5, 0.5);
+               manViewerContour->SetColorSelectContour(1, 0.8, 0);
+               manViewerContour->SetWidthLine(_widthOfContour);
+
+               manContourControl->SetModelView( manModelContour , manViewerContour );
+               manContourControl->Configure();
+               int i,sizeLstPoints = manModelContour->GetSizeLstPoints();
+               for ( i=0; i<sizeLstPoints; i++ )
+               {
+                       manViewerContour->AddPoint();
+               }
+
+               manContourControl->CreateNewManualContour();
+               manViewerContour->RefreshContour();                     
+               addToScene( theKeyName );
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: configureSelectionROI( double * spc )
+       {
+               _controlerSelectionROI = new manualRoiControler();
+               _viewerSelectionROI = new manualViewRoi();
+               _modelSelectionROI = new manualContourModel();
+               
+               _viewerSelectionROI->SetModel( _modelSelectionROI );
+               _viewerSelectionROI->SetWxVtkBaseView( _wxVtk_BaseView );
+               _viewerSelectionROI->SetRange( 2 );
+               _viewerSelectionROI->SetZ( 1000 );
+               _viewerSelectionROI->SetColorNormalContour(0.6, 0.8, 0);
+
+               _viewerSelectionROI->SetSpacing( spc );
+
+               _controlerSelectionROI->SetModelView( _modelSelectionROI , _viewerSelectionROI );
+               _wxVtk_BaseView->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _controlerSelectionROI );
+               _controlerSelectionROI->SetActive(false);
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour  * manViewerContour )
+       {       
+               ContourWrap_ViewControl * newContourWrap = new ContourWrap_ViewControl(manContourControl, manViewerContour);
+               _contours_ViewControl->insert(std::pair <std::string, ContourWrap_ViewControl *> ( theKeyName, newContourWrap ));
+               return newContourWrap;
+       } 
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: desconfigureViewControlOf( std::string theKeyName )
+       {
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: removeWrap( std::string theKeyName )
+       {
+               std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
+               iter = _contours_ViewControl->find( theKeyName );
+               _contours_ViewControl->erase( iter );
+               _lastInteraction=NULL;
+               _lastInteractionName = "";
+               _workingGroup->clear();
+               this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+               this->_vtkInteractorStyleBaseView->EvaluateToRefresh();
+       } 
+       //------------------------------------------------------------------------------------------------------------
+       ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf ( std::string theName )
+       {
+               std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
+               iter = _contours_ViewControl->find( theName );
+               return iter->second;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap )
+       {
+               std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
+               iter = theMap->find( theName );
+               return iter->second;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       manualContourBaseControler * wxVtkBaseView_SceneManager :: getControlerOf( std::string theName )
+       {
+               return getContourWrap_ViewControlOf ( theName )->getControler();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       manualViewBaseContour * wxVtkBaseView_SceneManager :: getViewerOf( std::string theName )
+       {
+               return getContourWrap_ViewControlOf ( theName )->getViewer();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: set_creatingMULT_ROI( bool condition )
+       {
+               _creatingMULT_ROI = condition;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: set_editingROI( bool condition )
+       {
+               _editingROI = condition;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: set_toIncludeAtInteractionGroup( bool condition )
+       {
+               _toIncludeAtInteractionGroup = condition;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: set_waiting( bool condition )
+       {
+               _waiting = condition;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool wxVtkBaseView_SceneManager :: get_creatingMULT_ROI(  )
+       {
+               return _creatingMULT_ROI;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool wxVtkBaseView_SceneManager :: get_editingROI(  )
+       {
+               return _editingROI;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool wxVtkBaseView_SceneManager :: get_toIncludeAtInteractionGroup(  )
+       {
+               return _toIncludeAtInteractionGroup;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       bool wxVtkBaseView_SceneManager :: get_waiting(  )
+       {
+               return _waiting;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       bool wxVtkBaseView_SceneManager :: get_creatingROI()
+       {
+               return _creatingROI;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: set_creatingROI( bool condition )
+       {
+               _creatingROI = condition;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxVtkBaseView_SceneManager :: createCopyContourOf( std::string anExistingKName, std::string cloneName, manualContourModel * manualModel, bool append )
+       {
+               if ( !append )
+               {
+                       setControlActiveStateOf( _workingGroup, false );
+                       _workingGroup->clear();
+               }
+        std::map <std::string, ContourWrap_ViewControl *>::iterator iter = NULL; 
+
+//EED Borrame
+// FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+// fprintf(ff,"EED wxVtkBaseView_SceneManager::createCopyContourOf() \n" );
+//     int ii,size = _contours_ViewControl->size();
+//     iter = _contours_ViewControl->begin();
+//    for (ii=0;ii<size;ii++)
+//     {
+//             fprintf(ff,"   %d  %s\n ", ii ,iter->first.c_str() );
+//             iter++;
+//     }
+//fclose(ff);
+
+               iter = _contours_ViewControl->find( anExistingKName );
+
+               manualContourModel                      *cModule        = manualModel;
+               manualViewBaseContour           *cViewer        = iter->second->getViewer()->Clone();
+               manualContourBaseControler      *cControl       = iter->second->getControler()->Clone(  );
+
+               cViewer->SetModel(cModule);
+               cControl->SetModelView( cModule , cViewer );
+               cControl->CreateNewManualContour();
+               cControl->SetActive( true );    
+               cControl->SetEditable( false );         
+
+        cViewer->RefreshContour();     
+               cViewer->Refresh();
+               this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+               this->_vtkInteractorStyleBaseView->EvaluateToRefresh();
+
+               _lastInteraction = insertWrap( cloneName, cControl, cViewer );
+               _workingGroup->insert(std::pair <std::string, ContourWrap_ViewControl *> ( cloneName, _lastInteraction ));              
+        addToScene( cloneName );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxVtkBaseView_SceneManager :: removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization, bool control )
+       {
+               if( contourWRP == _lastInteraction )
+               {
+                       _lastInteraction = NULL;
+                       _lastInteractionName = "";
+               }
+
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxVtkBaseView_SceneManager :: removeFromScene \n" );
+//fprintf(ff,"    %p \n", contourWRP->getControler() );
+//fclose(ff);
+
+               _wxVtk_BaseView->GetInteractorStyleBaseView()->RemoveInteractorStyleMaracas( contourWRP->getControler() );
+
+               contourWRP->getControler()->SetActive( control );       
+               contourWRP->getControler()->SetEditable( false );               
+
+               if ( !visualization && control )
+               {
+                       contourWRP->getViewer()->RemoveControlPoints( );
+                       contourWRP->getViewer()->RemoveTextActor( );
+               }
+               if ( visualization )
+               {
+                       contourWRP->getViewer()->RemoveCompleteContourActor();                  
+               }
+               
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: removeFromScene( std::string theKeyName, bool visualization , bool control )
+       {
+
+               std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
+               iter = _sceneContours_ViewControl->find( theKeyName );
+               if (iter != _sceneContours_ViewControl->end()){
+                       ContourWrap_ViewControl * contourWRP =   iter->second;
+                       removeFromScene( contourWRP );  
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxVtkBaseView_SceneManager :: removeFromScene Bbbbb \n" );
+//fprintf(ff,"    %d \n", _sceneContours_ViewControl->size() );
+                       _sceneContours_ViewControl->erase(iter);
+               }
+//EED Borrame
+//fprintf(ff,"    %d \n", _sceneContours_ViewControl->size() );
+//fclose(ff);
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       std::vector<std::string> wxVtkBaseView_SceneManager::GetlstContoursNameActualSlice()
+       {
+               std::vector<std::string> lstContoursNameActualSlice;
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = _sceneContours_ViewControl->begin(); 
+               int i,size = _sceneContours_ViewControl->size();
+               for ( i = 0; i<size; i++ )
+               {
+                       lstContoursNameActualSlice.push_back( iter->first );
+                       iter++;
+               }
+               return lstContoursNameActualSlice;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: removeSceneContours( )
+       {
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED wxVtkBaseView_SceneManager :: removeSceneContours  \n" );
+//fprintf(ff,"    %d \n", _sceneContours_ViewControl->size() );
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = _sceneContours_ViewControl->begin(); 
+               int size = _sceneContours_ViewControl->size();
+               for ( int i = 0; i<size; i++ )
+               {
+                       removeFromScene( iter->second );
+                       iter++;
+               }
+               _sceneContours_ViewControl->clear();
+
+//EED Borrame
+//fprintf(ff,"    %d \n", _sceneContours_ViewControl->size() );
+//fclose(ff);
+
+               //Removing the selection rectangle to avoid showing when it's innecesary
+               _controlerSelectionROI->SetActive( false );             
+               _viewerSelectionROI->RemoveCompleteContourActor();      
+       }
+
+       void wxVtkBaseView_SceneManager::removeAllOutlines()
+       {
+               manualViewBaseContour           * cViewer;
+               manualContourBaseControler      * cControler;
+
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter; 
+               int i,size=_contours_ViewControl->size();
+               for (i=0;i<size;i++)
+               {
+                       iter = _contours_ViewControl->begin(); 
+                       cControler      = iter->second->getControler();
+                       cViewer         = iter->second->getViewer();
+                       removeWrap( iter->first );
+                       delete cViewer;
+                       delete cControler;
+               }// for
+
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+       {
+               if( !append )
+               {
+                       removeSceneContours();                  
+               }
+               ContourWrap_ViewControl * contourWRP =  getContourWrap_ViewControlOf( theKeyName );
+               _sceneContours_ViewControl->insert(std::pair <std::string, ContourWrap_ViewControl *> ( theKeyName, contourWRP ) );             
+
+               addToScene( theKeyName, contourWRP, true, visualization, control, ifActive, ifShowCtrlPoints);
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+       {
+               if( !append )
+               {
+                       removeSceneContours();                  
+               }               
+               _sceneContours_ViewControl->insert(std::pair <std::string, ContourWrap_ViewControl *> ( theKeyName, contourWRP ) );             
+               if ( visualization )
+               {
+                       contourWRP->getViewer()->AddCompleteContourActor( ifShowCtrlPoints );
+               }
+
+               if( control )
+               {
+                       _wxVtk_BaseView->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( contourWRP->getControler() );
+               }
+               if( ifActive )
+               {
+                       contourWRP->getControler()->SetActive( true );  
+                       contourWRP->getViewer()->RemoveTextActor();
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: removeFromScene( std::vector< std::string> theKeyNameVector, bool visualization, bool control  )
+       {
+               int i, size = theKeyNameVector.size();
+               for( i=0; i< size; i++ )
+               {
+                       removeFromScene( theKeyNameVector[i], visualization, control );
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: addToScene( std::vector< std::string> theKeyNameVector, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
+       {
+               int i, size = theKeyNameVector.size();
+               for( i=0; i< size; i++ )
+               {
+                       addToScene( theKeyNameVector[i], append, visualization, control, ifActive, ifShowCtrlPoints );
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setControlActiveStateOfALL( bool stateCondition )
+       {
+               setControlActiveStateOf( _contours_ViewControl, stateCondition );                       
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setControlActiveStateOf( std::string theKeyName, bool stateCondition )
+       {
+               ContourWrap_ViewControl * contourWRP =  getContourWrap_ViewControlOf( theKeyName );
+               setControlActiveStateOf( contourWRP, stateCondition );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setControlActiveStateOf( ContourWrap_ViewControl * contourWRP, bool stateCondition )
+       {
+               contourWRP->getControler()->SetActive( stateCondition );        
+               contourWRP->getControler()->SetEditable( false );               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setVisibleStateOf( std::string theKeyName, bool stateCondition )
+       {
+               ContourWrap_ViewControl * contourWRP =  getContourWrap_ViewControlOf( theKeyName );
+//             contourWRP->getViewer()->SetVisible( stateCondition );
+               if ( contourWRP!=NULL )
+                       removeFromScene( contourWRP, false, stateCondition );
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       std::vector< std::string > wxVtkBaseView_SceneManager :: getSelectedObjects()
+       {
+               std::vector< std::string > selectedObjects;
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = _workingGroup->begin(); 
+               int size = _workingGroup->size();
+               for ( int i = 0; i<size; i++ )
+               {
+                       manualViewBaseContour * viewer = iter->second->getViewer();
+                       selectedObjects.push_back( iter->first);        
+
+                       iter++;
+               }       
+               return selectedObjects;
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: selectObjects( std::vector< std::string > theExistingObjectsToSelect )
+       {
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = _contours_ViewControl->begin(); 
+               int size = _contours_ViewControl->size();       
+               bool selected;
+               /*for ( int i = 0; i<size; i++ )
+               {
+                       selected = false;
+                       manualViewBaseContour * viewer = iter->second->getViewer();     
+                       std::vector <std::string >::iterator iterIN;
+                       int a = 0;
+                       for( a = 0, iterIN = theExistingObjectsToSelect.begin() ; !selected && a < theExistingObjectsToSelect.size() ; a++ )
+                       {
+                               if( iter->first.compare( theExistingObjectsToSelect[i] ) )
+                               {                                       
+                                       viewer->SelectAllPoints( true );
+                                       viewer->SelectPosibleContour( true );           
+                                       selected = true;
+                                       theExistingObjectsToSelect.erase( iterIN );                                     
+                               }
+                               if( !selected )
+                                       iterIN++;
+                       }
+               }       */
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: selectObjects( std::map<std::string, ContourWrap_ViewControl *> * theMap )
+       {
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = theMap->begin(); 
+               int size = _contours_ViewControl->size();       
+               for ( int i = 0; i<size; i++ )
+               {
+                       manualViewBaseContour * viewer = iter->second->getViewer();     
+
+                       viewer->SetSelected( true );
+                       /*viewer->SelectAllPoints( true );
+                       viewer->SelectPosibleContour( true );*/         
+                       
+                       iter++;
+               }       
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setControlActiveStateOf( std::vector< std::string> &theKeyNameVector, bool controlCondition )
+       {
+               int i, size = theKeyNameVector.size();
+               for( i=0; i< size; i++ )
+               {
+                       setControlActiveStateOf( theKeyNameVector[i], controlCondition );
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setControlActiveStateOf( std::map<std::string, ContourWrap_ViewControl *> * theMap, bool controlCondition )
+       {
+               std::map<std::string, ContourWrap_ViewControl *>::iterator iter = theMap->begin();
+               int i, size = theMap->size();
+               for( i=0; i< size; i++ )
+               {
+                       removeFromScene( iter->second, false, controlCondition );               
+                       iter++;
+               }               
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+       //------------------------------------------------------------------------------------------------------------
+       // Inherited Methods
+       //------------------------------------------------------------------------------------------------------------
+
+       bool  wxVtkBaseView_SceneManager :: OnChar()
+       { 
+
+               bool ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1;
+               bool shiftKey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey() == 1;
+
+               _lastKeyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+               
+               
+               if( _eventHandler!=NULL )
+               {
+                       const char * toolCommand = NULL;
+
+                       if ( _lastKeyCode == 3 && ctrlKey ) //'C' || 'c' 
+                       {
+                               toolCommand = &(wxContour_ActionCommnadsID::COPY_TOOL);
+                       }
+                       else if(  _lastKeyCode == 22 && ctrlKey ) //'V' || 'v' 
+                       {
+                               toolCommand = &(wxContour_ActionCommnadsID::PASTE_TOOL);
+                       }
+                       else if(  _lastKeyCode == 8 || (_lastKeyCode==127) ) // Delete 
+                       {
+                               toolCommand = &(wxContour_ActionCommnadsID::DELETE_KEY);
+                       }
+                       else if(  _lastKeyCode == 14 && ctrlKey ) //'N' || 'n' 
+                       {
+                               toolCommand = &(wxContour_ActionCommnadsID::CREATE_CONTOUR_KEY);
+                       }
+                       else if(  _lastKeyCode == 15 && ctrlKey ) //'O' || 'o' 
+                       {
+                               toolCommand = &(wxContour_ActionCommnadsID::OPEN_TOOL);
+                       }
+                       else if(  _lastKeyCode == 19 && ctrlKey ) //'S' || 's' 
+                       {
+                               toolCommand = &(wxContour_ActionCommnadsID::SAVE_KEY);
+                       }
+
+                       if ( toolCommand!=NULL )
+                       {
+                               wxCommandEvent cevent( wxEVT_COMMAND_BUTTON_CLICKED );
+                               cevent.SetClientData( (void *) toolCommand);
+                               _eventHandler->ProcessEvent( cevent );
+                       }                               
+               }
+               
+       
+       //      long int endtime = clock();             
+
+               return true; 
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       bool  wxVtkBaseView_SceneManager :: OnMouseMove()
+       { 
+//EED Borrame
+// FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+// fprintf(ff,"EED wxVtkBaseView_SceneManager::OnMouseMove() \n" );
+// fclose(ff);
+
+               bool condition = true;  
+               int X,Y;
+               wxVTKRenderWindowInteractor *_wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+               _wxVTKiren->GetEventPosition( X , Y );
+
+               bool ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1;
+               bool shiftKey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey() == 1;
+
+               if( _waiting && !ctrlKey )
+               {
+                       sendEnvent( wxEVT_CHANGED_DEEP, "Update");
+                       //toca ver como decirle al viewer que no se mueva mientras no se este esperando que se pueda mover                      
+               }
+               
+               if ( !_creatingROI && !_creatingMULT_ROI )
+               {
+                       
+                       /*if( ctrlKey || shiftKey )
+                       {
+                               
+                       }
+                       else
+                       {
+                               _toIncludeAtInteractionGroup = false;
+                       }*/
+                       
+                       bool preserveState = _lastInteraction!=NULL? _lastInteraction->getViewer()->GetSelected() : false;
+                       std::string preservingName = preserveState ? _lastInteractionName : "";
+
+                       std::map<std::string, ContourWrap_ViewControl *>::iterator iter = _sceneContours_ViewControl->begin();
+                       int i, size = _sceneContours_ViewControl->size();
+                       bool foundOne = false;
+
+                       manualContourBaseControler      * control       = _lastInteraction != NULL ? _lastInteraction->getControler() : NULL;
+                       manualViewBaseContour           * viewer        = NULL; 
+                       
+                       
+                       bool singleMoving = true;
+                       int selectionSize = _workingGroup->size();
+                       if( selectionSize > 1 ) 
+                       {
+                               //Multiple moving
+                               
+                               bool ckecking = false;
+                               for( i =0; i<size ; i++ ) 
+                               {
+                                       control = iter->second->getControler();
+                                       viewer = iter->second->getViewer();
+                                       /*ckecking = */control->SetActive( true );
+                               }
+                               if (_lastInteraction != NULL)
+                               {
+                                       singleMoving = !_lastInteraction->getViewer()->GetSelected();
+
+                               }
+                               if( !singleMoving )
+                               {
+                                       size = selectionSize;
+                                       iter = _workingGroup->begin();
+                               }
+                       }                       
+                       else
+                       {
+                               
+                               _toIncludeAtInteractionGroup = false;
+                       }
+                       
+                       if( ((_lastInteraction != NULL && !control->IsEditable() && !control->IsMoving() ) || _lastInteraction==NULL ))
+                       {                                       
+//EED Borrame
+// FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+// fprintf(ff,"EED wxVtkBaseView_SceneManager::OnMouseMove() 00222\n" );
+// fclose(ff);
+                        _lastInteraction=NULL;
+                               for( i =0; i<size ; i++ )
+                               {
+                                       control = iter->second->getControler();
+                                       viewer = iter->second->getViewer();
+//                                     _wxVtk_BaseView->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( control );
+                                       control->SetActive( true );                                     
+                                       
+                                       foundOne = control->OnMouseMove();
+                                       foundOne &= viewer->GetPosibleSelected();                               
+                                       
+                                       if ( !foundOne && singleMoving )
+                                       {
+                                               control->SetActive( false );
+//                                             _wxVtk_BaseView->GetInteractorStyleBaseView()->RemoveInteractorStyleMaracas( control );
+                                               control->SetPosibleToMove( false );
+                                       }
+                                       else
+                                       {                                               
+                                               if( _toIncludeAtInteractionGroup && preserveState && _lastInteractionName.compare( preservingName)==0 )
+                                               {
+                                                       _lastInteraction->getControler()->SetActive( true );
+                                               }
+
+                                               _lastInteraction                = iter->second;
+                                               _lastInteractionName    = iter->first;
+
+                                               viewer->UpdateColorActor();
+                                               control->SetPosibleToMove( true );                                              
+                                               // viewer->AddCompleteContourActor();
+                                       }
+                                       iter++;
+                               }
+                               control = NULL;
+                               viewer = NULL;  
+                       }                               
+               }
+               return condition;       
+       }
+
+
+
+
+
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnLeftButtonDown()
+       { 
+
+               /*FILE *ff;
+               ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+               long int endtime = clock();
+//             double sg = (double)(endtime-startTimeAE) / (double)CLK_TCK;
+               fprintf(ff,"wxVtkBaseView_SceneManager :: OnLeftButtonDown() tLBDown = %i \n  \n",endtime);
+               fclose(ff);*/
+
+
+               char aa = _vtkInteractorStyleBaseView->GetInteractor()->GetKeyCode();
+               bool condition = false;  
+               //vtkCommand * theComand = _wxVtk_BaseView ->GetInteractorStyleBaseView()->GetCommand(
+               vtkRenderWindowInteractor               * vtkRWInteractor1      = _wxVtk_BaseView ->GetWxVTKRenderWindowInteractor(); 
+               wxVTKRenderWindowInteractor             * vtkRWInteractor2      = _wxVtk_BaseView ->GetWxVTKRenderWindowInteractor();//GetInteractorStyleBaseView()->GetInteractor();
+               wxVTKRenderWindowInteractorPlus * vtkRWInteractor3      = (wxVTKRenderWindowInteractorPlus*)_wxVtk_BaseView ->GetWxVTKRenderWindowInteractor();//GetInteractorStyleBaseView()->GetInteractor();
+               vtkRenderWindowInteractor               * vtkRWInteractor       = _vtkInteractorStyleBaseView->GetInteractor();
+               
+               bool ctrlKey = vtkRWInteractor->GetControlKey() == 1;
+               bool shftKey = vtkRWInteractor->GetShiftKey() == 1;
+               _toIncludeAtInteractionGroup = false;
+               if ( ctrlKey || shftKey )
+               {
+                       _toIncludeAtInteractionGroup = true;                    
+               }
+               else
+               {
+                       if( _lastInteraction!=NULL && !_toIncludeAtInteractionGroup )
+                       {
+                               if( _lastInteraction->getControler()->GetIfCompleteCreation() && !_lastInteraction->getControler()->IsEditable()&& !_lastInteraction->getViewer()->GetPosibleSelected() )
+                               {
+                                       _lastInteraction->getControler()->SetEditable( false );
+                                       _lastInteraction->getControler()->SetActive( false ); 
+                                       _lastInteraction->getControler()->SetPosibleToMove( false );
+                                       _lastInteraction->getViewer()->Refresh();
+                                       _lastInteraction=NULL;
+                               }
+                       }
+               }
+
+
+
+               if( !_toIncludeAtInteractionGroup )
+               {
+                       _workingGroup->clear();
+               }
+
+               if( _lastInteraction!=NULL )
+               {
+                       _toIncludeAtInteractionGroup = !_lastInteraction->getControler()->IsEditable();
+                       _toIncludeAtInteractionGroup &= _lastInteraction->getViewer()->GetSelected();
+                       _workingGroup->insert(std::pair <std::string, ContourWrap_ViewControl *> ( _lastInteractionName, _lastInteraction ));   
+               }
+               if( _creatingMULT_ROI && !_creatingROI && !ctrlKey  && !shftKey )
+               {
+                       _creatingROI = true;
+                       //setControlActiveStateOf( _contours_ViewControl, false );
+                       sendEnvent( wxEVT_START_CREATE_ROI, "");
+               }                       
+               condition = true; 
+
+// FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+// fprintf(ff,"EED wxVtkBaseView_SceneManager::OnLeftButtonDown() contours=%d  sceneContour=%d  workingContours=%d\n",
+//                                     _contours_ViewControl->size(), _sceneContours_ViewControl->size(), _workingGroup->size() );
+// fclose(ff);
+
+
+               return condition;       
+       } 
+
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnLeftButtonUp()
+       {
+               bool condition = false; 
+               condition = true; 
+                               
+               if( _drawingSelectionROI )
+               {
+                       setSelection2DROIInternalOutlines();
+               }
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnMiddleButtonDown()
+       {
+               bool condition = false; 
+               condition = true; 
+                       
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnMiddleButtonUp()
+       {
+               bool condition = false; 
+               condition = true; 
+                       
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnRightButtonDown()
+       {
+               bool condition = false; 
+               vtkRenderWindowInteractor * vtkRWInteractor = _vtkInteractorStyleBaseView->GetInteractor();
+               bool ctrlKey = vtkRWInteractor->GetControlKey() == 1;
+               _waiting = true; 
+               
+               condition = true;               
+               
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnRightButtonUp()
+       {
+               bool condition = false; 
+               condition = true; 
+               //setControlActiveStateOfALL( false );//************************************************
+               if ( _creatingMULT_ROI )
+               {
+                       //setControlActiveStateOfALL( false );
+               }
+               if( _creatingROI )
+               {
+                       sendEnvent( wxEVT_STOP_CREATE_ROI, "Activate");
+                       _creatingROI = false;
+               }
+               else
+               {
+                       if(_lastInteraction!=NULL && !_toIncludeAtInteractionGroup)
+                       {
+                               manualContourBaseControler * control = _lastInteraction->getControler();
+                               //_lastInteraction->getControler()->SetPosibleToMove( false );
+                               control->SetActive( false );
+                               control->SetEditable( false );                          
+                               _wxVtk_BaseView->GetInteractorStyleBaseView()->RemoveInteractorStyleMaracas( control );
+                               _lastInteraction->getViewer()->Refresh();                       
+                               this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+                       }       
+               }
+               _waiting = false; 
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       bool  wxVtkBaseView_SceneManager :: OnLeftDClick()
+       {
+               bool condition = false; 
+               condition = true; 
+               
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnRightDClick()
+       { 
+               bool condition = false;  condition = true; 
+               vtkRenderWindowInteractor * vtkRWInteractor = _vtkInteractorStyleBaseView->GetInteractor();
+               /*vtkRenderWindowInteractor * vtkRWInteractor1 =*/ _vtkInteractorStyleBaseView->OnChar();
+               wxVTKRenderWindowInteractor * wxVtkRWInterator = _wxVtk_BaseView ->GetWxVTKRenderWindowInteractor();
+               
+               /*if( _waiting )
+               {
+                       sendEnvent( wxEVT_START_CREATE_MULT_ROI, "Multiple");
+                       set_creatingMULT_ROI( !_creatingMULT_ROI );
+                       _waiting = false;
+               }
+               else
+                       _waiting = true;*/
+
+               return condition;       
+       }  
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnMiddleDClick()
+       {
+               bool condition = false; 
+               condition = true; 
+               
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+       bool  wxVtkBaseView_SceneManager :: OnMouseWheel()
+       {
+               bool condition = false; 
+               condition = true; 
+               return condition;       
+       }
+       //------------------------------------------------------------------------------------------------------------
+
+       void wxVtkBaseView_SceneManager :: drawSelectionROI()
+       {
+               _drawingSelectionROI = true;
+               _workingGroup->clear();
+               _controlerSelectionROI->CreateNewManualContour();       
+               if (_lastInteraction!=NULL)
+               {
+                       _lastInteraction->getControler()->SetEditable( false );
+                       _lastInteraction->getControler()->SetActive( false ); 
+                       _lastInteraction->getControler()->SetPosibleToMove( false );
+                       _lastInteraction->getViewer()->Refresh();
+               }
+               std::map<std::string, ContourWrap_ViewControl *>::iterator iter = _workingGroup->begin();
+               int i, workSize = _workingGroup->size();
+               for( i=0; i< workSize; i++ )
+               {
+                       manualContourBaseControler * control = iter->second->getControler();
+                       control->SetEditable( false );
+                       control->SetActive( false );
+                       control->SetPosibleToMove( false );
+                       iter->second->getViewer()->Refresh();
+
+                       iter++;
+               }
+               _lastInteraction = NULL;
+               _lastInteractionName = "";
+
+               _viewerSelectionROI->AddCompleteContourActor( true );   
+               _controlerSelectionROI->SetActive( true );
+               
+               _viewerSelectionROI->RefreshContour();
+               this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: setSelection2DROIInternalOutlines( )
+       {
+               _drawingSelectionROI = false;
+               _workingGroup->clear();
+               double minX,minY,maxX,maxY, minX_ROI,minY_ROI,maxX_ROI,maxY_ROI;
+               double minZ = -1.0;
+               double maxZ = -1.0;
+               std::map<std::string, ContourWrap_ViewControl *>::iterator iter = _sceneContours_ViewControl->begin();
+               int i, size = _sceneContours_ViewControl->size();
+               _viewerSelectionROI->GetMinMax( minX_ROI, minY_ROI, maxX_ROI, maxY_ROI );
+               manualViewBaseContour * viewer;
+               bool insideRoi = false;
+               for ( i=0; i<size; i++ )
+               {
+                       viewer = iter->second->getViewer();
+                       viewer->GetMinMax( minX, minY, minZ, maxX, maxY, maxZ );
+                       insideRoi = minX >= minX_ROI && maxX <= maxX_ROI && minY_ROI && maxY <= maxY_ROI;
+                       if ( insideRoi )
+                       {
+                               viewer->SetSelected( true );
+                               viewer->UpdateColorActor();
+                               setControlActiveStateOf( iter->second, true );
+                               _workingGroup->insert(std::pair <std::string, ContourWrap_ViewControl *> ( iter->first, iter->second ));
+                       }
+                       iter++;
+               }   
+               _viewerSelectionROI->RemoveCompleteContourActor( );     
+               _controlerSelectionROI->SetActive( false );
+       }
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager :: writeCoords( std::string method )
+       {
+               FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+               long int start = clock();
+               double sg = (double)(start) / (double)CLK_TCK;
+               int tmpPx,tmpPy;
+               wxVTKRenderWindowInteractor *wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition( tmpPx , tmpPy );
+               fprintf(ff,"::%s (x,y) = (%i, %i) t(sg): \n  \n",method, tmpPx, tmpPy, sg);
+               fclose(ff);
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager::SaveThingName(FILE *ff, std::string nameThing)
+       {
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter = _contours_ViewControl->find(nameThing); 
+               manualViewBaseContour           * cViewer;
+               manualContourBaseControler      * cControler;
+               ContourWrap_ViewControl *conwraviwcont=iter->second;
+
+               cViewer         = conwraviwcont->getViewer();
+               cViewer->Save(ff);
+
+               cControler      = conwraviwcont->getControler();
+//             cControler->Save(ff);
+
+//             cModel          = cControler->GetManualContourModel();
+//             cModel->Save(ff);
+       }
+
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
+       {
+               std::vector<std::string> currentSelection = this->getSelectedObjects();
+               if (currentSelection.size()>=1){
+                       
+                       manualContourBaseControler *cControler  = this->getControlerOf( currentSelection[0] );
+                       manualContourModel *cModel                              = cControler->GetManualContourModel();
+                       int i,size = cModel->GetNumberOfPointsSpline();
+                       double x,y,z;
+                       for (i=0; i<size; i++) 
+                       {
+                               cModel->GetSpline_i_Point(i, &x, &y, &z);
+                               vecX->push_back(x);
+                               vecY->push_back(y);
+                               vecZ->push_back(z);
+                       }
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       vtkImageData *wxVtkBaseView_SceneManager::GetImageData()
+       {
+               wxVtk2DBaseView *wxvtk2dbaseview =(wxVtk2DBaseView*)_wxVtk_BaseView;
+               return wxvtk2dbaseview->GetVtkBaseData()->GetImageData();
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       int wxVtkBaseView_SceneManager::GetImageDataSizeZ()
+       {
+                       int ext[6];
+                       vtkImageData    *imagedata      = GetImageData();
+                       imagedata->GetExtent(ext);
+                       int sizeZ = ext[5]-ext[4]+1;
+
+//EED OJO   Machete
+//                     sizeZ = sizeZ-1;
+
+                       return sizeZ;
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager::GetImageDataRange( double *range )
+       {
+               int ext[6];
+               vtkImageData    *imagedata      = GetImageData();
+               imagedata->GetExtent(ext);
+               int sizeX       = ext[1]-ext[0]+1;
+               int sizeY       = ext[3]-ext[2]+1;
+               int sizeZ       = GetImageDataSizeZ();
+               int sizeXYZ = sizeX*sizeY*sizeZ;
+               long int i;
+               range[0]=9999999;
+               range[1]=-9999999;
+               unsigned short *p = (unsigned short *)imagedata->GetScalarPointer(0,0,0);
+               for (i=0;i<sizeXYZ;i++)
+               {
+                       if ( p[i]<range[0] ) range[0]=p[i];
+                       if ( p[i]>range[1] ) range[1]=p[i]; 
+               }
+       }
+
+       //------------------------------------------------------------------------------------------------------------
+       void wxVtkBaseView_SceneManager::SetWidthContour(double width)
+       {
+               _widthOfContour = width;
+               manualViewBaseContour           *cViewer;
+               ContourWrap_ViewControl         *conwraviwcont;
+               std::map <std::string, ContourWrap_ViewControl *>::iterator iter;; 
+
+               for (iter=_contours_ViewControl->begin(); iter!=_contours_ViewControl->end(); iter++ )
+               {
+                       conwraviwcont   = iter->second;
+                       cViewer                 = conwraviwcont->getViewer();
+                       cViewer->SetWidthLine(_widthOfContour);
+               }
+       }
diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h
new file mode 100644 (file)
index 0000000..49d2ca6
--- /dev/null
@@ -0,0 +1,205 @@
+#ifndef __wxVtkBaseView_SceneManager_h_INCLUDED_H__
+#define __wxVtkBaseView_SceneManager_h_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "ContourWrap_ViewControl.h"
+#include "wxVtkBaseView.h"
+#include <iostream>
+#include <map>
+#include <manualContour.h>
+#include <wx/event.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Events declaration
+//------------------------------------------------------------------------------------------------------------
+BEGIN_DECLARE_EVENT_TYPES()
+       DECLARE_EVENT_TYPE( wxEVT_START_CREATE_MULT_ROI, -1 )   
+       DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_MULT_ROI, -1 )    
+       DECLARE_EVENT_TYPE( wxEVT_SELECTED_MULT_ROI, -1 )       
+       DECLARE_EVENT_TYPE( wxEVT_START_CREATE_ROI, -1 )
+       DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_ROI, -1)
+       DECLARE_EVENT_TYPE( wxEVT_DELETE_ROI, -1 )
+       DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI, -1 )    
+       DECLARE_EVENT_TYPE( wxEVT_UNSLECTED_ROI, -1 )   
+       DECLARE_EVENT_TYPE( wxEVT_MANUAL_HIDED_ROI, -1 )        
+       DECLARE_EVENT_TYPE( wxEVT_MANUAL_SHOWED_ROI, -1 )
+       DECLARE_EVENT_TYPE( wxEVT_EDITING_ROI, -1 )     
+       DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI, -1 )      
+       DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI_POINT, -1 )        
+       DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI_POINT, -1 )      
+       DECLARE_EVENT_TYPE( wxEVT_UNSELECTED_ROI_POINT, -1 )                    
+       DECLARE_EVENT_TYPE( wxEVT_CHANGED_DEEP, -1 )
+END_DECLARE_EVENT_TYPES()
+
+/** file wxVtkBaseView_SceneManager.h */
+
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
+
+       public:
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constructors & Destructors
+       //------------------------------------------------------------------------------------------------------------
+
+       wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
+       ~wxVtkBaseView_SceneManager();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Methods for capturing events
+       //------------------------------------------------------------------------------------------------------------
+       
+               
+       //------------------------------------------------------------------------------------------------------------
+       //  Methods for sending events
+       //------------------------------------------------------------------------------------------------------------
+       void sendEnvent( WXTYPE theEventType, std::string text );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Attributes getters and setters
+       //------------------------------------------------------------------------------------------------------------
+       
+       void setWxVtkViewBase( wxVtkBaseView * theBaseView );
+       void setWxEventHandler( wxEvtHandler * theEventHandler );
+       wxVtkBaseView * getWxVtkViewBase();
+       void configureViewControlTo( std::string theKeyName, manualContourModel * manContourControl, double * spc ,int typeContour);
+       void configureSelectionROI( double * spc );
+       ContourWrap_ViewControl * insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour  * manViewerContour ); 
+       void desconfigureViewControlOf( std::string theKeyName );
+       void removeWrap( std::string theKeyName );
+       ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName );
+       ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap );
+       manualContourBaseControler * getControlerOf( std::string theName );
+       manualViewBaseContour * getViewerOf( std::string theName );
+       void set_creatingMULT_ROI( bool condition );
+       void set_editingROI( bool condition );
+       void set_toIncludeAtInteractionGroup( bool condition );
+       void set_waiting( bool condition );
+       bool get_creatingMULT_ROI(  );
+       bool get_editingROI(  );
+       bool get_toIncludeAtInteractionGroup(  );
+       bool get_waiting(  );
+       bool get_creatingROI();
+       void set_creatingROI( bool theCondition );
+
+       //------------------------------------------------------------------------------------------------------------
+       //  Other functional methods
+       //------------------------------------------------------------------------------------------------------------
+
+       void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualContourModel * manualModel, bool append = false );
+       void removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization = true, bool control = true );
+       void removeFromScene( std::string theKeyName, bool visualization = true, bool control = true );
+       void removeSceneContours( );
+       void removeAllOutlines();
+       void addToScene( std::string theKeyName, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
+       void addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
+       void removeFromScene( std::vector< std::string> theKeyNameVector, bool visualization = true, bool control = true );
+       void addToScene( std::vector< std::string> theKeyNameVector, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
+       void setControlActiveStateOfALL( bool stateCondition );
+       void setControlActiveStateOf( std::string theKeyName, bool stateCondition );
+       void setControlActiveStateOf( ContourWrap_ViewControl * contourWRP, bool stateCondition );
+       void setVisibleStateOf( std::string theKeyName, bool stateCondition );
+
+       std::vector< std::string >  getSelectedObjects();
+       void selectObjects( std::vector< std::string > theExistingObjectsToSelect );
+       void selectObjects( std::map<std::string, ContourWrap_ViewControl *> * theMap );
+       void setControlActiveStateOf( std::vector< std::string> &theKeyNameVector, bool controlCondition = false );
+       void setControlActiveStateOf( std::map<std::string, ContourWrap_ViewControl *> * theMap, bool controlCondition = false );
+       void drawSelectionROI();
+       void setSelection2DROIInternalOutlines( );
+       void writeCoords( std::string method );
+
+   // EED
+       void SaveThingName(FILE *ff, std::string nameThing);
+       void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );       
+       vtkImageData *GetImageData();
+       std::vector<std::string> GetlstContoursNameActualSlice();
+
+       //------------------------------------------------------------------------------------------------------------
+       // Inherited Methods
+       //------------------------------------------------------------------------------------------------------------
+
+       virtual bool  OnChar();
+       virtual bool  OnMouseMove();
+       virtual bool  OnLeftButtonDown(); 
+       virtual bool  OnLeftButtonUp();
+       virtual bool  OnMiddleButtonDown(); 
+       virtual bool  OnMiddleButtonUp();
+       virtual bool  OnRightButtonDown();
+       virtual bool  OnRightButtonUp();
+
+       virtual bool  OnLeftDClick();
+       virtual bool  OnRightDClick();   
+       virtual bool  OnMiddleDClick();  
+       virtual bool  OnMouseWheel(); 
+
+       int                       GetImageDataSizeZ();
+       void              GetImageDataRange( double *range );
+       void                    SetWidthContour(double width);
+
+
+private:
+       //------------------------------------------------------------------------------------------------------------
+       //  Private methods
+       //------------------------------------------------------------------------------------------------------------
+
+       
+       //------------------------------------------------------------------------------------------------------------
+       // Creational and initialization methods
+       //------------------------------------------------------------------------------------------------------------
+
+               
+       //------------------------------------------------------------------------------------------------------------
+       // Attributtes
+       //------------------------------------------------------------------------------------------------------------
+       
+       std::map<std::string, ContourWrap_ViewControl *> * _contours_ViewControl;
+       std::map<std::string, ContourWrap_ViewControl *> * _sceneContours_ViewControl;
+       wxVtkBaseView                   *_wxVtk_BaseView;
+       wxEvtHandler                    *_eventHandler;
+       ContourWrap_ViewControl *_lastInteraction;
+       std::string                             _lastInteractionName;
+       std::map<std::string, ContourWrap_ViewControl *> * _workingGroup;
+       bool                                    _creatingMULT_ROI;
+       bool                                    _editingROI;
+       bool                                    _toIncludeAtInteractionGroup;
+       bool                                    _waiting;
+       bool                                    _creatingROI;
+       int                                             _enventID;
+       int                                             _leftClickCount;
+       int                                             _rigthClickCount;
+       int                                             clickX;
+       int                                             clickY;
+       char                                    _lastKeyCode;
+       long int                                onCharCallBackTimeEnd;
+       long int                                onCharNeeded;
+       bool                                    _drawingSelectionROI;
+       manualRoiControler              *_controlerSelectionROI;
+       manualViewRoi                   *_viewerSelectionROI;
+       manualContourModel              *_modelSelectionROI;
+       double                                  _widthOfContour;
+       
+};
+#endif // __wxVtkBaseView_SceneManager_HEADER_FILE__
+
diff --git a/lib/kernel_ManagerContour_NDimensions/AxeThing.cxx b/lib/kernel_ManagerContour_NDimensions/AxeThing.cxx
new file mode 100644 (file)
index 0000000..4a4ab8b
--- /dev/null
@@ -0,0 +1,54 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "AxeThing.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file AxeThing.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates an AxeThing
+       */
+       AxeThing :: AxeThing()
+       {
+
+       }
+
+       /*
+       * Destroys an AxeThing
+       */
+       AxeThing :: ~AxeThing()
+       {
+
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       void AxeThing :: setDescription(std::string aDescription)
+       {
+               description = aDescription;
+       }
+
+       std::string AxeThing :: getDescription()
+       {
+               return description;
+       }
+
+       void AxeThing :: setLength(int aLength)
+       {
+               length = aLength;
+       }
+
+       int AxeThing :: getLength()
+       {
+               return length;
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/AxeThing.h b/lib/kernel_ManagerContour_NDimensions/AxeThing.h
new file mode 100644 (file)
index 0000000..e936e74
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef __AXE_THING__
+#define __AXE_THING__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+
+
+class AxeThing{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates an AxeThing
+       */
+       AxeThing();
+
+       /*
+       * Destroys an AxeThing
+       */
+       ~AxeThing();
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       
+       void setDescription(std::string aDescription);
+
+       std::string getDescription();
+
+       void setLength(int aLength);
+
+       int getLength();
+
+       
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       
+       std::string description;
+
+       int length;
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/CMakeLists.txt b/lib/kernel_ManagerContour_NDimensions/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1ad684f
--- /dev/null
@@ -0,0 +1,64 @@
+#----------------------------------------------------------------------------
+# SET THE NAME OF YOUR LIBRARY
+SET ( LIBRARY_NAME   kernel_ManagerContour_NDimensions_lib  )
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# CREATES A USER OPTION IN CMAKE
+OPTION ( BUILD_${LIBRARY_NAME}  "Build ${LIBRARY_NAME} library ?" ON)
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+IF ( BUILD_${LIBRARY_NAME} )
+#----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # BUILD LIBRARY
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY HEADERS (TO BE INSTALLED)
+  # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE:
+  FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h")
+  # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND
+  #  SET ( ${LIBRARY_NAME}_HEADERS
+  #
+  #    )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY SOURCES (TO BE COMPILED)
+  # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
+  FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc *.h)
+  # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
+  #  SET ( ${LIBRARY_NAME}_SOURCES 
+  #   
+  #    )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH)
+  SET ( ${LIBRARY_NAME}_LINK_LIBRARIES
+       #NDimensionsEnvironment
+    ${crea_LIBRARIES}
+    ${WXWIDGETS_LIBRARIES}
+    ${VTK_LIBRARIES}
+    #    ${ITK_LIBRARIES}
+    #    ${GDCM_LIBRARIES}
+    #    ${BOOST_LIBRARIES}
+    )
+  #----------------------------------------------------------------------------
+
+  
+  #----------------------------------------------------------------------------
+  # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL
+  #CREA_ADD_LIBRARY( ${LIBRARY_NAME} )
+  #----------------------------------------------------------------------------
+
+  ADD_LIBRARY(${LIBRARY_NAME} STATIC  ${${LIBRARY_NAME}_SOURCES})
+  # LINK
+  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES})
+  
+  
+  #---------------------------------------------------------------------------
+ENDIF ( BUILD_${LIBRARY_NAME} )
\ No newline at end of file
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandDataBase.cxx b/lib/kernel_ManagerContour_NDimensions/CommandDataBase.cxx
new file mode 100644 (file)
index 0000000..8082d6a
--- /dev/null
@@ -0,0 +1,29 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "CommandDataBase.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file CommandDataBase.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandDataBase.h b/lib/kernel_ManagerContour_NDimensions/CommandDataBase.h
new file mode 100644 (file)
index 0000000..0a142f2
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __COMMAND_DATA_BASE__
+#define __COMMAND_DATA_BASE__
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+class CommandDataBase{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandObject.cxx b/lib/kernel_ManagerContour_NDimensions/CommandObject.cxx
new file mode 100644 (file)
index 0000000..7110e43
--- /dev/null
@@ -0,0 +1,41 @@
+#include <vector>
+#include <iostream>
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "CommandObject.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file TestOutline.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates a command with the given text
+       * @param aText Is the text to assign to the command
+       * @return Returns the created commandObject pointer
+       */
+       CommandObject :: CommandObject(/*std::string aText*/)
+       { 
+               //setText(aText);               
+       }
+
+       /*
+       * Destroys the command
+       */
+       CommandObject :: ~CommandObject()
+       { 
+               
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       
+       
\ No newline at end of file
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandObject.h b/lib/kernel_ManagerContour_NDimensions/CommandObject.h
new file mode 100644 (file)
index 0000000..2085a22
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef __COMMAND_OBJECT__
+#define __COMMAND_OBJECT__
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include <iostream>
+#include <deque>
+
+class CommandObject{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates a command with the given text 
+       * @return Returns the created commandObject pointer
+       */
+       CommandObject( );
+
+       /*
+       * Destroys the command
+       */
+       ~CommandObject( );
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Includes the command into the given queue for execution
+       * @param executionQueue Is the queue in which is included the command
+       */
+       virtual void includeToExecute(std::deque<CommandObject *> &executionQueue)=0;   
+
+       /*
+       * Counts the command(s)
+       * @return The value of commands that represents this
+       */
+       virtual int count() = 0;
+
+       /*
+       * Method that clears the command
+       */
+       virtual void clear() = 0;
+       
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       int accum;      
+       
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandsHandler.cxx b/lib/kernel_ManagerContour_NDimensions/CommandsHandler.cxx
new file mode 100644 (file)
index 0000000..a3a3daf
--- /dev/null
@@ -0,0 +1,273 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "CommandsHandler.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file CommandsHandler.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+       
+       /*
+       * Constructs the CommandsHandler
+       */
+       CommandsHandler :: CommandsHandler()
+       {
+               redo_actions = new CommandsRegisterStructure();
+               unDo_actions = new CommandsRegisterStructure();
+
+               posibleREDO = false;
+               posibleUNDO = false;
+
+               isLastREDO_executed = true;
+               isLastUNDO_executed = false;
+       }
+
+       /*
+       * Destructs the CommandsHandler
+       */
+       CommandsHandler :: ~CommandsHandler()
+       {
+               clearActions();
+               delete redo_actions;
+               delete unDo_actions;
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Registers in the vectors of doneActions and unDoActions the given commands that all ready corresponds each other to the inverse of the otherone. 
+       * If is the first registered action notifies the posibleUNDO avaliability.
+       * @param doneAction Is the action to register in the redo_actions vector.
+       * @param unDoAction Is the action to register in the unDo_actions vector.
+       */
+       void CommandsHandler :: registerCommand(CommandObject* doneAction, CommandObject* unDoAction)
+       {
+               int actToUNDO = unDo_actions->getActualIndex(); 
+               redo_actions->setActualIndex( actToUNDO );                              
+               
+               redo_actions->registerCommand(doneAction);
+               unDo_actions->registerCommand(unDoAction);
+               
+               posibleREDO = false;
+               posibleUNDO = true;
+
+               isLastREDO_executed = true;
+               isLastUNDO_executed = false;
+               
+       }
+
+       /*
+       * Undo a command. Managing the correspondig vectors and the execution of the inverse action to the - ACTUAL DONE- action
+       * @return Returns true if the inverse command ( the actual to execute in UNDO actions) is executed. If it is false the state of the vector must not change.
+       */
+       bool CommandsHandler :: undo()
+       {
+               bool executed = posibleUNDO;
+               if( posibleUNDO )
+               {                       
+                       validateOperationsAvaliability();//para borrar!!!!!!!!-----------------------------*********************---------------------
+                       executed = theWorksSpaceBoss->executeCommand(getActual_UNDO(), true);
+                       isLastUNDO_executed = true;
+                       if (!unDo_actions->hasActualNext() && !redo_actions->hasActualNext())
+                       {                               
+                               if(unDo_actions->hasActualPrevious())
+                                       executed = unDo_actions->moveBack_Actual() ;
+                               else
+                                       executed = true;
+                               if( unDo_actions->hasLastNext() ) 
+                                       executed = executed && unDo_actions->moveBack_Last();   
+                               isLastREDO_executed = false;
+                       }
+                       else if (!unDo_actions->hasActualPrevious() && redo_actions->hasActualPrevious())
+                       {
+                               executed = redo_actions->moveBack_Actual();     
+                               executed = executed && redo_actions->moveBack_Last();   
+                               executed = executed && unDo_actions->moveBack_Last();                           
+                       }
+                       else 
+                       {                                       
+                               executed = unDo_actions->moveBack_Last();
+                               executed = executed && unDo_actions->moveBack_Actual(); 
+                               executed = executed && redo_actions->moveBack_Actual(); 
+                               if( redo_actions->hasLastNext() ) 
+                                       executed = executed && redo_actions->moveBack_Last();   
+                       }
+                       validateOperationsAvaliability();                       
+               }
+               return executed;
+       }
+
+       /*
+       * Redo a command. Managing the correspondig vectors and the execution of the inverse action to the - ACTUAL DONE- action
+       * @return Returns true if the actual command to execute ( the actual to execute in REDO actions )has been executed. If it is false the state of the vector must not change.
+       */
+       bool CommandsHandler :: redo()
+       {
+               bool executed = posibleREDO;
+               if( posibleREDO )
+               {                       
+                       validateOperationsAvaliability();//para borrar!!!!!!!!-----------------------------*********************---------------------
+                       isLastREDO_executed = true;
+                       //isLastUNDO_executed = false; // Posible needed
+                       executed = theWorksSpaceBoss->executeCommand(getActual_REDO(), true);
+                       if (!unDo_actions->hasActualPrevious() && !redo_actions->hasActualPrevious())
+                       {                                                               
+                               executed = redo_actions->moveForward_Actual();
+                               executed = executed && redo_actions->moveBack_Last();
+                               isLastUNDO_executed = false;
+                       }
+                       else if (!unDo_actions->hasActualPrevious() && redo_actions->hasActualPrevious())
+                       {
+                               executed = redo_actions->moveForward_Actual();
+                               if(unDo_actions->hasLastNext())
+                                       executed = executed && unDo_actions->moveForward_Last();        
+                               executed = executed && unDo_actions->moveForward_Actual();
+                               if(redo_actions->hasLastNext())
+                                       executed = executed && redo_actions->moveForward_Last();
+                       }
+                       else 
+                       {       
+                               executed = unDo_actions->moveForward_Actual();  
+                               executed = executed && unDo_actions->moveForward_Last();        
+                               executed = executed && redo_actions->moveForward_Actual();              
+                               if( redo_actions->hasLastNext() ) 
+                                               executed = executed && redo_actions->moveForward_Last();        
+                               else
+                                       executed = executed && redo_actions->moveBack_Last();   
+                       }
+                       if (!unDo_actions->hasActualPrevious() && redo_actions->hasActualPrevious())
+                       {
+                               isLastUNDO_executed = false;
+                       }
+                       if (!unDo_actions->hasActualNext() && !redo_actions->hasActualNext())
+                       {
+                               isLastUNDO_executed = false;
+                       }
+                       validateOperationsAvaliability();
+               }               
+               return executed;
+       }
+
+       /*
+       * Notitify if posibleREDO is posible or not.
+       * @return Returns the state of posibleUNDO
+       */
+       bool CommandsHandler :: isPosibleUNDO()
+       {
+               return posibleUNDO;
+       }
+
+       /*
+       * Indicates if posibleUNDO is posible or not.
+       * @return Returns the state of posibleREDO
+       */
+       bool CommandsHandler :: isPosibleREDO()
+       {
+               return posibleREDO;
+       }
+
+       /*
+       * Sets  posibleREDO state.
+       * @param UNDOstate The state of posibleUNDO to set
+       */
+       void CommandsHandler :: setPosibleUNDO( bool UNDOstate )
+       {
+               posibleUNDO = UNDOstate;
+       }
+
+       /*
+       * Sets posibleUNDO state.
+       * @param REDOstate The state of posibleREDO to set
+       */
+       void CommandsHandler :: setPosibleREDO( bool REDOstate )
+       {
+               posibleREDO = REDOstate;
+       }
+
+       /*
+       * Clear the registered actions in the DO and UNDO vectors.
+       */
+       void CommandsHandler :: clearActions()
+       {
+               redo_actions->clearActions();
+               unDo_actions->clearActions();
+       }
+
+       /*
+       * Returns hoy mane paired commands had been registered, if the done and unDo vectors dont match returns -1 as error code.
+       * @return Returns how many paired-commands had been registered
+       */
+       int CommandsHandler :: getTotalCommands()
+       {
+               int value = redo_actions->getTotalCommandsCount();
+               return value == (unDo_actions->getTotalCommandsCount())  ? value : -1;
+       }
+
+
+       /*
+       * Gets the actual command in the UNDO-list
+       * @return  Returns a pointer to the actual undo action
+       */
+       CommandObject * CommandsHandler :: getActual_UNDO()
+       {
+               return unDo_actions->getActual_Pointer();
+       }
+
+       /*
+       * Gets the actual command in the REDO-list
+       * @return  Returns a pointer to the actual do action
+       */
+       CommandObject * CommandsHandler :: getActual_REDO()
+       {
+               return redo_actions->getActual_Pointer();
+       }
+
+       /*
+       * Gets the command at the given position in the DO (REDO) vector
+       * @return The pointer to the referenced object by the position
+       */
+       CommandObject * CommandsHandler :: get_DO_CommandAt(int position)
+       {
+               return redo_actions->getCommandAt(position);
+       }
+
+       /*
+       * Gets the command at the given position in the UNDO vector
+       * @return The pointer to the referenced object by the position
+       */
+       CommandObject * CommandsHandler :: get_UNDO_CommandAt(int position)
+       {
+               return unDo_actions->getCommandAt(position);
+       }
+
+               /*
+       * Sets the model parent of the action handler
+       * @param theModelParent The boss reference
+       */
+       void CommandsHandler :: setModelBoss(ICommandsUser * theModelParent)
+       {
+               theWorksSpaceBoss = theModelParent;
+       }
+
+       /*
+       * Validates if it is posible of not to do UNDO and/or REDO and sets the corresponding values
+       */
+       void CommandsHandler :: validateOperationsAvaliability()
+       {
+               posibleREDO = (redo_actions->hasActualNext() && unDo_actions->hasActualNext() )? true :
+                       ( (!redo_actions->hasActualNext()&& unDo_actions->hasActualNext() ) ? true : 
+                       ( !unDo_actions->hasActualNext() && !redo_actions->hasActualNext() )? false : true && !isLastREDO_executed );   
+
+               posibleUNDO = (redo_actions->hasActualPrevious() && unDo_actions->hasActualPrevious() )? true :
+                       ( (!unDo_actions->hasActualPrevious()&& redo_actions->hasActualPrevious() ) ? true : 
+                       ( !unDo_actions->hasActualPrevious() && !redo_actions->hasActualPrevious() )? false : true && !isLastUNDO_executed );   
+
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandsHandler.h b/lib/kernel_ManagerContour_NDimensions/CommandsHandler.h
new file mode 100644 (file)
index 0000000..d490dbf
--- /dev/null
@@ -0,0 +1,153 @@
+#ifndef __COMMANDS_HANDLER__
+#define __COMMANDS_HANDLER__
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "CommandObject.h"
+#include "CommandsRegisterStructure.h"
+#include "ContourWorkspace.h"
+#include "ICommandsUser.h"
+
+class ContourWorkspace;
+
+class CommandsHandler{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+
+       /*
+       * Constructs the CommandsHandler
+       */
+       CommandsHandler();
+
+       /*
+       * Destructs the CommandsHandler
+       */
+       ~CommandsHandler();
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Registers in the vectors of doneActions and unDoActions the given commands that all ready corresponds each other to the inverse of the otherone. 
+       * If is the first registered action notifies the posibleUNDO avaliability.
+       * @param doneAction Is the action to register in the redo_actions vector.
+       * @param unDoAction Is the action to register in the unDo_actions vector.
+       */
+       void registerCommand(CommandObject* doneAction, CommandObject* unDoAction);
+
+       /*
+       * Undo a command. Managing the correspondig vectors and the execution of the inverse action to the - ACTUAL DONE- action
+       * @return Returns true if the inverse command ( the actual to execute in UNDO actions ) is executed. If it is false the state of the vector must not change.
+       */
+       bool undo();
+
+       /*
+       * Redo a command. Managing the correspondig vectors and the execution of the inverse action to the - ACTUAL DONE- action
+       * @return Returns true if the actual command to execute ( the actual to execute in REDO actions )has been executed. If it is false the state of the vector must not change.
+       */
+       bool redo();
+
+       /*
+       * Notitify if posibleREDO is posible or not.
+       * @return Returns the state of posibleUNDO
+       */
+       bool isPosibleUNDO();
+
+       /*
+       * Indicates if posibleUNDO is posible or not.
+       * @return Returns the state of posibleREDO
+       */
+       bool isPosibleREDO();
+
+       /*
+       * Sets  posibleREDO state.
+       * @param UNDOstate The state of posibleUNDO to set
+       */
+       void setPosibleUNDO(bool UNDOstate);
+
+       /*
+       * Sets posibleUNDO state.
+       * @param REDOstate The state of posibleREDO to set
+       */
+       void setPosibleREDO(bool REDOstate);
+       
+       /*
+       * Clear the registered actions in the DO and UNDO vectors.
+       */
+       void clearActions();
+
+       /*
+       * Returns hoy mane paired commands had been registered, if the done and unDo vectors dont match returns -1 as error code.
+       * @return Returns how many paired-commands had been registered
+       */
+       int getTotalCommands();
+
+       /*
+       * Gets the actual command in the UNDO-list
+       * @return  Returns a pointer to the actual undo action
+       */
+       CommandObject * getActual_UNDO();
+
+       /*
+       * Gets the actual command in the REDO-list
+       * @return  Returns a pointer to the actual do action
+       */
+       CommandObject * getActual_REDO();
+
+       /*
+       * Gets the command at the given position in the DO (REDO) vector
+       * @return The pointer to the referenced object by the position
+       */
+       CommandObject * get_DO_CommandAt(int position);
+
+       /*
+       * Gets the command at the given position in the UNDO vector
+       * @return The pointer to the referenced object by the position
+       */
+       CommandObject * get_UNDO_CommandAt(int position);
+
+       
+       /*
+       * Validates if it is posible of not to do UNDO and/or REDO and sets the corresponding values
+       */
+       void validateOperationsAvaliability();
+
+       /*
+       * Sets the model parent of the action handler
+       * @param theModelParent The boss reference
+       */
+       void setModelBoss(ICommandsUser * theModelParent);
+
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       CommandsRegisterStructure * redo_actions;
+
+       CommandsRegisterStructure * unDo_actions;
+
+       bool posibleUNDO;
+
+       bool posibleREDO;
+
+       ICommandsUser * theWorksSpaceBoss;
+
+       bool isLastREDO_executed;
+
+       bool isLastUNDO_executed;
+
+       std::deque<CommandObject *> executionQueue;     
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandsRegisterStructure.cxx b/lib/kernel_ManagerContour_NDimensions/CommandsRegisterStructure.cxx
new file mode 100644 (file)
index 0000000..e350937
--- /dev/null
@@ -0,0 +1,351 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "CommandsRegisterStructure.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file CommandsRegisterStructure.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+/*
+       * Creates the CommandsRegisterStructure
+       */
+       CommandsRegisterStructure :: CommandsRegisterStructure()
+       { 
+               actualIndexToExec = -1;         
+               lastAction = -1;
+       }
+
+       /*
+       * Destroys the CommandsRegisterStructure
+       */
+       CommandsRegisterStructure :: ~CommandsRegisterStructure()
+       { 
+               clearActions();         
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Registers a command in the vector with no verification, is should be well constructed
+       * @param theCommand The command to register
+       */
+       void CommandsRegisterStructure :: registerCommand(CommandObject * theCommand)
+       {
+               int antes =registeredActions.size();
+               levelLastToActual(true);
+               registeredActions.push_back(theCommand);
+               actualIndexToExec = registeredActions.size()-1;
+               lastAction = actualIndexToExec;
+               int despues =registeredActions.size();
+               int otr = 0;
+       }
+
+
+       /*
+       * Gets the -ACTUAL- command text 
+       * @return
+       */
+       /*std::string CommandsRegisterStructure :: getActualCommandText()
+       { 
+               return !isEmpty() ? getCommandAt(actualIndexToExec)->includeToExecute(): " ";
+       }*/
+
+       /*
+       * Gets the -LAST- command text 
+       * @return
+       */
+       /*std::string CommandsRegisterStructure :: getLastCommandText()
+       { 
+               return !isEmpty() ? getCommandAt(lastAction)->executeCommand(): " ";
+       }*/
+
+       /*
+       * Deletes all the registered actions and reinitialize the -ACTUAL- and  -LAST- 
+       */
+       void CommandsRegisterStructure ::  clearActions()
+       { 
+               if(!registeredActions.empty())
+               {
+                       for(int i=0; i < registeredActions.size(); i++)
+                       {
+                               registeredActions[i] = NULL;
+                       }
+                       registeredActions.clear();              
+                       lastAction = -1;                
+                       actualIndexToExec = -1;
+               }
+       }
+
+       /*
+       * Moves to the the previous position the -ACTUAL- 
+       * @return Indicates true if it was done
+       */
+       bool CommandsRegisterStructure :: moveBack_Actual()
+       { 
+               if ( !isEmpty() &&  hasActualPrevious() )
+               {
+                       actualIndexToExec--;
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Moves to the the next position the -ACTUAL- 
+       * @return Indicates true if it was done
+       */
+       bool CommandsRegisterStructure :: moveForward_Actual()
+       {
+               if ( !isEmpty() &&  hasActualNext() )
+               {
+                       actualIndexToExec++;
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Moves to the the previous position the -LAST- 
+       * @return Indicates true if it was done
+       */
+       bool CommandsRegisterStructure :: moveBack_Last()
+       { 
+               if ( !isEmpty() && hasLastPrevious() )
+               {
+                       lastAction--;
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Moves to the the next position the -LAST- 
+       * @return Indicates true if it was done
+       */
+       bool CommandsRegisterStructure :: moveForward_Last()
+       {
+               if ( !isEmpty() && hasLastNext() )
+               {
+                       lastAction++;
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Indicates if the -LAST-  has a next action or not
+       * @return Returns true if it has
+       */
+       bool CommandsRegisterStructure :: hasLastNext()
+       {
+               int total = registeredActions.size();
+               return total > 0 ? total -1 > lastAction : false;
+       }
+
+       /*
+       * Indicates if the -ACTUAL-  has a next action or not
+       * @return Returns true if it has
+       */
+       bool CommandsRegisterStructure :: hasActualNext()
+       {
+               int total = registeredActions.size();
+               return total > 0 ? total -1 > actualIndexToExec : false;
+       }
+
+       /*
+       * Indicates if the -LAST-  has a previous action or not
+       * @return Returns true if it has
+       */
+       bool CommandsRegisterStructure :: hasLastPrevious()
+       {
+               return ! 0 < lastAction;
+       }
+
+       /*
+       * Indicates if the -ACTUAL-  has a previous action or not
+       * @return Returns true if it has
+       */
+       bool CommandsRegisterStructure :: hasActualPrevious()
+       {
+               return 0 < actualIndexToExec;
+       }
+
+       /*
+       * Puts to point CommandsRegisterStructure ::  the -ACTUAL-  up to the -LAST-  . 
+       */
+       void CommandsRegisterStructure :: levelActualToLast()
+       { 
+               actualIndexToExec = lastAction;
+       }
+
+       /*
+       * Puts to point CommandsRegisterStructure ::  the -LAST-  up to the -ACTUAL-  and erases automatically the actions after the 
+       * referenced last new position of the registered actions if nothing is given by parameter.
+       * @clearingAfterActual Indicates if is wondered to erase or not the mentioned range 
+       */
+       void CommandsRegisterStructure :: levelLastToActual( bool clearingAfterActual )
+       {
+               if ( !isEmpty() )
+               {
+                       lastAction = actualIndexToExec;
+                       if( clearingAfterActual )
+                       {
+                               for (int a=registeredActions.size()-1; a>=0 && actualIndexToExec < a; a--)
+                               {
+                                       if(actualIndexToExec < a)
+                                       {
+                                               registeredActions.pop_back();
+                                       }
+                               }                               
+                       }                       
+               }
+       }
+
+       /*
+       * Clear all the elements in the vector bettween the -LAST-  and the end of the vector
+       */
+       void CommandsRegisterStructure ::  clearAll_afterLast()
+       {
+               for (int a=registeredActions.size()-1; a>=0 && lastAction < a; a--)
+               {
+                       if( lastAction < a )
+                       {
+                               registeredActions.pop_back();
+                       }
+               }               
+       }
+
+       /*
+       * Clear all the elements in the vector bettween the -ACTUAL-  and the start of the vector       
+       */
+       void CommandsRegisterStructure ::  clearAll_beforeActual()
+       { 
+               std::vector <CommandObject*>::iterator frontIter;
+               for (int a=0; a<registeredActions.size() && lastAction < a; a--)
+               {
+                       frontIter = registeredActions.begin();
+                       if( actualIndexToExec > a )
+                       {
+                               registeredActions.erase(frontIter);
+                       }
+               }       
+       }
+
+       /**
+       * Indicates if there are actions in the vector of not
+       * @return Returns true is there are not registered actions      
+       */
+       bool CommandsRegisterStructure :: isEmpty()
+       { 
+               return registeredActions.empty();
+       }
+
+       /**
+       * Indicates the quantity of actions that are registered
+       * @return Returns the total amount of registered actions in the vector
+       */
+       int CommandsRegisterStructure ::  getCommandsCount()
+       { 
+               return registeredActions.size();
+       }
+
+       /*
+       * Gets the -ACTUAL-   information data pointer
+       * @return The pointer to the referenced object by the -ACTUAL- 
+       */
+       CommandObject * CommandsRegisterStructure :: getActual_Pointer ()
+       {
+               return  getCommandAt(actualIndexToExec);
+       }
+
+       /*
+       * Gets the -LAST-   information data pointer 
+       * @return The pointer to the referenced object by the -LAST- 
+       */
+       CommandObject * CommandsRegisterStructure ::getLast_Pointer ()
+       { 
+               return  getCommandAt(lastAction);
+       }
+
+       /*
+       * Gets the command at the given position 
+       * @return The pointer to the referenced object by the position
+       */
+       CommandObject * CommandsRegisterStructure :: getCommandAt(int position)
+       {
+               if(position< getCommandsCount())
+               {
+                       return registeredActions[position];
+               }
+               return NULL;
+       }
+
+       /*
+       * Gets the index of the actualAction in the vector
+       * @return actualIndexToExec Is the corresponding index
+       */
+       int CommandsRegisterStructure :: getActualIndex()
+       {
+               return actualIndexToExec;
+       }
+
+       /*
+       * Gets the index of the lasAction in the vector
+       * @return lasAction Is the corresponding index
+       */
+       int CommandsRegisterStructure :: getLasIndex()
+       {
+               return lastAction;
+       }
+
+       /*
+       * Sets the index of the actualAction in the vector
+       * @param newActualIndex Is the corresponding index
+       */
+       void CommandsRegisterStructure :: setActualIndex(int newActualIndex)
+       {
+               actualIndexToExec = newActualIndex;
+       }
+
+       /*
+       * Sets the index of the lasAction in the vector
+       * @param newLasIndex Is the corresponding index
+       */
+       void CommandsRegisterStructure :: setLasIndex(int newLasIndex)
+       {
+               lastAction = newLasIndex;
+       }
+
+       /*
+       * Gets the registered commands vector size
+       * @return Returns the vector size
+       */
+       int CommandsRegisterStructure :: getRegistereCommandsCount()
+       {
+               return registeredActions.size();
+       }
+
+       /*
+       * Gets the total registered commands 
+       * @return Returns the total of commands
+       */
+       int CommandsRegisterStructure :: getTotalCommandsCount()
+       {
+               int totalAccum = 0;
+               for( int i=0; i< registeredActions.size(); i++)
+               {
+                       totalAccum+= registeredActions[i]->count();
+               }
+               return totalAccum;
+       }
+   
diff --git a/lib/kernel_ManagerContour_NDimensions/CommandsRegisterStructure.h b/lib/kernel_ManagerContour_NDimensions/CommandsRegisterStructure.h
new file mode 100644 (file)
index 0000000..3779397
--- /dev/null
@@ -0,0 +1,221 @@
+#ifndef __COMMANDS_REGISTER_STRUCTURE__
+#define __COMMANDS_REGISTER_STRUCTURE__
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include <vector>
+#include <iostream>
+#include "CommandObject.h"
+
+class CommandsRegisterStructure{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates the CommandsRegisterStructure
+       */
+       CommandsRegisterStructure();
+
+       /*
+       * Destroys the CommandsRegisterStructure
+       */
+       ~CommandsRegisterStructure();
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Registers a command in the vector with no verification, is should be well constructed
+       * @param theCommand The command to register
+       */
+       void registerCommand(CommandObject * theCommand);
+
+       /*
+       * Gets the -ACTUAL- command text 
+       * @return
+       */
+       //std::string getActualCommandText();
+
+       /*
+       * Gets the -LAST- command text 
+       * @return
+       */
+       //std::string getLastCommandText();
+
+       /*
+       * Deletes all the registered actions and reinitialize the -ACTUAL- and  -LAST- iterators
+       */
+       void clearActions();
+
+       /*
+       * Moves to the the previous position the -ACTUAL- iterator
+       * @return Indicates true if it was done
+       */
+       bool moveBack_Actual();
+
+       /*
+       * Moves to the the next position the -ACTUAL- iterator
+       * @return Indicates true if it was done
+       */
+       bool moveForward_Actual();
+
+       /*
+       * Moves to the the previous position the -LAST- iterator
+       * @return Indicates true if it was done
+       */
+       bool moveBack_Last();
+
+       /*
+       * Moves to the the next position the -LAST- iterator
+       * @return Indicates true if it was done
+       */
+       bool moveForward_Last();
+
+       /*
+       * Indicates if the -LAST- iterator has a next action or not
+       * @return Returns true if it has
+       */
+       bool hasLastNext();
+
+       /*
+       * Indicates if the -ACTUAL- iterator has a next action or not
+       * @return Returns true if it has
+       */
+       bool hasActualNext();
+
+       /*
+       * Indicates if the -LAST- iterator has a previous action or not
+       * @return Returns true if it has
+       */
+       bool hasLastPrevious();
+
+       /*
+       * Indicates if the -ACTUAL- iterator has a previous action or not
+       * @return Returns true if it has
+       */
+       bool hasActualPrevious();
+
+       /*
+       * Puts to point the -ACTUAL- iterator up to the -LAST-  iterator.
+       */
+       void levelActualToLast();
+
+       /*
+       * Puts to point the -LAST- iterator up to the -ACTUAL- iterator and erases automatically the actions after the 
+       * referenced last and the end of the registered actions if nothing is given by parameter.       
+       */
+       void levelLastToActual(bool clearingAfterLast = true);
+
+       /*
+       * Clear all the elements in the vector bettween the -LAST- iterator and the end of the vector
+       */
+       void clearAll_afterLast();
+
+       /*
+       * Clear all the elements in the vector bettween the -ACTUAL- iterator and the start of the vector       
+       */
+       void clearAll_beforeActual();
+
+       /**
+       * Indicates if there are actions in the vector of not
+       * @return Returns true is there are not registered actions      
+       */
+       bool isEmpty();
+
+       /**
+       * Indicates the quantity of actions that are registered
+       * @return Returns the total amount of registered actions in the vector
+       */
+       int getCommandsCount();
+
+       /*
+       * Gets the -ACTUAL-  iterator information data pointer
+       * @return The pointer to the referenced object by the -ACTUAL- iterator
+       */
+       CommandObject * getActual_Pointer();
+
+       /*
+       * Gets the -LAST-  iterator information data pointer
+       * @return The pointer to the referenced object by the -LAST- iterator
+       */
+       CommandObject * getLast_Pointer();
+
+       /*
+       * Gets the command at the given position 
+       * @return The pointer to the referenced object by the position
+       */
+       CommandObject * getCommandAt(int position);
+
+       /*
+       * Gets the index of the actualAction in the vector
+       * @return actualIndexToExec Is the corresponding index
+       */
+       int getActualIndex();
+
+       /*
+       * Gets the index of the lasAction in the vector
+       * @return lasAction Is the corresponding index
+       */
+       int getLasIndex();
+
+       /*
+       * Sets the index of the actualAction in the vector
+       * @param newActualIndex Is the corresponding index
+       */
+       void setActualIndex(int newActualIndex);
+
+       /*
+       * Sets the index of the lasAction in the vector
+       * @param newLasIndex Is the corresponding index
+       */
+       void setLasIndex(int newLasIndex);
+
+       /*
+       * Gets the registered commands vector size
+       * @return Returns the vector size
+       */
+       int getRegistereCommandsCount();
+
+       /*
+       * Gets the total registered commands 
+       * @return Returns the total of commands
+       */
+       int getTotalCommandsCount();
+
+
+       
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       
+       /*
+       * Represents the actions successfully registered 
+       */
+       std::vector<CommandObject*> registeredActions;
+       
+       /*
+       * Represents the index to the actual action to execute at the registered actions vector
+       */
+       //std::vector <CommandObject*>::iterator actualAction;
+       int actualIndexToExec;
+       
+       /*
+       * Represents the index to the last action executed at the registered actions vector
+       */
+       //std::vector <CommandObject*>::iterator lastAction;   
+       int lastAction;   
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/ComposedCommand.cxx b/lib/kernel_ManagerContour_NDimensions/ComposedCommand.cxx
new file mode 100644 (file)
index 0000000..13cd2c1
--- /dev/null
@@ -0,0 +1,83 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ComposedCommand.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ComposedCommand.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+
+       ComposedCommand :: ComposedCommand( )
+       {
+
+       }
+
+       ComposedCommand :: ~ComposedCommand( )
+       {
+               clear();        
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+       
+       /*
+       * Adds a command to the list of command
+       * @param nwCommand Is the new command to include
+       */
+       void ComposedCommand :: addCommand(CommandObject * nwCommand)
+       {       
+               internalCommands.push_back(nwCommand);
+       }
+
+       /*
+       * Virtual method implentation that includes the commands list into the given queue for execution
+       * @param executionQueue Is the queue in which is included the command
+       */
+       void ComposedCommand :: includeToExecute(std::deque<CommandObject* > &executionQueue)
+       {
+        std::deque<CommandObject *>::iterator actualCommandIter = internalCommands.end();
+               while( actualCommandIter != internalCommands.begin())
+               {
+                       (*actualCommandIter)->includeToExecute(executionQueue);                 
+                       actualCommandIter--;                    
+               }       
+       }
+
+       /*
+       * Virtual method implementation that returns 1 as the ExecutableCommand is just one command effective
+       * @return The value of commands that represents this
+       */
+       int ComposedCommand :: count()
+       {
+               int count = 0;
+               int i =0;
+               while( i<internalCommands.size() )
+               {
+                       count += internalCommands[i]->count();  
+                       i++;
+               }
+               return count;
+       }
+
+       /*
+       * Virtual method implentation that that clears the commands inside the composed command calling each one to clean it self
+       */
+       void ComposedCommand :: clear()
+       {               
+               while( internalCommands.size()>0 )
+               {
+                       internalCommands.back()->clear();
+                       internalCommands.pop_back();
+               }
+               internalCommands.clear();
+       }
+               
+               
diff --git a/lib/kernel_ManagerContour_NDimensions/ComposedCommand.h b/lib/kernel_ManagerContour_NDimensions/ComposedCommand.h
new file mode 100644 (file)
index 0000000..7a0d620
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef __COMPOSED_COMMAND__
+#define __COMPOSED_COMMAND__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <deque>
+#include "CommandObject.h"
+
+/*
+class CommandObject;
+class ExecutableCommand;*/
+
+class ComposedCommand : public CommandObject{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       ComposedCommand( );
+
+       ~ComposedCommand( );
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+       
+       /*
+       * Adds a command to the list of command
+       * @param nwCommand Is the new command to include
+       */
+       void addCommand(CommandObject * nwCommand);     
+
+       /*
+       * Includes the command into the given queue for execution
+       * @param executionQueue Is the queue in which is included the command
+       */
+       virtual void includeToExecute(std::deque<CommandObject *> &executionQueue);
+
+       /*
+       * Counts the command(s)
+       * @return The value of commands that represents this
+       */
+       virtual int count();
+
+       /*
+       * Method that clears the command
+       */
+       virtual void clear();
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       
+       /*
+       * Represents the internal commands 
+       */
+       std::deque< CommandObject *> internalCommands;  
+       
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/ContourThing.cxx b/lib/kernel_ManagerContour_NDimensions/ContourThing.cxx
new file mode 100644 (file)
index 0000000..aa87478
--- /dev/null
@@ -0,0 +1,83 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ContourThing.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ContourThing.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates a ContourThing 
+       */
+       ContourThing :: ContourThing(manualContourModel * model)
+       {
+               setModel( model );
+       }
+
+       /*
+       * Destroys a ContourThing 
+       */
+       ContourThing :: ~ContourThing()
+       {
+
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * 
+       */
+       std::string ContourThing :: getName()
+       {
+               return outlineName;
+       }
+
+       /*
+       *
+       */
+       void ContourThing :: setName(std::string  aName)
+       {
+               outlineName = aName;
+       }
+
+       manualContourModel * ContourThing ::getModel()
+       {
+               return theModel;
+       }
+
+       void ContourThing :: setModel(manualContourModel * model)
+       {
+               theModel = model;
+       }
+
+       /*
+       * Executes the given command if posible and returns is posible or not
+       * @param theSpecificCommand Is the specific command to execute
+       * @return Returns if the command was successfuly executed
+       */
+       bool ContourThing :: executeCommand (CommandObject * theSpecificCommand)
+       {
+               return true;
+       }
+
+       /*
+       * Interprets the given command and constructs the opposite command for returning it
+       * @param theSpecificDOCommand Is the specific DO command 
+       * @return Returns the UNDO command of the given one
+       */
+       CommandObject * ContourThing :: getUndoCommandOf(CommandObject * theSpecificDOCommand)
+       {
+               ExecutableCommand * unDOcommand = new ExecutableCommand("UNDO command");
+               return unDOcommand;
+       }
+   
+
diff --git a/lib/kernel_ManagerContour_NDimensions/ContourThing.h b/lib/kernel_ManagerContour_NDimensions/ContourThing.h
new file mode 100644 (file)
index 0000000..8fc88b1
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef __CONTOUR_THING__
+#define __CONTOUR_THING__
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include "CommandObject.h"
+#include "ExecutableCommand.h"
+#include "ComposedCommand.h"
+#include "manualContour.h"
+
+class ContourThing{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates a ContourThing 
+       */
+       ContourThing(manualContourModel * model);
+
+       /*
+       * Destroys a ContourThing 
+       */
+       ~ContourThing();
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * 
+       */
+       std::string getName();
+
+       /*
+       *
+       */
+       void setName(std::string  aName);
+
+       
+       manualContourModel * getModel();
+
+       void setModel(manualContourModel * model);
+
+       /*
+       * Executes the given command if posible and returns is posible or not
+       * @param theSpecificCommand Is the specific command to execute
+       * @return Returns if the command was successfuly executed
+       */
+       bool executeCommand (CommandObject * theSpecificCommand);
+
+       /*
+       * Interprets the given command and constructs the opposite command for returning it
+       * @param theSpecificDOCommand Is the specific DO command 
+       * @return Returns the UNDO command of the given one
+       */
+       CommandObject * getUndoCommandOf(CommandObject * theSpecificDOCommand);
+
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       std::string outlineName;
+
+       manualContourModel * theModel;
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/ContourWorkspace.cxx b/lib/kernel_ManagerContour_NDimensions/ContourWorkspace.cxx
new file mode 100644 (file)
index 0000000..d79922c
--- /dev/null
@@ -0,0 +1,186 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ContourWorkspace.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ContourWorkspace.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+/*
+       * Constructs the workspace with the corresponding given parent
+       * @param parent Is the parent relation with
+       * @return Returns a pointer to the created ContourWorkspace
+       */
+       ContourWorkspace :: ContourWorkspace (OutlineModelManager * parent)
+       {
+               theModelBoss = parent;
+               commHandler = new CommandsHandler(); 
+               commHandler->setModelBoss(this);
+       }
+
+       /*
+       * Destroys the ContourWorkspace
+       */
+       ContourWorkspace :: ~ ContourWorkspace()
+       {
+
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool ContourWorkspace :: executeCommand(CommandObject * theCommand, bool fromRegistration)
+       {
+               return theModelBoss->executeCommand(theCommand, fromRegistration);
+       }
+
+       /*
+       * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
+       * @param executionQueue Is the command queue to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool ContourWorkspace ::  executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration)
+       {
+               return theModelBoss->executeCommandsQueue(executionQueue, fromRegistration);
+       }
+
+       /**
+       * Method that propagates an outline over the deep concept of the axe
+       */
+       void ContourWorkspace :: spreadInDepth()
+       {
+               //Getting the vector of the actual instant
+
+               //Getting the basic object name and patter to create the spreaded outlines
+
+               //Variating (i) the depth in the current axe, previously getting the axe size as maxmimum value conditioned by the imageSource deep in the axe direction
+
+               //Calling the creation of the section or plane and including it in the correspondig enviroment using the outlineManager for that
+
+               //Creating the (i-th) outline and including it in the correspondig enviroment using the outlineManager for that
+
+               //Including the (i-th) outline in a new propagation group calling the outlineManager
+               
+       }
+
+       /*
+       * Sets the working group id and pointer
+       * @param theWorkingGroupKey Is the correspondig key (id) of the working group 
+       * @param theGroup Is the correspondig group to work with
+       */
+       void ContourWorkspace :: setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup)
+       {
+               workingGroupKey = theWorkingGroupKey;
+               actualGroup = theGroup;         
+       }
+
+       /*
+       * Gets the working group key
+       * @return theGroupKey Is the correspondig key (id) of the working group 
+       */
+       int ContourWorkspace :: getWorkingGroupKey( )
+       {
+               return workingGroupKey;
+       }
+
+       /*
+       * Calls the execution for UNION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void ContourWorkspace :: callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall )
+       {
+
+       }
+
+       /*
+       * Calls the execution for INTERSECTION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void ContourWorkspace :: callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall )
+       {
+
+       }
+
+       
+       /*
+       * Calls the execution for COMBINATION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void ContourWorkspace :: callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall )
+       {
+
+       }
+
+
+       /*
+       * Calls the execution for FRAGMENTATION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void ContourWorkspace :: callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall )
+       {
+
+       }
+
+       /*
+       * Calls the execution for AGRUPATION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void ContourWorkspace :: callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall )
+       {
+
+       }
+
+       /*
+       * Calls to redo a the actual REDO command. 
+       * @return Returns true if the actual command to execute has been executed. 
+       */
+       bool ContourWorkspace :: callREDO()
+       {
+               return commHandler->redo();
+       }
+
+       /*
+       * Calls to undo the actual UNDO command. 
+       * @return Returns true if the inverse command is executed. 
+       */
+       bool ContourWorkspace :: callUNDO()
+       {
+               return commHandler->undo();
+       }
+
+       /*
+       * Calls the registration of the given commands (do, undo) in the commands handler
+       * If is the first registered command notifies the posibleUNDO avaliability.
+       * @param doCommand Is the command to register in the redo_commands vector.
+       * @param unDoCommand Is the command to register in the unDo_commands vector.
+       */
+       void ContourWorkspace :: callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand)
+       {
+               commHandler->registerCommand( doCommand, unDoCommand );
+       }
+
+       /*
+       * Gets the command handler
+       */
+       CommandsHandler * ContourWorkspace :: getCommandHandler()
+       {
+               return commHandler;
+       }
+
+       void ContourWorkspace :: setCommandHandler(CommandsHandler * aCommHandler)
+       {
+               commHandler = aCommHandler;
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/ContourWorkspace.h b/lib/kernel_ManagerContour_NDimensions/ContourWorkspace.h
new file mode 100644 (file)
index 0000000..54aa84a
--- /dev/null
@@ -0,0 +1,159 @@
+#ifndef __CONTOUR_WORKSPACE__
+#define __CONTOUR_WORKSPACE__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include <iostream>
+#include <vector>
+#include  "ICommandsUser.h"
+#include  "OutlineModelManager.h"
+#include  "OutlineGroup.h"
+#include  "CommandObject.h"
+#include  "CommandsHandler.h"
+#include  "ICommandsUser.h"
+
+class OutlineModelManager;
+class CommandsHandler; 
+
+class ContourWorkspace : public ICommandsUser{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Constructs the workspace with the corresponding given parent
+       * @param parent Is the parent relation with
+       * @return Returns a pointer to the created ContourWorkspace
+       */
+       ContourWorkspace (OutlineModelManager * parent);
+
+       /*
+       * Destroys the ContourWorkspace
+       */
+       ~ ContourWorkspace();
+
+//------------------------------------------------------------------------------------------------------------
+// Implamented methods from ICommandsUser.h
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       virtual bool executeCommand(CommandObject * theCommand, bool fromRegistration=false);
+       
+       /*
+       * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
+       * @param executionQueue Is the command queue to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       virtual bool executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration);
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Method that propagates an outline over the deep concept of the axe
+       */
+       void spreadInDepth();
+
+       /*
+       * Sets the working group id and pointer
+       * @param theWorkingGroupKey Is the correspondig key (id) of the working group 
+       * @param theGroup Is the correspondig group to work with
+       */
+       void setWorkingGroup( int theWorkingGroupKey , OutlineGroup * theGroup);
+
+       /*
+       * Gets the working group key
+       * @return theGroupKey Is the correspondig key (id) of the working group 
+       */
+       int getWorkingGroupKey( );
+
+       /*
+       * Calls the execution for UNION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void callOutline_Union_Of( std::vector<std::string> outlinesNamesToCall );
+
+       /*
+       * Calls the execution for INTERSECTION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void callOutline_Intersection_Of( std::vector<std::string> outlinesNamesToCall );
+       
+       /*
+       * Calls the execution for COMBINATION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void callOutline_Combination_Of( std::vector<std::string> outlinesNamesToCall );
+
+       /*
+       * Calls the execution for FRAGMENTATION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void callOutline_Fragmentation_Of( std::vector<std::string> outlinesNamesToCall );
+       
+       /*
+       * Calls the execution for AGRUPATION of the given outlines
+       * @param outlinesNamesToCall Is the correspondig vector with the names of the outlines to operate
+       */
+       void callOutline_Agrupation_Of( std::vector<std::string> outlinesNamesToCall );
+
+       /*
+       * Calls to redo a the actual REDO command. 
+       * @return Returns true if the actual command to execute has been executed. 
+       */
+       bool callREDO();
+
+       /*
+       * Calls to undo the actual UNDO command. 
+       * @return Returns true if the inverse command is executed. 
+       */
+       bool callUNDO();
+       
+       /*
+       * Calls the registration of the given commands (do, undo) in the commands handler
+       * If is the first registered command notifies the posibleUNDO avaliability.
+       * @param doCommand Is the command to register in the redo_commands vector.
+       * @param unDoCommand Is the command to register in the unDo_commands vector.
+       */
+       void callRegisterCommand(CommandObject * doCommand, CommandObject * unDoCommand);
+
+       /*
+       * Gets the command handler
+       */
+       CommandsHandler * getCommandHandler();
+
+       void setCommandHandler(CommandsHandler * aCommHandler);
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       std::vector<std::string> selectedOutlineskNames;
+
+       std::string actualOutlinekName;
+
+       int workingGroupKey;
+
+       OutlineModelManager * theModelBoss;
+       
+       CommandsHandler * commHandler;
+
+       OutlineGroup * actualGroup;
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/ExecutableCommand.cxx b/lib/kernel_ManagerContour_NDimensions/ExecutableCommand.cxx
new file mode 100644 (file)
index 0000000..dd6a336
--- /dev/null
@@ -0,0 +1,84 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ExecutableCommand.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ExecutableCommand.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates a command with the given text
+       * @param aText Is the text to assign to the command
+       * @return Returns the created ExecutableCommand pointer
+       */
+       ExecutableCommand :: ExecutableCommand(std::string aText)
+       { 
+               setText(aText); 
+               std::cout<<"execComm created "<< aText.data()<<std::endl;//SIL
+       }
+
+       /*
+       * Destroys the command
+       */
+       ExecutableCommand :: ~ExecutableCommand()
+       { 
+               clear();
+       }
+
+       
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Gets the text of the command
+       * @return text Is the text of the command
+       */
+       std::string ExecutableCommand :: getText()
+       {
+               return text;
+       }
+
+       /*
+       * Sets the text of the command
+       * @param theText Is the text of the command
+       */
+       void ExecutableCommand :: setText(std::string theText)
+       { 
+               text = theText;
+       }
+       
+       /*
+       * Includes the command into the given queue for execution
+       * @param executionQueue Is the queue in which is included the command
+       */
+       void ExecutableCommand :: includeToExecute(std::deque<CommandObject *> & executionQueue)
+       {
+               executionQueue.push_back( this );
+       }
+
+
+       /*
+       * Virtual method implementation that returns 1 as the ExecutableCommand is just one command effective
+       * @return The value of commands that represents this
+       */
+       int ExecutableCommand :: count()
+       {
+               return 1;
+       }
+
+       /*
+       * Method that clears the command
+       */
+       void ExecutableCommand :: clear()
+       {
+               
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/ExecutableCommand.h b/lib/kernel_ManagerContour_NDimensions/ExecutableCommand.h
new file mode 100644 (file)
index 0000000..bc609a0
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef __EXECUTABLE_COMMAND__
+#define __EXECUTABLE_COMMAND__
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include "CommandObject.h"
+
+class ExecutableCommand : public CommandObject{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates a command (executable) with the given text
+       * @param aText Is the text to assign to the command
+       * @return Returns the created ExecutableCommand pointer
+       */
+       ExecutableCommand(std::string aText );
+
+       /*
+       * Destroys the command
+       */
+       ~ExecutableCommand( );
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+
+       /*
+       * Gets the text of the command
+       * @return text Is the text of the command
+       */
+       std::string getText();
+
+       /*
+       * Sets the text of the command
+       * @param theText Is the text of the command
+       */
+       void setText(std::string theText);
+
+       /*
+       * Includes the command into the given queue for execution
+       * @param executionQueue Is the queue in which is included the command
+       */
+       virtual void includeToExecute(std::deque<CommandObject * > & executionQueue);
+
+       /*
+       * Counts the command(s)
+       * @return The value of commands that represents this
+       */
+       virtual int count();
+
+       /*
+       * Method that clears the command
+       */
+       virtual void clear();
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Represents the text of the command
+       */
+       std::string text;
+       
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/ICommandsUser.h b/lib/kernel_ManagerContour_NDimensions/ICommandsUser.h
new file mode 100644 (file)
index 0000000..4c7763a
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef __ICOMMANDS_USER__
+#define __ICOMMANDS_USER__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include <iostream>
+#include <deque>
+#include "CommandObject.h"
+
+class ICommandsUser{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       
+       /*
+       * Executes a command by resending the received parameters to its parent to do the appropiate interpretation and execution.
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       virtual bool executeCommand(CommandObject * theCommand, bool fromRegistration=false) = 0;
+       
+       /*
+       * Executes a command queue by resending the received parameters to its parent to do the appropiate interpretation and execution.
+       * @param executionQueue Is the command queue to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       virtual bool executeCommandsQueue(std::deque<CommandObject *> & executionQueue, bool fromRegistration) = 0;
+
+       
+};
+#endif
+
diff --git a/lib/kernel_ManagerContour_NDimensions/ImageSectionThing.cxx b/lib/kernel_ManagerContour_NDimensions/ImageSectionThing.cxx
new file mode 100644 (file)
index 0000000..aacb3a4
--- /dev/null
@@ -0,0 +1,54 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ImageSectionThing.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ImageSectionThing.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates the section image with the given image
+       * @param sourceImage The image data to set.
+       */
+       ImageSectionThing :: ImageSectionThing(vtkImageData * theImage)
+       {
+               setImageData(theImage);
+       }
+
+       /*
+       * Destroys the image section
+       */
+       ImageSectionThing :: ~ImageSectionThing()
+       {
+
+       }
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Gets the image data 
+       * @return image The image.
+       */
+       vtkImageData * ImageSectionThing :: getImageData()
+       {
+               return image;
+       }
+
+       /*
+       * Sets the source image 
+       * @param theImage The image to set.
+       */
+       void ImageSectionThing :: setImageData( vtkImageData *  theImage)
+       {
+               image = theImage;
+       }
+   
+   
diff --git a/lib/kernel_ManagerContour_NDimensions/ImageSectionThing.h b/lib/kernel_ManagerContour_NDimensions/ImageSectionThing.h
new file mode 100644 (file)
index 0000000..63d461b
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef __IMAGE_SECTION_THING__
+#define __IMAGE_SECTION_THING__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include "vtkImageData.h"
+
+class ImageSectionThing{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+
+       /*
+       * Creates the section image with the given image
+       * @param sourceImage The image data to set.
+       */
+       ImageSectionThing(vtkImageData * theImage);
+
+       /*
+       * Destroys the image section
+       */
+       ~ImageSectionThing();
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Gets the image data 
+       * @return image The image.
+       */
+       vtkImageData * getImageData();
+
+       /*
+       * Sets the source image 
+       * @param theImage The image to set.
+       */
+       void setImageData( vtkImageData *  theImage);
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       vtkImageData * image;
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/ImageSourceThing.cxx b/lib/kernel_ManagerContour_NDimensions/ImageSourceThing.cxx
new file mode 100644 (file)
index 0000000..be82051
--- /dev/null
@@ -0,0 +1,166 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "ImageSourceThing.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file ImageSourceThing.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates the source image with the given parameter
+       * @param sourceImage The image source to set.
+       */
+       ImageSourceThing :: ImageSourceThing(vtkImageData * theSource)
+       {
+               setSourceImage(theSource);
+       }
+
+       /*
+       * Destroys the image source
+       */
+       ImageSourceThing :: ~ImageSourceThing()
+       {
+
+       }
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Gets the source image 
+       * @return sourceImage The image source.
+       */
+       vtkImageData * ImageSourceThing :: getSourceImage()
+       {
+               return sourceImage;
+       }
+
+       /*
+       * Sets the source image 
+       * @param sourceImage The image source.
+       */
+       void ImageSourceThing :: setSourceImage( vtkImageData *  theSource)
+       {
+               sourceImage = theSource;
+       }
+   
+   /**
+       * Gets the max value of the x-axis
+       * @return x-extend_MAX
+       */
+       int ImageSourceThing :: getMax_X()
+       { 
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               return x2;
+       }
+
+       /**
+       * Gets the min value of the x-axis
+       * @return x-extend_MIN
+       */
+       int ImageSourceThing :: getMin_X()
+       { 
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               return x1;
+       }
+
+       /**
+       * Gets the range values of the x-axis
+       * @return x-extend pointer to a 2 sized []
+       */
+       int * ImageSourceThing :: getRangeX()
+       {
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               int retVal[2] = {x1, x2};
+               return retVal;
+       }
+
+       /**
+       * Gets the max value of the y-axis
+       * @return y-extend_MAX
+       */
+       int ImageSourceThing :: getMax_Y()
+       {
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               return y2;
+       }
+
+       /**
+       * Gets the min value of the y-axis
+       * @return y-extend_MIN
+       */
+       int ImageSourceThing :: getMin_Y()
+       {
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               return y1;
+       }
+
+       
+       /**
+       * Gets the range values of the y-axis
+       * @return y-extend pointer to a 2 sized []
+       */
+       int * ImageSourceThing :: getRangeY()
+       { 
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               int retVal[2] = {y1, y2};
+               return retVal;
+       }
+
+       /**
+       * Gets the max value of the z-axis
+       * @return z-extend_MAX
+       */
+       int ImageSourceThing :: getMax_Z()
+       {
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               return z2;
+       }
+
+       /**
+       * Gets the min value of the z-axis
+       * @return z-extend_MIN
+       */
+       int ImageSourceThing :: getMin_Z()
+       { 
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               return z1;
+       }
+
+       
+       /**
+       * Gets the range values of the z-axis
+       * @return z-extend pointer to a 2 sized []
+       */
+       int * ImageSourceThing :: getRangeZ()
+       { 
+               int x1, x2, y1, y2, z1, z2;
+               sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
+               int retVal[2] = {z1, z2};
+               return retVal;
+       }
+
+       
+       /**
+       * Gets the range values of the x-axis
+       * @return x-extend pointer to a 6 sized []
+       */
+       int * ImageSourceThing :: getAllRanges()
+       { 
+               return sourceImage-> GetExtent();
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/ImageSourceThing.h b/lib/kernel_ManagerContour_NDimensions/ImageSourceThing.h
new file mode 100644 (file)
index 0000000..b05a424
--- /dev/null
@@ -0,0 +1,127 @@
+#ifndef __IMAGE_SOURCE_THING__
+#define __IMAGE_SOURCE_THING__
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include <iostream>
+#include "vtkImageData.h" 
+/*
+* Represents the image source, is named the source because is the base for all calculus with the complete loaded image needeed
+*/
+class ImageSourceThing{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       
+       /*
+       * Creates the source image with the given parameter
+       * @param sourceImage The image source to set.
+       */
+       ImageSourceThing(vtkImageData * theSource);
+
+       /*
+       * Destroys the image source
+       */
+       ~ImageSourceThing();
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Gets the source image 
+       * @return sourceImage The image source.
+       */
+       vtkImageData * getSourceImage();
+
+       /*
+       * Sets the source image 
+       * @param sourceImage The image source to set.
+       */
+       void setSourceImage( vtkImageData *  theSource);
+
+       /**
+       * Gets the max value of the x-axis
+       * @return x-extend_MAX
+       */
+       int getMax_X();
+
+       /**
+       * Gets the min value of the x-axis
+       * @return x-extend_MIN
+       */
+       int getMin_X();
+
+       /**
+       * Gets the range values of the x-axis
+       * @return x-extend pointer to a 2 sized []
+       */
+       int * getRangeX();
+
+       /**
+       * Gets the max value of the y-axis
+       * @return y-extend_MAX
+       */
+       int getMax_Y();
+
+       /**
+       * Gets the min value of the y-axis
+       * @return y-extend_MIN
+       */
+       int getMin_Y();
+
+       
+       /**
+       * Gets the range values of the y-axis
+       * @return y-extend pointer to a 2 sized []
+       */
+       int * getRangeY();
+
+       /**
+       * Gets the max value of the z-axis
+       * @return z-extend_MAX
+       */
+       int getMax_Z();
+
+       /**
+       * Gets the min value of the z-axis
+       * @return z-extend_MIN
+       */
+       int getMin_Z();
+
+       
+       /**
+       * Gets the range values of the z-axis
+       * @return z-extend pointer to a 2 sized []
+       */
+       int * getRangeZ();
+
+       
+       /**
+       * Gets the range values of the x-axis
+       * @return x-extend pointer to a 6 sized []
+       */
+       int * getAllRanges();
+       
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Represents the source image
+       */
+       vtkImageData * sourceImage;
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/InstantMembersNameList.cxx b/lib/kernel_ManagerContour_NDimensions/InstantMembersNameList.cxx
new file mode 100644 (file)
index 0000000..fe6da74
--- /dev/null
@@ -0,0 +1,153 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "InstantMembersNameList.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file InstantMemberNameList.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Create the InstantMembersNameList with empty data pointers
+       */
+       InstantMembersNameList :: InstantMembersNameList()
+       {
+               actualAxeNamesWrapp                             = new NameWrapper("","");
+               actualSourceImageNamesWrapp             = new NameWrapper("","");
+               actualSectionImageNamesWrapp    = new NameWrapper("","");
+               actualOutlineNamesWrapp                 = new NameWrapper("","");
+       }
+
+       /*
+       * Destroys the InstantMembersNameList
+       */
+       InstantMembersNameList :: ~InstantMembersNameList()
+       {
+               clean();
+               outlinesNamesVector.clear();
+               axesNamesVector.clear();
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+       /*
+       * Sets the actual outline names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void InstantMembersNameList :: setActualOutline(std::string thekeyName, std::string theRealName )
+       {
+               actualOutlineNamesWrapp->setWrappingPair(thekeyName, theRealName);
+       }
+
+       /*
+       * Sets the actual axes names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void InstantMembersNameList :: addOutlineName(std::string thekeyName, std::string theRealName)
+       {
+               NameWrapper * outlineWrap = new NameWrapper (thekeyName, theRealName);
+               outlinesNamesVector.push_back(outlineWrap);
+       }       
+       
+       /*
+       * Sets the actual axes names pair
+       * @param thekeyName The key name asigned to the actual axe      
+       * @param theRealName The real name asigned to the actual axe
+       */
+       void InstantMembersNameList :: setActualAxeWrap(std::string thekeyName, std::string theRealName)
+       {
+               actualAxeNamesWrapp -> setWrappingPair(thekeyName, theRealName);
+       }
+
+       /*
+       * Gets the actual axes key name
+       * @return actualAxeKeyName The key name asigned to the actual axe
+       */
+       std::string InstantMembersNameList :: getActualAxeKeyName()
+       {
+               return actualAxeNamesWrapp->getKeyName();
+       }
+
+       /*
+       * Gets the actual axes key name
+       * @return actualSourceImageKeyName The key name asigned to the actual axe
+       */
+       std::string InstantMembersNameList :: getActualSourceImageKeyName()
+       {
+               return actualSourceImageNamesWrapp->getKeyName();
+       }
+
+       /*
+       * Gets the actual axes key name
+       * @return actualSectionImageKeyName The key name asigned to the actual axe
+       */
+       std::string InstantMembersNameList :: getActualSectionImageKeyName()
+       {
+               return actualSourceImageNamesWrapp->getKeyName();
+       }
+
+       /*
+       * Gets the vector of the key names of currect instant outlines
+       * @return vectorPairedNames The vector with the pair of outline names wrapping
+       */
+       std::vector<NameWrapper *> InstantMembersNameList :: getOutlinesNamesVector()
+       {
+               return outlinesNamesVector;
+       }
+
+       /*
+       * Sets the actualSourceImage names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void InstantMembersNameList :: setActualSourceImageNamesWrapp(std::string thekeyName, std::string theRealName)
+       {
+               actualSourceImageNamesWrapp = new NameWrapper(thekeyName,theRealName);
+       }
+
+       /*
+       * Sets the actualSectionImage names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void InstantMembersNameList :: setActualSectionImageNamesWrapp(std::string thekeyName, std::string theRealName)
+       {
+               actualSectionImageNamesWrapp = new NameWrapper(thekeyName,theRealName);
+       }
+
+       /*
+       * Cleans the vector and the information of the instant members wrapping
+       */
+       void InstantMembersNameList :: clean()
+       {
+               
+               /*
+               if(!outlinesNamesVector.empty())
+               {while(outlinesNamesVector.size()>0)
+                       outlinesNamesVector.pop_back();
+               }
+               if ( !axesNamesVector.empty())
+               {
+               while(axesNamesVector.size()>0)
+                       axesNamesVector.pop_back();
+               }
+               */
+               outlinesNamesVector.clear();
+               axesNamesVector.clear();
+               /*
+               delete actualAxeNamesWrapp;
+               delete actualSourceImageNamesWrapp;
+               delete actualSectionImageNamesWrapp;
+               delete actualOutlineNamesWrapp;*/
+       }
+   
+   
diff --git a/lib/kernel_ManagerContour_NDimensions/InstantMembersNameList.h b/lib/kernel_ManagerContour_NDimensions/InstantMembersNameList.h
new file mode 100644 (file)
index 0000000..e9daedb
--- /dev/null
@@ -0,0 +1,122 @@
+#ifndef __INSTANT_MEMBERS_NAME_LIST__
+#define __INSTANT_MEMBERS_NAME_LIST__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <vector>
+#include <iostream>
+#include <string>
+
+#include "NameWrapper.h"
+
+
+class InstantMembersNameList{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Create the InstantMembersNameList with empty data pointers
+       */
+       InstantMembersNameList();
+
+       /*
+       * Destroys the InstantMembersNameList
+       */
+       ~InstantMembersNameList();
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Sets the actual outline names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void setActualOutline(std::string thekeyName, std::string theRealName );
+
+       /*
+       * Sets the actual axes names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void addOutlineName(std::string thekeyName, std::string theRealName);
+       
+       /*
+       * Sets the actual axes names pair
+       * @param thekeyName The key name asigned to the actual axe      
+       * @param theRealName The real name asigned to the actual axe
+       */
+       void setActualAxeWrap(std::string thekeyName, std::string theRealName);
+
+       /*
+       * Gets the actual axes key name
+       * @return actualAxeKeyName The key name asigned to the actual axe
+       */
+       std::string getActualAxeKeyName();
+
+       /*
+       * Gets the actual axes key name
+       * @return actualSourceImageKeyName The key name asigned to the actual axe
+       */
+       std::string getActualSourceImageKeyName();
+
+       /*
+       * Gets the actual axes key name
+       * @return actualSectionImageKeyName The key name asigned to the actual axe
+       */
+       std::string getActualSectionImageKeyName();
+
+       /*
+       * Gets the vector of the key names of currect instant outlines
+       * @return vectorPairedNames The vector with the pair of outline names wrapping
+       */
+       std::vector<NameWrapper *> getOutlinesNamesVector();
+
+
+       /*
+       * Sets the actualSourceImage names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void setActualSourceImageNamesWrapp(std::string thekeyName, std::string theRealName);
+
+       /*
+       * Sets the actualSectionImage names pair
+       * @param thekeyName The key name asigned to the actual outline  
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void setActualSectionImageNamesWrapp(std::string thekeyName, std::string theRealName);
+       
+       /*
+       * Cleans the vector and the information of the instant members wrapping
+       */
+       void clean();
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       std::vector<NameWrapper *> outlinesNamesVector;
+
+       std::vector<std::string> axesNamesVector;
+
+       NameWrapper * actualAxeNamesWrapp;
+
+       NameWrapper * actualSourceImageNamesWrapp;
+
+       NameWrapper * actualSectionImageNamesWrapp;
+
+       NameWrapper * actualOutlineNamesWrapp;
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/KeyThing.cxx b/lib/kernel_ManagerContour_NDimensions/KeyThing.cxx
new file mode 100644 (file)
index 0000000..7b5a68b
--- /dev/null
@@ -0,0 +1,73 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "KeyThing.h"
+
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file KeyThing.cxx */
+
+
+       /*
+       * Creates the key thing 
+       * @param thePrefix Is the prefix of the new keyThing for the key generation correponding to the new keyThing
+       * @param theValue Is the value of the intial key generation correponding to the new keyThing
+       */
+       KeyThing :: KeyThing(std::string thePrefix, int theValue)
+       {
+               setPrefix( thePrefix );
+               setValue( theValue );
+       }
+
+       /*
+       * Destroys the key thing        
+       */
+       KeyThing :: ~KeyThing()
+       {
+
+       }
+
+       
+//------------------------------------------------------------------------------------------------------------
+// Public Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Sets the prefix of the keyThing
+       */
+       void KeyThing :: setPrefix( std::string aPrefix)
+       {
+               prefix = aPrefix;
+       }
+       
+       /*
+       * Sets the value value of the keyThing
+       * @param aValue The valueimum to set
+       */
+       void KeyThing :: setValue (int aValue)
+       {
+               value = aValue;
+       }
+
+       /*
+       * Gets the prefix of the keyThing
+       * @return prefix The setted prefix
+       */
+       std::string KeyThing :: getPrefix()
+       {
+               return prefix;
+       }
+       
+       /*
+       * Gets the value value of the keyThing
+       * @return value The setted valueimum
+       */
+       int KeyThing :: getValue()
+       {
+               return value;
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/KeyThing.h b/lib/kernel_ManagerContour_NDimensions/KeyThing.h
new file mode 100644 (file)
index 0000000..322e7bc
--- /dev/null
@@ -0,0 +1,80 @@
+#ifndef __KEY_THING__
+#define __KEY_THING__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <string>
+
+class KeyThing{
+
+       
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates the key thing 
+       * @param thePrefix Is the prefix of the new keyThing for the key generation correponding to the new keyThing
+       * @param theValue Is the value of the intial key generation correponding to the new keyThing
+       */
+       KeyThing(std::string thePrefix, int theValue);
+
+       /*
+       * Destroys the key thing        
+       */
+       ~KeyThing();
+
+       
+//------------------------------------------------------------------------------------------------------------
+// Public Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Sets the prefix of the keyThing
+       */
+       void setPrefix( std::string aPrefix);
+       
+       /*
+       * Sets the value value of the keyThing
+       * @param aValue The valueimum to set
+       */
+       void setValue (int aValue);
+
+       /*
+       * Gets the prefix of the keyThing
+       * @return prefix The setted prefix
+       */
+       std::string getPrefix();
+       
+       /*
+       * Gets the value value of the keyThing
+       * @return value The setted valueimum
+       */
+       int getValue();
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       
+private:       
+
+       /*
+       * Represents the prefix of the keyThing
+       */
+       std::string prefix;
+       
+       /*
+       * Represents the value value of the keyThing
+       */
+       int value;
+};
+#endif
+
diff --git a/lib/kernel_ManagerContour_NDimensions/NameWrapper.cxx b/lib/kernel_ManagerContour_NDimensions/NameWrapper.cxx
new file mode 100644 (file)
index 0000000..01c949b
--- /dev/null
@@ -0,0 +1,68 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "NameWrapper.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file NameWrapper.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates the NameWrapper
+       * @param thekeyName The key name
+       * @param theRealName  The real name
+       * @return Returns the created NameWrapper 
+       */
+       NameWrapper :: NameWrapper(std::string thekeyName, std::string theRealName)
+       {
+               setWrappingPair(thekeyName, theRealName);
+       }
+
+       /*
+       * Destroys the NameWrapper
+       */
+       NameWrapper :: ~ NameWrapper()
+       {
+
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Sets the names pair to wrapp
+       * @param thekeyName The key name
+       * @param theRealName  The real name
+       */
+       void NameWrapper :: setWrappingPair(std::string thekeyName, std::string theRealName )
+       {
+               realName = theRealName;
+               keyName = thekeyName;
+       }
+
+       /*
+       * Gets the wrapped key name
+       * @param keyName The key name
+       */
+       std::string NameWrapper :: getKeyName()
+       {
+               return keyName;
+       }
+
+       /*
+       * Gets the wrapped real name
+       * @param realName The real name
+       */
+       std::string NameWrapper :: getRealName()
+       {
+               return realName;
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/NameWrapper.h b/lib/kernel_ManagerContour_NDimensions/NameWrapper.h
new file mode 100644 (file)
index 0000000..608f949
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef __NAME_WRAPPER__
+#define __NAME_WRAPPER__
+
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+
+class NameWrapper{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates the NameWrapper
+       * @param thekeyName The key name
+       * @param theRealName  The real name
+       * @return Returns the created NameWrapper 
+       */
+       NameWrapper(std::string thekeyName, std::string theRealName);
+
+       /*
+       * Destroys the NameWrapper
+       */
+       ~NameWrapper();
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Sets the names pair to wrapp
+       * @param thekeyName The key name
+       * @param theRealName  The real name
+       */
+       void setWrappingPair(std::string thekeyName, std::string theRealName );
+
+       /*
+       * Gets the wrapped key name
+       * @param keyName The key name
+       */
+       std::string getKeyName();
+
+       /*
+       * Gets the wrapped real name
+       * @param realName The real name
+       */
+       std::string getRealName();      
+
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * The wrapped key name
+       */
+       std::string keyName;
+
+       /*
+       * The wrapped real name
+       */
+       std::string realName;
+       
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineGroup.cxx b/lib/kernel_ManagerContour_NDimensions/OutlineGroup.cxx
new file mode 100644 (file)
index 0000000..ed66019
--- /dev/null
@@ -0,0 +1,315 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "OutlineGroup.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file OutlineGroup.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Constructs an outline group with the given name
+       * @param theName Is the name for the group
+       * @param theGroupType Is the type for the group corresponding to one of the constants of this class
+       */ 
+       OutlineGroup :: OutlineGroup(std::string theName, int theGroupType)
+       {
+               name = theName;         
+               groupType = theGroupType;
+               totalCount = 0;
+               
+               if ( groupType == PROPAGATION || groupType == PLANE_SECTION  )
+               {
+                       visibleGroup = true;                    
+                       selectedGroup = false;
+                       editingGroup = false;
+                       staticGroup = false;
+                       acceptsRepetedOutlines = false;
+               }
+               else if ( groupType ==  STRIP )
+               {       
+                       visibleGroup = true;                    
+                       selectedGroup = false;
+                       editingGroup = false;
+                       staticGroup = false;
+                       acceptsRepetedOutlines = true;
+               }
+               else if ( groupType == OVERLAPED )
+               {                               
+                       visibleGroup = true;                    
+                       selectedGroup = false;
+                       editingGroup = false;
+                       staticGroup = true;
+                       acceptsRepetedOutlines = false;
+               }
+               else if ( groupType ==  MANUAL_GROUP )
+               {                               
+                       visibleGroup = true;
+                       selectedGroup = true;
+                       editingGroup = true;
+                       staticGroup = false;
+                       acceptsRepetedOutlines = true;
+               }                               
+       }
+       
+       /*
+       * Destroyes the outline and its dependencies
+       */
+       OutlineGroup :: ~ OutlineGroup()
+       {
+               outlines_keyNames.clear();
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+
+       /*
+       * Indicates if a given name of an outline is member of the group or not
+       * @param aKeyName Is the name of an outline to search for
+       */
+       bool OutlineGroup :: isMemberOfGroup(std::string aKeyName)
+       {
+               for (int a=0; a < outlines_keyNames.size(); a++)
+               {
+                       if ( outlines_keyNames[a].compare(aKeyName) == 0 )
+                               return true;
+               }               
+               return false;
+       }
+
+       /*
+       * Removes an outline with the given name from the group 
+       * @param theNameToRemove Is the name to remove from member name list
+       */
+       void OutlineGroup :: removeOutline(std::string theNameToRemove, bool allOcurrencies)
+       {
+               std::vector <std::string>::iterator iter;               
+               
+               bool ifContinue = true;
+               bool deleted = false;
+               for ( iter = outlines_keyNames.begin( ); iter != outlines_keyNames.end( ) && ifContinue; iter++ )
+               {
+                       if ( (*iter).compare(theNameToRemove)==0 )
+                       {
+                               outlines_keyNames.erase(iter);
+                               deleted = true;
+                       }
+                       ifContinue = allOcurrencies ? acceptsRepetedOutlines : deleted; 
+               }
+               //delete iter; Se incluye esta linea o no ????????????????????
+       }
+       
+       /*
+       * Adds an outline with the given name to the group members list
+       * @param theNameNw Is the name to add to the group
+       */
+       void OutlineGroup :: addOutline(std::string theNameNw)
+       {
+               bool ifInclude = acceptsRepetedOutlines ? true : !isMemberOfGroup(theNameNw);
+               if ( ifInclude )
+                       outlines_keyNames.push_back(theNameNw);
+       /*
+               if( groupType == PROPAGATION )
+                       addOutline_PropagationType( theNameNw );
+               else if ( groupType == PLANE_SECTION )
+                       addOutline_PlaneSectionType( theNameNw );
+               else if ( groupType == OVERLAPED )
+                       addOutline_OverlapedType( theNameNw );
+               else if ( groupType == STRIP )
+                       addOutline_StripType( theNameNw );
+               else if ( groupType == MANUAL_GROUP )
+                       addOutline_ManualType( theNameNw );
+       */
+       }       
+
+       /*
+       * Gets the name of the group
+       * @return name Is the name of the group
+       */ 
+       std::string OutlineGroup :: getName()
+       { 
+               return name;
+       }
+
+       /*
+       * Sets the name of the group as the given one 
+       * @param name Is the new name of the group
+       */ 
+       void OutlineGroup :: setName(std::string theNwName)
+       { 
+               name = theNwName;
+       }
+
+       /*
+       * Gets the state of visiblility (true:visible) or not of the group
+       * @return visibleGroup Is the corresponding state
+       */ 
+       bool OutlineGroup ::  getIfVisibleGroup()
+       { 
+               return visibleGroup;
+       }
+
+       /*
+       * Sets state of visible (true) or not of the with the given one 
+       * @param theNwVisiblity Is the corresponding state
+       */ 
+       void OutlineGroup :: setIfVisibleGroup(bool theNwVisiblity)
+       { 
+               visibleGroup = theNwVisiblity;
+       }
+
+       /*
+       * Gets the state of static (true:static) or not of the group
+       * @return staticGroup Is the corresponding state
+       */ 
+       bool OutlineGroup ::  getIfStaticGroup()
+       { 
+               return staticGroup;
+       }
+
+       /*
+       * Sets state of static (true) or not of the with the given one 
+       * @param theNwStatic Is the corresponding state
+       */ 
+       void OutlineGroup :: setIfStaticGroup(bool theNwStatic)
+       { 
+               staticGroup = theNwStatic;
+       }
+
+       /*
+       * Gets the state of selection (true:selected) or not of the group
+       * @return selecetedGroup Is the corresponding state
+       */ 
+       bool OutlineGroup ::  getIfSelectedGroup()
+       { 
+               return selectedGroup;
+       }
+
+       /*
+       * Sets state of visible (true) or not of the with the given one 
+       * @param theNwSelected Is the corresponding state
+       */ 
+       void OutlineGroup :: setIfSelectedGroup(bool theNwSelected)
+       { 
+               selectedGroup = theNwSelected;
+       }
+
+       /*
+       * Gets the state of edition (true:editing) or not of the group
+       * @return editingGroup Is the corresponding state
+       */ 
+       bool OutlineGroup ::  getIfEditingGroup()
+       { 
+               return editingGroup;
+       }
+
+       /*
+       * Sets state of editing (true) or not of the with the given one 
+       * @param theNwEditing Is the corresponding state
+       */ 
+       void OutlineGroup :: setIfEditingGroup(bool theNwEditing)
+       { 
+               editingGroup = theNwEditing;
+       }
+
+       /*
+       * Gets the total count of outlines in the group
+       * @return totalCount Is the corresponding number of elements
+       */ 
+       int  OutlineGroup :: getGroupType()
+       {
+               return groupType;
+       }
+
+       /*
+       * Sets the group type 
+       * @param theType Is the corresponding new type to assign 
+       */ 
+       void OutlineGroup :: setGroupType(int  theType)
+       {
+               groupType = theType;
+       }
+
+       /*
+       * Sets the total count of outlines in the group
+       * @param theNwVisiblity Is the corresponding state
+       */ 
+       void OutlineGroup :: setIfEditingGroup(int  theTotal)
+       {
+               totalCount = theTotal;
+       }
+
+       /*
+       * Gets the group type 
+       * @return type Is the corresponding number of elements
+       */ 
+       int  OutlineGroup :: getOutlinesCount()
+       {
+               return totalCount;
+       }
+
+       /*
+       * Adds an outline to the group as propagation type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void OutlineGroup :: addOutline_PropagationType(std::string theOutlineKeyName)
+       {
+               outlines_keyNames.push_back(theOutlineKeyName);
+       }
+
+       /*
+       * Adds an outline to the group as plane section type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void OutlineGroup :: addOutline_PlaneSectionType(std::string theOutlineKeyName)
+       {
+               outlines_keyNames.push_back(theOutlineKeyName);
+       }
+
+
+       /*
+       * Adds an outline to the group as overlaped type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void OutlineGroup :: addOutline_OverlapedType(std::string theOutlineKeyName)
+       {
+               bool ifInclude = isMemberOfGroup(theOutlineKeyName);
+               if ( ifInclude )
+                       outlines_keyNames.push_back(theOutlineKeyName);
+       }
+
+       /*
+       * Adds an outline to the group as strip type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void OutlineGroup :: addOutline_StripType(std::string theOutlineKeyName)
+       {
+               outlines_keyNames.push_back(theOutlineKeyName);
+       }
+
+       /*
+       * Adds an outline to the group as manual type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void OutlineGroup :: addOutline_ManualType(std::string theOutlineKeyName)
+       {
+               outlines_keyNames.push_back(theOutlineKeyName);
+       }
+
+       /*
+       * Gets the outlines of the group
+       * @return Returns the names of the outlines that belong to the group
+       */
+        std::vector< std::string > OutlineGroup :: getGroupOutlinesNames ( )
+        {
+                return outlines_keyNames;
+        }
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineGroup.h b/lib/kernel_ManagerContour_NDimensions/OutlineGroup.h
new file mode 100644 (file)
index 0000000..238386b
--- /dev/null
@@ -0,0 +1,238 @@
+#ifndef __OTULINE_GROUP__
+#define __OTULINE_GROUP__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <vector>
+
+class OutlineGroup{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Constructs an outline group with the given name
+       * @param theName Is the name for the group
+       * @param theGroupType Is the type for the group corresponding to one of the constants of this class
+       */ 
+       OutlineGroup(std::string theName, int theGroupType);
+       
+       /*
+       * Destroyes the outline and its dependencies
+       */
+       ~ OutlineGroup();
+
+//------------------------------------------------------------------------------------------------------------
+// Methods definition
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Indicates if a given name of an outline is member of the group or not
+       * @param aKeyName Is the name of an outline to search for
+       */
+       bool isMemberOfGroup(std::string aKeyName);
+
+       /*
+       * Removes an outline with the given name from the group 
+       * @param theNameToRemove Is the name to remove from member name list
+       * @param allOcurrencies Indicates to errase all ocurrences
+       */
+       void removeOutline(std::string theNameToRemove,  bool allOcurrencies = true);
+       
+       /*
+       * Adds an outline with the given name to the group members list
+       * @param theNameNw Is the name to add to the group
+       */
+       void addOutline(std::string theNameNw);
+
+       /*
+       * Gets the name of the group
+       * @return name Is the name of the group
+       */ 
+       std::string getName();
+
+       /*
+       * Sets the name of the group as the given one 
+       * @param name Is the new name of the group
+       */ 
+       void setName(std::string theNwName);
+
+       /*
+       * Gets the state of visiblility (true:visible) or not of the group
+       * @return visibleGroup Is the corresponding state
+       */ 
+       bool getIfVisibleGroup();
+
+       /*
+       * Sets state of visible (true) or not of the with the given one 
+       * @param theNwVisiblity Is the corresponding state
+       */ 
+       void setIfVisibleGroup(bool theNwVisiblity);
+
+       /*
+       * Gets the state of static (true:static) or not of the group
+       * @return staticGroup Is the corresponding state
+       */ 
+       bool getIfStaticGroup();
+
+       /*
+       * Sets state of static (true) or not of the with the given one 
+       * @param theNwStatic Is the corresponding state
+       */ 
+       void setIfStaticGroup(bool theNwStatic);
+
+       /*
+       * Gets the state of selection (true:selected) or not of the group
+       * @return selecetedGroup Is the corresponding state
+       */ 
+       bool getIfSelectedGroup();
+
+       /*
+       * Sets state of visible (true) or not of the with the given one 
+       * @param theNwSelected Is the corresponding state
+       */ 
+       void setIfSelectedGroup(bool theNwSelected);
+
+       /*
+       * Gets the state of edition (true:editing) or not of the group
+       * @return editingGroup Is the corresponding state
+       */ 
+       bool getIfEditingGroup();
+
+       /*
+       * Sets state of editing (true) or not of the with the given one 
+       * @param theNwEditing Is the corresponding state
+       */ 
+       void setIfEditingGroup(bool theNwEditing);
+
+       /*
+       * Gets the total count of outlines in the group
+       * @return totalCount Is the corresponding number of elements
+       */ 
+       int getGroupType();
+
+       /*
+       * Sets the group type 
+       * @param theType Is the corresponding new type to assign 
+       */ 
+       void setGroupType(int theType);
+
+       /*
+       * Gets the group type 
+       * @return type Is the corresponding number of elements
+       */ 
+       int getOutlinesCount();
+
+       /*
+       * Sets the total count of outlines in the group
+       * @param theNwVisiblity Is the corresponding state
+       */ 
+       void setIfEditingGroup(int theTotal);
+
+       /*
+       * Adds an outline to the group as propagation type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void addOutline_PropagationType(std::string theOutlineKeyName);
+
+       /*
+       * Adds an outline to the group as plane section type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void addOutline_PlaneSectionType(std::string theOutlineKeyName);
+
+       /*
+       * Adds an outline to the group as overlaped type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void addOutline_OverlapedType(std::string theOutlineKeyName);
+       
+       /*
+       * Adds an outline to the group as strip type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void addOutline_StripType(std::string theOutlineKeyName);
+
+       /*
+       * Adds an outline to the group as manual type
+       * @param theOutlineKeyName Is the name used as identifier of the outline        
+       */
+       void addOutline_ManualType(std::string theOutlineKeyName);
+
+
+       /*
+       * Gets the outlines of the group
+       * @return Returns the names of the outlines that belong to the group
+       */
+        std::vector< std::string >  getGroupOutlinesNames ( );
+
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+private:       
+
+       bool acceptsRepetedOutlines;
+
+       /*
+       * Represents the name of the group
+       */
+       std::string name;
+
+       /*
+       * Represents the state of visible for the outlines in the group
+       */
+       bool visibleGroup;
+
+       /*
+       * Represents the state of selection for the outlines in the group
+       */
+       bool selectedGroup;
+
+       /*
+       * Represents the state of edition for the outlines in the group
+       */
+       bool editingGroup;
+
+       /*
+       * Represents the state of static for the outlines in the group
+       */
+       bool staticGroup;
+
+       /*
+       * Represents the type of the group
+       */
+       int groupType;
+
+       /*
+       * Represents the total elements count of the group
+       */
+       int totalCount;
+
+       /*
+       * Represents the outlines of the group
+       */
+       std::vector< std::string > outlines_keyNames;
+
+       //------------------------------------------------------------------------------------------------------------
+       // Constants
+       //------------------------------------------------------------------------------------------------------------
+       
+public :
+       enum
+               {
+                       PROPAGATION = 0,
+                       PLANE_SECTION = 1,
+                       OVERLAPED = 2,
+                       STRIP = 3,              
+                       MANUAL_GROUP = 4,               
+               };
+               
+
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.cxx b/lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.cxx
new file mode 100644 (file)
index 0000000..5c0c33c
--- /dev/null
@@ -0,0 +1,128 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "OutlineModelBuilder.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file OutlineModelBuilder.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Creates an OutlineModelBuilder
+       * @ param filesNames Paired set of files with the names of the files to read ConceptsFile, ImageSourcesFile, ImageSectionsFile, AxeThingsFile, ContoursFile
+       * @ param sources Paired set of sourceKeyName-ImageSourceThing
+       * @ param sections Paired set of sectionKeyName-ImageSectionThing
+       * @ param axes Paired set of axeKeyName-AxeThing
+       * @ param outlines Paired set of contoKeyName-ContourThing
+       */
+OutlineModelBuilder ::  OutlineModelBuilder(std::string  theConceptsFile, std::string datadir)//std::map<std::string, std::string> filesNames, std::map<std::string, ImageSourceThing *> * sources, std::map<std::string, ImageSectionThing *>* sections, std::map<std::string, AxeThing *>* axes, std::map<std::string, ContourThing *>* outlines)
+       {
+               conceptsFile = theConceptsFile; 
+               imagesSectionEnvOtherConceptsFN = datadir + "/imageSectionOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/imageSectionOtherConceptsFile.cf";
+               outlinesEnvOtherConceptsFN = datadir + "/outlinesOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/outlinesOtherConceptsFile.cf";
+               axesEnvOtherConceptsFN = datadir + "/axesOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/axesOtherConceptsFile.cf";
+               axesEnv_Reader = NULL;
+               imagesSectionEnv_Reader = NULL;
+               imageSourceEnv_Reader = NULL;
+               outlinesEnv_Reader = NULL;
+       }
+
+       /**
+       * Destroys an AxeThing
+       */
+       OutlineModelBuilder ::  ~OutlineModelBuilder()
+       {
+               delete axesEnv_Reader;
+               delete imagesSectionEnv_Reader;
+               delete imageSourceEnv_Reader;
+               delete outlinesEnv_Reader;
+       }
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Gets the ImageSourceThing environment
+       *@param  ImSourceEnv 
+       */
+    SomeEnvironment<ImageSourceThing *> * OutlineModelBuilder ::  getImSourceEnv()
+       {
+               return ( imageSourceEnv_Reader!= NULL ) ? imageSourceEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSourceThing *>();
+       }
+       /**
+       * Gets the ImageSectionThing environment
+       *@param  imSectionEnv 
+       */
+       SomeEnvironment<ImageSectionThing *> * OutlineModelBuilder ::  getImSectionEnv()
+       {
+               return ( imagesSectionEnv_Reader!= NULL ) ? imagesSectionEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSectionThing *>();
+       }
+       /*
+       * Gets the AxeThing environment
+       *@param  AxesEnv
+       */
+       SomeEnvironment<AxeThing *> * OutlineModelBuilder ::  getAxesEnv()
+       {
+               return ( axesEnv_Reader!= NULL ) ? axesEnv_Reader->getEnvironment() : new SomeEnvironment<AxeThing *>();
+       }
+       /**
+       * Gets the ContourThing environment
+       *@param  ContourEnv 
+       */
+       SomeEnvironment<ContourThing *> * OutlineModelBuilder ::  getContourEnv()
+       {
+               return ( outlinesEnv_Reader!= NULL ) ? outlinesEnv_Reader->getEnvironment() : new SomeEnvironment<ContourThing *>();
+       }
+
+
+       /**
+       * Builds the ImageSourceThing * environment
+       * @param sourcesFile File path with the object key names and specific instants for each one
+       * @param sources The sources to include in the enivorment
+       */
+       void OutlineModelBuilder :: buildImageSource_Envornment( std::string sourcesFile, std::map<std::string, ImageSourceThing *> * sources )
+       {
+               if( !conceptsFile.empty() )
+                       imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> (conceptsFile, sourcesFile, sources);
+       }
+
+       /**
+       * Builds the ImageSectionThing * environment
+       * @param sectionsFile File path with the object key names and specific instants for each one
+       * @param sections The sections to include in the enivorment
+       */
+       void OutlineModelBuilder :: buildImageSection_Envornment( std::string sectionsFile, std::map<std::string, ImageSectionThing *>* sections )
+       {
+               if( !conceptsFile.empty() )
+                       imagesSectionEnv_Reader = new ReaderEnvironment<ImageSectionThing *> ( imagesSectionEnvOtherConceptsFN, conceptsFile, sectionsFile, sections);
+       }
+
+
+       /**
+       * Builds the AxeThing * environment
+       * @param axesFile File path with the object key names and specific instants for each one
+       * @param axes The axes to include in the enivorment
+       */
+       void OutlineModelBuilder :: buildAxe_Envornment( std::string axesFile, std::map<std::string, AxeThing *>* axes )
+       {
+               if( !conceptsFile.empty() )
+                       axesEnv_Reader = new ReaderEnvironment<AxeThing *> ( axesEnvOtherConceptsFN, conceptsFile, axesFile, axes);
+       }
+
+       /**
+       * Builds the CountourThing * environment
+       * @param outlinesFile File path with the object key names and specific instants for each one
+       * @param outlines The outlines to include in the enivorment
+       */
+       void OutlineModelBuilder :: buildCountour_Envornment( std::string outlinesFile, std::map<std::string, ContourThing *>* outlines )
+       {
+               if( !conceptsFile.empty() )
+                       outlinesEnv_Reader = new ReaderEnvironment< ContourThing *> ( outlinesEnvOtherConceptsFN, conceptsFile, outlinesFile, outlines);
+       }
+
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.h b/lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.h
new file mode 100644 (file)
index 0000000..c3c5bba
--- /dev/null
@@ -0,0 +1,135 @@
+#ifndef __OUTLINE_MODEL_BUILDER__
+#define __OUTLINE_MODEL_BUILDER__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <vector>
+#include <string>
+
+
+#include "ReaderEnvironment.h"
+#include "SomeEnvironment.h"
+#include "ContourThing.h"
+#include "AxeThing.h"
+#include "ImageSourceThing.h"
+#include "ImageSectionThing.h"
+
+
+
+class OutlineModelBuilder{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /**
+       * Creates an OutlineModelBuilder
+       * @ param filesNames Paired set of files with the names of the files to read ConceptsFileName, ImageSourcesFile, ImageSectionsFile, AxeThingsFile, ContoursFile
+       * @ param sources Paired set of sourceKeyName-ImageSourceThing
+       * @ param sections Paired set of sectionKeyName-ImageSectionThing
+       * @ param axes Paired set of axeKeyName-AxeThing
+       * @ param outlines Paired set of contoKeyName-ContourThing
+       */
+       OutlineModelBuilder(std::string conceptsFile, std::string datadir = "data" );//std::map<std::string, std::string> filesNames, std::map<std::string, ImageSourceThing *> * sources, std::map<std::string, ImageSectionThing *>* sections, std::map<std::string, AxeThing *>* axes, std::map<std::string, ContourThing *>* outlines);
+
+       /**
+       * Destroys an AxeThing
+       */
+       ~OutlineModelBuilder();
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /**
+       * Gets the ImageSourceThing environment
+       *@param  ImSourceEnv 
+       */
+    SomeEnvironment<ImageSourceThing *> * getImSourceEnv();
+       /**
+       * Gets the ImageSectionThing environment
+       *@param  imSectionEnv 
+       */
+       SomeEnvironment<ImageSectionThing *> * getImSectionEnv();
+       /**
+       * Gets the AxeThing environment
+       *@param  AxesEnv
+       */
+       SomeEnvironment<AxeThing *> * getAxesEnv();
+       /**
+       * Gets the ContourThing environment
+       * @param  ContourEnv 
+       */
+       SomeEnvironment<ContourThing *> * getContourEnv();
+       
+       /**
+       * Builds the ImageSourceThing * environment
+       * @param sourcesFile File path with the object key names and specific instants for each one
+       * @param sources The sources to include in the enivorment
+       */
+       void buildImageSource_Envornment( std::string sourcesFile, std::map<std::string, ImageSourceThing *> * sources );
+
+       /**
+       * Builds the ImageSectionThing * environment
+       * @param sectionsFile File path with the object key names and specific instants for each one
+       * @param sections The sections to include in the enivorment
+       */
+       void buildImageSection_Envornment( std::string sectionsFile, std::map<std::string, ImageSectionThing *>* sections );
+
+       /**
+       * Builds the AxeThing * environment
+       * @param axesFile File path with the object key names and specific instants for each one
+       * @param axes The axes to include in the enivorment
+       */
+       void buildAxe_Envornment( std::string axesFile, std::map<std::string, AxeThing *>* axes );
+
+       /**
+       * Builds the CountourThing * environment
+       * @param outlinesFile File path with the object key names and specific instants for each one
+       * @param outlines The outlines to include in the enivorment
+       */
+       void buildCountour_Envornment( std::string outlinesFile, std::map<std::string, ContourThing *>* outlines );
+
+private:
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       
+       /**
+       * Represents the environment builder based of reading files of axes
+       */
+       ReaderEnvironment<AxeThing *> *axesEnv_Reader;
+
+       /**
+       *  Represents the environment builder based of reading files of section images 
+       */
+       ReaderEnvironment<ImageSectionThing *> *imagesSectionEnv_Reader;
+
+       /**
+       * Represents the environment builder based of reading files of source images (Generally a complete volume data per image) 
+       */
+       ReaderEnvironment<ImageSourceThing *>  *imageSourceEnv_Reader;
+
+       /**
+       * Represents the environment builder based of reading files of outlines (outlines)
+       */
+       ReaderEnvironment<ContourThing *> * outlinesEnv_Reader;
+
+       /*
+       *
+       */
+       std::string conceptsFile;
+
+       std::string imagesSectionEnvOtherConceptsFN;
+
+       std::string outlinesEnvOtherConceptsFN;
+
+       std::string axesEnvOtherConceptsFN;
+       
+
+};
+#endif
+
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx b/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx
new file mode 100644 (file)
index 0000000..2c7d703
--- /dev/null
@@ -0,0 +1,780 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "OutlineModelManager.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file OutlineModelManager.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+/*
+       * Creates the outline manager
+       */
+       OutlineModelManager :: OutlineModelManager( SomeEnvironment<ImageSourceThing *> *imSourceEnv, SomeEnvironment<ImageSectionThing *> *imSectionEnv, SomeEnvironment<AxeThing *> *axesEnv, SomeEnvironment<ContourThing *> *contourEnv )
+       {
+               actualInstant                           = NULL;
+               imageSourceEnvironment          = imSourceEnv;
+               imagesSectionEnvironment        = imSectionEnv;
+               axesEnvironment                         = axesEnv;
+               outlinesEnvironment                     = contourEnv;
+
+               workSpace                                       = new ContourWorkspace(this);//implies a shared workSpace
+               keyGenerator                            = * new PrefixMaxKeyGenerator();        
+               counterIdKey                            = 0;
+
+               actualInstantWrapping           = new InstantMembersNameList();
+               changeSourceImage                       = true; 
+
+               bool allOK      = keyGenerator.addKeyThing("Axes", "Axe");
+               allOK &= keyGenerator.addKeyThing("Image Sources", "Image source");
+               allOK &= keyGenerator.addKeyThing("Image Sections", "Image section");
+               allOK &= keyGenerator.addKeyThing("Outlines", "Outline");
+               //setAutomaticConcepts();
+       }
+
+       /*
+       * Destroys the outline manager
+       */
+       OutlineModelManager :: ~OutlineModelManager()
+       {
+               clean();
+               delete actualInstant;
+               delete workSpace;
+               delete actualInstantWrapping;           
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Methods 
+//------------------------------------------------------------------------------------------------------------
+
+
+       /*
+       * Creates and sets a workSpace object
+       * @return Retourns the created workSpace
+       */
+       ContourWorkspace * OutlineModelManager :: createWorkSpace()
+       {
+               workSpace = new ContourWorkspace(this);
+               return workSpace;
+       }
+
+       /*
+       * Sets the workSpace object
+       * @param  aWorkSpace The workSpace to set 
+       */
+       void OutlineModelManager :: setWorkSpace( ContourWorkspace * aWorkSpace )
+       {
+               workSpace = aWorkSpace;
+       }
+
+       /*
+       * Executes a command over an outline object
+       * @param imaKName Is the key name of the outline
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool OutlineModelManager :: executeCommand_OutlineModel(std::string outKName, CommandObject * theCommand, bool fromRegistration)
+       {
+               ContourThing * theOutline = *outlinesEnvironment->getThingByName( outKName );
+               if(!fromRegistration)
+               {
+                       CommandObject * undoCommand = theOutline->getUndoCommandOf( theCommand );
+                       workSpace->callRegisterCommand(theCommand, undoCommand);
+               }
+               return theOutline->executeCommand( theCommand );
+       }
+
+       /*
+       * Executes a command identifying which actions have to realize before executing it.
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool OutlineModelManager :: executeCommand(CommandObject * theCommand, bool fromRegistration)
+       {
+               bool executedCom = true;
+               //TODO**********************************************************************************************************************************************
+               //Interpreting who is the one that executes the command
+
+               //Modifiying the command in necessary for detaching interpreted information
+
+               //If is an outline, sending the command to execute the specific command
+
+               return executedCom;
+       }
+
+       /*
+       * Executes a command queue identifying which actions have to realize before executing it, using FIFO for each.
+       * @param executionQueue Is the command queue to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool OutlineModelManager ::  executeCommandsQueue(std::deque<CommandObject *> executionQueue, bool fromRegistration)
+       {
+               bool executedComs = executionQueue.size()>0 ? true : false;
+               while( executionQueue.size()>0 )
+               {                       
+                       CommandObject * aCmmand = executionQueue.front();
+                       executedComs &= executeCommand(aCmmand, fromRegistration);
+                       executionQueue.pop_front();
+               }
+               return executedComs;
+       }
+
+       
+       /*
+       * Sets the concepts of the environments and includes the concepts managed by the program 
+       * @conceptsScript Is the script for with the concepts descrition
+       * @return Returns true if successful insert of the given concepts, false otherwise
+       */
+       bool OutlineModelManager :: setUserConcepts(std::string conceptsScript)
+       {
+               bool allOK = true;
+               int endSub;
+               std::string::size_type equalIndex = conceptsScript.find("=", 0);
+               std::string::size_type nextIndex = 0;
+               while( equalIndex != std::string::npos && allOK) 
+               {       
+            endSub = equalIndex;
+                       std::string concept = conceptsScript.substr( 0, endSub ); 
+                       conceptsScript.erase( 0, endSub+1 ); 
+                       std::cout << "C: " << concept <<std::endl;                      
+                       nextIndex = conceptsScript.find(";", 0);
+                       std::string cSize;
+                       if(nextIndex != std::string::npos)
+                       {
+                               endSub = nextIndex;
+                               cSize = conceptsScript.substr( 0, endSub ); 
+                               conceptsScript.erase( 0, endSub+1 ); 
+                       }
+                       else
+                       {
+                               endSub = conceptsScript.size();         
+                               cSize = conceptsScript.substr( 0, endSub ); 
+                               conceptsScript.erase( 0, endSub ); 
+                       }                       
+                       int intReturn = atoi(cSize.c_str());                    
+                       std::cout << "SZ: "<<intReturn <<std::endl;     
+                       equalIndex = conceptsScript.find("=", 0);       
+                       if( intReturn>0 )
+                               allOK &= addUserConcept(concept, intReturn);
+                       else
+                               allOK = false;
+               }               
+               return allOK;
+       }
+
+       /*
+       * Add a concept to all the environments 
+       * @param theConceptName Is the name of the new concept
+       * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances 
+       * @return Returns true if successful insert of concept, false otherwise
+       */              
+       bool OutlineModelManager :: addUserConcept(std::string theConceptName, int conceptSize)
+       {       
+               bool allOK = axesEnvironment->addConcept(theConceptName, conceptSize);
+               allOK &= imagesSectionEnvironment->addConcept(theConceptName, conceptSize);
+               allOK &= imageSourceEnvironment->addConcept(theConceptName, conceptSize);
+               allOK &= outlinesEnvironment->addConcept(theConceptName, conceptSize);
+               return allOK;
+       }
+
+       /**
+       * Gets the outlines at an instant form the outline's environment
+       * @param anInstant The instant wondered to get outlines at
+       * @param ifAnnotate Indicates if it is needed to annotate the searched outlines
+       * @return The vector to the outlines at the given instance
+       */
+       std::vector<NameWrapper *> OutlineModelManager :: getActualInstantOutlines ()
+       {
+               return actualInstantWrapping->getOutlinesNamesVector();
+       }
+
+//EED01
+       void OutlineModelManager :: ChangeContourOfList(std::string keyName, Instant *instant)
+       {
+               int ispartofstaticlist = IsPartOfStaticList(keyName);
+               if (ispartofstaticlist==-1)
+               {
+                       staticContourLst.push_back(  this->outlinesEnvironment->getThingByName(keyName)  );
+                       this->outlinesEnvironment->removeThingFromInstant(keyName, instant);
+               } else {
+                       ContourThing **contourthing  = staticContourLst[ispartofstaticlist];
+                       this->outlinesEnvironment->addInstantToThing    ( keyName , instant );                  
+                       staticContourLst.erase( staticContourLst.begin()+ispartofstaticlist );
+               }
+       }
+
+
+       /**
+       * Gets the outlines at an instant form the outline's environment
+       * @param anInstant The instant wondered to get outlines at
+       * @param ifAnnotate Indicates if it is needed to annotate the searched outlines
+       * @return The vector to the outlines at the given instance
+       */
+       std::vector<ContourThing**>  OutlineModelManager :: getOutlinesAtInstant(Instant * anInstant, bool ifAnnotate)
+       {
+               std::vector<std::string> kNamesVector;
+               std::vector<ContourThing **> outlinesVector; //= new std::vector<ContourThing **>();
+               outlinesEnvironment->getThings( kNamesVector, outlinesVector, anInstant);
+
+//EED01
+               int i,sizeStaticContourLst =  staticContourLst.size();
+               for ( i=0 ; i<sizeStaticContourLst ; i++ )
+               {
+                       ContourThing **contourthing  = staticContourLst[i];
+                       outlinesVector.push_back( contourthing );
+                       kNamesVector.push_back( (*contourthing)->getName() );
+               }// for i
+
+               if (ifAnnotate)
+               {
+                       annotateOutlinesWrap(kNamesVector, outlinesVector);
+               }
+               return outlinesVector;
+       }
+
+//EED01
+       std::vector<std::string> OutlineModelManager :: GetLstNameThingsStatic()
+       {
+               std::vector<std::string> result;
+               int i,sizeStaticContourLst =  staticContourLst.size();
+               for ( i=0 ; i<sizeStaticContourLst ; i++ )
+               {
+                       ContourThing **contourthing  = staticContourLst[i];
+                       result.push_back( (*contourthing)->getName() );
+               }// for i
+               return result;
+       }
+
+       std::vector<std::string> OutlineModelManager :: GetLstNameThings()
+       {
+               std::vector<std::string> kNamesVector;
+               std::vector<ContourThing **> outlinesVector; //= new std::vector<ContourThing **>();
+               std::vector<Instant *> lstInstants = getOutlineInstants();
+               int i,sizeLstInstants = lstInstants.size(); 
+               Instant *instant;
+               for ( i=0 ; i<sizeLstInstants ; i++ )
+               {
+                       instant = lstInstants[i];
+                       outlinesEnvironment->getThings( kNamesVector, outlinesVector, instant);
+               } // for i
+               return kNamesVector;
+       }
+
+
+       /**
+       * Gets the outlines at a specific form the outline's environment
+       * @param aGroupName The name of the group containing the outlines names to get
+       * @return The vector to the outlines at the given group
+       */ 
+       std::vector<ContourThing*> OutlineModelManager :: getOutlinesFromGroup(std::string aGroupName)
+       {
+               std::vector<ContourThing *> outlinesVector;
+               std::map< std::string,OutlineGroup * >::iterator iterP = outlineGroups.find(aGroupName);
+               if ( iterP != outlineGroups.end() )
+               {       
+                       std::vector<std::string> kNamesVector = iterP->second->getGroupOutlinesNames(); 
+                       for(int i=0; i<kNamesVector.size();i++)
+                       {
+                               ContourThing * outlineI = getOutlineByKeyName(kNamesVector[i]);
+                               outlinesVector.push_back(outlineI);
+                       }                       
+               }
+               return outlinesVector;
+       }
+
+       /**
+       * Gets the outlines at a specific form the outline's environment
+       * @param aGroupName The name of the group containing the outlines names to get
+       * @return The vector to the outlineGroups at the given group
+       */ 
+       bool OutlineModelManager :: addOutlinesGroup( std::string theOutlineName, OutlineGroup * theGroup )
+       {
+        outlineGroups.insert(std::pair <std::string, OutlineGroup *> ( theOutlineName, theGroup ));                            
+               std::map<std::string, OutlineGroup *> :: iterator iter = NULL;
+               iter = outlineGroups.find( theOutlineName );
+               bool ifAdded = iter->first.compare( theOutlineName ) == 0;
+               return ifAdded;
+       }
+       /*
+       * Gets the an outline given the keyName used to be indexed in the outlines's environment
+       * @param outKName Is the outline keyName to search
+       * @return  The corresponding unique outline with the given key name
+       */
+       ContourThing* OutlineModelManager :: getOutlineByKeyName(std::string outKName)
+       {
+               return *(outlinesEnvironment->getThingByName(outKName));
+       }
+
+       /*
+       * Gets the an imageSourceThing given the keyName used to be indexed in the ImageSourceThing's environment
+       * @param outKName Is the imageSourceThing keyName to search
+       * @return  The corresponding unique outline with the given key name
+       */
+       ImageSourceThing* OutlineModelManager ::getImageSourceThingByKeyName(std::string iSeourceKName)
+       {
+               return *(imageSourceEnvironment->getThingByName(iSeourceKName));
+       }
+
+       /*
+       * Gets the an imageSectionThing given the keyName used to be indexed in the ImageSectionThing's environment
+       * @param outISectionName Is the imageSectionThing keyName to search
+       * @return  The corresponding unique outline with the given key name
+       */
+       ImageSectionThing* OutlineModelManager ::getImageSectionThingByKeyName(std::string iSectionName)
+       {
+               return *(imagesSectionEnvironment->getThingByName(iSectionName));
+       }
+
+       /*
+       * Creates an outlineThing with a given name, if no name is given it would have an automatic
+       * @param aName The name for the outlineThing
+               * @return Returns the key name of the created outline, or ""if it wasn't created
+       */
+//     bool OutlineModelManager :: createOutline(std::string aName, ContourThing * &theOutline)
+       std::string  OutlineModelManager :: createOutline(manualContourModel * model, std::vector<int> theInstantData, std::string aName)
+       {
+               ContourThing * theOutline = new ContourThing ( model );
+               theOutline->setName(aName);             
+               return addOutline( theOutline, new Instant( &theInstantData ) );                                
+       }
+
+       /*
+       * Creates an axeThing with a given name
+       * @param aDescription The description for the axeThing
+       * @return Returns true if the creation of the axe was successful
+       */
+       //bool OutlineModelManager :: createAxe(std::string aDescription, AxeThing * &theAxe)
+       bool  OutlineModelManager :: createAxe(std::string aDescription, Instant * theInstantData)
+       {
+               AxeThing * theAxe = new AxeThing ();
+               theAxe->setDescription(aDescription);                 
+               return addAxe(theAxe, theInstantData);          
+       }
+
+       /*
+       * Creates an imageSourceThing with a given name
+       * @param aSource The name for the imageSourceThing
+       * @return Returns true if the creation of the imageSource was successful
+       */
+       //bool OutlineModelManager :: createImageSource(std::string aSource, ImageSourceThing * &imageSource)
+       bool OutlineModelManager :: createImageSource(std::string aSource, Instant * theInstantData)
+       {
+//             imageSource = new ImageSourceThing(aSource);                
+               //return addImageSource(new ImageSourceThing(aSource), theInstantData);         
+               return NULL;//***********************************************************************************************
+       }
+
+       /*
+       * Creates an imageSectionThing with a given name
+       * @param aSecImageData The name for the imageSectionThing
+       * @return Returns true if the creation of the imageSection was successful
+       */
+       //bool OutlineModelManager :: createImageSection(std::string aSecImageData, ImageSectionThing * &imageSection)
+       bool OutlineModelManager :: createImageSection(std::string aSecImageData, Instant * theInstantData)
+       {
+               //imageSection = new ImageSectionThing(aSecImageData);               
+//             return addImageSection(new ImageSectionThing(aSecImageData), theInstantData);   
+               return NULL;
+       }
+
+       /*
+       * Adds an outlineThing 
+       * @param theOutline The outline/contour (thing)
+       * @param theInstantData Is the instant for the outline to add
+       * @return Returns true if the addition of the outline was successful
+       */
+       std::string OutlineModelManager :: addOutline( ContourThing * theOutline, Instant * theInstantData)
+       {               
+               std::string kName;
+
+// EED 
+//             bool added  = keyGenerator.generateKeyOf("Outlines", outlinesEnvironment->getNumberOfThings(),kName);
+
+               counterIdKey++;
+               bool added = keyGenerator.generateKeyOf( "Outlines", counterIdKey , kName );
+
+               if( theOutline->getName().compare("")==0 )
+               {
+                       theOutline->setName(kName);
+               }
+               added &= outlinesEnvironment->addThingWithInstant(kName,theOutline, theInstantData);
+               if( added )
+                       return kName;
+               else
+                       return "";              
+       }
+
+
+       int OutlineModelManager::IsPartOfStaticList(std::string ss)
+       {
+               int iBack=-1;
+               int i, size = staticContourLst.size();
+               for( i=0 ; i<size ; i++ )
+               {
+                       ContourThing **contourthing  = staticContourLst[i];
+                       if ((*contourthing)->getName() == ss)
+                       {
+                               iBack=i;
+                       } // getName() == ss
+               }
+               return iBack;
+       }
+
+
+       /*
+       * Remove an outlineThing 
+       * @param theOutline The outline/contour (thing)
+       */
+       void OutlineModelManager :: removeOutline( std::string ss )
+       {               
+                       outlinesEnvironment->removeThing( ss );
+       }
+
+//EED01
+       void OutlineModelManager :: removeAllOutlines()
+       {
+               //
+               staticContourLst.clear();
+
+               //
+               std::vector< ContourThing **>  thingsVector;
+               outlinesEnvironment->getThingsOfEnvironment( &thingsVector );
+               int i,sizeThingVector = thingsVector.size();
+               for(i=0;i<sizeThingVector;i++) 
+               {
+                       ContourThing ** contourthing =  thingsVector[i];
+                   removeOutline(  (*contourthing)->getName()   );
+               }
+       }
+
+
+       /*
+       * Adds an axeThing 
+       * @param thaAxe The axe (thing)
+       * @param theInstantData Is the instant for the axe to add
+       * @return Returns true if the addition of the axe was successful
+       */
+       bool OutlineModelManager :: addAxe( AxeThing * theAxe , Instant * theInstantData)
+       {
+               std::string kName;
+               bool added  = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName);           
+               added &= axesEnvironment->addThingWithInstant(kName,theAxe, theInstantData);
+               return added;
+       }
+
+       /*
+       * Adds an imageSourceThing 
+       * @param imgageSource The image source (thing)
+       * @param theInstantData Is the instant for the source to add
+       * @return Returns true if the addition of the imageSource was successful
+       */
+       bool OutlineModelManager :: addImageSource(ImageSourceThing * imageSource, Instant * theInstantData)
+       {
+               std::string kName;
+               bool added  = keyGenerator.generateKeyOf("Image Sources", imageSourceEnvironment->getNumberOfThings(),kName);
+               added &= imageSourceEnvironment->addThingWithInstant(kName,imageSource, theInstantData );
+               return added;
+       }
+
+       /*
+       * Adds an imageSectionThing with a given name, if no name is given it would have an automatic
+       * @param aName The imageSection (thing)
+       * @param theInstantData Is the instant for the imageSection to add
+       * @return Returns true if the addition of the imageSection was successful
+       */
+       bool OutlineModelManager :: addImageSection(ImageSectionThing * imageSection, Instant * theInstantData)
+       {               
+               std::string kName;
+               bool added  = keyGenerator.generateKeyOf("Image Sections", imagesSectionEnvironment->getNumberOfThings(),kName);
+               added &= imagesSectionEnvironment->addThingWithInstant(kName, imageSection, theInstantData);
+               return added;
+       }
+
+       /*
+       * Annotates an outline keyname at the actual instant
+       * @param kOutlineName The key name to annotate
+       * @param theRealName The real name asigned to the outline
+       */
+       void OutlineModelManager :: annotateOutlineWrap(std::string kOutlineName, std::string theRealName)
+       {
+               actualInstantWrapping -> addOutlineName(kOutlineName, theRealName);
+       }
+
+       /*
+       * Annotates a set of outline keynames-real names wrapping at the actual instant
+       * @param kNamesVector The key names vector to annotate
+       * @param theOutlinesVector The outlines pointers vector to get the real names from
+       */
+       void OutlineModelManager :: annotateOutlinesWrap(std::vector<std::string> kNamesVector, std::vector<ContourThing **> theOutlinesVector)
+       {
+               actualInstantWrapping ->clean();
+               for(int i=0; i<kNamesVector.size(); i++)
+               {
+                       ContourThing * anOutline = *theOutlinesVector[i];
+                       actualInstantWrapping -> addOutlineName( kNamesVector[i], anOutline->getName() );
+               }
+       }
+       
+       /*
+       * Annotates the actual outline keyName-real name wrapping at the actual instant
+       * @param actualKeyOutline The key name to annotate
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void OutlineModelManager :: annotateActualOutlineWrap(std::string actualKeyOutline, std::string theRealName)
+       {
+               actualInstantWrapping -> setActualOutline(actualKeyOutline, theRealName);
+       }
+
+       /*
+       * Annotate the actual axe keyName-real name wrapping at the actual instant
+       * @param actualKeyAxe The key name to annotate
+       * @param theRealName The real name asigned to the actual axe
+       */
+       void OutlineModelManager :: annotateActualAxeWrap(std::string actualKeyAxe, std::string theRealName)
+       {
+               actualInstantWrapping -> setActualAxeWrap(actualKeyAxe, theRealName);
+       }
+
+       /*
+       * Annotate the annotateActualSection image keyName-real name wrapping at the actual instant
+       * @param actualKeyImage The key name to annotate
+       * @param theRealName The real name asigned to the annotateActualSection
+       */
+       void OutlineModelManager :: annotateActualSectionImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR...
+       {
+               actualInstantWrapping -> setActualSectionImageNamesWrapp(actualKeyImage, theRealName);
+       } 
+
+       /*
+       * Annotate the annotateActualSource image keyName-real name wrapping at the actual instant
+       * @param actualKeyImage The key name to annotate
+       * @param theRealName The real name asigned to the annotateActualSource 
+       */
+       void OutlineModelManager :: annotateActualSourceImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR...
+       {
+               actualInstantWrapping -> setActualSourceImageNamesWrapp(actualKeyImage, theRealName);
+       } 
+
+
+       /*
+       * Sets the actual instant and manage the search of the corresponding elements with the specified instant in all the enviornments
+       * @param newActualInstantData Is the instant data
+       */
+       void OutlineModelManager :: setInstant(Instant * newActualInstantData)
+       {
+               actualInstant = newActualInstantData;
+               updateToActualInstant();
+       }
+
+       /*
+       * Gets the an axe with a given keyName
+       * @axeKName The axe keyName for searching in the axes environment
+       * @return The corresponding axe
+       */
+       AxeThing * OutlineModelManager :: getAxeByKeyName(std::string axeKName)
+       {
+               return *axesEnvironment->getThingByName(axeKName);
+       }
+
+       /*
+       * Gets the instants of a specific outline
+       * @param thekName Is the name of the outline
+       * @return The instants set 
+       */
+       std::vector<Instant *> OutlineModelManager :: getOutlineInstantsByName(std::string thekName)
+       {               
+               return *outlinesEnvironment->getInstantsOfThing(thekName);              
+       }
+
+       /*
+       * Gets all instants outlines
+       * @return The instants set 
+       */
+       std::vector<Instant *> OutlineModelManager :: getOutlineInstants()
+       {               
+               return *outlinesEnvironment->getExistingInstants();             
+       }
+
+
+
+       /*
+       * Includes an instant to the specified axe
+       * @param outKName Is outline key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool OutlineModelManager :: includeOutlineInstant(std::string outKName,Instant * anInstantData)
+       {
+               return outlinesEnvironment->addInstantToThing(outKName,anInstantData);
+       }
+
+       /*
+       * Includes an instant to the specified axe
+       * @param axeKName Is axe key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool OutlineModelManager :: includeAxeInstant(std::string axeKName,Instant * anInstantData)
+       {
+               return axesEnvironment->addInstantToThing( axeKName,anInstantData );
+       }
+
+       /*
+       * Includes an instant to the specified image section
+       * @param imaKName Is the image section key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool OutlineModelManager :: includeImageSectionInstant(std::string imaKName,Instant * anInstantData)
+       {
+               return imagesSectionEnvironment->addInstantToThing( imaKName,anInstantData );
+       }
+
+       /*
+       * Includes an instant to the specified image source
+       * @param imaKName Is the image section key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool OutlineModelManager :: includeImageSourceInstant(std::string imaKName,Instant * anInstantData)
+       {
+               return imageSourceEnvironment->addInstantToThing( imaKName,anInstantData );
+       }
+       
+       /*
+       *       Method that retorns the name of each concept and the size of it.
+       *       @param conceptNameVect, Vector in which is disposed to be setted the name for each of the included concepts
+       *       @param conceptSizeVect, Vector in which is disposed to be setted the size for each of the included concepts
+       */
+       void OutlineModelManager :: getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect)
+       {
+               if( outlinesEnvironment != NULL )
+               {
+                       //if (outlinesEnvironment->getNumberOfThings()>0)
+                               outlinesEnvironment->getConceptsInformation(conceptNameVect, conceptSizeVect);
+               }       
+       }
+
+
+       /*
+       * Gets the contourWorspace 
+       * @return Returns the workspace
+       */
+       ContourWorkspace * OutlineModelManager :: getContourWorkspace()
+       {
+               return workSpace;
+       }
+
+
+       /*
+       * Cleans the outline model manager and its dependencies
+       */
+       void OutlineModelManager :: clean()
+       {
+               /*axesEnvironment->clean();
+               imagesSectionEnvironment->clean();
+               imageSourceEnvironment->clean();
+               outlinesEnvironment->clean();*/
+               outlineGroups.clear();
+               actualInstantWrapping->clean();
+               keyGenerator.clear();
+               //workSpace->clear();
+       }
+
+       /*
+       * Update the registered objects in the InstantMemebersNameList, is the one that really changes the instant in the model
+       */
+       void OutlineModelManager :: updateToActualInstant()
+       {               
+               Instant * longInstant = actualInstant;
+               /*Instant * mediumInstant = new Instant();
+               Instant * shortInstant = new Instant();         
+               std::vector<int>* theInstant = longInstant->getInstant();
+               for(int i=1; i<theInstant->size(); i++)
+               {
+                       if (i>=2)
+                               shortInstant->addConcept( (*theInstant)[i] );
+                       mediumInstant->addConcept( (*theInstant)[i] );
+               }
+               
+               //getting the sourceAtInstant
+               std::vector<std::string> kSourceVector;
+               std::vector<ImageSourceThing **> imSourceVector;
+               imageSourceEnvironment->getThings(kSourceVector, imSourceVector, shortInstant);
+               annotateActualSourceImageWrap(kSourceVector[0], (**imSourceVector[0]).getSourceImage());
+
+        //getting the aAxeAtInstant 
+               std::vector<std::string> kAxeVector;
+               std::vector<AxeThing **> axesVector;
+               axesEnvironment->getThings(kAxeVector, axesVector, mediumInstant);
+               if ( !kAxeVector.empty() )
+                       annotateActualAxeWrap(kAxeVector[0], (**axesVector[0]).getDescription());
+
+               //getting the sectionAtInstant
+               std::vector<std::string> kSectionVector;
+               std::vector<ImageSectionThing **> imSectionVector;
+               imagesSectionEnvironment->getThings(kSectionVector, imSectionVector, longInstant); if ( !kSectionVector.empty() )
+           //annotateActualSectionImageWrap(kSectionVector[0], (**imSectionVector[0]).getImageData());
+               */
+               
+               //getting the outlines          
+
+               std::vector<ContourThing ** > vect = getOutlinesAtInstant( longInstant );
+
+       }
+       
+       /*
+       * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments.   
+       * @return Returns true if successful insert of the automatic concepts, false otherwise
+       */
+       bool OutlineModelManager :: setAutomaticConcepts()
+       {
+               axeConcept = "Axe";
+               axeDepthConcept = "Axe Depth";
+               int axeC_size = 10;
+               int axeDepthC_size = INT_MAX;
+
+               bool allOK = axesEnvironment->addConcept(axeConcept, axeC_size);
+               allOK &= imagesSectionEnvironment->addConcept(axeConcept, axeC_size);
+               allOK &= outlinesEnvironment->addConcept(axeConcept, axeC_size);
+               
+               allOK &= imagesSectionEnvironment->addConcept(axeDepthConcept, axeDepthC_size);
+               allOK &= outlinesEnvironment->addConcept(axeDepthConcept, axeDepthC_size);
+/*
+               allOK &= keyGenerator.addKeyThing("Axes", "Axe");
+               allOK &= keyGenerator.addKeyThing("Image Sources", "Image source");
+               allOK &= keyGenerator.addKeyThing("Image Sections", "Image section");
+               allOK &= keyGenerator.addKeyThing("Outlines", "Outline");*/
+
+               return allOK;
+       }
+
+
+       std::string OutlineModelManager :: createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData )
+       {
+               manualContourModel * manModelContour  = getOutlineByKeyName( anExistingKName )->getModel()->Clone();
+               return createOutline( manModelContour, instantNoTouchData );
+       }
+
+       void OutlineModelManager::SaveThingName( FILE *pFile, std::string nameThing )
+       {
+               std::vector< Instant * > *lstInstants;
+               lstInstants = outlinesEnvironment->getInstantsOfThing( nameThing );
+               Instant *instant = (*lstInstants)[0];
+               std::vector<int> *vecInst =instant->getInstant();
+               int i,sizeVecInst = vecInst->size();
+               fprintf(pFile,"Instant ");
+               for ( i=0 ; i<sizeVecInst ; i++ )
+               {
+                       fprintf(pFile,"%d ",(*vecInst)[i]);
+               }
+               fprintf(pFile,"\n");
+               ContourThing *contourthing = *outlinesEnvironment->getThingByName(nameThing);
+               contourthing->getModel()->Save(pFile);
+       }
+
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.h b/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.h
new file mode 100644 (file)
index 0000000..76322a5
--- /dev/null
@@ -0,0 +1,475 @@
+#ifndef __OTULINE_MODEL_MANAGER__
+#define __OTULINE_MODEL_MANAGER__
+
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream> 
+#include <sstream>
+#include <map>
+#include <vector>
+#include <string>
+
+
+#include "ContourThing.h"
+#include "AxeThing.h"
+#include "ImageSourceThing.h"
+#include "ImageSectionThing.h"
+#include "InstantMembersNameList.h"
+#include "OutlineGroup.h"
+#include "ContourWorkspace.h"
+#include "CommandsHandler.h"
+#include "InstantMembersNameList.h"
+#include "PrefixMaxKeyGenerator.h"
+
+//#include "../kernel_Environment/InstantHandler.h" //Is not working
+//#include "../kernel_Environment/Instant.h" //Is included in the SomeEnvironment template
+//#include "../kernel_Environment/SomeEnvironment.h"
+#include "SomeEnvironment.h"
+
+class ContourWorkspace; 
+
+class OutlineModelManager{
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates the outline manager
+       */
+       OutlineModelManager( SomeEnvironment<ImageSourceThing *>* imSourceEnv, SomeEnvironment<ImageSectionThing *>* imSectionEnv, SomeEnvironment<AxeThing *>* axesEnv, SomeEnvironment<ContourThing *>* contourEnv );
+
+
+       /*
+       * Destroys the outline manager
+       */
+       ~OutlineModelManager();
+
+//------------------------------------------------------------------------------------------------------------
+// Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates and sets a workSpace object
+       * @return Retourns the created workSpace
+       */
+       ContourWorkspace * createWorkSpace();
+
+       /*
+       * Sets the workSpace object
+       * @param  aWorkSpace The workSpace to set 
+       */
+       void setWorkSpace( ContourWorkspace * aWorkSpace );
+
+       /*
+       * Executes a command over an outline object
+       * @param imaKName Is the key name of the outline
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool executeCommand_OutlineModel(std::string outKName, CommandObject * theCommand, bool fromRegistration);
+
+       /*
+       * Executes a command identifying which actions have to realize before executing it.
+       * @param theCommand Is the command to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool executeCommand(CommandObject * theCommand, bool fromRegistration=false);
+
+       /*
+       * Executes a command queue identifying which actions have to realize before executing it, starting in from the front of it.
+       * @param executionQueue Is the command queue to execute
+       * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
+       */
+       bool executeCommandsQueue(std::deque<CommandObject *> executionQueue, bool fromRegistration=false);
+
+       /*
+       * Sets the concepts of the environments and includes the concepts managed by the program 
+       * @conceptsScript Is the script for with the concepts descrition
+       * @return Returns true if successful insert of the given concepts, false otherwise
+       */
+       bool setUserConcepts(std::string conceptsScript);
+
+       /*
+       * Add a concept to all the environments 
+       * @param theConceptName Is the name of the new concept
+       * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances 
+       * @return Returns true if successful insert of concept, false otherwise
+       */              
+       bool addUserConcept( std::string theConceptName, int conceptSize );
+       
+       /**
+       * Gets the outlines at an instant form the wrapping reference
+       * @param anInstant The instant wondered to get outlines at
+       * @param ifAnnotate Indicates if it is needed to annotate the searched outlines
+       * @return The vector to the outlines at the given instance
+       */      
+       std::vector<NameWrapper *> getActualInstantOutlines ();
+
+       /**
+       * Gets the outlines at an instant form the outline's environment
+       * @param anInstant The instant wondered to get outlines at
+       * @param ifAnnotate Indicates if it is needed to annotate the searched outlines
+       * @return The vector to the outlines at the given instance
+       */
+       std::vector<ContourThing**> getOutlinesAtInstant(Instant * anInstant,  bool ifAnnotate = true);
+
+       /**
+       * Gets the name of all outlines 
+       * @return The vector of strings of all outlines
+       */
+       std::vector<std::string> GetLstNameThings();
+
+       std::vector<std::string> GetLstNameThingsStatic();
+
+
+       /**
+       * Gets the outlines at a specific form the outline's environment
+       * @param aGroupName The name of the group containing the outlines names to get
+       * @return The vector to the outlineGroups at the given group
+       */ 
+       std::vector<ContourThing*> getOutlinesFromGroup(std::string aGroupName);
+
+       /**
+       * Adds to storing at (outlineGroups) an outline group given its name and the group
+       * @param theOutlineName The name of the group containing the outlines names to add
+       * @param theGroup The outlines group to add
+       * @return Returns true
+       */ 
+       bool addOutlinesGroup( std::string theOutlineName, OutlineGroup * theGroup );
+
+       /*
+       * Gets the an outline given the keyName used to be indexed in the outlines's environment
+       * @param outKName Is the outline keyName to search
+       * @return  The corresponding unique outline with the given key name
+       */
+       ContourThing* getOutlineByKeyName(std::string outKName);
+
+       /*
+       * Gets the an imageSourceThing given the keyName used to be indexed in the ImageSourceThing's environment
+       * @param outKName Is the imageSourceThing keyName to search
+       * @return  The corresponding unique outline with the given key name
+       */
+       ImageSourceThing* getImageSourceThingByKeyName(std::string iSeourceKName);
+
+       /*
+       * Gets the an imageSectionThing given the keyName used to be indexed in the ImageSectionThing's environment
+       * @param outISectionName Is the imageSectionThing keyName to search
+       * @return  The corresponding unique outline with the given key name
+       */
+       ImageSectionThing* getImageSectionThingByKeyName(std::string iSectionName);
+
+       /*
+       * Creates an outlineThing with a given name, if no name is given it would have an automatic
+       * @param aName The name for the outlineThing
+       * @return Returns the key name of the created outline, or ""if it wasn't created
+       */
+       //bool createOutline(std::string aName, ContourThing * &theOutline);
+       std::string createOutline(manualContourModel * model, std::vector<int>  theInstantData, std::string aName = "" );
+
+       /*
+       * Creates an axeThing with a given name
+       * @param aDescription The description for the axeThing
+       * @return Returns true if the creation of the axe was successful
+       */
+       //bool createAxe(std::string aDescription,AxeThing * &theAxe);
+       bool createAxe(std::string aDescription, Instant * theInstantData);
+
+       /*
+       * Creates an imageSourceThing with a given name
+       * @param aName The name for the imageSourceThing
+       * @return Returns true if the creation of the imageSource was successful
+       */
+       //bool createImageSource(std::string aName, ImageSourceThing * &imageSource);
+       bool createImageSource(std::string aSource, Instant * theInstantData);
+
+       /*
+       * Creates an imageSectionThing with a given name
+       * @param aSecImageData The name for the imageSectionThing
+       * @return Returns true if the creation of the imageSection was successful
+       */
+       //bool createImageSection(std::string aSecImageData, ImageSectionThing * &imageSection);
+       bool createImageSection(std::string aSecImageData, Instant * theInstantData);
+
+       /*
+       * Adds an outlineThing 
+       * @param theOutline The outline/contour (thing)
+       * @param theInstantData Is the instant for the outline to add
+       * @return Returns the key name of the created outline, or ""if it wasn't created
+       */
+       std::string addOutline(ContourThing * theOutline, Instant * theInstantData);
+
+       /*
+       * Remove an outlineThing 
+       * @param theOutline The outline/contour (thing)
+       */
+       void removeOutline( std::string ss );
+
+       /*
+       * Adds an axeThing 
+       * @param thaAxe The axe (thing)
+       * @param theInstantData Is the instant for the axe to add
+       * @return Returns true if the addition of the axe was successful
+       */
+       bool addAxe( AxeThing * thaAxe, Instant * theInstantData);
+
+       /*
+       * Adds an imageSourceThing 
+       * @param imgageSource The image source (thing)
+       * @param theInstantData Is the instant for the source to add
+       * @return Returns true if the addition of the imageSource was successful
+       */
+       bool addImageSource(ImageSourceThing * imageSource, Instant * theInstantData);
+
+       /*
+       * Adds an imageSectionThing with a given name, if no name is given it would have an automatic
+       * @param aName The imageSection (thing)
+       * @param theInstantData Is the instant for the imageSection to add
+       * @return Returns true if the addition of the imageSection was successful
+       */
+       bool addImageSection(ImageSectionThing * imageSection, Instant * theInstantData);
+
+       /*
+       * Annotates an outline keyname at the actual instant
+       * @param kOutlineName The key name to annotate
+       * @param theRealName The real name asigned to the outline
+       */
+       void annotateOutlineWrap(std::string kOutlineName, std::string theRealName);
+
+       /*
+       * Annotates a set of outline keynames-real names wrapping at the actual instant
+       * @param kNamesVector The key names vector to annotate
+       * @param theOutlinesVector The outlines pointers vector to get the real names from
+       */
+       void annotateOutlinesWrap(std::vector<std::string> keyNames, std::vector<ContourThing **> theOutlinesVector);
+
+       /*
+       * Annotates the actual outline keyName-real name wrapping at the actual instant
+       * @param actualKeyOutline The key name to annotate
+       * @param theRealName The real name asigned to the actual outline
+       */
+       void annotateActualOutlineWrap(std::string actualKeyOutline, std::string theRealName);
+
+       /*
+       * Annotate the actual axe keyName-real name wrapping at the actual instant
+       * @param actualKeyAxe The key name to annotate
+       * @param theRealName The real name asigned to the actual axe
+       */
+       void annotateActualAxeWrap(std::string actualKeyAxe, std::string theRealName);
+
+       /*
+       * Annotate the annotateActualSection image keyName-real name wrapping at the actual instant
+       * @param actualKeyImage The key name to annotate
+       */
+       void annotateActualSectionImageWrap(std::string actualKeyImage, std::string theRealName);//---BORRAR...
+
+       /*
+       * Annotate the annotateActualSource image keyName-real name wrapping at the actual instant
+       * @param actualKeyImage The key name to annotate
+       */
+       void annotateActualSourceImageWrap(std::string actualKeyImage, std::string theRealName);//---BORRAR...
+       /*
+       * Sets the actual instant and manage the search of the corresponding elements with the specified instant in all the enviornments
+       * @param newActualInstantData Is the instant data
+       */
+       void setInstant(Instant * newActualInstantData);
+
+       /*
+       * Gets the an axe with a given keyName
+       * @axeKName The axe keyName for searching in the axes environment
+       * @return The corresponding axe
+       */
+       AxeThing * getAxeByKeyName(std::string axeKName);
+
+       /*
+       * Gets the instants of a specific outline
+       * @param thekName Is the name of the outline
+       * @return The instants set 
+       */
+       std::vector<Instant *> getOutlineInstantsByName(std::string thekName);
+
+       /*
+       * Gets all instants outlines
+       * @return The instants set 
+       */
+       std::vector<Instant *> OutlineModelManager :: getOutlineInstants();
+
+       /*
+       * Includes an instant to the specified axe
+       * @param outKName Is outline key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool includeOutlineInstant(std::string outKName,Instant * anInstantData);
+
+       /*
+       * Includes an instant to the specified axe
+       * @param axeKName Is axe key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool includeAxeInstant(std::string axeKName,Instant * anInstantData);
+
+       /*
+       * Includes an instant to the specified image section
+       * @param imaKName Is the image section key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool includeImageSectionInstant(std::string imaKName,Instant * anInstantData);
+
+       /*
+       * Includes an instant to the specified image source
+       * @param imaKName Is the image section key name
+       * @param anInstantData Is the instant data
+       * @return Returns if the insertion was successful or not
+       */
+       bool includeImageSourceInstant(std::string imaKName,Instant * anInstantData);
+
+       /*
+       *       Method that retorns the name of each concept and the size of it.
+       *       @param conceptNameVect, Vector in which is disposed to be setted the name for each of the included concepts
+       *       @param conceptSizeVect, Vector in which is disposed to be setted the size for each of the included concepts
+       */
+       void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
+       
+       /*
+       * Gets the contourWorspace 
+       * @return Returns the workspace
+       */
+       ContourWorkspace * getContourWorkspace();
+
+       /*
+       * Gets the number of groups in the model management 
+       * @return Returns the size of 
+       */
+       int getGroupsCount();
+       
+       /*
+       * Cleans the outline model manager and its dependencies
+       */
+       void clean();   
+
+       void removeAllOutlines();
+       std::string createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData );
+
+       void SaveThingName( FILE *pFile, std::string nameThing );
+
+       void ChangeContourOfList(std::string keyName, Instant *instant);
+       int IsPartOfStaticList(std::string ss);
+
+
+
+private : 
+
+       /*
+       * Update the registered objects in the InstantMemebersNameList, is the one that really changes the instant in the model
+       */
+       void updateToActualInstant();
+       
+       /*
+       * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments.
+       * @return Returns true if successful insert of the automatic concepts, false otherwise
+       */
+       bool setAutomaticConcepts();
+       
+
+
+       
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+       
+
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+
+       
+private:       
+
+       /*
+       * Represents the keyName of the actual gruop in the map of gruops
+       */
+       std::string actualGruopID;
+
+       /*
+       * Represents the environment instant iterator of axes
+       */
+//     InstantHandler<AxeThing *> * axesITER;
+       
+       /*
+       * Represents the environment of axes
+       */
+       SomeEnvironment<AxeThing *>* axesEnvironment;
+
+       /*
+       * Represents the environment instant iterator of section images 
+       */
+//     InstantHandler<ImageSectionThing *> * sectionITER;
+
+       /*
+       *  Represents the environment of section images 
+       */
+       SomeEnvironment<ImageSectionThing *>* imagesSectionEnvironment;
+
+       /*
+       * Represents the environment instant iterator of source's images (Generally a complete volume data per image) 
+       */
+//     InstantHandler<ImageSourceThing *> * imageITER;
+
+       /*
+       * Represents the environment of source images (Generally a complete volume data per image) 
+       */
+       SomeEnvironment<ImageSourceThing *>*  imageSourceEnvironment;
+
+       /*
+       * Represents the environment instant iterator of outlines (outlines)
+       */
+//     InstantHandler<ContourThing *> * outlinesITER;
+
+       /*
+       * Represents the environment of outlines (outlines)
+       */
+       SomeEnvironment<ContourThing *>*  outlinesEnvironment;
+
+       /*
+       * Represents the table of outlines groups
+       */
+       std::map< std::string,OutlineGroup * > outlineGroups;
+
+       /*
+       * Represents the workspace
+       */
+       ContourWorkspace * workSpace;
+
+       /*
+       * Represents the actual instant members list wrrapping (keyName, realName) of objects
+       */
+       InstantMembersNameList * actualInstantWrapping;
+
+       /*
+       * Represents a flag indicating if the actualSourceImage has to be changed when changed instant
+       */
+       bool changeSourceImage;
+
+       int counterIdKey;
+       PrefixMaxKeyGenerator keyGenerator;     
+
+
+       /*const*/std::string axeConcept /*= "Axe"*/;
+       /*const*/std::string axeDepthConcept /*= "Axe Depth"*/;
+
+       Instant * actualInstant;
+       
+       //EED
+       std::vector<ContourThing **> staticContourLst;
+       
+};
+#endif
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelReader.cxx b/lib/kernel_ManagerContour_NDimensions/OutlineModelReader.cxx
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelReader.h b/lib/kernel_ManagerContour_NDimensions/OutlineModelReader.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/kernel_ManagerContour_NDimensions/PrefixMaxKeyGenerator.cxx b/lib/kernel_ManagerContour_NDimensions/PrefixMaxKeyGenerator.cxx
new file mode 100644 (file)
index 0000000..83fc7f8
--- /dev/null
@@ -0,0 +1,197 @@
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "PrefixMaxKeyGenerator.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Class implementation
+//----------------------------------------------------------------------------------------------------------------
+/** @file PrefixMaxKeyGenerator.cxx */
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Creates the prefix+max key generator
+       */
+       PrefixMaxKeyGenerator :: PrefixMaxKeyGenerator()
+       {
+               numberOfKeyThings = 0;          
+       }
+
+       /*
+       * Destroys the outline manager
+       */
+       PrefixMaxKeyGenerator :: ~PrefixMaxKeyGenerator()
+       {
+               clear();
+       }
+
+//------------------------------------------------------------------------------------------------------------
+// Public Methods
+//------------------------------------------------------------------------------------------------------------
+
+       
+       /*
+       * Adds a key thing to the keyThings building the respective KeyThing (new keyThing). 
+       * @param theName Is the name of the new keyThing to include. If the name is not unique, returns false.
+       * @param thePrefix Is the prefix of the new keyThing for the key generation correponding to the new keyThing
+       * @param theMax Is the maximum value for the key generation correponding to the new keyThing
+       * @return Returns true if the keyThing could be added of not.
+       */
+       bool PrefixMaxKeyGenerator :: addKeyThing( std::string theName, std::string thePrefix, int theMax )
+       {
+               KeyThing * kThing = new KeyThing(thePrefix, theMax);
+               int before = keyThings.size();
+               keyThings.insert(std::pair < std::string, KeyThing >( theName, *kThing ));
+               int after = keyThings.size();                   
+               return after > before;
+       }
+
+       /*
+       * Remove a key thing  
+       * @param theName Is the name of the keyThing to remove. 
+       */
+       void PrefixMaxKeyGenerator :: removeKeyThing( std::string theName )
+       {
+               keyThings.erase(theName);               
+       }
+
+
+       /*
+       * Indicates if a key thing existis in the generator
+       * @param theName Is the name of the keyThing to search. 
+       * @return Returns true if the keyThing exists in the keyThings.
+       */
+       bool PrefixMaxKeyGenerator :: existsKeyThing( std::string theName )
+       {
+               return keyThings.find(theName) != keyThings.end();              
+       }
+
+       /*
+       * Updates the maximum value of a key thing if necesary (posibleMax>theMaxOfKeyThing). If the key thing doesn't exist nothing is done.
+       * @param theName Is the name of the keyThing to update.         
+       * @param posibleMax Is the number that corresponds to a posible max value of the keyThing to update. 
+       */
+       void PrefixMaxKeyGenerator :: updateMaxTo( std::string theName, int posibleMax )
+       {
+               std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
+               if ( iterP != keyThings.end() )
+               {
+                       int max = (iterP->second).getValue();
+                       if ( max < posibleMax )
+                               (iterP->second).setValue(posibleMax);
+               }
+       }
+
+       /*
+       * Generates a (std::string) key for a given keyThing. If the key thing doesn't exist nothing is done and returns false.
+       * @param theName Is the name of the keyThing to search. 
+       * @param theInputString Is string to load the generated key formed like <prefixOfTheKeyThing> <maxOfTheKeyThing>
+       * @return theKey Returns true if the key was generated successfully. (If theName is an existent keyThing)
+       */
+       bool PrefixMaxKeyGenerator :: generateKeyOf( std::string theName, std::string &theInputString )
+       {
+               theInputString = "";
+               std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
+               if ( iterP != keyThings.end() )
+               {                       
+                       KeyThing kthing = (iterP->second);
+                       int max = kthing.getValue();                    
+                       std::ostringstream genKey;
+                       genKey<<kthing.getPrefix() << " " << max;
+                       theInputString = genKey.str();
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Generates a (std::string) key for a given keyThing and updates the max value of it if necesary. If the key thing doesn't exist nothing is done. 
+       * @param theName Is the name of the keyThing to search. 
+       * @param posibleMax Is the number that corresponds to a posible max value of the keyThing to update. 
+       * @param theInputString Is string to load the generated key formed like <prefixOfTheKeyThing> <maxOfTheKeyThing>
+       * @return Returns true if the key was generated successfully. (If theName is an existent keyThing)
+       */
+       bool PrefixMaxKeyGenerator :: generateKeyOf( std::string theName,  int posibleMax, std::string &theInputString  )
+       {
+               theInputString = "";
+               std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
+               if ( iterP != keyThings.end() )
+               {       
+                       KeyThing kthing = (iterP->second);
+                       int max = kthing.getValue();
+
+                       if ( max < posibleMax )
+                       {
+                               kthing.setValue(posibleMax);
+                       }
+
+
+                       std::ostringstream genKey;
+                       genKey<<kthing.getPrefix() << " " << kthing.getValue();
+                       theInputString = genKey.str();
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Gets the prefix of a specific keyThing identified with the name in the parameter, if the key thing doesn't exists return false.
+       * @param theName Is the name of the keyThing to search the prefix. 
+       * @param theInputString Is string to load the prefix of the searched keyThing.
+       * @return isStringOutputReal Returns if the loaded string in theInputString is real (i.e if the -theName- keyThing exists)
+       */
+       bool PrefixMaxKeyGenerator :: getPrefixOf( std::string theName, std::string &theInputString )           
+       {
+               theInputString = "";
+               std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
+               if ( iterP != keyThings.end() )
+               {       
+                       KeyThing kthing = (iterP->second);
+                       theInputString = kthing.getPrefix();
+                       return true;
+               }
+               return false;
+       }
+
+       /*
+       * Gets the max value of a specific keyThing identified with the name in the parameter. If the key thing doesn't exists returns -1.
+       * @param theName Is the name of the keyThing to search the maximum.     
+       * @return theMax Returns the maxumum value for key generation at the keyThing. Returns -1 if not finded keyThing.
+       */
+       int PrefixMaxKeyGenerator :: getCurrentMaxOf( std::string theName )
+       {
+               std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
+               if ( iterP != keyThings.end() )
+               {       
+                       KeyThing kthing = (iterP->second);
+                       return kthing.getValue();                       
+               }
+               return -1;
+       }
+
+       /*
+       * Gets the total of keyThings managed
+       * @return Retuns the total of keyThing managed
+       */
+       int PrefixMaxKeyGenerator :: getTotalThingsNumber()
+       {
+               return keyThings.size();
+       }
+
+       /*
+       * Clears the generator deleating the existring keyThings
+       */
+       void PrefixMaxKeyGenerator :: clear()
+       {               
+               std::map<std::string, KeyThing >::iterator iter = keyThings.begin();
+               while( iter != keyThings.end() )
+               {
+                       keyThings.erase(iter);                  
+               }
+               keyThings.clear();              
+               numberOfKeyThings = 0;
+       }
diff --git a/lib/kernel_ManagerContour_NDimensions/PrefixMaxKeyGenerator.h b/lib/kernel_ManagerContour_NDimensions/PrefixMaxKeyGenerator.h
new file mode 100644 (file)
index 0000000..cbd730e
--- /dev/null
@@ -0,0 +1,133 @@
+#ifndef __PREFIX_MAX__KEYGENERATOR_
+#define __PREFIX_MAX__KEYGENERATOR_
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <map>
+
+#include "KeyThing.h"
+
+/*
+* Class that manages the creation of std::string keys of multiple objects independently, identified each by a unique name.
+* Format of the key is: <prefixOfTheKeyThing> <maxOfTheKeyThing>
+*/
+class PrefixMaxKeyGenerator{
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+public:
+
+       /*
+       * Creates the prefix+max key generator  
+       */
+       PrefixMaxKeyGenerator();
+
+       /*
+       * Destroys the outline manager
+       */
+       ~PrefixMaxKeyGenerator();
+
+//------------------------------------------------------------------------------------------------------------
+// Public Methods
+//------------------------------------------------------------------------------------------------------------
+
+       /*
+       * Adds a key thing to the keyThings building the respective KeyThing (new keyThing). 
+       * @param theName Is the name of the new keyThing to include. If the name is not unique, returns false.
+       * @param thePrefix Is the prefix of the new keyThing for the key generation correponding to the new keyThing
+       * @param theMax Is the maximum value for the key generation correponding to the new keyThing
+       * @return Returns true if the keyThing could be added of not.
+       */
+       bool addKeyThing( std::string theName, std::string thePrefix, int theMax=0 );
+
+       /*
+       * Remove a key thing  
+       * @param theName Is the name of the keyThing to remove. 
+       */
+       void removeKeyThing( std::string theName );
+
+       /*
+       * Indicates if a key thing existis in the generator
+       * @param theName Is the name of the keyThing to search. 
+       * @return Returns true if the keyThing exists in the keyThings.
+       */
+       bool existsKeyThing( std::string theName );
+
+       /*
+       * Updates the maximum value of a key thing if necesary (posibleMax>theMaxOfKeyThing). If the key thing doesn't exist nothing is done.
+       * @param theName Is the name of the keyThing to update.         
+       * @param posibleMax Is the number that corresponds to a posible max value of the keyThing to update. 
+       */
+       void updateMaxTo( std::string theName, int posibleMax );
+
+       /*
+       * Generates a (std::string) key for a given keyThing. If the key thing doesn't exist nothing is done and returns false.
+       * @param theName Is the name of the keyThing to search. 
+       * @param theInputString Is string to load the generated key formed like <prefixOfTheKeyThing> <maxOfTheKeyThing>
+       * @return theKey Returns true if the key was generated successfully. (If theName is an existent keyThing)
+       */
+       bool generateKeyOf( std::string theName , std::string &theInputString );
+
+       /*
+       * Generates a (std::string) key for a given keyThing and updates the max value of it if necesary. If the key thing doesn't exist nothing is done. 
+       * @param theName Is the name of the keyThing to search. 
+       * @param posibleMax Is the number that corresponds to a posible max value of the keyThing to update. 
+       * @param theInputString Is string to load the generated key formed like <prefixOfTheKeyThing> <maxOfTheKeyThing>
+       * @return Returns true if the key was generated successfully. (If theName is an existent keyThing)
+       */
+       bool generateKeyOf( std::string theName,  int posibleMax, std::string &theInputString );
+
+       /*
+       * Gets the prefix of a specific keyThing identified with the name in the parameter, if the key thing doesn't exists return false.
+       * @param theName Is the name of the keyThing to search the prefix. 
+       * @param theInputString Is string to load the prefix of the searched keyThing.
+       * @return isStringOutputReal Returns if the loaded string in theInputString is real (i.e if the -theName- keyThing exists)
+       */
+       bool getPrefixOf(std::string theName, std::string &theInputString);
+
+       /*
+       * Gets the max value of a specific keyThing identified with the name in the parameter. If the key thing doesn't exists returns -1.
+       * @param theName Is the name of the keyThing to search the maximum.     
+       * @return theMax Returns the maxumum value for key generation at the keyThing. Returns -1 if not finded keyThing.
+       */
+       int getCurrentMaxOf(std::string theName);
+
+       /*
+       * Gets the total of keyThings managed
+       * @return Retuns the total of keyThing managed
+       */
+       int getTotalThingsNumber();
+
+       /*
+       * Clears the generator deleating the existring keyThings
+       */
+       void clear();
+       
+//------------------------------------------------------------------------------------------------------------
+// Constants
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
+// Attributes
+//------------------------------------------------------------------------------------------------------------
+       
+private:       
+
+       /*
+       * Represents the number of things that are currently managing
+       */
+       int numberOfKeyThings;
+
+       /*
+       * Represents the map or table in which the key-things are saved
+       */
+       std::map<std::string,KeyThing> keyThings;
+};
+#endif
+