]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx
Code cleaning done
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / interface / CutModelMainPanel.cxx
index f917adc1129203c094a8b35be586354b61d173b0..c1a3dfd8e8aa83747bc67e0b76d5f8854a22ea96 100644 (file)
@@ -1,10 +1,35 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
 /*=========================================================================
 
 Program:   wxMaracas
 Module:    $RCSfile: CutModelMainPanel.cxx,v $
 Language:  C++
-Date:      $Date: 2010/09/29 21:21:03 $
-Version:   $Revision: 1.11 $
+Date:      $Date: 2012/11/15 14:16:20 $
+Version:   $Revision: 1.14 $
 
 Copyright: (c) 2002, 2003
 License:
@@ -26,10 +51,10 @@ PURPOSE.  See the above copyright notice for more information.
 #include <wx/colordlg.h>
 #include <wx/bmpbuttn.h>
 
-#include <Add.xpm>
-#include <Undo.xpm>
-#include <Redo.xpm>
-#include <OkAll.xpm>
+#include "Add.xpm"
+#include "Undo.xpm"
+#include "Redo.xpm"
+#include "OkAll.xpm"
 
 
 
@@ -44,7 +69,7 @@ CutModelMainPanel::CutModelMainPanel( wxWindow* parent, std::string path)
        initialize(path);
 
 }
-CutModelMainPanel::~CutModelMainPanel( ){      
+CutModelMainPanel::~CutModelMainPanel( ){
        viewpanels.clear();
        delete cutmanager;
 }
@@ -52,7 +77,7 @@ CutModelMainPanel::~CutModelMainPanel( ){
 void CutModelMainPanel::initialize(std::string path){
        cutmanager = new CutModelManager(path);
        _panelid = 0;
-       _wxauimanager = new wxAuiManager(this); 
+       _wxauimanager = new wxAuiManager(this);
 
        wxAuiPaneInfo paneinfo;
 
@@ -60,8 +85,8 @@ void CutModelMainPanel::initialize(std::string path){
        _notebook = new wxAuiNotebook(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP |wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS);
 
        _notebook->AddPage(new ToolBarCutModel(_notebook),_T("Cutter"),true);
-       //_wxauimanager->AddPane(new ToolBarCutModel(this),paneinfo.ToolbarPane().Top());       
-       _wxauimanager->AddPane(_notebook,paneinfo.Center());
+       //_wxauimanager->AddPane(new ToolBarCutModel(this),paneinfo.ToolbarPane().Top());
+       _wxauimanager->AddPane(_notebook,paneinfo.Center().CloseButton(false));
        addPolygonCutterTab();
        _notebook->Update();
 
@@ -113,10 +138,10 @@ void CutModelMainPanel::setRenderer(vtkRenderer* renderer){
 void CutModelMainPanel::checkInvariant()throw (CutModelException){
        if(cutmanager==NULL){
                throw CutModelException("The manager is not initialize");
-       }       
+       }
 }
 
-void CutModelMainPanel::showErrorDialog(std::string str){      
+void CutModelMainPanel::showErrorDialog(std::string str){
        wxMessageDialog* diag = new wxMessageDialog(this, wxString(str.c_str(),wxConvUTF8 ), wxString(str.c_str(),wxConvUTF8 ), wxICON_ERROR);
        diag->ShowModal();
 }
@@ -138,7 +163,7 @@ void CutModelMainPanel::RemoveActor(int id){
                        }
                        viewpanels.pop_back();
                        cutmanager->RemoveActor(id);
-               }       
+               }
 
        }catch(CutModelException e){
                showErrorDialog(e.getCause());
@@ -154,7 +179,7 @@ void CutModelMainPanel::onCheckChanged(){
        }
 
        if(_isCheck==false)
-       {       
+       {
                _isCheck=true;
                //Draw Polygon
 
@@ -165,7 +190,7 @@ void CutModelMainPanel::onCheckChanged(){
                lblMessagePolygon->SetLabel(_T("Drawing polygon..."));
        }
        else
-       {       
+       {
                _isCheck=false;
                //Finish Drawing
                cout<<"Finish Drawing"<<endl;
@@ -194,7 +219,7 @@ void CutModelMainPanel::onAddCutModel(){
        try{
                checkInvariant();
 
-               int id = addNewViewPanel();             
+               int id = addNewViewPanel();
                cutmanager->onAddCutModel(id, getModelView(id));
 
                _panelid++;
@@ -209,7 +234,7 @@ void CutModelMainPanel::onAddCutModel(){
 void CutModelMainPanel::ShowCurrentPanel(int id)
 {
         int i;
-       for(i = 0; i < (int) viewpanels.size();i++){            
+       for(i = 0; i < (int) viewpanels.size();i++){
                if(viewpanels[i]->getId()==id){
                        _wxauimanager->GetPane(viewpanels[i]).Show(true);
                        cutmanager->RefreshActor(id);
@@ -224,10 +249,10 @@ int CutModelMainPanel::addNewViewPanel()throw( CutModelException){
        CutModelView* viewpanel = new CutModelView(this,cutmanager->getImageRange());
 
        wxAuiPaneInfo paneinfo0;
-       _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre());   
+       _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre().Bottom());
 
        viewpanel->setId(_panelid);
-       viewpanels.push_back(viewpanel);        
+       viewpanels.push_back(viewpanel);
 
        return viewpanel->getId();
 
@@ -255,7 +280,7 @@ CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException)
 void CutModelMainPanel::onUndo()
        {
        try{
-               checkInvariant();               
+               checkInvariant();
                /*int result = */ cutmanager->Undo(); // result unused// JPR
 
        }catch(CutModelException e){
@@ -265,7 +290,7 @@ void CutModelMainPanel::onUndo()
 
 void CutModelMainPanel::onRedo(){
        try{
-               checkInvariant();               
+               checkInvariant();
                /*int result = */ cutmanager->Redo();
 
        }catch(CutModelException e){
@@ -275,7 +300,7 @@ void CutModelMainPanel::onRedo(){
 
 void CutModelMainPanel::changeOpacity(int id,int opacity){
        try{
-               checkInvariant();               
+               checkInvariant();
                cutmanager->changeOpacity(id, opacity);
 
        }catch(CutModelException e){
@@ -285,7 +310,7 @@ void CutModelMainPanel::changeOpacity(int id,int opacity){
 
 void CutModelMainPanel::ShowViewBox(int id,bool check){
        try{
-               checkInvariant();               
+               checkInvariant();
                cutmanager->ShowViewBox(id, check);
 
        }catch(CutModelException e){
@@ -300,7 +325,7 @@ void CutModelMainPanel::ShowPopUpMenu(int id){
 void CutModelMainPanel::changeColor(int id,double r,double g,double b){
 
        try{
-               checkInvariant();               
+               checkInvariant();
                cutmanager->changeColor(id, r, g, b);
 
        }catch(CutModelException e){
@@ -331,7 +356,7 @@ void CutModelMainPanel::updateActorDirection(int id){
 
 void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside){
        try{
-               checkInvariant();               
+               checkInvariant();
 
                cutmanager->ExecuteCut(id, range, isinside);
        }catch(CutModelException e){
@@ -387,7 +412,7 @@ int CutModelMainPanel::GetType(){
 void CutModelMainPanel::addPolygonCutterTab(){
        wxPanel *panel = new wxPanel(_notebook);
        panel->SetAutoLayout(true);
-       wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 
+       wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
        panel->SetSizer(sizer);
        sizer->AddSpacer(20);
 
@@ -406,7 +431,7 @@ void CutModelMainPanel::addPolygonCutterTab(){
        sizer->Add(_radioinsideout, wxALIGN_LEFT);
 
        btnExecutePolygonCut = new wxButton(panel,20,_T("Execute Cut"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("") );
-       Connect(btnExecutePolygonCut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)(&PolygonCutterEventHandlerCutModel::onExecuteCutPolygon));  
+       Connect(btnExecutePolygonCut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)(&PolygonCutterEventHandlerCutModel::onExecuteCutPolygon));
        sizer->Add(btnExecutePolygonCut, 0, wxALIGN_LEFT);
 
        _notebook->AddPage(panel, _T("Polygon Cutter"), false);
@@ -435,12 +460,12 @@ ToolBarCutModel::ToolBarCutModel(wxWindow * parent)
        this->AddTool(20, wxString(_T("Undo")),bitmap20);
 
        wxBitmap bitmap30(Redo_xpm);
-       this->AddTool(30, wxString(_T("Redo")),bitmap30);       
+       this->AddTool(30, wxString(_T("Redo")),bitmap30);
 
        this->AddSeparator();
 
        wxBitmap bitmap40(OkAll_xpm);
-       this->AddTool(40, wxString(_T("Ok All")),bitmap40);     
+       this->AddTool(40, wxString(_T("Ok All")),bitmap40);
 
        this->Realize();
 
@@ -462,7 +487,7 @@ void ToolBarEventHandlerCutModel::onAdd(wxCommandEvent& event){
 }
 
 void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event){
-       CutModelMainPanel::getInstance()->onUndo();     
+       CutModelMainPanel::getInstance()->onUndo();
 }
 
 void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event){