X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2FCutModule%2Finterface%2FCutModelMainPanel.cxx;h=c1a3dfd8e8aa83747bc67e0b76d5f8854a22ea96;hb=3c6c4d236dd41550927d9180688f40c127301431;hp=c667375fec9c34125070b509f59d4f7e4c4cd3c3;hpb=c5ce7457fe37b2dfee0912b81280324e56282e03;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx index c667375..c1a3dfd 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx @@ -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/03/31 12:41:56 $ -Version: $Revision: 1.8 $ +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 #include -#include -#include -#include -#include +#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(); } @@ -126,10 +151,11 @@ void CutModelMainPanel::RemoveActor(int id){ checkInvariant(); if(!this->IsBeingDeleted()){ - for(int i = 0; i < viewpanels.size()-1;i++){ + int i,j; + for(i = 0; i < (int)viewpanels.size()-1;i++){ CutModelView* view = viewpanels[i]; if(view->getId()==id){ - for(int j = i; j < viewpanels.size()-1;j++){ + for(j = i; j < (int)viewpanels.size()-1;j++){ viewpanels[j]=viewpanels[j+1]; } i = viewpanels.size(); @@ -137,7 +163,7 @@ void CutModelMainPanel::RemoveActor(int id){ } viewpanels.pop_back(); cutmanager->RemoveActor(id); - } + } }catch(CutModelException e){ showErrorDialog(e.getCause()); @@ -153,7 +179,7 @@ void CutModelMainPanel::onCheckChanged(){ } if(_isCheck==false) - { + { _isCheck=true; //Draw Polygon @@ -164,7 +190,7 @@ void CutModelMainPanel::onCheckChanged(){ lblMessagePolygon->SetLabel(_T("Drawing polygon...")); } else - { + { _isCheck=false; //Finish Drawing cout<<"Finish Drawing"<onAddCutModel(id, getModelView(id)); _panelid++; @@ -208,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); @@ -223,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(); @@ -254,8 +280,8 @@ CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException) void CutModelMainPanel::onUndo() { try{ - checkInvariant(); - int result = cutmanager->Undo(); // result unused// JPR + checkInvariant(); + /*int result = */ cutmanager->Undo(); // result unused// JPR }catch(CutModelException e){ showErrorDialog(e.getCause()); @@ -264,8 +290,8 @@ void CutModelMainPanel::onUndo() void CutModelMainPanel::onRedo(){ try{ - checkInvariant(); - int result = cutmanager->Redo(); + checkInvariant(); + /*int result = */ cutmanager->Redo(); }catch(CutModelException e){ showErrorDialog(e.getCause()); @@ -274,7 +300,7 @@ void CutModelMainPanel::onRedo(){ void CutModelMainPanel::changeOpacity(int id,int opacity){ try{ - checkInvariant(); + checkInvariant(); cutmanager->changeOpacity(id, opacity); }catch(CutModelException e){ @@ -284,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){ @@ -299,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){ @@ -330,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){ @@ -386,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); @@ -405,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); @@ -434,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(); @@ -461,7 +487,7 @@ void ToolBarEventHandlerCutModel::onAdd(wxCommandEvent& event){ } void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event){ - CutModelMainPanel::getInstance()->onUndo(); + CutModelMainPanel::getInstance()->onUndo(); } void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event){