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