]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.cxx
index 21b1c630403aecab2f414f13af5a19aaa02e46c7..4c67ae203886dbfcf780602e50833104284b8c1c 100644 (file)
@@ -29,6 +29,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        spreadPanel = NULL;
        infoWin=NULL;
        informationPanel=NULL;
+       mirrorPanel=NULL;
        
        splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T("")));
        
@@ -374,7 +375,31 @@ void interfMainPanel::showPanel(wxWindow* panel){
        infoPanel->Refresh();
        this->Layout();
        this->Refresh();
+}
+
+/**
+**     Hide the panel in the 
+**/
+void interfMainPanel::hidePanel( ){
+       wxContourMainFrame::getInstance()->showAxis(false);
+       wxSizer* sizer = infoPanel->GetSizer();
+
+       if(currentWindow != NULL){
+               currentWindow->Hide();
+               sizer->Remove(currentWindow);
+       }
+       wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+       sizer->Add(emptyPanel);
+    currentWindow = emptyPanel;
+       currentWindow->Show(true);
 
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
+
+       infoPanel->Layout();
+       infoPanel->Refresh();
+       this->Layout();
+       this->Refresh();
 }
 
 /**
@@ -396,6 +421,10 @@ void interfMainPanel::onCreateContourCircle( ){
        wxContourMainFrame::getInstance()->showAxis(false);
     wxContourMainFrame::getInstance()->onCreateContourCircle();
 }
+void interfMainPanel::onCreateContourLine( ){
+       wxContourMainFrame::getInstance()->showAxis(false);
+    wxContourMainFrame::getInstance()->onCreateContourLine();
+}
 void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull){
        wxContourMainFrame::getInstance()->showAxis(false);
        wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull);
@@ -439,7 +468,8 @@ vtkImageData* interfMainPanel::getImageData(){
        return wxContourMainFrame::getInstance()->getImageData();
 }
 
-void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method){
+void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method)
+{
        wxContourMainFrame::getInstance()->onSegmentationOneSlice(isovalue, sampling, method);
 }
 
@@ -455,6 +485,11 @@ void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int
        wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method);
 }
 
+void interfMainPanel::onMirror()
+{
+       wxContourMainFrame::getInstance()->onMirror();
+}
+
 void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString){        
     ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
 }
@@ -611,7 +646,7 @@ void interfMainPanel::onInformationPressed(){
                infoWin->SetAutoLayout( true );
                infoWin->Layout();
 
-               infoWin->Show();                
+               infoWin->Show();
 
        }else {
 
@@ -670,3 +705,49 @@ wxString interfMainPanel::getCellValue(int j,int i){
        return ((interfInformationPanel*)informationPanel)->getCellValue(j, i );
 }
 
+void interfMainPanel::onSnakePressed(){
+    wxContourMainFrame::getInstance()->onSnakePressed();
+}
+
+void interfMainPanel::onMirrorPressed(){
+    if(mirrorPanel==NULL){
+
+               mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               mirrorPanel->SetSizer(flexsizer, true);
+               mirrorPanel->SetAutoLayout( true );     
+               panelMirror = new interfMirrorPanel(mirrorPanel);
+       
+               wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T("   Mirroring Tool   ")), wxDefaultPosition,
+                       wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panelMirror, wxEXPAND);
+               mirrorPanel->Layout();
+
+               refLineShown=true;
+
+               showPanel(mirrorPanel);
+               wxContourMainFrame::getInstance()->referenceLine();
+       }       
+
+       else
+       {
+               if(refLineShown)
+               {
+                       wxContourMainFrame::getInstance()->refLineHide();
+                       refLineShown=false;
+
+                       hidePanel();
+               }
+
+               else if (!refLineShown)
+               {
+                       wxContourMainFrame::getInstance()->refLineShow();
+                       refLineShown=true;
+
+                       showPanel(mirrorPanel);
+               }
+       }
+
+}