From 4fb4460557cee7b3e2c673df20090b3efc4fee98 Mon Sep 17 00:00:00 2001 From: Suchita Lad Date: Fri, 26 Jul 2024 10:54:51 +0530 Subject: updated files --- blocks/Xcos/MxGraphParser.py | 30 +++++++++++++++++++-- blocks/xcos2xml/links/CommandControlLink.xsl | 22 --------------- blocks/xcos2xml/links/ExplicitLink.xsl | 2 +- blocks/xcos2xml/links/ImplicitLink.xsl | 22 --------------- blocks/xcos2xml/ports/port.xsl | 8 +++--- blocks/xcos2xml/split.xsl | 40 ++++++++++++++-------------- 6 files changed, 53 insertions(+), 71 deletions(-) delete mode 100644 blocks/xcos2xml/links/CommandControlLink.xsl delete mode 100644 blocks/xcos2xml/links/ImplicitLink.xsl diff --git a/blocks/Xcos/MxGraphParser.py b/blocks/Xcos/MxGraphParser.py index 46bf4945..94f2aefe 100755 --- a/blocks/Xcos/MxGraphParser.py +++ b/blocks/Xcos/MxGraphParser.py @@ -59,6 +59,7 @@ for root in model: edgeDict = {} edgeDict2 = {} splitList = [] + mxPointList = {} for cell in list(root): try: attrib = cell.attrib @@ -78,7 +79,7 @@ for root in model: continue cell_type = attrib['CellType'] - + if cell_type == 'Component': style = attrib['style'] componentGeometry = {} @@ -144,11 +145,24 @@ for root in model: ordering = len(styleArray) IDLIST[attribid] = style globals()[style](outroot, attribid, ParentComponent, ordering, geometry) + print("Testing Value: ", attribid, ordering, ParentComponent,geometry) elif 'edge' in attrib: + print(attrib) + mxGeometry = cell.find('mxGeometry') + print(mxGeometry) + array = mxGeometry.find('Array') + celid = cell.attrib.get('id') + mxPointList[celid] = array + print(mxPointList) + for points in mxPointList: + value = mxPointList[points] + + sourceVertex = attrib['sourceVertex'] targetVertex = attrib['targetVertex'] sourceType = IDLIST[sourceVertex] targetType = IDLIST[targetVertex] + # print("SV:", sourceVertex, "TV:", targetVertex, "ST:", sourceType, "TT:",targetType) # switch vertices if required if sourceType in ['ExplicitInputPort', 'ImplicitInputPort', 'ControlPort'] and targetType in ['ExplicitOutputPort', 'ExplicitLink', 'ImplicitOutputPort', 'ImplicitLink', 'CommandPort', 'CommandControlLink']: @@ -185,22 +199,34 @@ for root in model: IDLIST[attribid] = style if addSplit: + for a in cell.attrib: + print(a, cell.attrib.get(a) ) mxGeometry = cell.find('mxGeometry') if mxGeometry is not None: + for a in mxGeometry.attrib: + print(a, mxGeometry.attrib.get(a) ) + for child in mxGeometry: + print(child) mxPoint = mxGeometry.find('mxPoint') if mxPoint is not None: + for b in mxPoint.attrib: + print(b, mxPoint.attrib.get(b)) + for child in mxPoint: + print(child) geometry = {} geometry['width'] = mxPoint.attrib.get('width', '7') geometry['height'] = mxPoint.attrib.get('height', '7') geometry['x'] = mxPoint.attrib.get('x', '0') geometry['y'] = mxPoint.attrib.get('y', '0') - + print("Testing Value1: ", geometry) splitList.append((attribid, sourceVertex, targetVertex, sourceType, targetType, geometry)) try: + print("Source",edgeDict[sourceVertex]) del edgeDict[sourceVertex] except KeyError: pass try: + print("target",edgeDict[targetVertex]) del edgeDict[targetVertex] except KeyError: pass diff --git a/blocks/xcos2xml/links/CommandControlLink.xsl b/blocks/xcos2xml/links/CommandControlLink.xsl deleted file mode 100644 index 3433c5d9..00000000 --- a/blocks/xcos2xml/links/CommandControlLink.xsl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - 1 - - - - - - - .null - Unknown - 0 - 0 - - - - - - diff --git a/blocks/xcos2xml/links/ExplicitLink.xsl b/blocks/xcos2xml/links/ExplicitLink.xsl index e1e8d8a1..d7c85dd2 100644 --- a/blocks/xcos2xml/links/ExplicitLink.xsl +++ b/blocks/xcos2xml/links/ExplicitLink.xsl @@ -1,4 +1,4 @@ - + diff --git a/blocks/xcos2xml/links/ImplicitLink.xsl b/blocks/xcos2xml/links/ImplicitLink.xsl deleted file mode 100644 index 13c5e046..00000000 --- a/blocks/xcos2xml/links/ImplicitLink.xsl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - 1 - - - - - - - .null - Unknown - 0 - 0 - - - - - - diff --git a/blocks/xcos2xml/ports/port.xsl b/blocks/xcos2xml/ports/port.xsl index 0754d9e1..f6a5422d 100644 --- a/blocks/xcos2xml/ports/port.xsl +++ b/blocks/xcos2xml/ports/port.xsl @@ -24,7 +24,7 @@ 0 0 - + @@ -52,7 +52,7 @@ 0 0 - + @@ -80,7 +80,7 @@ 0 0 - + @@ -108,7 +108,7 @@ 0 0 - + diff --git a/blocks/xcos2xml/split.xsl b/blocks/xcos2xml/split.xsl index ba3ef4df..cefd4d58 100644 --- a/blocks/xcos2xml/split.xsl +++ b/blocks/xcos2xml/split.xsl @@ -1,7 +1,7 @@ - - - - + + + + @@ -18,8 +18,20 @@ + + @@ -34,12 +46,6 @@ Unknown 0 0 - - - - - - @@ -49,10 +55,10 @@ - + - + @@ -71,9 +77,6 @@ - - - @@ -100,9 +103,6 @@ - - - @@ -136,7 +136,7 @@ - + @@ -156,7 +156,7 @@ - + -- cgit