bool SUPERVGUI_CanvasLinkBuilder::canCreateEngine(SUPERVGUI_CanvasPort* thePort)
{
- bool result = false;
if (thePort && myPort) {
SUPERVGUI_CanvasPort* aInPort;
SUPERVGUI_CanvasPort* aOutPort;
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
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)