]> Creatis software - creaMaracasVisu.git/commitdiff
Compila en Unix Fedora
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 14 Apr 2009 12:47:28 +0000 (12:47 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 14 Apr 2009 12:47:28 +0000 (12:47 +0000)
bbtk/src/bbcreaMaracasVisuIRMViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h

index 8d6777bfcebc42d179a9bcadbf6804fd47684ac0..429278c06cb0bd269c1777f953226d0749b0ae0c 100644 (file)
@@ -38,13 +38,35 @@ void IRMViewer::Process()
 }
 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);
index 3355f76d85462b697083efc78e3102736f81d9c6..c13e1571fa78b0a206e73f89f061d945217603a2 100644 (file)
@@ -3,8 +3,8 @@
   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:
@@ -94,9 +94,10 @@ void wxMaracasIRMView::changeColor(int propid, double red, double green, double
 
        }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;
 
        }
 }
@@ -107,7 +108,7 @@ void wxMaracasIRMView::onLoadImageFile(){
        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();
@@ -125,10 +126,11 @@ void wxMaracasIRMView::onLoadImageFile(){
 }
 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);
        }
        
        
@@ -149,17 +151,18 @@ void wxMaracasIRMView::addPropMHD(vtkImageData* imgdata, std::string dataname){
        }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
        }
@@ -177,14 +180,14 @@ void wxMaracasIRMView::addProp3D(vtkProp3D* prop3D, std::string dataname){
                }
        }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();
@@ -207,8 +210,8 @@ wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){
 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);   
index 1f02c5b739ed3375621f99826ff0b710ac8366ad..1b3ec3676b4f13c574bc209887c8ebf5616af841 100644 (file)
@@ -3,8 +3,8 @@
   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:
@@ -35,7 +35,7 @@ void wxMaracasIRMViewManager::setRenderer(vtkRenderer*  renderer){
 /**
 **     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);
@@ -68,7 +68,7 @@ int wxMaracasIRMViewManager::addPropMHD(vtkImageData* imagedata, std::string dat
 /**
 **     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);          
@@ -85,7 +85,7 @@ void wxMaracasIRMViewManager::addRemoveActor(int propid, bool addremove)  throw(
 /**
 **     Changes the opacity in a prop3D
 **/
-void wxMaracasIRMViewManager::changeOpacity(int propid, int value)  throw(...){
+void wxMaracasIRMViewManager::changeOpacity(int propid, int value)  throw(char*){
        checkInvariant();       
 
 
@@ -98,7 +98,7 @@ void wxMaracasIRMViewManager::changeOpacity(int propid, int value)  throw(...){
 /**
 **     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);          
@@ -141,13 +141,13 @@ vtkImageData* wxMaracasIRMViewManager::getImageData(std::string filename){
        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){
@@ -159,13 +159,13 @@ wxMaracasIRMViewManagerData* wxMaracasIRMViewManager::getViewData(int id) throw(
        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);
 
index b9656d5e26de7e7bb5243c291daf7d57671fd213..b3be47c7724a7f917617aeb84cf692ebb7906d7a 100644 (file)
@@ -3,8 +3,8 @@
   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:
@@ -136,7 +136,7 @@ public:
        /**
        **      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
        **/
@@ -144,12 +144,12 @@ public:
        /**
        **      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
@@ -164,27 +164,27 @@ public:
        /**
        **      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;