/// <summary> /// Creates a node of given type /// </summary> /// <param name="nodeType">Type of node to create</param> public static SNode CreateSNode(this INodeType nodeType) { var ret = new SNode { NodeType = nodeType }; nodeType.Init(ret); nodeType.PostLoad(ret); return(ret); }
private SGraph CreateGraphToSerialize(IEnumerable <BaseNodeView> nodes, IEnumerable <BaseConnectionView> connections) { var sgraph = new SGraph { Type = _graphView.Graph.Type }; foreach (var nodeModel in nodes) { SNode sNode = nodeModel.Node; sNode.Position = nodeModel.localBound.min; sgraph.AddNode(sNode); } foreach (var connectionModel in connections) { sgraph.AddConnection(connectionModel.Connection); } return(sgraph); }
/// <summary> /// Returns all input ports of a node /// </summary> /// <param name="node">Node to look for ports</param> public static IEnumerable <SPort> InputPorts(this SNode node) { return(node.Ports.Where(p => p.Direction == PortDirection.Input)); }