Пример #1
0
func CreateXmlConnection(c bh.ConnectionIf) *backend.XmlConnect {
	from := c.From()
	to := c.To()
	fromNode := from.Node()
	toNode := to.Node()
	switch from.Direction() {
	case gr.OutPort:
		return backend.XmlConnectNew(fromNode.Name(), toNode.Name(), from.Name(), to.Name())
	default:
		return backend.XmlConnectNew(toNode.Name(), fromNode.Name(), to.Name(), from.Name())
	}
}
Пример #2
0
func (v *signalGraphView) selectConnect(conn bh.ConnectionIf) {
	n1 := v.findNode(conn.From().Node().Name())
	n2 := v.findNode(conn.To().Node().Name())
	for _, c := range v.connections {
		if n1 == c.From() && n2 == c.To() &&
			n1.OutPorts()[c.FromId()] == conn.From() &&
			n2.InPorts()[c.ToId()] == conn.To() {
			if c.Select() {
				v.repaintConnection(c)
			}
		} else {
			if c.Deselect() {
				v.repaintConnection(c)
			}
		}
	}
}