00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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)
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)
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)
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)
00154 {
00155 _sceneManager->setComplexBox(true);
00156 _sceneManager->SetCbName(name);
00157 _sceneManager->SetCbPackageName(pack);
00158 }
00159
00160
00161
00162
00163 void InterpreterBBS::commandEndDefine()
00164 {
00165 }
00166
00167
00168
00169
00170 void InterpreterBBS::commandExec(const std::string &word)
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)
00180 {
00181 _sceneManager->SetAuthor(author);
00182 }
00183
00184
00185
00186 void InterpreterBBS::commandCategory(const std::string &categorytype)
00187 {
00188 _sceneManager->SetCategory(categorytype);
00189 }
00190
00191
00192
00193 void InterpreterBBS::commandDescription(const std::string &description)
00194 {
00195 _sceneManager->SetDescription(description);
00196 }
00197
00198
00199
00200
00201
00202
00203 }
00204
00205
00206