diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java index fe18a84c3046b2ef514d135d473ec84378c2831e..543b16a5bd33771872fa62f07070c3b89683153e 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java @@ -492,7 +492,7 @@ public class ReactionToXml { sb.append(getListOfModificationsXmlStringForReaction(reaction)); sb.append(getListOfGateMembersXmlStringForReaction(reaction)); - sb.append(getLineXmlStringForLines(reaction.getReactants().get(0).getLine())); + sb.append(getLineXmlStringForLines(reaction.getLine())); XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(); sb.append("</celldesigner:extension>\n"); @@ -584,6 +584,7 @@ public class ReactionToXml { } result.append("</celldesigner:listOfLineDirection>\n"); result.append("</celldesigner:connectScheme>\n"); + result.append(getLineXmlStringForLines(operator.getLine())); result.append("</celldesigner:GateMember>\n"); @@ -684,11 +685,7 @@ public class ReactionToXml { sb.append(getConnectSchemeXmlStringForLines(new PolylineData[] { reactant.getLine() })); sb.append(getEditPointsXmlStringForLine(new PolylineData[] { reactant.getLine() }, 0)); - sb.append("<celldesigner:line "); - sb.append("width=\"" + reactant.getLine().getWidth() + "\" "); - sb.append("color=\"" + XmlParser.colorToString(reactant.getLine().getColor()) + "\" "); - sb.append("type=\"Straight\" "); - sb.append("/>\n"); + sb.append(getLineXmlStringForLines(reactant.getLine())); sb.append("</celldesigner:reactantLink>\n"); return sb.toString(); } @@ -715,13 +712,8 @@ public class ReactionToXml { sb.append(getConnectSchemeXmlStringForLines(lines)); - // TODO sb.append(getEditPointsXmlStringForLine(lines, 0)); - sb.append("<celldesigner:line "); - sb.append("width=\"" + product.getLine().getWidth() + "\" "); - sb.append("color=\"" + XmlParser.colorToString(product.getLine().getColor()) + "\" "); - sb.append("type=\"Straight\" "); - sb.append("/>\n"); + sb.append(getLineXmlStringForLines(product.getLine())); sb.append("</celldesigner:productLink>\n"); return sb.toString(); } diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java index 47e02a29dbd82d818e8daf561372a9b8f8ac8ddb..09b54e687f8cf68ca0ca4dd471b79b10f6b95fe2 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java @@ -773,5 +773,18 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions { assertFalse("Black wasn't used in reaction coloring", colors.contains(Color.BLACK)); } + @Test + public void testExportBooleanReactioWithColors() throws Exception { + CellDesignerXmlParser parser = new CellDesignerXmlParser(); + Model model = parser.createModel(new ConverterParams().filename("testFiles/reactions/boolean-colors.xml")); + + model.setName(null); + assertNotNull(model); + String str = parser.model2String(model); + Model model2 = parser.createModel( + new ConverterParams().inputStream(new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8)))); + assertEquals(0, new ModelComparator().compare(model, model2)); + } + }