-void Dispatcher::disconnectInterFromGroup(InterfaceItem *item) {
- static QString fctName = "Dispatcher::disconnectInterFromGroup()";
-#ifdef DEBUG_FCTNAME
- cout << "call to " << qPrintable(fctName) << endl;
-#endif
-
- // getting the GroupBlock and GroupItem that are parent of the block that owns item
- ConnectedInterface *refInter = item->refInter;
- ConnectedInterface *groupInter = NULL;
- GroupBlock* parentGroup = AB_TO_GRP(refInter->getOwner()->getParent());
- GroupItem *parentItem = item->getOwner()->getScene()->getGroupItem();
-
- // removing the connection from graph
-#ifdef DEBUG
- cout << "removing connections from graph ..." ;
-#endif
-
- if (refInter->getDirection() == AbstractInterface::Output) {
- groupInter = refInter->getConnectionToParentGroup(); // must be a single connection to
- refInter->removeConnectedTo(groupInter);
- groupInter->clearConnectedFrom();
- }
- else if (refInter->getDirection() == AbstractInterface::Input) {
- groupInter = refInter->getConnectedFrom();
- refInter->clearConnectedFrom();
- groupInter->removeConnectedTo(refInter);
- }
- else if (refInter->getDirection() == AbstractInterface::InOut) {
- groupInter = refInter->getConnectionToParentGroup(); // must be a single connection to
- refInter->clearConnectedTo();
- refInter->clearConnectedFrom();
- groupInter->clearConnectedTo();
- groupInter->clearConnectedFrom();
- }
-#ifdef DEBUG
- cout << "done." << endl ;
-#endif
-
- if (groupInter == NULL) {
- cerr << "abnormal case 1 while removing an interface item of a block, linked to a parent group" << endl;
- }
-
-#ifdef DEBUG
- cout << "getting group interface item, and connection item ..." ;
-#endif
-
-
- InterfaceItem* groupIfaceItem = parentItem->searchInterfaceByRef(groupInter);
- if (groupIfaceItem == NULL) {
- cerr << "abnormal case 2 while removing an interface item of a block, linked to a parent group" << endl;
- }
- ConnectionItem* conn = parentItem->getScene()->searchConnectionItem(item,groupIfaceItem);
- if (conn == NULL) {
- cerr << "abnormal case 3 while removing an interface item of a block, linked to a parent group" << endl;
- }
-#ifdef DEBUG
- cout << "done." << endl ;
-#endif
-
- // removing the interface group item from the group item, and the connection item
-#ifdef DEBUG
- cout << "removing group interface item, and connection item ..." ;
-#endif
-
- bool groupInterRemove = false;
- if ((groupInter->isConnectedTo() == false) && (groupInter->isConnectedFrom() == false)) groupInterRemove = true;
-
- item->removeConnectionItem(conn);
- groupIfaceItem->removeConnectionItem(conn);
- if (groupInterRemove) {
- parentItem->removeInterface(groupIfaceItem); // CAUTION : this deletes the interface item.
- }
- parentItem->getScene()->removeConnectionItem(conn);
-#ifdef DEBUG
- cout << "done." << endl ;
-#endif
-
- if (groupInterRemove) {
- // removing the interface box item in the parent scene
-#ifdef DEBUG
- cout << "removing the inteeface item of box item in parent scene if needed ..." ;
-#endif
-
- BoxItem* parent2Item = parentItem->getParentItem();
- if (parent2Item != NULL) {
- InterfaceItem* group2IfaceItem = parent2Item->searchInterfaceByRef(groupInter);
- parent2Item->removeInterface(group2IfaceItem);
- }
-#ifdef DEBUG
- cout << "done." << endl ;
-#endif
-
- // removing the interface group from the group
-#ifdef DEBUG
- cout << "removing group interface ..." ;
-#endif
- parentGroup->removeInterface(groupInter);
-#ifdef DEBUG
- cout << "done." << endl ;
-#endif
- }
-
-}
-void Dispatcher::removeFunctionalInterface(InterfaceItem *item) {