2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------
26 /*=========================================================================
32 =========================================================================*/
34 /* ---------------------------------------------------------------------
36 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
39 * This software is governed by the CeCILL-B license under French law and
40 * abiding by the rules of distribution of free software. You can use,
41 * modify and/ or redistribute the software under the terms of the CeCILL-B
42 * license as circulated by CEA, CNRS and INRIA at the following URL
43 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
44 * or in the file LICENSE.txt.
46 * As a counterpart to the access to the source code and rights to copy,
47 * modify and redistribute granted by the license, users are provided only
48 * with a limited warranty and the software's author, the holder of the
49 * economic rights, and the successive licensors have only limited
52 * The fact that you are presently reading this means that you have had
53 * knowledge of the CeCILL-B license and that you accept its terms.
54 * ------------------------------------------------------------------------ */
58 * \brief Class bbtk::InterpreterBBS
62 #include "InterpreterBBS.h"
64 #include "bbtkExecuter.h"
65 #include "bbtkMessageManager.h"
66 #include "bbtkFactory.h"
67 #include "bbtkUtilities.h"
72 //=========================================================================
73 InterpreterBBS::Pointer InterpreterBBS::New( wxVtkSceneManager* sceneManager, Factory::Pointer factory )
75 return MakePointer( new InterpreterBBS( sceneManager, factory) );
77 //=========================================================================
81 //=========================================================================
82 InterpreterBBS::InterpreterBBS( wxVtkSceneManager* sceneManager, Factory::Pointer factory )
85 _sceneManager = sceneManager;
89 _zGeneral = GPOSITION_Z; // ?????
95 bbtk::InterpreterVirtual::Init();
98 //=========================================================================
101 //=========================================================================
102 InterpreterBBS::~InterpreterBBS()
105 //=========================================================================
108 //=========================================================================
109 /// Creates a new black box in current complex box
110 void InterpreterBBS::commandNew( const std::string& boxType, const std::string& boxName) // virtual
112 _yGeneral = _yGeneral - 30;
113 std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType);
114 int idBox = _sceneManager->createGBlackBox( 0,0, packagename ,boxType);
116 double px = _xGeneral + (_countBoxes%2)*100;
117 double py = _yGeneral;
119 _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+100, py-10 , _zGeneral );
121 //=========================================================================
124 //=========================================================================
125 /// Connects the output boxOutput to the input boxInput
126 void InterpreterBBS::commandConnection (const std::string &boxfrom,
127 const std::string &output,
128 const std::string &boxto,
129 const std::string &input) // virtual
131 _sceneManager->configGConnetion( boxfrom,output,boxto,input);
133 //=========================================================================
136 //=========================================================================
137 void InterpreterBBS::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help)
139 double xIn = -100+50+_countInputs*50;
141 double zIn = GPOSITION_Z;
142 _sceneManager->configGComBoxInputOutputPort(true,name,xIn,yIn,zIn);
143 _sceneManager->configGConnetion( name,name,box,input);
146 printf("EED InterpreterBBS::commandInput what to do with help information ..???? \n ");
148 //=========================================================================
150 //=========================================================================
151 void InterpreterBBS::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help)
153 _yGeneral = _yGeneral - 30;
154 double xIn = -100+_countOutputs*30;
155 double yIn = _yGeneral;
156 double zIn = GPOSITION_Z;
157 _sceneManager->configGComBoxInputOutputPort(false,name,xIn,yIn,zIn);
158 _sceneManager->configGConnetion( box,output,name,name);
161 printf("EED InterpreterBBS::commandInput what to do with help information ..???? \n ");
163 //=========================================================================
166 //=========================================================================
167 /// sets the input of the box with the value
168 void InterpreterBBS::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual
170 GBlackBoxModel *bbMod = (GBlackBoxModel *)_sceneManager->findGBox(box);
171 bbMod->setValueToInput(input,"\""+value+"\"");
173 //=========================================================================
176 //=========================================================================
177 void InterpreterBBS::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
179 _sceneManager->setComplexBox(true);
180 _sceneManager->SetCbName(name);
181 _sceneManager->SetCbPackageName(pack);
183 //=========================================================================
186 //=========================================================================
187 void InterpreterBBS::commandEndDefine() // virtual
190 //=========================================================================
193 //=========================================================================
194 void InterpreterBBS::commandExec(const std::string &word) // virtual
196 GBlackBoxModel *bbMod = (GBlackBoxModel *)_sceneManager->findGBox(word);
197 bbMod->setExecutable(true);
199 //=========================================================================
202 //=========================================================================
203 void InterpreterBBS::commandAuthor(const std::string &author) // virtual
205 _sceneManager->SetAuthor(author);
207 //=========================================================================
209 //=========================================================================
210 void InterpreterBBS::commandCategory(const std::string &categorytype) // virtual
212 _sceneManager->SetCategory(categorytype);
214 //=========================================================================
216 //=========================================================================
217 void InterpreterBBS::commandDescription(const std::string &description) // virtual
219 _sceneManager->SetDescription(description);
221 //=========================================================================
227 } // EO namespace bbtk