//=========================================================================
wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView,int idManager)
{
- printf ("EED %p wxVtkSceneManager()\n" , this );
_parent = parent;
_numBoxes=0;
_idManager=idManager;
int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType)
{
-printf("EED %p wxVtkSceneManager::createGBlackBox 1\n",this);
-
_worldState = NOTHING_HAPPENS;
-printf("EED %p wxVtkSceneManager::createGBlackBox 1.1\n",this);
int windowWidth=_baseView->GetRenWin()->GetSize()[0];
-printf("EED %p wxVtkSceneManager::createGBlackBox 1.2\n",this);
int windowHeight=_baseView->GetRenWin()->GetSize()[1];
-printf("EED %p wxVtkSceneManager::createGBlackBox 1.3\n",this);
int type = GBLACKBOX;
//Create the MVC Objects
GBlackBoxModel *model = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
-printf("EED %p wxVtkSceneManager::createGBlackBox 1.4\n",this);
vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
-printf("EED %p wxVtkSceneManager::createGBlackBox 1.5\n",this);
GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
-printf("EED %p wxVtkSceneManager::createGBlackBox 1.6 >%s< >%s<\n",this, packageName.c_str(), boxType.c_str() );
BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType);
//Prepares the initial model
//The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
-printf("EED %p wxVtkSceneManager::createGBlackBox 2\n",this);
double xx = x;
double yy = windowHeight-y;
_numBoxes++;
std::stringstream stream;
-printf("EED %p wxVtkSceneManager::createGBlackBox 3\n",this);
if(_numBoxes<10)
{
stream << "Box0" << _numBoxes;
i++;
}
-printf("EED %p wxVtkSceneManager::createGBlackBox 4\n",this);
//Iterate and create the output ports
std::map<std::string, BlackBoxOutputDescriptor*> descriptorOutMap = descriptor->GetOutputDescriptorMap();
std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
view->setModel(model);
view->setBaseView(_baseView);
view->initVtkObjects();
-printf("EED %p wxVtkSceneManager::createGBlackBox 5\n",this);
//Associates the controller with the correspondent model and view
controller->setModelAndView(model,view);
model->notifyObservers(_idManager);
int newId = addObjectController(controller);
-printf("EED %p wxVtkSceneManager::createGBlackBox 6\n",this);
+
return newId;
}
void wxVtkSceneManager::saveDiagram(std::string &content)
{
-printf("EED %p wxVtkSceneManager::saveDiagram 1\n",this);
char buffer [50];
//Print info IF COMPLEX BOX
content+="COMPLEXBOX:";
if(_isComplexBox)
{
-printf("EED %p wxVtkSceneManager::saveDiagram 2\n",this);
content+="TRUE\n";
//Print info complex input ports
content+=buffer;
content+="\n";
-printf("EED %p wxVtkSceneManager::saveDiagram 3\n",this);
for(int i = 0;i<bsize;i++)
{
int id = boxes[i];
content+=buffer;
content+="\n";
-printf("EED %p wxVtkSceneManager::saveDiagram 4\n",this);
for(int i = 0;i<csize;i++)
{
int id = connections[i];
void wxVtkSceneManager::loadDiagram(ifstream &inputStream)
{
-printf("EED %p wxVtkSceneManager::loadDiagram 1\n",this);
std::string line="";
char delims[] = ":";
}
else if(line=="APP_START")
{
-printf("EED %p wxVtkSceneManager::loadDiagram 2\n",this);
start = true;
break;
}
if(start)
{
-printf("EED %p wxVtkSceneManager::loadDiagram 3\n",this);
//----------
getline(inputStream,line);//COMPLEX_BOX:TRUE|FALSE
- char complex[20];
+ char complex[30];
strcpy( complex, line.c_str() );
result = strtok( complex, delims );
result = strtok( NULL, delims );
if(isComplexBox=="TRUE")
{
-printf("EED %p wxVtkSceneManager::loadDiagram 4\n",this);
_isComplexBox=true;
//-----------------------
//- COMPLEX INPUT PORTS
//-----------------------
getline(inputStream,line);//COMPLEXINPUTS:num
- char inputs[18];
+ char inputs[30];
strcpy( inputs, line.c_str() );
result = strtok( inputs, delims );
result = strtok( NULL, delims );
//-----------------------
getline(inputStream,line);//COMPLEXOUTPUTS:num
- char outputs[18];
+ char outputs[30];
strcpy( outputs, line.c_str() );
result = strtok( outputs, delims );
result = strtok( NULL, delims );
} // complex box
//----------
-printf("EED %p wxVtkSceneManager::loadDiagram 4.1\n",this);
getline(inputStream,line);//BOXES:num
-printf("EED %p wxVtkSceneManager::loadDiagram 4.2\n",this);
char boxes[9];
-printf("EED %p wxVtkSceneManager::loadDiagram 4.3\n",this);
strcpy( boxes, line.c_str() );
-printf("EED %p wxVtkSceneManager::loadDiagram 4.4\n",this);
result = strtok( boxes, delims );
-printf("EED %p wxVtkSceneManager::loadDiagram 4.5\n",this);
result = strtok( NULL, delims );
-printf("EED %p wxVtkSceneManager::loadDiagram 4.6\n",this);
int numBoxes;
-printf("EED %p wxVtkSceneManager::loadDiagram 4.7\n",this);
std::istringstream is(result);
-printf("EED %p wxVtkSceneManager::loadDiagram 4.8\n",this);
is >> numBoxes;
-printf("EED %p wxVtkSceneManager::loadDiagram 5\n",this);
for(int i = 0;i<numBoxes;i++)
{
//----------
getline(inputStream,line);//BOX
getline(inputStream,line);//package:type:name
- char box[100];
+ char box[150];
strcpy( box, line.c_str() );
result = strtok( box, delims );//package
std::string package(result);
ySt >> yIn;
std::istringstream zSt(zInic);
zSt >> zIn;
-printf("EED %p wxVtkSceneManager::loadDiagram 6\n",this);
//----------
getline(inputStream,line);//xEnd:yEnd:zEnd
std::string yEnd(result);
result = strtok( NULL, delims );//zEnd
std::string zEnd(result);
-printf("EED %p wxVtkSceneManager::loadDiagram 6.1\n",this);
double xEn, yEn, zEn;
std::istringstream xEt(xEnd);
std::istringstream zEt(zEnd);
zEt >> zEn;
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
int idBox = createGBlackBox(0,0,package,type);
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
GObjectController *cont = _controllers[idBox];
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
GBlackBoxModel *bbmod = (GBlackBoxModel*)cont->getModel();
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
bbmod->setBBTKName(name);
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
bbmod->setInicPoint(xIn,yIn,zIn);
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
bbmod->setFinalPoint(xEn,yEn,zEn);
-printf("EED %p wxVtkSceneManager::loadDiagram 6.2\n",this);
if(isExec=="TRUE")
{
bbmod->setExecutable(true);
std::string port=line.substr(0,4);
while(port=="PORT")
{
-printf("EED %p wxVtkSceneManager::loadDiagram 7\n",this);
getline(inputStream,line);//name:value
- char poort[20];
+ char poort[150];
strcpy( poort, line.c_str() );
result = strtok( poort, delims );//name
std::string name(result);
/// CONNECTIONS
//----------
getline(inputStream,line);//CONNECTIONS:num
- char conns[20];
+ char conns[30];
strcpy( conns, line.c_str() );
result = strtok( conns, delims );
result = strtok( NULL, delims );
std::istringstream isCons(result);
isCons >> numConns;
-printf("EED %p wxVtkSceneManager::loadDiagram 8\n",this);
for(int i = 0;i<numConns;i++)
{
-printf("EED %p wxVtkSceneManager::loadDiagram 9\n",this);
//----------
getline(inputStream,line);//CONNECTION
getline(inputStream,line);//Startbox.PortName:EndBox.PortName
- char connec[100];
+ char connec[200];
strcpy( connec, line.c_str() );
result = strtok( connec, delims );
std::string nameStartBox(result);
} // for numConns
} // start
-printf("EED %p wxVtkSceneManager::loadDiagram 10\n",this);
}