當前位置: 首頁>>代碼示例>>Golang>>正文


Golang behaviour.SignalGraphIf類代碼示例

本文整理匯總了Golang中github.com/axel-freesp/sge/interface/behaviour.SignalGraphIf的典型用法代碼示例。如果您正苦於以下問題:Golang SignalGraphIf類的具體用法?Golang SignalGraphIf怎麽用?Golang SignalGraphIf使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SignalGraphIf類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SignalGraphViewNew

func SignalGraphViewNew(g bh.SignalGraphIf, context ContextIf) (viewer *signalGraphView, err error) {
	viewer = &signalGraphView{nil, DrawArea{}, nil, nil, g.ItsType(), g.Filename(), context, image.Point{}, false}
	err = viewer.init()
	if err != nil {
		return
	}
	viewer.Sync()
	return
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:9,代碼來源:signalgraphview.go

示例2: TestGraph

func TestGraph(t *testing.T) {
	case1 := []struct {
		library, graph     string
		nodes, connections int
	}{
		{`<library xmlns="http://www.freesp.de/xml/freeSP" version="1.0">
   <signal-type name="s1" scope="" mode="" c-type="" message-id=""></signal-type>
   <node-type name="Test">
      <intype port="" type="s1"></intype>
      <outtype port="" type="s1"></outtype>
   </node-type>
</library>
`, `<?xml version="1.0" encoding="UTF-8"?>
<signal-graph xmlns="http://www.freesp.de/xml/freeSP" version="1.0">
    <nodes>
        <input name="sensor">
            <outtype type="s1"/>
        </input>
        <output name="actuator">
            <intype type="s1"/>
        </output>
        <processing-node name="test" type="Test"></processing-node>
    </nodes>
    <connections>
        <connect from="sensor" to="test"/>
        <connect from="test" to="actuator"/>
    </connections>
</signal-graph>
`, 3, 2},
	}

	for i, c := range case1 {
		freesp.Init()
		var l bh.LibraryIf = LibraryNew("test.alml", nil)
		buf := copyBuf(c.library)
		_, err := l.Read(buf)
		if err != nil {
			t.Errorf("Testcase %d: Failed to read from buffer: %v", i, err)
			return
		}
		var sg bh.SignalGraphIf = SignalGraphNew("test.sml", nil)
		buf = copyBuf(c.graph)
		_, err = sg.Read(buf)
		if err != nil {
			t.Errorf("Testcase %d: Failed to read from buffer: %v", i, err)
			return
		}
		var st bh.SignalGraphTypeIf = sg.ItsType()
		if len(st.Nodes()) != c.nodes {
			t.Errorf("Testcase %d: NodeIf count mismatch", i)
			return
		}
	}
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:54,代碼來源:signalgraph_test.go

示例3: CreateXmlGraphHint

func CreateXmlGraphHint(g bh.SignalGraphIf) (xmlg *backend.XmlGraphHint) {
	xmlg = backend.XmlGraphHintNew(g.Filename())
	for _, n := range g.ItsType().InputNodes() {
		xmlg.InputNode = append(xmlg.InputNode, *CreateXmlIONodePosHint(n, ""))
	}
	for _, n := range g.ItsType().OutputNodes() {
		xmlg.OutputNode = append(xmlg.OutputNode, *CreateXmlIONodePosHint(n, ""))
	}
	for _, n := range g.ItsType().ProcessingNodes() {
		hintlist := CreateXmlNodePosHint(n, "")
		for _, h := range hintlist {
			xmlg.ProcessingNode = append(xmlg.ProcessingNode, h)
		}
	}
	return
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:16,代碼來源:backendconversions.go

示例4: SignalGraphApplyHints

func SignalGraphApplyHints(s bh.SignalGraphIf, xmlhints *backend.XmlGraphHint) (err error) {
	if s.Filename() != xmlhints.Ref {
		err = fmt.Errorf("SignalGraphApplyHints error: filename mismatch\n")
		return
	}
	g := s.ItsType()
	for _, xmln := range xmlhints.InputNode {
		n, ok := g.NodeByName(xmln.Name)
		if ok {
			n.SetExpanded(false)
			freesp.PathModePositionerApplyHints(n, xmln.XmlModeHint)
		}
	}
	for _, xmln := range xmlhints.OutputNode {
		n, ok := g.NodeByName(xmln.Name)
		if ok {
			n.SetExpanded(false)
			freesp.PathModePositionerApplyHints(n, xmln.XmlModeHint)
		}
	}
	NodesApplyHints("", g, xmlhints.ProcessingNode)
	return
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:23,代碼來源:signalgraph.go

示例5: CreateXmlSignalGraph

func CreateXmlSignalGraph(g bh.SignalGraphIf) *backend.XmlSignalGraph {
	return CreateXmlSignalGraphType(g.ItsType())
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:3,代碼來源:backendconversions.go

示例6: IdentifyGraph

func (v signalGraphView) IdentifyGraph(g bh.SignalGraphIf) bool {
	return g.ItsType() == v.sgType
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:3,代碼來源:signalgraphview.go

示例7: SignalGraphUsesSignalType

func SignalGraphUsesSignalType(s bh.SignalGraphIf, st bh.SignalTypeIf) bool {
	return SignalGraphTypeUsesSignalType(s.ItsType(), st)
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:3,代碼來源:signalgraph.go

示例8: SignalGraphUsesNodeType

func SignalGraphUsesNodeType(s bh.SignalGraphIf, nt bh.NodeTypeIf) bool {
	return SignalGraphTypeUsesNodeType(s.ItsType(), nt)
}
開發者ID:axel-freesp,項目名稱:sge,代碼行數:3,代碼來源:signalgraph.go


注:本文中的github.com/axel-freesp/sge/interface/behaviour.SignalGraphIf類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。