summaryrefslogtreecommitdiff
path: root/blocks/Xcos/links/ExplicitLink.py
blob: a9a468c7f4ce9fe891b090e5b5bede7defd946b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from common.AAAAAA import *


def ExplicitLink(outroot, attribid, sourceVertex, targetVertex, waypoints, parent=1):
    func_name = 'ExplicitLink'

    outnode = addNode(outroot, func_name, **{'id': attribid},
                      parent=parent, source=sourceVertex, target=targetVertex,
                      style=func_name, value='')

    mxGeoNode = addNode(outnode, 'mxGeometry', **{'as': 'geometry'})
    addNode(mxGeoNode, 'mxPoint', **{'as': 'sourcePoint', 'x': "0.0", 'y': "0.0"})
    arrayNode = addNode(mxGeoNode, 'Array', **{'as': 'points'})

    for point in waypoints:
        addNode(arrayNode, 'mxPoint', **{'x': point['x'], 'y': point['y']})

    addNode(mxGeoNode, 'mxPoint', **{'as': 'targetPoint', 'x': "0.0", 'y': "0.0"})

    return outnode