]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
#3161 creaContours Bug New Normal - Interpolate Image - Color and Threshold Layer...
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.cxx
index c1179ebc2b43ef97db6898fd80178767d046bf42..d1dd92247c4b9b43bb1287db150bc2a07678445d 100644 (file)
@@ -1,3 +1,28 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
 #include "interfMainPanel.h"
 
 
@@ -30,6 +55,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        colorImageLayerPanel    = NULL;
        currentWindow                   = NULL;
        testPanel                               = NULL;
+       flipPanel                               = NULL;
 
 //CMRU 17-08-09 ------------------------------------------------------------------
        infoPanelCalibration = NULL;
@@ -120,7 +146,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        splitterwindow->SetSashGravity(1);
 //EED  splitterwindow->SetSashPosition(600);
        splitterwindow->SetSashSize(5);
-       splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73);
+       splitterwindow->SplitHorizontally(toolpanel, infoPanel,9*73);
 
        Connect(b->GetId(),  wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
        Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
@@ -303,6 +329,7 @@ void interfMainPanel::showPanel(wxWindow* panel)
 
        if(currentWindow != NULL){
                currentWindow->Hide();
+               /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated 
                sizer->Remove(currentWindow);
        }
        sizer->Add(panel);
@@ -328,6 +355,7 @@ void interfMainPanel::hidePanel( )
 
        if(currentWindow != NULL){
                currentWindow->Hide();
+               /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated 
                sizer->Remove(currentWindow);
        }
        wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
@@ -445,11 +473,14 @@ void interfMainPanel::onSave()
        wxContourMainFrame::getInstance()->onSave();
 }
 
-void interfMainPanel::onImport(){
+void interfMainPanel::onImport()
+{
        wxContourMainFrame::getInstance()->onImport();
 }
 
-void interfMainPanel::onTest(){
+void interfMainPanel::onTest()
+{
+       printf("EED interfMainPanel::onTest \n");
        if(testPanel==NULL)
        {
                testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
@@ -458,17 +489,15 @@ void interfMainPanel::onTest(){
                testPanel->SetSizer(flexsizer, true);
                testPanel->SetAutoLayout( true );
                panelTest = new interfTestPanel(testPanel);
-
-               wxStaticText* stattext = new wxStaticText(mirrorPanel,  -1,
+               wxStaticText* stattext = new wxStaticText(testPanel,  -1,
                        wxString(_T("   Test Panel   ")),
                        wxDefaultPosition, wxDefaultSize,
                        wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
                flexsizer->Add(panelTest, wxEXPAND);
                testPanel->Layout();
-               showPanel(testPanel);
        }
+       showPanel(testPanel);
 }
 
 void interfMainPanel::RefreshInterface()
@@ -667,7 +696,6 @@ void interfMainPanel::setStringSpread(std::string stringtemp)
 
 void interfMainPanel::onInformationPressed()
 {
-
        // Statistics frame
        if(infoWin ==NULL){
                infoWin                 = new wxFrame (this, -1,_T("  Statistics  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
@@ -676,11 +704,13 @@ void interfMainPanel::onInformationPressed()
                wxSize sizepanel(825,675);
                informationPanel        = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
 
-               wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL);
+// Borrame             wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL);
+               wxFlexGridSizer * sizerPanel            = new wxFlexGridSizer(1);
+
                sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0);
 
                infoWin->SetSizer( sizerPanel );
-               infoWin->SetAutoLayout( true );
+//             infoWin->SetAutoLayout( true );
                infoWin->Layout();
                infoWin->Show();
        }else {
@@ -937,6 +967,38 @@ void interfMainPanel::SetContourGroup(int contourGroup)
        wxContourMainFrame::getInstance()->SetContourGroup( contourGroup);
 }
 
+
+void interfMainPanel::onFlipContours()
+{
+       printf("EED interfMainPanel::onFlipContours() \n");
+       if(flipPanel==NULL)
+       {
+               flipPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
+                       wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+               flipPanel->SetSizer(flexsizer, true);
+               flipPanel->SetAutoLayout( true );
+               panelFlip = new interfFlipPanel(flipPanel);
+               wxStaticText* stattext = new wxStaticText(flipPanel,  -1,
+                       wxString(_T("         Flip Contours   ")),
+                       wxDefaultPosition, wxDefaultSize,
+                       wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panelFlip, wxEXPAND);
+               flipPanel->Layout();
+       }
+       showPanel(flipPanel);
+}
+
+
+void interfMainPanel::FlipContours(int typeContourFlip, int flipDirection)
+{
+       printf("EED interfMainPanel::FlipContours( %d , %d ) \n",typeContourFlip,  flipDirection );
+       wxContourMainFrame::getInstance()->FlipContours( typeContourFlip , flipDirection );
+}
+
+
+
 //CMRU 17-08-09 ---------------------------------------------
 void interfMainPanel::onPrintLabel ()
 {
@@ -979,7 +1041,7 @@ void interfMainPanel::onCalibration(wxString size, int unit)
        type = wxContourMainFrame::getInstance()->getType();
        contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
 
-       std::cout<<"Cata->Tamaño del contorno en pixeles:"<<contourSize<<endl;
+       std::cout<<"Cata->Tamao del contorno en pixeles:"<<contourSize<<endl;
 
        if ( type == 6 )
        {