/// Creates a new black box in current complex box
void InterpreterBBS::commandNew( const std::string& boxType, const std::string& boxName) // virtual
{
- _yGeneral = _yGeneral - 30;
std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType);
std::string boxType2 = _factory->GetTypeNameOfaBlackBox(boxType);
int idBox = _sceneManager->createGBlackBox( 0,0, packagename ,boxType2);
_countBoxes++;
- double px = _xGeneral + (_countBoxes%2)*100;
- double py = _yGeneral;
+//EED 2022-01-16
+// double px = _xGeneral + (_countBoxes%2)*100;
+// _yGeneral = _yGeneral - 30;
+ double px = _xGeneral + (_countBoxes%2)*70;
+ _yGeneral = _yGeneral - 9;
- _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+100, py-10 , _zGeneral );
+ double py = _yGeneral;
+ _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+BOX_WIDTH, py-BOX_HEIGHT , _zGeneral );
}
//=========================================================================
for (i = 0; i < (int) connections.size(); i++) {
//script += LineNumber(wln, lnNmbr);
//script += "connect ";
- int id = connections[i];
- GObjectController *control = _controllers[id];
- GConnectorModel *model = (GConnectorModel*) control->getModel();
+ int id = connections[i];
+ GObjectController *control = _controllers[id];
+ GConnectorModel *model = (GConnectorModel*) control->getModel();
//Connection info
- GPortModel *start = model->getStartPort();
- GBoxModel *startBox = start->getParentBox();
+ GPortModel *start = model->getStartPort();
+ GBoxModel *startBox = start->getParentBox();
GPortModel *end = model->getEndPort();
GBoxModel *endBox = end->getParentBox();
int id = execBoxes[i];
GObjectController *control = _controllers[id];
GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
-
script += model->getBBTKName();
script += "\n";
}
//=========================================================================
-void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objectsMap) {
-
+void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objectsMap)
+{
std::map<int, int> oldIdNewIdBoxes;
std::vector<int> connections;
-
std::vector<int> newBoxesID;
-
std::map<int, GObjectController*>::iterator it;
- for (it = objectsMap.begin(); it != objectsMap.end(); ++it) {
+ for (it = objectsMap.begin(); it != objectsMap.end(); ++it)
+ {
GObjectController *cont = it->second;
int type = cont->getGObjectType();
-
- if (type == GBLACKBOX) {
+ if (type == GBLACKBOX)
+ {
// Copy black box
double xInic, yInic, zInic;
GBlackBoxModel* copyBox = (GBlackBoxModel*) cont->getModel();
copyBox->getInicPoint(xInic, yInic, zInic);
- int idBox = createGBlackBox(0, 0, copyBox->getBBTKPackage(),
- copyBox->getBBTKType());
+ int idBox = createGBlackBox(0, 0, copyBox->getBBTKPackage(), copyBox->getBBTKType());
int idcB = copyBox->getObjectId();
oldIdNewIdBoxes[idcB] = idBox;
GBlackBoxModel* newbox = (GBlackBoxModel*) cont->getModel();
newbox->setInicPoint(xInic, yInic, zInic);
int num = newbox->getNumInputPorts();
- for (int j = 0; j < num; j++) {
+ for (int j = 0; j < num; j++)
+ {
newbox->setValueToInputPort(j, copyBox->getValueInputPort(j));
- }
- newbox->move(xInic + 20, yInic + 20, zInic);
+ } // if j
+
+// EED 2022-01-16
+// newbox->move(xInic + 20, yInic + 20, zInic);
+ newbox->move(xInic + 14, yInic + 6, zInic);
+
newbox->notifyObservers(_idManager);
newBoxesID.push_back(newbox->getObjectId());
} else if (type == GCONNECTOR) {
int idCon = cont->getId();
connections.push_back(idCon);
- }
+ } // if type
- }
+ } // for it
- for (int i = 0; i < (int) connections.size(); i++) {
+ for (int i = 0; i < (int) connections.size(); i++)
+ {
int objId = connections[i];
GObjectController *cont = objectsMap[objId];
GConnectorModel* connectModel = (GConnectorModel*) cont->getModel();
tempp->endContourCreation();
conMod->setEndPort(newEndPort);
conView->updateStartEndPoints();
- }
+ } // for i
/// the new selected boxes are the duplicate ones
UnSelectBlackBoxes();
- for (int i = 0; i < newBoxesID.size(); i++) {
+ for (int i = 0; i < newBoxesID.size(); i++)
+ {
_selectedObjects.push_back(newBoxesID.at(i));
- }
+ } // for i
- for (int i = 0; i < (int) _selectedObjects.size(); i++) {
+ for (int i = 0; i < (int) _selectedObjects.size(); i++)
+ {
int id = _selectedObjects[i];
GObjectController* cont = _controllers[id];
-
cont->getView()->setState(SELECTED);
cont->getModel()->notifyObservers(_idManager);
-
- }
+ } // for i
}