From: asv Date: Fri, 14 Jan 2005 11:49:54 +0000 (+0000) Subject: Allow to create links to/from "default" ports of switch node in LinkBuilder::canCreat... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=55101eba6eb8e6c5fa457200b451d194d3e6f75e;p=modules%2Fsuperv.git Allow to create links to/from "default" ports of switch node in LinkBuilder::canCreateEngine() function. --- diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx index 5ae3abf..4855b18 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx @@ -326,7 +326,6 @@ SUPERVGUI_CanvasLinkBuilder::~SUPERVGUI_CanvasLinkBuilder() bool SUPERVGUI_CanvasLinkBuilder::canCreateEngine(SUPERVGUI_CanvasPort* thePort) { - bool result = false; if (thePort && myPort) { SUPERVGUI_CanvasPort* aInPort; SUPERVGUI_CanvasPort* aOutPort; @@ -345,17 +344,10 @@ bool SUPERVGUI_CanvasLinkBuilder::canCreateEngine(SUPERVGUI_CanvasPort* thePort) aInPort = thePort; } - // control if node is different + // control if nodes are different, not the same node QString aInNode(aInPort->getEngine()->Node()->Name()); QString aOutNode(aOutPort->getEngine()->Node()->Name()); - if (aInNode.compare(aOutNode) == 0) - return false; - - // control if no port is "Default" - QString aInName(aInPort->getEngine()->Name()); - QString aOutName(aOutPort->getEngine()->Name()); - if (aInName.compare("Default") == 0 || - aOutName.compare("Default") == 0) + if (aInNode.compare(aOutNode) == 0) // linking outport and inport of the same node return false; // control types of ports @@ -376,18 +368,21 @@ bool SUPERVGUI_CanvasLinkBuilder::canCreateEngine(SUPERVGUI_CanvasPort* thePort) if ( aInKind == SUPERV::GateParameter && aOutKind != SUPERV::GateParameter && aOutKind != SUPERV::InLineParameter ) return false; - // control if port is already linked except for input port of end switch node - if (!(aInKind == SUPERV::EndSwitchParameter || - aInPort->getEngine()->Node()->Kind() == SUPERV::EndSwitchNode)) { - // asv : 15.12.04 : PAL7374, p.2.2 "Bugs and Improvements": multiple links into Gate port - // for InGate it's OK to accept more than 1 link - if ( aInPort->getEngine()->IsLinked() && aInKind != SUPERV::GateParameter ) - return false; - } - - result = true; + // asv : 15.12.04 : PAL7374, p.2.2 "Bugs and Improvements": multiple links into Gate port + // for InGate it's OK to accept more than 1 link + // THESE NEEDS REVISION, ALSO DON'T ALLOW MANY LINKS TO "DEFAULT" PORT OF EndSwitch + //if ( aInPort->getEngine()->IsLinked() && aInKind != SUPERV::GateParameter ) + + // control if port is already linked except for input inline ports of end switch node (check for EndSwitchParameter) + // and "Default" port of Switch node (check for aNode->isEndSwitch()). "Default" port is linked by default, but we + // let it to be "re-linked" to another port. + const bool isEndSwitch = ( aInKind == SUPERV::EndSwitchParameter || aInPort->getEngine()->Node()->IsEndSwitch() ); + if ( !isEndSwitch && aInPort->getEngine()->IsLinked() ) + return false; + + return true; } - return result; + return false; } void SUPERVGUI_CanvasLinkBuilder::setCoords(SUPERV::Link_ptr theLink)