]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx
#3140 creaContours Feature New Normal - branch vtk7itk4wx3
[creaContours.git] / lib / Interface_Icons_NDimensions / interfNewContourMenu.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 #include "interfNewContourMenu.h"
27
28
29 interfNewContourMenu::interfNewContourMenu(wxWindow * parent, int sizex, int sizey, wxEvtHandler* evtHandler, std::string datdir)
30         : interfMenuBar(parent, sizex, sizey)
31 {
32         this->datadir = datdir;
33         //eventHandler = (wxContourEventHandler*)evtHandler;
34         panBull = NULL;
35         created = false;
36         initButtons(this);      
37 }
38
39 void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) 
40 {
41         std::vector<std::string> path, nom;
42         std::vector<wxObjectEventFunction> funct;
43         std::vector<wxEvtHandler*> hand;        
44         path.push_back(datadir + "/Spline.png");
45         nom.push_back("Create a contour using splines");        
46         funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourSpline);
47         hand.push_back(evtHandler);
48         path.push_back(datadir+"/Rectangle.png");
49         nom.push_back("Create a contour using the basic shape of a rectangle");
50         funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourRectangle);
51         hand.push_back(evtHandler);
52         path.push_back(datadir + "/Circle.png");
53         nom.push_back("Create a contour using the basic shape of a Circle");
54         funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourCircle);
55         hand.push_back(evtHandler);
56         path.push_back(datadir + "/bullseye.png");
57         nom.push_back("Create a contour using the bulls eye");
58         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourBullseye);
59         hand.push_back(this);
60         path.push_back(datadir + "/Line.png");
61         nom.push_back("Create a Line");
62         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourLine);
63         hand.push_back(this);
64         // RaC 09-09 ---------------------
65         path.push_back(datadir + "/Points.png");
66         nom.push_back("Create Points");
67         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPoints);
68         hand.push_back(this);
69         // RaC 09-09 ---------------------      
70         // RaC 10-09 ---------------------
71         path.push_back(datadir + "/Polygon.png");
72         nom.push_back("Create Polygon");
73         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPolygon);
74         hand.push_back(this);
75         // RaC 10-09 ---------------------      
76     this->addButtons(path, nom);
77         this->setVectorFunction(funct); 
78         this->setEventHandlers(hand);   
79         this->connectEvents();
80 }
81
82 interfNewContourMenu::~interfNewContourMenu()
83 {
84 }
85
86 void interfNewContourMenu::onCreateContourBullseye(wxCommandEvent& event)
87 {
88         if(!created){
89                 panBull = new PanelBullEyeOptions(interfMainPanel::getInstance()->getInfoPanel(), 
90                                                                 wxSize(100,200));
91                 created = true;
92         }
93         interfMainPanel::getInstance()->onCreateContoursBullEye(panBull);
94         //eventHandler->createContourBullsEye(panBull);
95         interfMainPanel::getInstance()->showPanel(panBull);
96 }
97
98 void interfNewContourMenu::onCreateContourSpline( wxCommandEvent& event )
99 {
100         interfMainPanel::getInstance()->onCreateContourSpline();
101 }
102
103 void interfNewContourMenu::onCreateContourRectangle( wxCommandEvent& event )
104 {
105         interfMainPanel::getInstance()->onCreateContourRectangle();
106 }
107
108 void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event )
109 {
110         interfMainPanel::getInstance()->onCreateContourCircle();
111 }
112
113 void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event )
114 {
115         interfMainPanel::getInstance()->onCreateContourLine();
116 }
117
118 // RaC 09-09 ---------------------
119 void interfNewContourMenu::onCreateContourPoints( wxCommandEvent& event )
120 {
121         interfMainPanel::getInstance()->onCreateContourPoints();
122 }
123 // RaC 09-09 ---------------------
124
125 // RaC 10-09 ---------------------
126 void interfNewContourMenu::onCreateContourPolygon( wxCommandEvent& event )
127 {
128         interfMainPanel::getInstance()->onCreateContourPolygon();
129 }
130 // RaC 10-09 ---------------------
131