Beispiel #1
0
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
}
Beispiel #2
0
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
}
Beispiel #3
0
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
}