]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/include/wxMaracas_ManualContour_Panel.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / include / wxMaracas_ManualContour_Panel.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 /*=========================================================================
27
28   Program:   wxMaracas
29   Module:    $RCSfile: wxMaracas_ManualContour_Panel.cxx,v $
30   Language:  C++
31   Date:      $Date: 2012/11/15 14:14:56 $
32   Version:   $Revision: 1.2 $
33
34   Copyright: (c) 2002, 2003
35   License:
36
37      This software is distributed WITHOUT ANY WARRANTY; without even
38      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39      PURPOSE.  See the above copyright notice for more information.
40
41 =========================================================================*/
42
43
44 #include <wx/splitter.h>
45 #include "widgets/pPlotter/mBarRange.h"
46 #include "wxMaracas_ManualContour_Panel.h"
47
48
49 BEGIN_EVENT_TABLE( wxMaracas_ManualContour_Panel, wxPanel )
50         EVT_MENU( 12121, wxMaracas_ManualContour_Panel::OnRefreshView )
51 END_EVENT_TABLE( );
52
53
54 wxMaracas_ManualContour_Panel::wxMaracas_ManualContour_Panel( wxWindow* parent  )
55 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
56 {
57   // Create the main frame window
58
59   wxWindow *wxwindow = CreateViewerPanel(this);
60   wxBoxSizer* szTop = new wxBoxSizer( wxVERTICAL );
61   szTop->Add( wxwindow, 1  , wxEXPAND |  wxALL , 0 );
62   szTop->Fit( this );
63   szTop->SetSizeHints( this );
64   this->SetAutoLayout( true );
65   this->SetSizer( szTop );
66   this->Layout();
67 }
68 //----------------------------------------------------------------------------
69 wxMaracas_ManualContour_Panel::~wxMaracas_ManualContour_Panel( )
70 {
71   // Nothing
72 }
73 //----------------------------------------------------------------------------
74 void wxMaracas_ManualContour_Panel::ConfigureVTK( marImageData *marimagedata )
75 {
76         vtkMPRBaseData  *vtkmprbasedata  = new vtkMPRBaseData();
77         vtkmprbasedata->SetMarImageData(marimagedata);
78         vtkmprbasedata->SetX(5);
79         vtkmprbasedata->SetY(5);
80         vtkmprbasedata->SetZ(5);
81 //      _vtkplane2Dview->SetVtkBaseData( vtkmprbasedata );
82 //      _vtkplane2Dview->Configure();
83 }
84
85 //----------------------------------------------------------------------------
86 void wxMaracas_ManualContour_Panel::OnRefreshView( wxCommandEvent & event)
87 {
88         _vtkplane2Dview->Refresh();
89         _vtkplane2Dview->RefreshView();
90 }
91
92 //----------------------------------------------------------------------------
93
94 void wxMaracas_ManualContour_Panel::OnActualChange(wxCommandEvent& event)
95 {
96 //      wxMessageDialog(this, _T("EED: OnActualChange")).ShowModal();
97 }
98
99
100 //----------------------------------------------------------------------------
101 wxWindow* wxMaracas_ManualContour_Panel::CreateViewerPanel(wxWindow* parent)
102 {
103         wxPanel *panel =  new wxPanel(parent,-1);
104 /*
105         // Panel Up Bar
106         wxPanel *panelUpBar = new wxPanel(panel,-1);
107
108                 int Tmin=0,Tmax=34;
109                 mBarRange *time_barrange = new mBarRange(panelUpBar,400,10);
110                 time_barrange -> setVisibleLabels(true);
111                 time_barrange -> setRepresentedValues (Tmin,Tmax);
112                 time_barrange -> setDeviceBlitStart (0,0);
113                 time_barrange -> SetActual((Tmin+Tmax)/2);
114                 time_barrange -> setActiveStateTo(true);
115                 time_barrange -> SetInRangeProperty(false);
116                 Connect(time_barrange->GetId(),wxEVT_TSBAR_ACTUAL  , (wxObjectEventFunction) &wxMaracas_ManualContour_Panel::OnActualChange,NULL,this);
117
118         wxBoxSizer *sizerUpBar= new wxBoxSizer(wxHORIZONTAL);
119         wxPanel *tmpPanel = new wxPanel(panel,-1, wxDefaultPosition , wxSize(50,50) );
120         sizerUpBar->Add( tmpPanel);
121         sizerUpBar->Add( time_barrange  , 1, wxEXPAND, 10 );
122         sizerUpBar->SetSizeHints( panelUpBar );   // set size hints to honour minimum size
123         panelUpBar->SetSizer(sizerUpBar);
124         panelUpBar->SetAutoLayout(true);
125         panelUpBar->Layout(); 
126
127
128 // Down
129         // Panel Down Bar
130         wxPanel *panelDownBar = new wxPanel(panel,-1);
131
132                 //z bar
133                 int Zmin = 0 , Zmax = 34;
134                 mBarRange *z_barrange = new mBarRange(panelDownBar,50,400);
135                 z_barrange -> SetBackgroundColour( wxColour(100,100,0) );
136                 z_barrange -> SetOrientation(false);
137                 z_barrange -> setVisibleLabels(true);
138                 z_barrange -> setRepresentedValues (Zmin,Zmax);
139         //      z_barrange -> SetActual((min+max)/2);
140                 z_barrange -> setDeviceBlitStart (0,0);
141                 z_barrange -> setActiveStateTo(true);
142                 z_barrange -> SetInRangeProperty(false);
143                 Connect(z_barrange->GetId(),wxEVT_TSBAR_ACTUAL  , (wxObjectEventFunction) &wxMaracas_ManualContour_Panel::OnActualChange,NULL,this);
144
145
146         wxFlexGridSizer *sizerDownBar   = new wxFlexGridSizer(5);
147         sizerDownBar->AddGrowableCol(2);
148         sizerDownBar->AddGrowableRow(0);
149
150         //tmp slider
151         wxSlider *tmpSlider                             = new wxSlider(panelDownBar,-1,0,0,100,wxDefaultPosition,wxSize(50,50),wxSL_VERTICAL);
152         sizerDownBar->Add( tmpSlider    , 1     , wxEXPAND|wxALIGN_BOTTOM , 10 );
153
154         sizerDownBar->Add( z_barrange   , 1     , wxEXPAND| wxALIGN_BOTTOM, 10 );
155
156         sizerDownBar->Add( CreateSplitePanel(panelDownBar)      , 1 , wxGROW , 10 );
157         sizerDownBar->SetSizeHints( panelDownBar );   // set size hints to honour minimum size
158         panelDownBar->SetSizer(sizerDownBar);
159         panelDownBar->SetAutoLayout(true);
160         panelDownBar->Layout(); 
161
162         wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
163         sizer->Add( panelUpBar          , 0 , wxEXPAND , 10);
164         sizer->Add( panelDownBar        , 1 , wxEXPAND, 10 );
165
166         sizer->SetSizeHints( panel );   // set size hints to honour minimum size
167         panel->SetSizer(sizer);
168         panel->SetAutoLayout(true);
169         panel->Layout(); 
170 */
171         return panel;
172 }
173
174 //----------------------------------------------------------------------------
175 wxWindow* wxMaracas_ManualContour_Panel::CreateSplitePanel(wxWindow *parent)
176 {
177         // Spliter
178         wxSplitterWindow *splitter      = new wxSplitterWindow(parent,-1);
179
180         // Plane Widget
181         _vtkplane2Dview                         = new vtkPlane2DView( splitter );
182         _vtkplane2Dview->SetImgSize( 350 );
183         wxWindow *pA = _vtkplane2Dview->GetWxVTKRenderWindowInteractor ();
184
185         wxPanel *pB = new wxPanel(splitter,-1);
186         pA->SetBackgroundColour( wxColour(255,0,0) );
187         pB->SetBackgroundColour( wxColour(0,0,255) );
188         splitter->SplitVertically( pA , pB );
189         return splitter;
190 }
191
192 //----------------------------------------------------------------------------
193 //----------------------------------------------------------------------------
194 //----------------------------------------------------------------------------
195
196
197
198
199
200 // EOF - wxMaracas_ManualContour_Panel.cxx