Program: wxMaracas
Module: $RCSfile: CutModelMainPanel.cxx,v $
Language: C++
-Date: $Date: 2010/09/29 21:21:03 $
-Version: $Revision: 1.11 $
+Date: $Date: 2010/11/13 10:11:34 $
+Version: $Revision: 1.12 $
Copyright: (c) 2002, 2003
License:
#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"
initialize(path);
}
-CutModelMainPanel::~CutModelMainPanel( ){
+CutModelMainPanel::~CutModelMainPanel( ){
viewpanels.clear();
delete cutmanager;
}
void CutModelMainPanel::initialize(std::string path){
cutmanager = new CutModelManager(path);
_panelid = 0;
- _wxauimanager = new wxAuiManager(this);
+ _wxauimanager = new wxAuiManager(this);
wxAuiPaneInfo paneinfo;
_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(new ToolBarCutModel(this),paneinfo.ToolbarPane().Top());
_wxauimanager->AddPane(_notebook,paneinfo.Center());
addPolygonCutterTab();
_notebook->Update();
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();
}
}
viewpanels.pop_back();
cutmanager->RemoveActor(id);
- }
+ }
}catch(CutModelException e){
showErrorDialog(e.getCause());
}
if(_isCheck==false)
- {
+ {
_isCheck=true;
//Draw Polygon
lblMessagePolygon->SetLabel(_T("Drawing polygon..."));
}
else
- {
+ {
_isCheck=false;
//Finish Drawing
cout<<"Finish Drawing"<<endl;
try{
checkInvariant();
- int id = addNewViewPanel();
+ int id = addNewViewPanel();
cutmanager->onAddCutModel(id, getModelView(id));
_panelid++;
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);
CutModelView* viewpanel = new CutModelView(this,cutmanager->getImageRange());
wxAuiPaneInfo paneinfo0;
- _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre());
+ _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre());
viewpanel->setId(_panelid);
- viewpanels.push_back(viewpanel);
+ viewpanels.push_back(viewpanel);
return viewpanel->getId();
void CutModelMainPanel::onUndo()
{
try{
- checkInvariant();
+ checkInvariant();
/*int result = */ cutmanager->Undo(); // result unused// JPR
}catch(CutModelException e){
void CutModelMainPanel::onRedo(){
try{
- checkInvariant();
+ checkInvariant();
/*int result = */ cutmanager->Redo();
}catch(CutModelException e){
void CutModelMainPanel::changeOpacity(int id,int opacity){
try{
- checkInvariant();
+ checkInvariant();
cutmanager->changeOpacity(id, opacity);
}catch(CutModelException e){
void CutModelMainPanel::ShowViewBox(int id,bool check){
try{
- checkInvariant();
+ checkInvariant();
cutmanager->ShowViewBox(id, check);
}catch(CutModelException e){
void CutModelMainPanel::changeColor(int id,double r,double g,double b){
try{
- checkInvariant();
+ checkInvariant();
cutmanager->changeColor(id, r, g, b);
}catch(CutModelException e){
void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside){
try{
- checkInvariant();
+ checkInvariant();
cutmanager->ExecuteCut(id, range, isinside);
}catch(CutModelException e){
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);
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);
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();
}
void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event){
- CutModelMainPanel::getInstance()->onUndo();
+ CutModelMainPanel::getInstance()->onUndo();
}
void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event){