]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
#3249 Change FontSize - Box graphic scale
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxVtkSceneManager.cxx
index 07b43058ccffe014b0bdce97850b8266b79d2c97..960cdad62c69741d83f8cc1861af317851a26dab 100644 (file)
@@ -1465,14 +1465,14 @@ std::string wxVtkSceneManager::getDiagramBBS(bool wln) {
                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();
@@ -1539,7 +1539,6 @@ std::string wxVtkSceneManager::getDiagramBBS(bool wln) {
                        int id = execBoxes[i];
                        GObjectController *control = _controllers[id];
                        GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
-
                        script += model->getBBTKName();
                        script += "\n";
                }
@@ -2616,25 +2615,23 @@ int wxVtkSceneManager::addObjectController(GObjectController* objController) {
 
 //=========================================================================
 
-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;
@@ -2642,21 +2639,27 @@ void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objec
                 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();
@@ -2691,23 +2694,23 @@ void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objec
             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
     }