-void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2) {
- ConnectionItem* conn = new ConnectionItem(iface1,iface2, dispatcher, params, groupItem);
+BoxItem* GroupScene::searchBoxItemByName(QString name) {
+ foreach(BoxItem* item, boxItems) {
+ if (item->getRefBlock()->getName() == name) {
+ return item;
+ }
+ }
+ return NULL;
+}
+
+StimuliItem *GroupScene::createStimuliItem(AbstractBlock *block) {
+
+ StimuliItem* item = new StimuliItem(block,dispatcher,params);
+ // adding item to the scene
+ addItem(item);
+ item->setZValue(1);
+ // add item from the QList
+ stimuliItems.append(item);
+ // center the new block
+ QPointF groupPos = groupItem->pos();
+ QPointF newPos(groupPos.x()-item->getTotalWidth()-100, groupPos.y());
+ newPos = newPos-item->getOriginPoint();
+ item->moveTo(newPos);
+ return item;
+}
+
+void GroupScene::addStimuliItem(StimuliItem* item) {
+ // adding item to the scene
+ addItem(item);
+ item->setZValue(1);
+ // add item from the QList
+ stimuliItems.append(item);
+}
+
+void GroupScene::removeStimuliItem(StimuliItem* item) {
+ // remove item from the viewport
+ removeItem(item);
+ // remove item from the QList
+ stimuliItems.removeAll(item);
+}
+
+void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2, bool visible) {
+ ConnectionItem* conn = NULL;
+
+ conn = new ConnectionItem(iface1,iface2, dispatcher, params);
+ conn->setVisible(visible);
+ addItem(conn);