}
void IRMViewer::CreateWidget(wxWindow* parent)
{
+
+ std::string path = "";
+#if defined(WIN32)
char currentPath[_MAX_PATH];
HMODULE hand = GetModuleHandle("bbcreaMaracasVisu");
GetModuleFileName(hand, currentPath, _MAX_PATH);
+ path = currentPath;
+ path = path.substr(0,path.find_last_of("\\"));
+
+#else if defined(UNIX)
+ pid_t pid = getpid();
+ char buf[10];
+ sprintf(buf,"%d",pid);
- std::string path = currentPath;
+ std::string _link = "/proc/";
+ _link.append( buf );
+ _link.append( "/exe");
- path = path.substr(0,path.find_last_of("\\"));
+ char proc[512];
+ int ch = readlink(_link.c_str(),proc,512);
+ if (ch != -1) {
+ proc[ch] = 0;
+ path = proc;
+ std::string::size_type t = path.find_last_of("/");
+ path = path.substr(0,t);
+ }
+
+
+#endif
std::cout << "Your application's directory is: " << path;
wxMaracasIRMView* irmview = wxMaracasIRMView::getInstance(parent,path);
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMView.cxx,v $
Language: C++
- Date: $Date: 2009/04/09 13:58:38 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/04/14 12:47:30 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
}catch(char* str){
- std::cout << "Exception : " << str << '\n';
- wxMessageDialog* diag = new wxMessageDialog(this, wxString(str), wxString(str), wxICON_ERROR);
+ wxString s( str,wxConvUTF8 );
+ wxMessageDialog* diag = new wxMessageDialog(this, s, s, wxICON_ERROR);
diag->ShowModal();
+ delete diag;
}
}
wxString stl(_T("stl"));
wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")),
- wxString(_T("")),"STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd" );
+ wxString(_T("")),wxString(_T("STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd")) );
if(fildial->ShowModal()==wxID_OK){
wxString filename = fildial->GetFilename();
}
void wxMaracasIRMView::loadPropMHD(wxString filename, wxString dataname){
-
- vtkImageData* img = irmmanager->getImageData(filename.c_str());
+ std::string s = std::string(filename.mb_str());
+ vtkImageData* img = irmmanager->getImageData(s);
if(img!=NULL){
- addPropMHD(img, dataname.c_str());
+ s = std::string(dataname.mb_str());
+ addPropMHD(img, s);
}
}catch(char* str){
std::cout << "Exception : " << str << '\n';
- wxMessageDialog* diag = new wxMessageDialog(this, wxString(str), wxString(str), wxICON_ERROR);
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR);
diag->ShowModal();
}
}
void wxMaracasIRMView::loadProp3D(wxString filename, wxString dataname){
-
- vtkProp3D* prop3D = irmmanager->getProp3D(filename.c_str());
+ std::string s = std::string(filename.mb_str());
+ vtkProp3D* prop3D = irmmanager->getProp3D(s);
if(prop3D != NULL){
- this->addProp3D(prop3D,dataname.c_str());
+ s = std::string(dataname.mb_str() );
+ this->addProp3D(prop3D,s);
}else{
//TODO msj to the user indicating error in file
}
}
}catch(char* str){
std::cout << "Exception : " << str << '\n';
- wxMessageDialog* diag = new wxMessageDialog(this, wxString(str), wxString(str), wxICON_ERROR);
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
diag->ShowModal();
}
}
void wxMaracasIRMView::addIRMViewPanel(wxMaracasIRMViewPanel* irmview, std::string dataname){
- wxString s(dataname.c_str());
+ wxString s(dataname.c_str(),wxConvUTF8 );
wxAuiPaneInfo paneinfo;
wxauimanager->AddPane(irmview, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s));
wxauimanager->Update();
void wxMaracasIRMViewProp3D::createControls(){
wxString choices[2];
- choices[0] = "On";
- choices[1] = "Off";
+ choices[0] = wxString(_T("On"));
+ choices[1] = wxString(_T("Off"));
checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
this->addControl(checkbox);
Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onCheckBoxChange);
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMViewManager.cxx,v $
Language: C++
- Date: $Date: 2009/04/09 13:58:38 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/04/14 12:47:30 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
/**
** Adds a prop3D to the manager and returns the identifier
**/
-int wxMaracasIRMViewManager::addProp3D(vtkProp3D* prop3D, std::string dataname) throw(...){
+int wxMaracasIRMViewManager::addProp3D(vtkProp3D* prop3D, std::string dataname) throw(char*){
checkInvariant();
if(prop3D != NULL){
wxMaracasIRMViewManagerData* data = new wxMaracasIRMViewManagerData(prop3D, dataname);
/**
** adds or removes an actor depending of the bool value
**/
-void wxMaracasIRMViewManager::addRemoveActor(int propid, bool addremove) throw(...){
+void wxMaracasIRMViewManager::addRemoveActor(int propid, bool addremove) throw(char*){
checkInvariant();
wxMaracasIRMViewManagerData* data = this->getViewData(propid);
/**
** Changes the opacity in a prop3D
**/
-void wxMaracasIRMViewManager::changeOpacity(int propid, int value) throw(...){
+void wxMaracasIRMViewManager::changeOpacity(int propid, int value) throw(char*){
checkInvariant();
/**
** changes the isovalue in a prop3D
**/
-void wxMaracasIRMViewManager::changeIsoValue(int propid, int value )throw (...){
+void wxMaracasIRMViewManager::changeIsoValue(int propid, int value )throw(char*){
checkInvariant();
wxMaracasIRMViewManagerData* data = this->getViewData(propid);
return NULL;
}
-void wxMaracasIRMViewManager::checkInvariant() throw(...){
+void wxMaracasIRMViewManager::checkInvariant() throw(char*){
if(this->_renderer==NULL){
throw "Renderer not set";
}
}
-wxMaracasIRMViewManagerData* wxMaracasIRMViewManager::getViewData(int id) throw(...){
+wxMaracasIRMViewManagerData* wxMaracasIRMViewManager::getViewData(int id) throw(char*){
int i;
for(i = 0; i < prop3Dvect.size();i++){
if(prop3Dvect[i]->getId() == id){
return NULL;
}
-int wxMaracasIRMViewManager::getMaxIsoValue(int propid){
+int wxMaracasIRMViewManager::getMaxIsoValue(int propid) throw(char*){
return this->getViewData(propid)->getMaxGreyLevel();
}
-void wxMaracasIRMViewManager::changeColor(int propid, double red, double green, double blue) throw (...){
+void wxMaracasIRMViewManager::changeColor(int propid, double red, double green, double blue) throw(char*){
checkInvariant();
this->getViewData(propid)->changeColor(red, green, blue);
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMViewManager.h,v $
Language: C++
- Date: $Date: 2009/04/09 13:58:38 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/04/14 12:47:30 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
/**
** Adds a prop3D to the manager and returns the identifier
**/
- int addProp3D(vtkProp3D* prop3D, std::string dataname);
+ int addProp3D(vtkProp3D* prop3D, std::string dataname) throw (char*);
/**
** Adds a prop3D to the manager and returns the identifier
**/
/**
** Changes the opacity in a prop3D
**/
- void changeOpacity(int propid, int value);
+ void changeOpacity(int propid, int value)throw(char*);
/**
** changes the isovalue in a prop3D
**/
- void changeIsoValue(int propid, int value);
+ void changeIsoValue(int propid, int value)throw(char*);
/**
** loads a prop3D from a nSTL file
/**
** adds or removes an actor depending of the bool value
**/
- void addRemoveActor(int propid, bool addremove);
+ void addRemoveActor(int propid, bool addremove)throw(char*);
/**
** Check if the variables are setted correctly
**/
- void checkInvariant();
+ void checkInvariant()throw(char*);
/**
** Given an id search the data in the vector
**/
- wxMaracasIRMViewManagerData* getViewData(int id);
+ wxMaracasIRMViewManagerData* getViewData(int id)throw(char*);
/**
** Given the id, return the max iso value from the imagedata
**/
- int getMaxIsoValue(int propid);
+ int getMaxIsoValue(int propid)throw(char*);
/**
** Changes the color of the actor
**/
- void changeColor(int propid, double red, double green, double blue);
+ void changeColor(int propid, double red, double green, double blue) throw(char*);
private:
std::vector<wxMaracasIRMViewManagerData*> prop3Dvect;