本文整理汇总了Golang中github.com/axel-freesp/sge/interface/behaviour.SignalGraphTypeIf.ProcessingNodes方法的典型用法代码示例。如果您正苦于以下问题:Golang SignalGraphTypeIf.ProcessingNodes方法的具体用法?Golang SignalGraphTypeIf.ProcessingNodes怎么用?Golang SignalGraphTypeIf.ProcessingNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/axel-freesp/sge/interface/behaviour.SignalGraphTypeIf
的用法示例。
在下文中一共展示了SignalGraphTypeIf.ProcessingNodes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NodesApplyHints
func NodesApplyHints(path string, g bh.SignalGraphTypeIf, xmlh []backend.XmlNodePosHint) {
for _, n := range g.ProcessingNodes() {
var p string
if len(path) == 0 {
p = n.Name()
} else {
p = fmt.Sprintf("%s/%s", path, n.Name())
}
ok := false
var xmln backend.XmlNodePosHint
for _, xmln = range xmlh {
if p == xmln.Name {
ok = true
break
}
}
if ok {
n.SetExpanded(xmln.Expanded)
freesp.PathModePositionerApplyHints(n, xmln.XmlModeHint)
for i, p := range n.InPorts() {
ok = p.Name() == xmln.InPorts[i].Name
if !ok {
log.Printf("NodesApplyHints FIXME: name mismatch\n")
continue
}
freesp.ModePositionerApplyHints(p, xmln.InPorts[i].XmlModeHint)
}
for i, p := range n.OutPorts() {
ok = p.Name() == xmln.OutPorts[i].Name
if !ok {
log.Printf("NodesApplyHints FIXME: name mismatch\n")
continue
}
freesp.ModePositionerApplyHints(p, xmln.OutPorts[i].XmlModeHint)
}
}
nt := n.ItsType()
for _, impl := range nt.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
NodesApplyHints(p, impl.Graph(), xmlh)
break
}
}
}
}
示例2: 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
}
示例3: ExpandedNodeNew
func ExpandedNodeNew(getPositioner GetPositioner, userObj bh.NodeIf, nId bh.NodeIdIf) (ret *ExpandedNode) {
positioner := getPositioner(nId)
pos := positioner.Position()
path := nId.String()
config := DrawConfig{ColorInit(ColorOption(NormalExpandedNode)),
ColorInit(ColorOption(HighlightExpandedNode)),
ColorInit(ColorOption(SelectExpandedNode)),
ColorInit(ColorOption(BoxFrame)),
ColorInit(ColorOption(Text)),
image.Point{global.padX, global.padY}}
cconfig := ContainerConfig{expandedPortWidth, expandedPortHeight, 120, 80}
// Add children
var g bh.SignalGraphTypeIf
nt := userObj.ItsType()
for _, impl := range nt.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
g = impl.Graph()
break
}
}
var children []ContainerChild
if g != nil {
empty := image.Point{}
first := image.Point{16, 32}
shift := image.Point{16, 16}
for i, n := range g.ProcessingNodes() {
var ch ContainerChild
var mode gr.PositionMode
if n.Expanded() {
mode = gr.PositionModeExpanded
} else {
mode = gr.PositionModeNormal
}
proxy := gr.PathModePositionerProxyNew(n)
proxy.SetActivePath(path)
proxy.SetActiveMode(mode)
log.Printf("ExpandedNodeNew TODO: position of child nodes. path=%s, mode=%v\n", path, mode)
chpos := proxy.Position()
if chpos == empty {
chpos = pos.Add(first.Add(shift.Mul(i)))
proxy.SetPosition(chpos)
}
id := freesp.NodeIdNew(nId, n.Name())
if n.Expanded() {
ch = ExpandedNodeNew(getPositioner, n, id)
} else {
ch = NodeNew(getPositioner, n, id)
}
children = append(children, ch)
}
}
ret = &ExpandedNode{ContainerInit(children, config, userObj, cconfig),
userObj, positioner, nil, nil}
ret.ContainerInit()
empty := image.Point{}
config = DrawConfig{ColorInit(ColorOption(InputPort)),
ColorInit(ColorOption(HighlightInPort)),
ColorInit(ColorOption(SelectInPort)),
ColorInit(ColorOption(BoxFrame)),
Color{},
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())
//.........这里部分代码省略.........