diff --git a/CHANGELOG b/CHANGELOG index 4013acd70eb001a0a50e49cec21e94e751ed808e..018af25c4a97d3e9299c6b4b7753accf4e8c95ac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,8 @@ minerva (14.0.0~beta.0) unstable; urgency=low * Bug fix: curator couldn't update data overlay in some situations (#905) * Bug fix: alignment of tabs fixed for dialogs: "Add Project", "Edit Genome", "Edit Project", "Edit User" (#881) + * Bug fix: all colors in boolean reaction (from CellDesigner) are processed + properly (#907) * Bug fix: user with modify access to the project can edit it in admin panel (#901) diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java index 8fdfaeaf5963219877a0230a7c6a1c24affd7c75..942ecfe62f3b50d0eed7fb4209dc69dfae5e2390 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java @@ -409,6 +409,9 @@ public class ReactionFromXml { } applyStylingToLine(line, result.getLine()); + if (booleanLogicGateType!=null) { + assignColorFromGateMembers(result, gateMembers); + } if (reactantsLinkNode != null) { parseReactantLinks(result, reactantsLinkNode, model); } @@ -906,10 +909,10 @@ public class ReactionFromXml { PolylineData line = new PolylineData(); line.addPoint(pointTransformation.copyPoint(product.getLine().getBeginPoint())); - Point2D secondPoint = pointTransformation.getPointOnLine(product.getLine().getPoints().get(1), - product.getLine().getPoints().get(0), 0.4); - Point2D thirdPoint = pointTransformation.getPointOnLine(product.getLine().getPoints().get(1), - product.getLine().getPoints().get(0), 0.6); + Point2D secondPoint = pointTransformation.getPointOnLine(product.getLine().getPoints().get(0), + product.getLine().getPoints().get(1), 0.4); + Point2D thirdPoint = pointTransformation.getPointOnLine(product.getLine().getPoints().get(0), + product.getLine().getPoints().get(1), 0.6); line.addPoint(pointTransformation.copyPoint(secondPoint)); operator.setLine(line); @@ -927,6 +930,37 @@ public class ReactionFromXml { } } + private void assignColorFromGateMembers(Reaction result, Node gateMembers) { + int elementIndex = 0; + for (int i = 0; i < gateMembers.getChildNodes().getLength(); i++) { + Node child = gateMembers.getChildNodes().item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + if (child.getNodeName().equalsIgnoreCase("celldesigner:GateMember")) { + Node lineNode = XmlParser.getNode("celldesigner:line", child); + if (lineNode != null) { + LineProperties line = getLineProperties(lineNode); + Set<PolylineData> polylines = new HashSet<>(); + if (elementIndex == 0) { + if (result.getOperators().size() > 0) { + polylines.add(result.getOperators().get(result.getOperators().size() - 1).getLine()); + polylines.add(result.getLine()); + } + } else { + if (result.getReactants().size() >= elementIndex) { + polylines.add(result.getReactants().get(elementIndex - 1).getLine()); + } + } + for (PolylineData polyline: polylines) { + polyline.setColor(line.getColor()); + polyline.setWidth(line.getWidth()); + } + } + elementIndex++; + } + } + } + } + /** * Creates lines for reaction that belongs to * {@link TwoProductReactionInterface}. 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/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/LineProperties.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/LineProperties.java index dd45ccc521e788b58910614b20718933bc9b8cc7..6bb3b60a34f27cc8dfb46fbc741086b7b8d69c68 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/LineProperties.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/fields/LineProperties.java @@ -1,7 +1,8 @@ package lcsb.mapviewer.converter.model.celldesigner.structure.fields; -import java.awt.*; +import java.awt.Color; +import lcsb.mapviewer.common.geometry.ColorParser; import lcsb.mapviewer.model.graphics.PolylineData; /** @@ -99,4 +100,9 @@ public class LineProperties { this.type = type; } + @Override + public String toString() { + return "[" + this.getClass().getSimpleName() + " w=" + width + "; c=" + new ColorParser().colorToHtml(color) + "]"; + } + } 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 0716583693194aa8307fe0a56ab8cdec00a338a6..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 @@ -759,4 +759,32 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions { assertEquals(0, new ModelComparator().compare(model, model2)); } + @Test + public void testParseBooleanReactionWithColors() throws Exception { + CellDesignerXmlParser parser = new CellDesignerXmlParser(); + Model model = parser.createModel(new ConverterParams().filename("testFiles/reactions/boolean-colors.xml")); + + Reaction r1 = model.getReactionByReactionId("re1"); + Set<Color> colors = new HashSet<>(); + for (AbstractNode node : r1.getNodes()) { + colors.add(node.getLine().getColor()); + } + assertEquals("Three different colors were used to draw the reaction", 3, colors.size()); + 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)); + } + + } diff --git a/converter-CellDesigner/testFiles/reactions/boolean-colors.xml b/converter-CellDesigner/testFiles/reactions/boolean-colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..23a16b92ed511048ee95d816b9a1eea92fd66995 --- /dev/null +++ b/converter-CellDesigner/testFiles/reactions/boolean-colors.xml @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sbml xmlns="http://www.sbml.org/sbml/level2/version4" xmlns:celldesigner="http://www.sbml.org/2001/ns/celldesigner" level="2" version="4"> +<model metaid="untitled" id="untitled"> +<annotation> +<celldesigner:extension> +<celldesigner:modelVersion>4.0</celldesigner:modelVersion> +<celldesigner:modelDisplay sizeX="600" sizeY="400"/> +<celldesigner:listOfCompartmentAliases/> +<celldesigner:listOfComplexSpeciesAliases/> +<celldesigner:listOfSpeciesAliases> +<celldesigner:speciesAlias id="sa1" species="s1"> +<celldesigner:activity>inactive</celldesigner:activity> +<celldesigner:bounds x="86.0" y="110.0" w="80.0" h="40.0"/> +<celldesigner:font size="12"/> +<celldesigner:view state="usual"/> +<celldesigner:usualView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="40.0"/> +<celldesigner:singleLine width="1.0"/> +<celldesigner:paint color="ffccffcc" scheme="Color"/> +</celldesigner:usualView> +<celldesigner:briefView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="60.0"/> +<celldesigner:singleLine width="0.0"/> +<celldesigner:paint color="3fff0000" scheme="Color"/> +</celldesigner:briefView> +<celldesigner:info state="empty" angle="-1.5707963267948966"/> +</celldesigner:speciesAlias> +<celldesigner:speciesAlias id="sa2" species="s2"> +<celldesigner:activity>inactive</celldesigner:activity> +<celldesigner:bounds x="91.0" y="220.0" w="80.0" h="40.0"/> +<celldesigner:font size="12"/> +<celldesigner:view state="usual"/> +<celldesigner:usualView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="40.0"/> +<celldesigner:singleLine width="1.0"/> +<celldesigner:paint color="ffccffcc" scheme="Color"/> +</celldesigner:usualView> +<celldesigner:briefView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="60.0"/> +<celldesigner:singleLine width="0.0"/> +<celldesigner:paint color="3fff0000" scheme="Color"/> +</celldesigner:briefView> +<celldesigner:info state="empty" angle="-1.5707963267948966"/> +</celldesigner:speciesAlias> +<celldesigner:speciesAlias id="sa3" species="s3"> +<celldesigner:activity>inactive</celldesigner:activity> +<celldesigner:bounds x="371.0" y="157.0" w="80.0" h="40.0"/> +<celldesigner:font size="12"/> +<celldesigner:view state="usual"/> +<celldesigner:usualView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="40.0"/> +<celldesigner:singleLine width="1.0"/> +<celldesigner:paint color="ffccffcc" scheme="Color"/> +</celldesigner:usualView> +<celldesigner:briefView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="60.0"/> +<celldesigner:singleLine width="0.0"/> +<celldesigner:paint color="3fff0000" scheme="Color"/> +</celldesigner:briefView> +<celldesigner:info state="empty" angle="-1.5707963267948966"/> +</celldesigner:speciesAlias> +</celldesigner:listOfSpeciesAliases> +<celldesigner:listOfGroups/> +<celldesigner:listOfProteins> +<celldesigner:protein id="pr1" name="s1" type="GENERIC"/> +<celldesigner:protein id="pr2" name="s2" type="GENERIC"/> +<celldesigner:protein id="pr3" name="s3" type="GENERIC"/> +</celldesigner:listOfProteins> +<celldesigner:listOfGenes/> +<celldesigner:listOfRNAs/> +<celldesigner:listOfAntisenseRNAs/> +<celldesigner:listOfLayers/> +<celldesigner:listOfBlockDiagrams/> +</celldesigner:extension> +</annotation> +<listOfUnitDefinitions> +<unitDefinition metaid="substance" id="substance" name="substance"> +<listOfUnits> +<unit metaid="CDMT00004" kind="mole"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="volume" id="volume" name="volume"> +<listOfUnits> +<unit metaid="CDMT00005" kind="litre"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="area" id="area" name="area"> +<listOfUnits> +<unit metaid="CDMT00006" kind="metre" exponent="2"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="length" id="length" name="length"> +<listOfUnits> +<unit metaid="CDMT00007" kind="metre"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="time" id="time" name="time"> +<listOfUnits> +<unit metaid="CDMT00008" kind="second"/> +</listOfUnits> +</unitDefinition> +</listOfUnitDefinitions> +<listOfCompartments> +<compartment metaid="default" id="default" size="1" units="volume"/> +</listOfCompartments> +<listOfSpecies> +<species metaid="s1" id="s1" name="s1" compartment="default" initialAmount="0"> +<annotation> +<celldesigner:extension> +<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment> +<celldesigner:speciesIdentity> +<celldesigner:class>PROTEIN</celldesigner:class> +<celldesigner:proteinReference>pr1</celldesigner:proteinReference> +</celldesigner:speciesIdentity> +</celldesigner:extension> +</annotation> +</species> +<species metaid="s2" id="s2" name="s2" compartment="default" initialAmount="0"> +<annotation> +<celldesigner:extension> +<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment> +<celldesigner:speciesIdentity> +<celldesigner:class>PROTEIN</celldesigner:class> +<celldesigner:proteinReference>pr2</celldesigner:proteinReference> +</celldesigner:speciesIdentity> +</celldesigner:extension> +</annotation> +</species> +<species metaid="s3" id="s3" name="s3" compartment="default" initialAmount="0"> +<annotation> +<celldesigner:extension> +<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment> +<celldesigner:speciesIdentity> +<celldesigner:class>PROTEIN</celldesigner:class> +<celldesigner:proteinReference>pr3</celldesigner:proteinReference> +</celldesigner:speciesIdentity> +</celldesigner:extension> +</annotation> +</species> +</listOfSpecies> +<listOfReactions> +<reaction metaid="re1" id="re1" reversible="false"> +<annotation> +<celldesigner:extension> +<celldesigner:reactionType>BOOLEAN_LOGIC_GATE</celldesigner:reactionType> +<celldesigner:baseReactants> +<celldesigner:baseReactant species="s2" alias="sa2"/> +<celldesigner:baseReactant species="s1" alias="sa1"/> +</celldesigner:baseReactants> +<celldesigner:baseProducts> +<celldesigner:baseProduct species="s3" alias="sa3"/> +</celldesigner:baseProducts> +<celldesigner:connectScheme connectPolicy="direct"/> +<celldesigner:editPoints>264.66666666666663,177.0</celldesigner:editPoints> +<celldesigner:line width="1.0" color="ffff00ff"/> +<celldesigner:listOfGateMember> +<celldesigner:GateMember type="BOOLEAN_LOGIC_GATE_AND" aliases="sa2,sa1" modificationType="REDUCED_TRIGGER" targetLineIndex="-1,-1" editPoints="264.66666666666663,177.0"> +<celldesigner:connectScheme connectPolicy="direct"> +<celldesigner:listOfLineDirection> +<celldesigner:lineDirection index="0" value="unknown"/> +</celldesigner:listOfLineDirection> +</celldesigner:connectScheme> +<celldesigner:line width="1.0" color="ffff00ff"/> +</celldesigner:GateMember> +<celldesigner:GateMember type="REDUCED_TRIGGER" aliases="sa2"> +<celldesigner:connectScheme connectPolicy="direct"> +<celldesigner:listOfLineDirection> +<celldesigner:lineDirection index="0" value="unknown"/> +</celldesigner:listOfLineDirection> +</celldesigner:connectScheme> +<celldesigner:linkTarget species="s2" alias="sa2"> +<celldesigner:linkAnchor position="INACTIVE"/> +</celldesigner:linkTarget> +<celldesigner:line width="1.0" color="ff00cc33"/> +</celldesigner:GateMember> +<celldesigner:GateMember type="REDUCED_TRIGGER" aliases="sa1" targetLineIndex="-1,0"> +<celldesigner:connectScheme connectPolicy="direct"> +<celldesigner:listOfLineDirection> +<celldesigner:lineDirection index="0" value="unknown"/> +</celldesigner:listOfLineDirection> +</celldesigner:connectScheme> +<celldesigner:linkTarget species="s1" alias="sa1"> +<celldesigner:linkAnchor position="INACTIVE"/> +</celldesigner:linkTarget> +<celldesigner:line width="1.0" color="ffff9999"/> +</celldesigner:GateMember> +</celldesigner:listOfGateMember> +</celldesigner:extension> +</annotation> +<listOfReactants> +<speciesReference metaid="CDMT00001" species="s2"> +<annotation> +<celldesigner:extension> +<celldesigner:alias>sa2</celldesigner:alias> +</celldesigner:extension> +</annotation> +</speciesReference> +<speciesReference metaid="CDMT00002" species="s1"> +<annotation> +<celldesigner:extension> +<celldesigner:alias>sa1</celldesigner:alias> +</celldesigner:extension> +</annotation> +</speciesReference> +</listOfReactants> +<listOfProducts> +<speciesReference metaid="CDMT00003" species="s3"> +<annotation> +<celldesigner:extension> +<celldesigner:alias>sa3</celldesigner:alias> +</celldesigner:extension> +</annotation> +</speciesReference> +</listOfProducts> +</reaction> +</listOfReactions> +</model> +</sbml> diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverter.java index e5785c8222c11297e494e44e4032a0d5c8f8a534..925e6e2566904679644adde76b72cf9c0bc497a4 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverter.java @@ -117,6 +117,8 @@ public class ReactionConverter extends BioEntityConverter<Reaction> { * where the rectangle should be drawn */ protected void drawRectangleData(final PolylineData line, final ReactionRect insideType, final Graphics2D graphics) { + Color color = graphics.getColor(); + graphics.setColor(line.getColor()); Point2D startPoint = line.getPoints().get(line.getPoints().size() / 2 - 1); Point2D endPoint = line.getPoints().get(line.getPoints().size() / 2); @@ -125,11 +127,11 @@ public class ReactionConverter extends BioEntityConverter<Reaction> { 0.5 - RECT_SIZE / (2 * startPoint.distance(endPoint))); Point2D rectEndPoint = pointTransformation.getPointOnLine(startPoint, endPoint, 0.5 + RECT_SIZE / (2 * startPoint.distance(endPoint))); - PolylineData preRectangleLine = new PolylineData(); + PolylineData preRectangleLine = line.getSubline(0, 0); preRectangleLine.addPoint(startPoint); preRectangleLine.addPoint(rectStartPoint); - PolylineData postRectangleLine = new PolylineData(); + PolylineData postRectangleLine = line.getSubline(0, 0); postRectangleLine.addPoint(rectEndPoint); postRectangleLine.addPoint(endPoint); @@ -171,10 +173,9 @@ public class ReactionConverter extends BioEntityConverter<Reaction> { // rectangle) graphics.rotate(angle, pointX, pointY); // fill rectangle - Color color = graphics.getColor(); graphics.setColor(Color.white); graphics.fill(rect); - graphics.setColor(color); + graphics.setColor(line.getColor()); // draw rectangle border graphics.draw(rect); @@ -203,12 +204,12 @@ public class ReactionConverter extends BioEntityConverter<Reaction> { } } + graphics.setColor(color); } @Override protected void drawImpl(final Reaction reaction, final Graphics2D graphics, final ConverterParams params) { Color color = graphics.getColor(); - graphics.setColor(reaction.getReactants().get(0).getLine().getColor()); // first reactants for (Reactant reactant : reaction.getReactants()) { if (isVisible(reactant, params)) { diff --git a/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/SbmlExporterTest.java b/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/SbmlExporterTest.java index 08b779a2dff81a5ec1bff34557ab7f8fe198dfe5..145e36e21ba025019f5d521ee7215783aa88f87d 100644 --- a/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/SbmlExporterTest.java +++ b/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/SbmlExporterTest.java @@ -2,13 +2,12 @@ package lcsb.mapviewer.converter.model.sbml; import static org.junit.Assert.*; -import java.awt.*; +import java.awt.Color; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.io.File; import java.lang.reflect.Modifier; import java.util.*; -import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -22,6 +21,8 @@ import lcsb.mapviewer.common.comparator.LineComparator; import lcsb.mapviewer.common.comparator.ListComparator; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.model.graphics.PolylineData; +import lcsb.mapviewer.model.graphics.PolylineDataComparator; import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.model.*; import lcsb.mapviewer.model.map.reaction.*; @@ -572,11 +573,17 @@ public class SbmlExporterTest extends SbmlTestFunctions { .createModel(new ConverterParams().filename("testFiles/cell_designer_problems/boolean_logic_gate.xml")); Model model = getModelAfterSerializing(originalModel); - new CellDesignerXmlParser().model2String(model); - List<Line2D> lines1 = originalModel.getReactions().iterator().next().getLines(); - List<Line2D> lines2 = model.getReactions().iterator().next().getLines(); + List<PolylineData> lines1 = new ArrayList<>(); + List<PolylineData> lines2 = new ArrayList<>(); - ListComparator<Line2D> comparator = new ListComparator<>(new LineComparator(Configuration.EPSILON)); + for (ReactionNode node : originalModel.getReactions().iterator().next().getReactionNodes()) { + lines1.add(node.getLine()); + } + for (ReactionNode node : model.getReactions().iterator().next().getReactionNodes()) { + lines2.add(node.getLine()); + } + + ListComparator<PolylineData> comparator = new ListComparator<>(new PolylineDataComparator(Configuration.EPSILON)); assertEquals(0, comparator.compare(lines1, lines2)); }