_baseView->Refresh();
}
+ //=========================================================================
+
+ std::string wxVtkSceneManager::generateANewNameForABox()
+ {
+ _numBoxes++;
+ std::stringstream boxname;
+ if(_numBoxes<10)
+ {
+ boxname << "Box0" << _numBoxes;
+ }else{
+ boxname << "Box" << _numBoxes;
+ }
+ return boxname.str();
+ }
+
+ //=========================================================================
+
+ std::string wxVtkSceneManager::findANewNameForABox()
+ {
+ std::string boxname=generateANewNameForABox();
+
+ while (boxExist(boxname)==true)
+ {
+ boxname=generateANewNameForABox();
+ } // while
+
+ return boxname;
+ }
+
//=========================================================================
int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType)
{
- _worldState = NOTHING_HAPPENS;
- int windowWidth=_baseView->GetRenWin()->GetSize()[0];
- int windowHeight=_baseView->GetRenWin()->GetSize()[1];
+ _worldState = NOTHING_HAPPENS;
+ int windowWidth = _baseView->GetRenWin()->GetSize()[0];
+ int windowHeight = _baseView->GetRenWin()->GetSize()[1];
- int type = GBLACKBOX;
+ int type = GBLACKBOX;
//Create the MVC Objects
- GBlackBoxModel *model = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
- vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
- GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
+ GBlackBoxModel *model = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+ vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+ GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
- BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType);
+ 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
_baseView->TransCoordScreenToWorld(xx,yy,zz);
model->setInicPoint(xx,yy,zz);
- _numBoxes++;
+//EED Borrame _numBoxes++;
std::stringstream stream;
+ str:string newBoxName = findANewNameForABox();
+ stream << newBoxName;
+/* EED Borrame
if(_numBoxes<10)
{
stream << "Box0" << _numBoxes;
{
stream << "Box" << _numBoxes;
}
+*/
std::string arraystring = stream.str();
model->setBBTKName(arraystring);
bbmod->setBBTKName(name);
bbmod->setInicPoint(xIn,yIn,zIn);
bbmod->setFinalPoint(xEn,yEn,zEn);
+
if(isExec=="TRUE")
{
bbmod->setExecutable(true);
//=========================================================================
+ bool wxVtkSceneManager::boxExist(std::string boxname)
+ {
+ bool ok=false;
+ std::map<int, GObjectController*>::iterator it;
+ for(it = _controllers.begin(); it != _controllers.end(); ++it)
+ {
+ GObjectController *cont = it->second;
+ if(cont->getModel()->getBBTKName()==boxname)
+ {
+ ok=true;
+ }
+ }
+ return ok;
+ }
+
+ //=========================================================================
+
std::vector<int> wxVtkSceneManager::getBlackBoxes()
{
std::vector<int> vect;