]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.cxx
index 4b8c16e9037c8b040bbeb4340c531f02a7b5d41b..fe241ccda59884b2c49d46f8ffb94cf8b1362b4a 100644 (file)
@@ -12,6 +12,7 @@
 */
 
 interfMainPanel* interfMainPanel::interfmainpanel=NULL;
+wxFrame* interfMainPanel::_newframe=NULL;
 
 interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir)
 : wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN)
@@ -38,8 +39,6 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        splitterwindow->SetMinimumPaneSize( 10 );
        sizey = sizey/8;
 
-       
-
        wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
 
        wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);      
@@ -126,29 +125,31 @@ interfMainPanel::~interfMainPanel(void)
 
 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler){       
 
-       wxFrame* newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,850),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
+       _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,850),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
        
                                                                                                                                                                                
        if(interfmainpanel == NULL){
-               interfmainpanel = new interfMainPanel(newframe, 350, 850, evtHandler, datadir);
+               interfmainpanel = new interfMainPanel(_newframe, 350, 850, evtHandler, datadir);
        }
 
-       newframe->Show(TRUE);
+       _newframe->Show(TRUE);
        return interfmainpanel;
 }
 
 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler){    
 
-       wxFrame* newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,850),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+       _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,850),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
 
        if(interfmainpanel == NULL){
-               interfmainpanel = new interfMainPanel(newframe, 350, 850, evtHandler);
+               interfmainpanel = new interfMainPanel(_newframe, 350, 850, evtHandler);
        }
 
-       newframe->Show(TRUE);
+       _newframe->Show(TRUE);
        return interfmainpanel;
 }
-
+bool interfMainPanel::Show(bool show){
+       return _newframe->Show(show);
+}
 interfMainPanel* interfMainPanel::getInstance()
 {      
 
@@ -157,7 +158,8 @@ interfMainPanel* interfMainPanel::getInstance()
 
 void interfMainPanel :: resetInstance()
 {
-       delete interfmainpanel;
+       //delete interfmainpanel;
+       delete _newframe;
        interfmainpanel = NULL;
 }
 
@@ -298,7 +300,7 @@ void interfMainPanel::showPanel(wxWindow* panel)
 }
 
 /**
-**     Hide the panel in the 
+**     Hide the panel in the lower box
 **/
 void interfMainPanel::hidePanel( ){
        wxContourMainFrame::getInstance()->showAxis(false);
@@ -407,24 +409,10 @@ int interfMainPanel::GetImageDataSizeZ(){
        return wxContourMainFrame::getInstance()->GetImageDataSizeZ();
 }
 
-void interfMainPanel::GetImageDataRange(double *range){
-       wxContourMainFrame::getInstance()->GetImageDataRange(range);
-}
-
 void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method){
        wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method);
 }
 
-void interfMainPanel::onMirror()
-{
-       wxContourMainFrame::getInstance()->onMirror();
-}
-
-void interfMainPanel::onMirrorChangeWidth(int width)
-{
-       wxContourMainFrame::getInstance()->refLineChangeWidth(width);
-}
-
 void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString){        
     ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
 }
@@ -496,7 +484,8 @@ void interfMainPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlev
        wxContourMainFrame::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
 }
 
