InterpreterBBS.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 Program:   bbtk
00003 Module:    $RCSfile: InterpreterBBS.cxx,v $
00004 Language:  C++
00005 Date:      $Date: 2010/06/22 09:17:27 $
00006 Version:   $Revision: 1.10 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and
00015 *  abiding by the rules of distribution of free software. You can  use,
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability.
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */
00030 
00037 #include "InterpreterBBS.h"
00038 
00039 #include "bbtkExecuter.h"
00040 #include "bbtkMessageManager.h"
00041 #include "bbtkFactory.h"
00042 #include "bbtkUtilities.h"
00043 
00044 namespace bbtk
00045 {
00046 
00047         //=========================================================================
00048         InterpreterBBS::Pointer InterpreterBBS::New( wxVtkSceneManager* sceneManager,  Factory::Pointer factory )
00049         {
00050                      return MakePointer( new InterpreterBBS( sceneManager, factory) );
00051         }
00052         //=========================================================================
00053 
00054 
00055 
00056         //=========================================================================
00057         InterpreterBBS::InterpreterBBS( wxVtkSceneManager* sceneManager, Factory::Pointer factory )
00058         {
00059                 _factory                = factory;
00060                 _sceneManager   = sceneManager;
00061 
00062                 _xGeneral               = -100;
00063                 _yGeneral               = 100;
00064                 _zGeneral               = 900;   //  ?????
00065 printf("EED  InterpreterBBS::createGBlackBox 900-450\n");
00066 
00067                 _countBoxes             = 0;
00068                 _countInputs    = 0;
00069                 _countOutputs   = 0;
00070 
00071                 bbtk::InterpreterVirtual::Init();
00072 
00073         }
00074         //=========================================================================
00075 
00076 
00077         //=========================================================================
00078         InterpreterBBS::~InterpreterBBS()
00079         {
00080         }
00081         //=========================================================================
00082 
00083 
00084         //=========================================================================
00086     void InterpreterBBS::commandNew( const std::string& boxType, const std::string& boxName) // virtual
00087         {
00088                 _yGeneral                               = _yGeneral - 30;
00089                 std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType);
00090                 int idBox                               = _sceneManager->createGBlackBox( 0,0, packagename ,boxType);
00091                 _countBoxes++;
00092                 double px                               = _xGeneral + (_countBoxes%2)*100;
00093                 double py                               = _yGeneral;
00094 
00095                 _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+100, py-10 , _zGeneral );
00096         }
00097         //=========================================================================
00098 
00099 
00100         //=========================================================================
00102     void InterpreterBBS::commandConnection (const std::string &boxfrom,
00103                                                                   const std::string &output,
00104                                                                   const std::string &boxto,
00105                                                                   const std::string &input)                     // virtual
00106         {
00107                 _sceneManager->configGConnetion( boxfrom,output,boxto,input);
00108         }
00109         //=========================================================================
00110 
00111 
00112         //=========================================================================
00113         void InterpreterBBS::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string  &help)
00114         {
00115                 double xIn      = -100+50+_countInputs*50;
00116                 double yIn      = 100;
00117                 double zIn      = 900;
00118                 _sceneManager->configGComBoxInputOutputPort(true,name,xIn,yIn,zIn);
00119                 _sceneManager->configGConnetion( name,name,box,input);
00120                 _countInputs++;
00121 
00122                 printf("EED InterpreterBBS::commandInput  what to do with help information ..???? \n  ");
00123         }
00124         //=========================================================================
00125 
00126         //=========================================================================
00127         void InterpreterBBS::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string  &help)
00128         {
00129                 _yGeneral       = _yGeneral - 30;
00130                 double xIn      = -100+_countOutputs*30;
00131                 double yIn      = _yGeneral;
00132                 double zIn      = 900;
00133                 _sceneManager->configGComBoxInputOutputPort(false,name,xIn,yIn,zIn);
00134                 _sceneManager->configGConnetion( box,output,name,name);
00135                 _countOutputs++;
00136 
00137                 printf("EED InterpreterBBS::commandInput  what to do with help information ..???? \n  ");
00138         }
00139         //=========================================================================
00140 
00141 
00142         //=========================================================================
00144         void InterpreterBBS::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual
00145         {
00146                 GBlackBoxModel *bbMod = (GBlackBoxModel *)_sceneManager->findGBox(box);
00147                 bbMod->setValueToInput(input,"\""+value+"\"");
00148         }
00149         //=========================================================================
00150 
00151 
00152         //=========================================================================
00153         void InterpreterBBS::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
00154         {
00155                 _sceneManager->setComplexBox(true);
00156                 _sceneManager->SetCbName(name);
00157                 _sceneManager->SetCbPackageName(pack);
00158         }
00159         //=========================================================================
00160 
00161 
00162         //=========================================================================
00163         void InterpreterBBS::commandEndDefine() // virtual
00164         {
00165         }
00166         //=========================================================================
00167 
00168 
00169         //=========================================================================
00170         void InterpreterBBS::commandExec(const std::string &word) // virtual
00171         {
00172                 GBlackBoxModel *bbMod = (GBlackBoxModel *)_sceneManager->findGBox(word);
00173                 bbMod->setExecutable(true);
00174         }
00175         //=========================================================================
00176 
00177 
00178         //=========================================================================
00179         void InterpreterBBS::commandAuthor(const std::string &author)  // virtual
00180         {
00181         _sceneManager->SetAuthor(author);
00182         }
00183         //=========================================================================
00184 
00185         //=========================================================================
00186         void InterpreterBBS::commandCategory(const std::string &categorytype)  // virtual
00187         {
00188         _sceneManager->SetCategory(categorytype);
00189         }
00190         //=========================================================================
00191 
00192         //=========================================================================
00193         void InterpreterBBS::commandDescription(const std::string &description)  // virtual
00194         {
00195         _sceneManager->SetDescription(description);
00196         }
00197         //=========================================================================
00198 
00199 
00200 
00201 
00202 
00203 }  // EO namespace bbtk
00204 
00205 // EOF
00206 

Generated on Thu May 31 15:12:19 2012 for bbtkGEditor by  doxygen 1.5.7.1