diff options
author | Suchita Lad | 2024-08-27 13:00:11 +0530 |
---|---|---|
committer | Suchita Lad | 2024-08-27 13:01:05 +0530 |
commit | 90af706a7cacb719c1979eaf14c0af8f35b84a5c (patch) | |
tree | 3d5dedaee9481cc895d7f98cd93aa2a45e89a089 | |
parent | 7ff45d978cb838f9f67173ccb164aa04fbe6f046 (diff) | |
download | Common-Interface-Project-90af706a7cacb719c1979eaf14c0af8f35b84a5c.tar.gz Common-Interface-Project-90af706a7cacb719c1979eaf14c0af8f35b84a5c.tar.bz2 Common-Interface-Project-90af706a7cacb719c1979eaf14c0af8f35b84a5c.zip |
Updated files
-rwxr-xr-x | blocks/Xcos/MxGraphParser.py | 34 | ||||
-rw-r--r-- | blocks/Xcos/links/ExplicitLink.py | 2 | ||||
-rw-r--r-- | blocks/Xcos/ports/ExplicitInputPort.py | 2 | ||||
-rw-r--r-- | blocks/Xcos/ports/ExplicitOutputPort.py | 2 |
4 files changed, 24 insertions, 16 deletions
diff --git a/blocks/Xcos/MxGraphParser.py b/blocks/Xcos/MxGraphParser.py index 4c0d9e20..03eac3a9 100755 --- a/blocks/Xcos/MxGraphParser.py +++ b/blocks/Xcos/MxGraphParser.py @@ -68,6 +68,7 @@ for root in model: edgeDict2 = {} splitList = [] mxPointList = {} + blkgeometry = {} for cell in list(root): try: attrib = cell.attrib @@ -119,6 +120,7 @@ for root in model: IOV[attribid] = [] COM[attribid] = [] IDLIST[attribid] = cell_type + blkgeometry[attribid] = componentGeometry globals()[style](outroot, attribid, componentOrdering, componentGeometry, parameters) elif 'vertex' in attrib: style = attrib['style'] @@ -152,6 +154,7 @@ for root in model: geometry['y'] = float(componentGeometry['y']) + float(componentGeometry['height']) * float(geometry['y']) ordering = len(styleArray) IDLIST[attribid] = style + blkgeometry[attribid] = blkgeometry[ParentComponent] globals()[style](outroot, attribid, ParentComponent, ordering, geometry) elif 'edge' in attrib: @@ -233,7 +236,7 @@ for root in model: if mxPoint is not None: point = mxPoint.attrib del point['as'] - # print(point) + print(point) larger_array = arrayelem2 larger_array = [{k: int(v) for k, v in coord.items()} for coord in larger_array] point = {k: int(v) for k, v in point.items()} @@ -270,20 +273,24 @@ for root in model: except BaseException: traceback.print_exc() -generatedsplitblk = {} +dict1 = {} for (attribid, sourceVertex, targetVertex, sourceType, targetType, geometry, array1, array2, array3) in splitList: componentOrdering += 1 - if sourceVertex in generatedsplitblk: - splitblockid = generatedsplitblk[sourceVertex] - elif targetVertex in generatedsplitblk: - splitblockid = generatedsplitblk[targetVertex] + SplitBlock(outroot, nextattribid, componentOrdering, geometry) + splitblockid = nextattribid + nextattribid += 1 + if sourceVertex in dict1: + new_array1, new_array2, new_array3, new_splitblockid, new_sourceVertex, new_targetVertex, new_splitblkgeometry = dict1[sourceVertex] + print('DICTSV1', dict1[sourceVertex]) + elif targetVertex in dict1: + new_array1, new_array2, new_array3, new_splitblockid, new_sourceVertex, new_targetVertex, new_splitblkgeometry = dict1[targetVertex] + print('DICTTV1', dict1[targetVertex]) else: - SplitBlock(outroot, nextattribid, componentOrdering, geometry) - splitblockid = nextattribid - nextattribid += 1 - generatedsplitblk[sourceVertex] = splitblockid - generatedsplitblk[targetVertex] = splitblockid - + dict1[sourceVertex] = array1, array2, array3, splitblockid, sourceVertex, targetVertex, geometry + print('DICTSV2', dict1[sourceVertex], sourceVertex) + dict1[targetVertex] = array1, array2, array3, splitblockid, sourceVertex, targetVertex, geometry + print('DICTTV2', dict1[targetVertex], targetVertex) + inputCount = 0 outputCount = 0 if sourceType == 'ExplicitOutputPort': @@ -372,10 +379,11 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, geometry, arr (style2, sourceVertex2, targetVertex2, sourceType2, targetType2) = edgeDict2[targetVertex] for (attribid, (style, sourceVertex, targetVertex, sourceType, targetType, array1)) in edgeDict.items(): - print("testing",attribid,style, sourceVertex, targetVertex, sourceType, targetType) + print("testing",attribid,style, sourceVertex, targetVertex, sourceType, targetType, array1) if int(attribid) >= 10000: attribid = nextattribid nextattribid += 1 + print('tst', attribid) globals()[style](outroot, attribid, sourceVertex, targetVertex, array1) outnode = ET.SubElement(outdiagram, 'mxCell') diff --git a/blocks/Xcos/links/ExplicitLink.py b/blocks/Xcos/links/ExplicitLink.py index 9a469b8d..2a83d1e4 100644 --- a/blocks/Xcos/links/ExplicitLink.py +++ b/blocks/Xcos/links/ExplicitLink.py @@ -7,7 +7,7 @@ def ExplicitLink(outroot, attribid, sourceVertex, targetVertex, arrayelem): parent=1, source=sourceVertex, target=targetVertex, style=func_name, value='') - print(arrayelem) + # print(arrayelem) mxGeoNode = addNode(outnode, 'mxGeometry', **{'as': 'geometry'}) addNode(mxGeoNode, 'mxPoint', **{'as': 'sourcePoint', 'x': "0.0", 'y': "0.0"}) diff --git a/blocks/Xcos/ports/ExplicitInputPort.py b/blocks/Xcos/ports/ExplicitInputPort.py index 8bee4041..b898d580 100644 --- a/blocks/Xcos/ports/ExplicitInputPort.py +++ b/blocks/Xcos/ports/ExplicitInputPort.py @@ -40,5 +40,5 @@ def addExplicitInputPortForSplit(outroot, splitBlock, sourceVertex, targetVertex # print('ED:', edgeDict[nextAttribForSplit]) nextAttrib += 1 nextAttribForSplit += 1 - print('ED:', inputCount, outputCount, nextAttrib, nextAttribForSplit) + # print('ED:', inputCount, outputCount, nextAttrib, nextAttribForSplit) return (inputCount, outputCount, nextAttrib, nextAttribForSplit) diff --git a/blocks/Xcos/ports/ExplicitOutputPort.py b/blocks/Xcos/ports/ExplicitOutputPort.py index c776fd8e..4c07c7d6 100644 --- a/blocks/Xcos/ports/ExplicitOutputPort.py +++ b/blocks/Xcos/ports/ExplicitOutputPort.py @@ -39,5 +39,5 @@ def addExplicitOutputPortForSplit(outroot, splitBlock, sourceVertex, targetVerte 'ExplicitOutputPort', targetType, arrayelem) nextAttrib += 1 nextAttribForSplit += 1 - print(inputCount, outputCount, nextAttrib, nextAttribForSplit) + # print(inputCount, outputCount, nextAttrib, nextAttribForSplit) return (inputCount, outputCount, nextAttrib, nextAttribForSplit) |