-void interfMainPanel::onInterpolation(bool interpolate){
+void interfMainPanel::onInterpolation(bool interpolate)
+{
        wxContourMainFrame::getInstance()->onInterpolation(interpolate);
 }
 
@@ -569,9 +558,9 @@ void interfMainPanel::setStringSpread(std::string stringtemp){
 void interfMainPanel::onInformationPressed(){
        if(infoWin ==NULL){
                infoWin                                         = new wxFrame (this, -1,_T("  Spread  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
-               infoWin->SetSize( wxSize(500,450) );
+               infoWin->SetSize( wxSize(825,650) );
                
-               wxSize sizepanel(200,300);
+               wxSize sizepanel(825,675);
                informationPanel                                                                        = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
 
                wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
@@ -634,15 +623,21 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString){
 
 }
 
-void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){
-       wxContourMainFrame::getInstance()->onSaveResults(directory, namefile,filename, typeContourGroup);
+void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, 
+                                                                       int typeContourGroup, bool XYZValues, bool contourImage, bool statistics)
+{
+       wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename, 
+               typeContourGroup, XYZValues, contourImage, statistics);
 }
 
 wxString interfMainPanel::getCellValue(int j,int i){
        return ((interfInformationPanel*)informationPanel)->getCellValue(j, i );
 }
 
-void interfMainPanel::onSnakePressed(){
+void interfMainPanel::onSnakePressed()
+{
+       axisshown=false;
+       wxContourMainFrame::getInstance()->showAxis(axisshown);
     wxContourMainFrame::getInstance()->onSnakePressed();
 }
 
@@ -664,36 +659,79 @@ void interfMainPanel::onMirrorPressed(){
                mirrorPanel->Layout();
 
                refLineShown=true;
-
-               showPanel(mirrorPanel);
                wxContourMainFrame::getInstance()->referenceLine();
        }       
 
        else
        {
-               if(refLineShown)
-               {
-                       wxContourMainFrame::getInstance()->refLineHide();
-                       refLineShown=false;
 
-                       hidePanel();
-               }
-
-               else if (!refLineShown)
+               if (!refLineShown)
                {
                        wxContourMainFrame::getInstance()->refLineShow();
                        refLineShown=true;
-
-                       showPanel(mirrorPanel);
                }
        }
 
+       showPanel(mirrorPanel);
 }
 
-       
-void interfMainPanel::onThreshold(int minVal, int maxVal)
+void interfMainPanel::onMirror()
+{
+       wxContourMainFrame::getInstance()->onMirror();
+}
+
+void interfMainPanel::onMirrorAxisShow()
+{
+       if (!refLineShown)
+       {
+               wxContourMainFrame::getInstance()->refLineShow();
+               refLineShown=true;
+       }
+}
+
+void interfMainPanel::onMirrorAxisHide()
+{
+       if (refLineShown)
+       {
+               wxContourMainFrame::getInstance()->refLineHide();
+               refLineShown=false;
+       }
+}
+
+void interfMainPanel::onMirrorChangeWidth(int width)
+{
+       wxContourMainFrame::getInstance()->refLineChangeWidth(width);
+}
+
+
+void interfMainPanel::onThreshold()
+{
+       wxContourMainFrame::getInstance()->onThreshold();
+}
+
+void interfMainPanel::onThresholdChange()
+{
+       wxContourMainFrame::getInstance()->onThresholdChange();
+}
+
+void interfMainPanel::onThresholdInstantChange(double range[])
+{
+       panelThreshold->onThresholdInstantChange(range);
+}
+
+void interfMainPanel::onThresholdInterpolation(bool interpolate)
 {
-       wxContourMainFrame::getInstance()->onThreshold(minVal, maxVal);
+       wxContourMainFrame::getInstance()->onThresholdInterpolation(interpolate);
+}
+
+void interfMainPanel::onThresholdChangeOpacity (int opacity)
+{
+       wxContourMainFrame::getInstance()->onThresholdChangeOpacity(opacity);
+}
+
+void interfMainPanel::onThresholdRemove()
+{
+       wxContourMainFrame::getInstance()->onThresholdRemove();
 }
 
 void interfMainPanel::onThresholdPressed()
@@ -713,24 +751,8 @@ void interfMainPanel::onThresholdPressed()
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
                flexsizer->Add(panelThreshold, wxEXPAND);
                thresholdPanel->Layout();
-               showPanel(thresholdPanel);
-       }       
-
-
-               else
-       {
-               if(thresholdShown)
-               {
-                       thresholdShown=false;
-                       panelThreshold->onThresholdStop();
-                       
-                       hidePanel();
-               }
 
-               else if (!thresholdShown)
-               {
-                       thresholdShown=true;
-                       showPanel(thresholdPanel);
-               }
-       }
+       }       
+       showPanel(thresholdPanel);
 }
+