本文整理汇总了Golang中github.com/axel-freesp/sge/interface/behaviour.SignalGraphTypeIf.InputNodes方法的典型用法代码示例。如果您正苦于以下问题:Golang SignalGraphTypeIf.InputNodes方法的具体用法?Golang SignalGraphTypeIf.InputNodes怎么用?Golang SignalGraphTypeIf.InputNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/axel-freesp/sge/interface/behaviour.SignalGraphTypeIf
的用法示例。
在下文中一共展示了SignalGraphTypeIf.InputNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CreateXmlSignalGraphType
func CreateXmlSignalGraphType(t bh.SignalGraphTypeIf) *backend.XmlSignalGraph {
ret := backend.XmlSignalGraphNew()
for _, l := range t.Libraries() {
ret.Libraries = append(ret.Libraries, *CreateXmlLibraryRef(l.Filename()))
}
for _, n := range t.InputNodes() {
ret.InputNodes = append(ret.InputNodes, *CreateXmlInputNode(n))
}
for _, n := range t.OutputNodes() {
ret.OutputNodes = append(ret.OutputNodes, *CreateXmlOutputNode(n))
}
for _, n := range t.ProcessingNodes() {
ret.ProcessingNodes = append(ret.ProcessingNodes, *CreateXmlProcessingNode(n))
}
for _, n := range t.Nodes() {
for _, p := range n.OutPorts() {
for _, c := range p.Connections() {
conn := p.Connection(c)
ret.Connections = append(ret.Connections, *CreateXmlConnection(conn))
}
}
}
return ret
}
示例2: ExpandedNodeNew
//.........这里部分代码省略.........
image.Point{}}
for i, p := range userObj.InPorts() {
pos := p.ModePosition(gr.PositionModeExpanded)
if pos == empty {
pos = ret.CalcInPortPos(i)
}
positioner := gr.ModePositionerProxyNew(p, gr.PositionModeExpanded)
ret.AddPort(config, p, positioner)
}
config = DrawConfig{ColorInit(ColorOption(OutputPort)),
ColorInit(ColorOption(HighlightOutPort)),
ColorInit(ColorOption(SelectOutPort)),
ColorInit(ColorOption(BoxFrame)),
Color{},
image.Point{}}
for i, p := range userObj.OutPorts() {
pos := p.ModePosition(gr.PositionModeExpanded)
if pos == empty {
pos = ret.CalcOutPortPos(i)
}
positioner := gr.ModePositionerProxyNew(p, gr.PositionModeExpanded)
ret.AddPort(config, p, positioner)
}
for _, n := range g.ProcessingNodes() {
from, ok := ret.ChildByName(n.Name())
if !ok {
log.Printf("ExpandedNodeNew error: node %s not found\n", n.Name())
continue
}
for _, p := range n.OutPorts() {
fromId := from.OutPortIndex(p.Name())
for _, c := range p.Connections() {
to, ok := ret.ChildByName(c.Node().Name())
if ok {
toId := to.InPortIndex(c.Name())
ret.connections = append(ret.connections, ConnectionNew(from, to, fromId, toId))
} else {
portname, ok := c.Node().PortLink()
if !ok {
log.Printf("ExpandedNodeNew error: output node %s not linked\n", c.Node().Name())
continue
}
ownPort, ok := ret.OutPortByName(portname)
if !ok {
log.Printf("ExpandedNodeNew error: linked port %s of output node %s not found\n", portname, c.Node().Name())
continue
}
nodePort, ok := from.OutPortByName(p.Name())
if !ok {
log.Printf("ExpandedNodeNew error: port %s of output node %s not found\n", p.Name(), from.Name())
continue
}
ret.portconn = append(ret.portconn, PortConnectorNew(nodePort, ownPort))
}
}
}
}
for _, n := range g.InputNodes() {
for _, p := range n.OutPorts() {
fromlink, ok := p.Node().PortLink()
if !ok {
log.Printf("ExpandedNodeNew error: input node %s not linked\n", p.Node().Name())
continue
}
fromPort, ok := ret.InPortByName(fromlink)
if !ok {
log.Printf("ExpandedNodeNew error: linked port %s of input node %s not found\n", fromlink, n.Name())
continue
}
for _, c := range p.Connections() {
to, ok := ret.ChildByName(c.Node().Name())
if ok {
// TODO: connect with node
toPort, ok := to.InPortByName(c.Name())
if !ok {
log.Printf("ExpandedNodeNew error: port %s of node %s not found\n", c.Name(), to.Name())
continue
}
ret.portconn = append(ret.portconn, PortConnectorNew(fromPort, toPort))
} else {
tolink, ok := c.Node().PortLink()
if !ok {
log.Printf("ExpandedNodeNew error: output node %s not linked\n", c.Node().Name())
continue
}
toPort, ok := ret.OutPortByName(tolink)
if !ok {
log.Printf("ExpandedNodeNew error: linked port %s of output node %s not found\n", tolink, c.Node().Name())
continue
}
ret.portconn = append(ret.portconn, PortConnectorNew(fromPort, toPort))
}
}
}
}
ret.RegisterOnDraw(func(ctxt interface{}) {
expandedNodeOnDraw(ret, ctxt)
})
return
}