+++ /dev/null
-/*=========================================================================
-
- Program: wxMaracas
- Module: $RCSfile: CutModel2MainPanel.cxx,v $
- Language: C++
- Date: $Date: 2009/11/23 13:00:20 $
- Version: $Revision: 1.5 $
-
- Copyright: (c) 2002, 2003
- License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-
-
-
-// EOF - wxMaracasMPR.cxx
-
-#include "CutModel2MainPanel.h"
-#include "HistogramDialog.h"
-#include "creaSystem.h"
-
-#include <wx/colordlg.h>
-#include <wx/bmpbuttn.h>
-
-#include <Add.xpm>
-#include <Undo.xpm>
-#include <Redo.xpm>
-#include <OkAll.xpm>
-
-
-
-CutModel2MainPanel* CutModel2MainPanel::instance=NULL;
-
-CutModel2MainPanel::CutModel2MainPanel( wxWindow* parent, std::string path)
-: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
-
- cutmanager=NULL;
-
- initialize(path);
-
-}
-CutModel2MainPanel::~CutModel2MainPanel( ){
-
- delete cutmanager;
-}
-
-void CutModel2MainPanel::initialize(std::string path){
-
- cutmanager = new CutModel2Manager(path);
-
- _panelid = 0;
- _wxauimanager = new wxAuiManager(this);
-
- wxAuiPaneInfo paneinfo;
- _wxauimanager->AddPane(new ToolBarCutModel2(this),paneinfo.ToolbarPane().Top());
-
- _wxauimanager->Update();
-}
-
-CutModel2MainPanel* CutModel2MainPanel::getInstance(wxWindow* parent, std::string path){
- if(instance==NULL){
- if(parent == NULL){
- parent = new wxFrame();
- }
- instance = new CutModel2MainPanel(parent, path);
- }
- return instance;
-}
-
-/*CutModel2MainPanel* CutModel2MainPanel::getInstance(){
- return instance;
-}*/
-
-void CutModel2MainPanel::setImageData(vtkImageData* img){
- try{
- checkInvariant();
- cutmanager->setImageData(img);
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::setInteractor(vtkRenderWindowInteractor* interactor){
- try{
- checkInvariant();
- cutmanager->setInteractor(interactor);
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::setRenderer(vtkRenderer* renderer){
- try{
- checkInvariant();
- cutmanager->setRenderer(renderer);
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::checkInvariant()throw (CutModelException){
- if(cutmanager==NULL){
- throw CutModelException("The manager is not initialize");
- }
-}
-
-void CutModel2MainPanel::showErrorDialog(std::string str){
- wxMessageDialog* diag = new wxMessageDialog(this, wxString(str.c_str(),wxConvUTF8 ), wxString(str.c_str(),wxConvUTF8 ), wxICON_ERROR);
- diag->ShowModal();
-}
-
-void CutModel2MainPanel::RemoveActor(int id){
- try{
- checkInvariant();
-
- for(int i = 0; i < viewpanels.size()-1;i++){
- if(viewpanels[i]->getId()==id){
- for(int j = i; j < viewpanels.size()-1;j++){
- viewpanels[j]=viewpanels[j+1];
- }
- i = viewpanels.size();
- }
- }
- viewpanels.pop_back();
-
-
- cutmanager->RemoveActor(id);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::onAddCutModel2(){
- try{
- checkInvariant();
-
- int id = addNewViewPanel();
- cutmanager->onAddCutModel2(id, getModelView(id));
-
- _panelid++;
-
- ShowCurrentPanel(id);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-void CutModel2MainPanel::ShowCurrentPanel(int id){
- for(int i = 0; i < viewpanels.size();i++){
- if(viewpanels[i]->getId()==id){
- _wxauimanager->GetPane(viewpanels[i]).Show(true);
- cutmanager->RefreshActor(id);
- }else{
- _wxauimanager->GetPane(viewpanels[i]).Show(false);
- }
- }
- _wxauimanager->Update();
-}
-int CutModel2MainPanel::addNewViewPanel()throw( CutModelException){
-
- CutModel2View* viewpanel = new CutModel2View(this,cutmanager->getImageRange());
-
- wxAuiPaneInfo paneinfo0;
- _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre());
- _wxauimanager->Update();
-
- viewpanel->setId(_panelid);
- viewpanels.push_back(viewpanel);
-
- return viewpanel->getId();
-
-
-}
-CutModel2View* CutModel2MainPanel::getModelView(int id)throw( CutModelException){
-
- CutModel2View* current = NULL;
- for(int i = 0; i < viewpanels.size();i++){
- if(viewpanels[i]->getId()==id){
- current = viewpanels[i];
- }
- }
- if(current == NULL){
- std::string s = "Id not found";
- throw CutModelException(s);
- }
- return current;
-}
-void CutModel2MainPanel::onUndo(){
- try{
- checkInvariant();
- int result = cutmanager->Undo();
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-
-}
-
-void CutModel2MainPanel::onRedo(){
-
- try{
- checkInvariant();
- int result = cutmanager->Redo();
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-
-}
-
-void CutModel2MainPanel::changeOpacity(int id,int opacity){
- try{
- checkInvariant();
- cutmanager->changeOpacity(id, opacity);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::ShowViewBox(int id,bool check){
- try{
- checkInvariant();
- cutmanager->ShowViewBox(id, check);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-void CutModel2MainPanel::ShowPopUpMenu(int id){
- showErrorDialog("test");
-}
-void CutModel2MainPanel::changeColor(int id,double r,double g,double b){
-
- try{
- checkInvariant();
- cutmanager->changeColor(id, r, g, b);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-
-}
-void CutModel2MainPanel::ChangeShape(int id,int selection){
- try{
- checkInvariant();
-
- cutmanager->ChangeShape(id, selection);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-void CutModel2MainPanel::updateActorDirection(int id){
- try{
- checkInvariant();
-
- cutmanager->updateActorDirection(id);
-
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::ExecuteCut(int id, double* range, bool isinside){
- try{
- checkInvariant();
-
- cutmanager->ExecuteCut(id, range, isinside);
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
-}
-
-void CutModel2MainPanel::ExecuteAll(){
- for(int i = 0; i < viewpanels.size();i++){
- viewpanels[i]->ExecuteCut();
- }
-
-}
-vtkImageData* CutModel2MainPanel::GetResultImage(){
- try{
- checkInvariant();
- return cutmanager->GetResultImage();
- }catch(CutModelException e){
- showErrorDialog(e.getCause());
- }
- return NULL;
-}
-
-void CutModel2MainPanel::ShowStatistics(int id){
-
- checkInvariant();
- HistogramDialog *histo = new HistogramDialog(this, _T("Statistics"));
-
- histo->initializeHistogram(cutmanager->GetResultImage());
-
- histo->ShowModal();
-
- delete histo;
-}
-
-void CutModel2MainPanel::SaveCutModelData(std::string filename){
- cutmanager->SaveCutModelData(filename);
-}
-
-void CutModel2MainPanel::LoadCutModelData(std::string filename){
- cutmanager->LoadCutModelData(filename);
-}
-/**
-**
-**/
-
-ToolBarCutModel2::ToolBarCutModel2(wxWindow * parent)
-: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize)
-{
-
- wxBitmap bitmap10(Add_xpm);
- this->AddTool(10, wxString(_T("Add")),bitmap10);
-
- this->AddSeparator();
-
- wxBitmap bitmap20(Undo_xpm);
- this->AddTool(20, wxString(_T("Undo")),bitmap20);
-
- wxBitmap bitmap30(Redo_xpm);
- this->AddTool(30, wxString(_T("Redo")),bitmap30);
-
- this->AddSeparator();
-
- wxBitmap bitmap40(OkAll_xpm);
- this->AddTool(40, wxString(_T("Ok All")),bitmap40);
-
- this->Realize();
-
- _evthand = new ToolBarEventHandlerCutModel2();
- this->SetEventHandler(_evthand);
-
-}
-
-ToolBarCutModel2::~ToolBarCutModel2(void){
-}
-
-ToolBarEventHandlerCutModel2::ToolBarEventHandlerCutModel2()
-: wxEvtHandler(){
-}
-ToolBarEventHandlerCutModel2::~ToolBarEventHandlerCutModel2(){
-}
-
-void ToolBarEventHandlerCutModel2::onAdd(wxCommandEvent& event){
- CutModel2MainPanel::getInstance()->onAddCutModel2();
-}
-
-void ToolBarEventHandlerCutModel2::onUndo(wxCommandEvent& event){
- CutModel2MainPanel::getInstance()->onUndo();
-}
-
-void ToolBarEventHandlerCutModel2::onRedo(wxCommandEvent& event){
- CutModel2MainPanel::getInstance()->onRedo();
-}
-
-void ToolBarEventHandlerCutModel2::onExecuteAll(wxCommandEvent& event){
- CutModel2MainPanel::getInstance()->ExecuteAll();
-}
-
-
-BEGIN_EVENT_TABLE(ToolBarEventHandlerCutModel2, wxEvtHandler)
- EVT_MENU(10, ToolBarEventHandlerCutModel2::onAdd)
- EVT_MENU(20, ToolBarEventHandlerCutModel2::onUndo)
- EVT_MENU(30, ToolBarEventHandlerCutModel2::onRedo)
- EVT_MENU(40, ToolBarEventHandlerCutModel2::onExecuteAll)
-END_EVENT_TABLE()
-
+++ /dev/null
-/*=========================================================================
-
- Program: wxMaracas
- Module: $RCSfile: CutModel2MainPanel.h,v $
- Language: C++
- Date: $Date: 2009/11/23 13:00:21 $
- Version: $Revision: 1.5 $
-
- Copyright: (c) 2002, 2003
- License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-
-#ifndef __CutModel2MainPanelPanelH__
-#define __CutModel2MainPanelPanelH__
-
-#include <vector>
-#include <wx/wx.h>
-#include <wx/treebook.h>
-#include "wx/aui/aui.h"
-#include <wx/toolbar.h>
-#include <iostream>
-#include "marTypes.h"
-
-
-#include "CutModel2Manager.h"
-#include "CutModelException.h"
-#include "CutModel2View.h"
-
-#include "vtkImageData.h"
-#include "vtkRenderWindowInteractor.h"
-
-
-class creaMaracasVisu_EXPORT CutModel2MainPanel : public wxPanel
-{
-
-public:
-
- ~CutModel2MainPanel( );
-
- static CutModel2MainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
-
- //static CutModel2MainPanel* getInstance();
-
- void setImageData(vtkImageData* img);
-
- void setInteractor(vtkRenderWindowInteractor* interactor);
-
- void setRenderer(vtkRenderer* renderer);
-
- void initialize(std::string path);
-
- void onAddCutModel2();
-
- void onUndo();
-
- void onRedo();
-
- void changeOpacity(int id,int opacity);
-
- void ShowViewBox(int id,bool check);
-
- void ChangeShape(int id,int selection);
-
- void changeColor(int id,double r,double g,double b);
-
- void updateActorDirection(int id);
-
- void RemoveActor(int id);
-
- void ExecuteCut(int id, double* range, bool isinside);
-
- void ExecuteAll();
-
- vtkImageData* GetResultImage();
-
- void ShowCurrentPanel(int id);
-
- void ShowPopUpMenu(int id);
-
- void ShowStatistics(int id);
-
-
-private:
-
- CutModel2MainPanel( wxWindow* parent, std::string path);
-
- static CutModel2MainPanel* instance;
-
- CutModel2Manager* cutmanager;
-
- void checkInvariant() throw( CutModelException);
-
- void showErrorDialog(std::string str);
-
- void SaveCutModelData(std::string filename);
-
- void LoadCutModelData(std::string filename);
-
- std::vector<CutModel2View*> viewpanels;
-
- wxAuiManager* _wxauimanager;
-
-
- int addNewViewPanel()throw( CutModelException);
-
- CutModel2View* getModelView(int id)throw( CutModelException);
-
- int _panelid;
-};
-
-
-class ToolBarEventHandlerCutModel2 : public wxEvtHandler{
-
- public:
- ToolBarEventHandlerCutModel2();
- ~ToolBarEventHandlerCutModel2();
-
- void onAdd(wxCommandEvent& event);
-
- void onUndo(wxCommandEvent& event);
-
- void onRedo(wxCommandEvent& event);
-
- void onExecuteAll(wxCommandEvent& event);
-
- private:
-
- DECLARE_EVENT_TABLE()
- };
-
-class ToolBarCutModel2 : public wxToolBar{
-
-
-public:
- ToolBarCutModel2(wxWindow * parent);
- ~ToolBarCutModel2(void);
-
-
-private:
-
- ToolBarEventHandlerCutModel2* _evthand;
-
-};
-
-#endif
-
+++ /dev/null
-/*=========================================================================
-
- Program: wxMaracas
- Module: $RCSfile: CutModel2View.cxx,v $
- Language: C++
- Date: $Date: 2009/11/23 13:00:26 $
- Version: $Revision: 1.3 $
-
- Copyright: (c) 2002, 2003
- License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-
-
-
-// EOF - wxMaracasMPR.cxx
-
-#include "CutModel2View.h"
-
-
-#include <wx/colordlg.h>
-#include <wx/bmpbuttn.h>
-
-#include <OpenImage.xpm>
-#include <Color.xpm>
-#include <Ok1.xpm>
-#include <Statistics.xpm>
-
-#include "vtkBoxWidget.h"
-
-#include "CutModel2MainPanel.h"
-
-CutModel2View::CutModel2View( wxWindow* parent, double* range)
-: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
-
- wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
-
- this->SetSizer(sizer);
-
- sizer->Add(getBoxControls(this, range),wxSizerFlags().FixedMinSize());
-
- sizer->AddSpacer(5);
-
- sizer->Add(getActorProperties(this),wxSizerFlags().FixedMinSize());
-
-
- wxBitmap bitmapok(Ok1_xpm);
- wxBitmapButton* okbutton = new wxBitmapButton(this, -1, bitmapok,wxDefaultPosition,wxSize(30,30));
- Connect(okbutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModel2ViewEventHandler::onExecute));
-
- sizer->AddSpacer(5);
- sizer->Add(okbutton,wxSizerFlags().FixedMinSize());
-
-
-
-
-
-}
-CutModel2View::~CutModel2View( ){
- CutModel2MainPanel::getInstance()->RemoveActor(this->getId());
-}
-
-wxSizer* CutModel2View::getBoxControls(wxWindow* parent,double* range){
-
- wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
- wxCheckBox* checkbox = new wxCheckBox(parent,-1,_T("View Box"));
- sizer->Add(checkbox,wxSizerFlags().FixedMinSize());
- checkbox->SetValue(true);
- Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)(&CutModel2ViewEventHandler::onViewBoxChecked));
-
- wxString choices1[3];
- //choices1[0] = _T("Select a shape...");
- choices1[0] = _T("Sphere");
- choices1[1] = _T("Cylinder");
- choices1[2] = _T("Cube");
- wxComboBox* combo = new wxComboBox(parent, -1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices1);
- combo->SetValue(_T("Sphere"));
- sizer->Add(combo,wxSizerFlags().FixedMinSize());
- Connect(combo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)(&CutModel2ViewEventHandler::onShapeChange));
-
- wxStaticText* labelgreyv = new wxStaticText(parent, -1, wxString(_T("Grey value range")));
- _sliderrange = new wxSlider(parent, -1, range[0],range[0],range[1],wxDefaultPosition,wxDefaultSize,wxSL_LABELS|wxSL_SELRANGE);
- wxBoxSizer* sizergreyv = new wxBoxSizer(wxVERTICAL);
- sizergreyv->Add(labelgreyv,wxSizerFlags().FixedMinSize());
- sizergreyv->Add(_sliderrange,wxSizerFlags().FixedMinSize());
- sizer->Add(sizergreyv,wxSizerFlags().FixedMinSize().Border());
-
- wxString choices0[2];
- choices0[0] = _T("inside");
- choices0[1] = _T("outside");
- _radioinsideout = new wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices0);
- sizer->Add(_radioinsideout,wxSizerFlags().FixedMinSize());
-
- /*wxString choices[2];
- choices[0] = _T("Cut");
- choices[1] = _T("Statistics");
- _radiocutstat = new wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices);
- sizer->Add(_radiocutstat,wxSizerFlags().FixedMinSize());*/
-
- wxBitmap bitmap(Statistics_xpm);
- wxBitmapButton* statbut = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30));
- Connect(statbut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModel2ViewEventHandler::onStatistics));
- sizer->Add(statbut,wxSizerFlags().FixedMinSize());
-
-
-
- return sizer;
-}
-wxSizer* CutModel2View::getActorProperties(wxWindow* parent){
-
- wxBoxSizer* sizeractorproperties = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* labelshapeactor = new wxStaticText(parent, -1, wxString(_T("Actor's properties")));
-
- sizeractorproperties->Add(labelshapeactor,wxSizerFlags().FixedMinSize());
-
- sizeractorproperties->Add(getColorChooseActor(parent),wxSizerFlags().FixedMinSize());
-
- sizeractorproperties->Add(getOpacityActor(parent),wxSizerFlags().FixedMinSize());
-
- return sizeractorproperties;
-
-}
-
-wxSizer* CutModel2View::getOpacityActor(wxWindow* parent){
- wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* labelopacity = new wxStaticText(parent, -1, wxString(_T("Opacity")));
- wxSlider* slider0 = new wxSlider(parent, -1, 60,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS);
- Connect(slider0->GetId(), wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(&CutModel2ViewEventHandler::onOpacityChange));
-
- sizeropacity->Add(labelopacity,wxSizerFlags().FixedMinSize());
- sizeropacity->Add(slider0,wxSizerFlags().FixedMinSize());
-
- return sizeropacity;
-}
-
-wxSizer* CutModel2View::getColorChooseActor(wxWindow* parent){
- wxBoxSizer* sizercolor = new wxBoxSizer(wxHORIZONTAL);
- wxBitmap bitmap(Color_xpm);
- wxBitmapButton* colorchoose = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30));
- wxObjectEventFunction f = (wxObjectEventFunction)(&CutModel2ViewEventHandler::onColorChange);
- Connect(colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, f);
-
- _currentcolor = new wxStaticText(parent,-1,_T(""),wxDefaultPosition,wxSize(20,20));
- this->SetCurrentColor(wxColour(255.0,0.0,0.0));
-
- sizercolor->Add(colorchoose,wxSizerFlags().FixedMinSize());
- sizercolor->AddSpacer(5);
- sizercolor->Add(_currentcolor,wxSizerFlags().FixedMinSize().Centre());
- return sizercolor;
-}
-
-void CutModel2View::checkInvariant()throw (CutModelException){
-
-}
-
-void CutModel2View::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
- //vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
-
- if(eventId==vtkCommand::StartInteractionEvent){
- CutModel2MainPanel::getInstance()->ShowCurrentPanel(this->getId());
- }else if(eventId==vtkCommand::InteractionEvent){
- CutModel2MainPanel::getInstance()->updateActorDirection(this->getId());
- }else if(eventId==vtkCommand::RightButtonReleaseEvent){
- // =(
- CutModel2MainPanel::getInstance()->ShowPopUpMenu(this->getId());
- }
-}
-
-void CutModel2View::ExecuteCut(){
- if(this->isCut()){
- CutModel2MainPanel::getInstance()->ExecuteCut(this->getId(),this->getRange(),this->isInside());
- }else{
- }
-
-}
-
-double* CutModel2View::getRange(){
- double* x = new double[3];
- x[0] = 0;
- x[1] = _sliderrange->GetValue();
- x[2] = 100000;
-
- return x;
-}
-bool CutModel2View::isCut(){
- return true;
- //return _radiocutstat->GetSelection()==0;
-}
-bool CutModel2View::isInside(){
- return _radioinsideout->GetSelection()==0;
-}
-void CutModel2View::SetCurrentColor(wxColour colour){
- _currentcolor->SetBackgroundColour(colour);
-
- this->Refresh();
- this->Layout();
-}
-
-void CutModel2ViewEventHandler::onColorChange(wxCommandEvent& event){
- CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent();
- wxColourDialog* colourdiag = new wxColourDialog(parent);
- if(colourdiag->ShowModal()==wxID_OK){
- wxColour colour = colourdiag->GetColourData().GetColour();
-
- parent->SetCurrentColor(colour);
-
- double r = (double)(colour.Red())/255.0;
- double g = (double)(colour.Green())/255.0;
- double b = (double)(colour.Blue())/255.0;
- CutModel2MainPanel::getInstance()->changeColor(parent->getId(),r,g,b);
-
-
- }
- delete colourdiag;
-}
-
-void CutModel2ViewEventHandler::onOpacityChange(wxScrollEvent& event){
- CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent();
-
- CutModel2MainPanel::getInstance()->changeOpacity(parent->getId(),event.GetInt());
-}
-void CutModel2ViewEventHandler::onViewBoxChecked(wxCommandEvent& event){
- CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent();
-
- CutModel2MainPanel::getInstance()->ShowViewBox(parent->getId(),event.IsChecked());
-}
-void CutModel2ViewEventHandler::onShapeChange(wxCommandEvent& event){
- CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent();
-
- //if(event.GetSelection()>0){
- //std::cout<<"id in CutModel2ViewEventHandler:: "<<parent->getId()<<std::endl;
- CutModel2MainPanel::getInstance()->ChangeShape(parent->getId(),event.GetSelection());
- //}
-}
-void CutModel2ViewEventHandler::onStatistics(wxCommandEvent& event){
- CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent();
- CutModel2MainPanel::getInstance()->ShowStatistics(parent->getId());
-}
-void CutModel2ViewEventHandler::onExecute(wxCommandEvent& event){
- CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent();
-
- parent->ExecuteCut();
-
-}
+++ /dev/null
-/*=========================================================================
-
- Program: wxMaracas
- Module: $RCSfile: CutModel2View.h,v $
- Language: C++
- Date: $Date: 2009/11/23 13:00:27 $
- Version: $Revision: 1.3 $
-
- Copyright: (c) 2002, 2003
- License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-
-#ifndef __CutModel2ViewPanelH__
-#define __CutModel2ViewPanelH__
-
-#include <vector>
-#include <wx/wx.h>
-#include <wx/radiobut.h>
-#include "wx/aui/aui.h"
-#include <iostream>
-#include "marTypes.h"
-
-
-#include "CutModel2Manager.h"
-#include "CutModelException.h"
-
-#include "vtkObject.h"
-#include "vtkCommand.h"
-
-
-class creaMaracasVisu_EXPORT CutModel2View : public wxPanel, public vtkCommand
-{
-
-public:
- CutModel2View( wxWindow* parent,double* range);
- ~CutModel2View( );
-
- virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
-
- int getId(){
- return _id;
- }
- void setId(int id){
- _id = id;
- }
-
- void ExecuteCut();
-
- void SetCurrentColor(wxColour colour);
-
-private:
-
- int _id;
-
- wxSlider* _sliderrange;
- wxRadioBox* _radioinsideout;
- //wxRadioBox* _radiocutstat;
- wxStaticText* _currentcolor;
-
- double* getRange();
- bool isCut();
- bool isInside();
-
-
-
- wxSizer* getBoxControls(wxWindow* parent, double* range);
-
-
- wxSizer* getActorProperties(wxWindow* parent);
- wxSizer* getColorChooseActor(wxWindow* parent);
- wxSizer* getOpacityActor(wxWindow* parent);
-
- void checkInvariant() throw( CutModelException);
-
-};
-
-class CutModel2ViewEventHandler : public wxEvtHandler{
-
- public:
- CutModel2ViewEventHandler(): wxEvtHandler(){};
- ~CutModel2ViewEventHandler(){};
-
- void onColorChange(wxCommandEvent& event);
- void onOpacityChange(wxScrollEvent& event);
- void onViewBoxChecked(wxCommandEvent& event);
- void onShapeChange(wxCommandEvent& event);
- void onStatistics(wxCommandEvent& event);
- void onExecute(wxCommandEvent& event);
-
-
-
- private:
-
-};
-
-
-#endif
-