当前位置: 首页>>代码示例>>Golang>>正文


Golang behaviour.NodeIdIf类代码示例

本文整理汇总了Golang中github.com/axel-freesp/sge/interface/behaviour.NodeIdIf的典型用法代码示例。如果您正苦于以下问题:Golang NodeIdIf类的具体用法?Golang NodeIdIf怎么用?Golang NodeIdIf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NodeIdIf类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: SelectNode

func (n *Node) SelectNode(ownId, selectId bh.NodeIdIf) (modified bool, node NodeIf) {
	if ownId.String() == selectId.String() {
		n.highlighted = true
		node = n
		modified = n.Select()
	} else {
		n.highlighted = false
		modified = n.Deselect()
	}
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:11,代码来源:node.go

示例2: nodePath

func (g *Global) nodePath(n bh.NodeIf, nCursor tr.Cursor, selectId bh.NodeIdIf) (cursor tr.Cursor) {
	ids := strings.Split(selectId.String(), "/")
	if len(ids) == 1 {
		cursor = nCursor
		return
	}
	nt := n.ItsType()
	for _, impl := range nt.Implementation() {
		if impl.ImplementationType() == bh.NodeTypeGraph {
			for _, nn := range impl.Graph().ProcessingNodes() {
				if nn.Name() == ids[1] {
					nnId := behaviour.NodeIdFromString(strings.Join(ids[1:], "/"), selectId.Filename())
					cursor = g.nodePath(nn, g.fts.CursorAt(nCursor, nn), nnId)
					break
				}
			}
			break
		}
	}
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:21,代码来源:global.go

示例3: GetNodeById

func (g Global) GetNodeById(id bh.NodeIdIf) (n bh.NodeIf, err error) {
	sg, err := g.SignalGraphMgr().Access(id.Filename())
	if err != nil {
		err = fmt.Errorf("Global.GetNodeById error: %s", err)
		return
	}
	for _, n = range sg.(bh.SignalGraphIf).Nodes() {
		if n.Name() == id.First() {
			return
		}
	}
	err = fmt.Errorf("Global.GetNodeById error: node %v not found in graph %s\n", id, id.Filename())
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:14,代码来源:global.go

示例4: SubNode

func (n *node) SubNode(ownId, childId bh.NodeIdIf) (ret bh.NodeIf, ok bool) {
	log.Printf("node.SubNode(%s, %s)\n", ownId, childId)
	if ownId.String() == childId.String() {
		ret, ok = n, true
		return
	}
	if !ownId.IsAncestor(childId) {
		return
	}
	for _, chn := range n.children() {
		ret, ok = chn.SubNode(NodeIdNew(ownId, chn.Name()), childId)
		if ok {
			return
		}
	}
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:17,代码来源:node.go

示例5: SelectNode

func (n *ExpandedNode) SelectNode(ownId, selectId bh.NodeIdIf) (modified bool, node NodeIf) {
	if ownId.String() == selectId.String() || ownId.IsAncestor(selectId) {
		n.highlighted = true
		node = n
		modified = n.Select()
	} else {
		n.highlighted = false
		modified = n.Deselect()
	}
	for _, ch := range n.Children {
		nn := ch.(NodeIf)
		chId := freesp.NodeIdNew(ownId, nn.Name())
		m, nd := nn.SelectNode(chId, selectId)
		if nd != nil {
			node = nd
		}
		modified = modified || m
	}
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:20,代码来源:expandednode.go

示例6: MappedElement

func (m *mapping) MappedElement(nId bh.NodeIdIf) (melem mp.MappedElementIf, ok bool) {
	melem, ok = m.maps[nId.String()]
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:4,代码来源:mapping.go

示例7: AddMapping

func (m *mapping) AddMapping(n bh.NodeIf, nId bh.NodeIdIf, p pf.ProcessIf) mp.MappedElementIf {
	m.maps[nId.String()] = mapelemNew(n, nId, p, m)
	m.maplist.Append(nId)
	return m.maps[nId.String()]
}
开发者ID:axel-freesp,项目名称:sge,代码行数:5,代码来源:mapping.go

示例8: 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())
//.........这里部分代码省略.........
开发者ID:axel-freesp,项目名称:sge,代码行数:101,代码来源:expandednode.go


注:本文中的github.com/axel-freesp/sge/interface/behaviour.NodeIdIf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。