]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
#3129 creaContours Feature New Normal - branch changeWx28to30 compilation with...
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
index 617dce59520bbb9db6365a86d28add0a4af07306..8aaa0bb954ab78dd74df584db0fdc5c959714b3c 100644 (file)
@@ -961,7 +961,12 @@ void wxContourMainFrame::onLoad()
        if(GetFileLocation().empty())
        {
 //------------------------------------------------------------------------------------------------------------
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
+#else
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_OPEN );
+#endif
                if (dialog.ShowModal() == wxID_OK)
                {
                        fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
@@ -1010,16 +1015,11 @@ printf("EED wxContourMainFrame::SetZForAllContours contour=%d \n", i );
        }// for i  list of static things
 }
 
-
-
 void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool interactiveInterface)
 {
        char tmp[255];
        char tmpD[255];
-
        FILE *pFile =fopen(fileNameContourROI.c_str(),"r+");
-
-
 //CMRU 03-09-09- ----------------------------------------------------------------------------------------------
        if(pFile != NULL)
        {
@@ -1086,18 +1086,22 @@ printf("EED wxContourMainFrame::onLoadContours  version%s \n", version.c_str() )
                if(pFileData != NULL)
                {
                        fclose(pFileData);
-               }
+               } // if
        }
        _theViewPanel->getSceneManager()->removeSceneContours();
        changeInstant();
 }
 
 
-
-void wxContourMainFrame::onImport(){
+void wxContourMainFrame::onImport()
+{
        std::string filename, filenamecontours;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
        wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxOPEN );
-
+#else
+       wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxFD_OPEN );
+#endif
        if (dialog.ShowModal() == wxID_OK)
        {
                filename = dialog.GetPath().mb_str();
@@ -1105,19 +1109,25 @@ void wxContourMainFrame::onImport(){
 
                if(filenamecontours.compare("") != 0){
                        onLoadContours(filenamecontours,true);
-               }
-
-       }
+               } // if
+       } // if
 }
-void wxContourMainFrame::onTest(){
+
+void wxContourMainFrame::onTest()
+{
        std::string filename, filenamecontours;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
        wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxOPEN );
+#else
+       wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN );
+#endif
 
        if (dialog.ShowModal() == wxID_OK)
        {
                filename = dialog.GetPath().mb_str();
                std::cout << "This is the filename: " << filename << std::endl;
-       }
+       } // if
 }
 
 
@@ -1127,7 +1137,12 @@ void wxContourMainFrame::onSave(){
        if(GetFileLocation().empty())
        {
 //------------------------------------------------------------------------------------------------------------
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
+#else
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_SAVE );
+#endif
                if (dialog.ShowModal() == wxID_OK)
                {
                        std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
@@ -1194,11 +1209,22 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
        fprintf(pFileData,"NumberOfContours %d\n", sizeLstNameThings );
 //------------------------------------------------------------------------------------------------------------
 
+
+// EED 2017-05-30
+       double spc[3];
+       spc[0]=1; 
+       spc[1]=1; 
+       spc[2]=1; 
+
        for (i=0 ; i<sizeLstNameThings ; i++)
        {
 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
                manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
-               double sizeInPixel = manualModel ->GetPathSize();
+
+// EED 2017-05-30
+//             double sizeInPixel = manualModel ->GetPathSize(  );
+               double sizeInPixel = manualModel ->GetPathSize( spc );
+
                double realContourSize = sizeInPixel*_onePixelSize;
                manualModel ->SetRealSize(realContourSize);
 //------------------------------------------------------------------------------------------------------------
@@ -3227,10 +3253,18 @@ double wxContourMainFrame::getContourSizeInPixels()
                std::string cloneName = currentSelection [0];
 
                manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
-               contourSize = manualModel-> GetPathSize();
+
+// EED 2017-05-30
+//             contourSize = manualModel->GetPathSize();
+               double spc[3];
+               spc[0]=1; 
+               spc[1]=1; 
+               spc[2]=1; 
+               contourSize = manualModel->GetPathSize( spc );
        }
        return contourSize;
 }
+
 manualBaseModel * wxContourMainFrame::getContour ()
 {
        std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
@@ -3260,9 +3294,16 @@ void wxContourMainFrame::onPrintLabel (wxString label, manualBaseModel* manualMo
 }
 void wxContourMainFrame::onInsertCalculation(manualBaseModel* manualModel)
 {
-       double sizeInPixel = manualModel ->GetPathSize();
+// EED 2017-05-30
+//     double sizeInPixel      = manualModel ->GetPathSize(  );
+       double spc[3];
+       spc[0]=1; // ????
+       spc[1]=1; // ????
+       spc[2]=1; // ????
+       double sizeInPixel      = manualModel ->GetPathSize( spc );
+
        double onePixelRealSize = interfMainPanel::getInstance()->GetPixelValue();;
-       double realContourSize = sizeInPixel*onePixelRealSize;
+       double realContourSize  = sizeInPixel*onePixelRealSize;
        manualModel ->SetRealSize(realContourSize);
 }