]> AND Private Git Repository - blast.git/blobdiff - GroupScene.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
adding xsd files to master
[blast.git] / GroupScene.cpp
index 7ba8c9d1310bcd0efe6d88aab80e3a37be0635ed..e8c9e842ecb9454925fef709f5d6b6d199cfffd7 100644 (file)
@@ -84,16 +84,10 @@ QList<AbstractBoxItem*> GroupScene::getGroupAndBlocks() {
   return lst;
 }
 
   return lst;
 }
 
-void GroupScene::createBlockItem(AbstractBlock *block) {
+BoxItem *GroupScene::createBlockItem(AbstractBlock *block) {
 
 
-  BoxItem* blockItem = new BoxItem(block,dispatcher,params,groupItem);
-  blockItem->setZValue(1);
-  addBlockItem(blockItem);
-}
-
-void GroupScene::addBlockItem(BoxItem* item) {
-  // add item from the viewport
-  //addItem(item);
+  BoxItem* item = new BoxItem(block,dispatcher,params,groupItem);
+  item->setZValue(1);
   // add item from the QList
   blockItems.append(item);
   // repainting the group
   // add item from the QList
   blockItems.append(item);
   // repainting the group
@@ -101,7 +95,16 @@ void GroupScene::addBlockItem(BoxItem* item) {
   // center the new block
   QPointF newPos((groupItem->getWidth()-item->getTotalWidth())/2.0, (groupItem->getHeight()-item->getTotalHeight())/2.0);
   newPos = newPos-item->getOriginPoint();
   // center the new block
   QPointF newPos((groupItem->getWidth()-item->getTotalWidth())/2.0, (groupItem->getHeight()-item->getTotalHeight())/2.0);
   newPos = newPos-item->getOriginPoint();
-  item->moveTo(newPos);  
+  item->moveTo(newPos);
+
+  return item;
+}
+
+void GroupScene::addBlockItem(BoxItem* item) {  
+  // add item from the QList
+  blockItems.append(item);
+  // repainting the group
+  groupItem->updateShape();  
 }
 
 void GroupScene::removeBlockItem(BoxItem* item) {
 }
 
 void GroupScene::removeBlockItem(BoxItem* item) {
@@ -179,13 +182,19 @@ void GroupScene::unselecteInterfaces() {
 void GroupScene::updateConnectionItemsShape() {
 
   foreach(ConnectionItem* conn, connectionItems){
 void GroupScene::updateConnectionItemsShape() {
 
   foreach(ConnectionItem* conn, connectionItems){
-    conn->setPathes();
+    conn->setPath();
   }
 }
 
 void GroupScene::save(QXmlStreamWriter &writer) {
   writer.writeStartElement("scene");
   writer.writeAttribute("id",QString::number(id));
   }
 }
 
 void GroupScene::save(QXmlStreamWriter &writer) {
   writer.writeStartElement("scene");
   writer.writeAttribute("id",QString::number(id));
+  if (parentScene == NULL) {
+    writer.writeAttribute("upper_scene",QString::number(-1));
+  }
+  else {
+    writer.writeAttribute("upper_scene",QString::number(parentScene->getId()));
+  }
   groupItem->save(writer);
 
   writer.writeStartElement("block_items");
   groupItem->save(writer);
 
   writer.writeStartElement("block_items");