Skip to content
Snippets Groups Projects
Commit 963352dc authored by Piotr Gawron's avatar Piotr Gawron
Browse files

line width is export/imported properly

parent 18b64eb6
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!452Resolve "Allow for color and line thickness control in the generated layout"
Pipeline #6754 passed
......@@ -247,6 +247,7 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
LocalStyle style = createStyle(reaction);
ColorDefinition color = getColorDefinition(reaction.getReactants().get(0).getLine().getColor());
style.getGroup().setStrokeWidth(reaction.getReactants().get(0).getLine().getWidth());
style.getGroup().setFill(color.getId());
assignStyleToGlyph(reactionGlyph, style);
......
......@@ -210,7 +210,7 @@ public class SbmlReactionParser extends SbmlBioEntityParser {
operator.setLine(line);
reactionWithLayout.addNode(operator);
}
assignColorToReaction(glyph, reactionWithLayout);
assignRenderDataToReaction(glyph, reactionWithLayout);
minervaModel.addReaction(reactionWithLayout);
} catch (InvalidArgumentException e) {
......@@ -265,7 +265,7 @@ public class SbmlReactionParser extends SbmlBioEntityParser {
return nodeClass;
}
private void assignColorToReaction(ReactionGlyph glyph, Reaction reactionWithLayout)
private void assignRenderDataToReaction(ReactionGlyph glyph, Reaction reactionWithLayout)
throws InvalidInputDataExecption {
RenderGraphicalObjectPlugin rgop = (RenderGraphicalObjectPlugin) glyph.getExtension(RenderConstants.shortLabel);
if (rgop != null) {
......@@ -279,6 +279,11 @@ public class SbmlReactionParser extends SbmlBioEntityParser {
node.getLine().setColor(color);
}
}
if (style.getGroup().getStrokeWidth() != null) {
for (AbstractNode node : reactionWithLayout.getNodes()) {
node.getLine().setWidth(style.getGroup().getStrokeWidth());
}
}
}
}
......
......@@ -298,4 +298,16 @@ public class SbmlExporterTest {
assertEquals(0, comparator.compare(model, model2));
}
@Test
public void testReactionLineWidthParsing() throws Exception {
Model model = parser.createModel(new ConverterParams().filename("testFiles/layoutExample/example1.xml"));
for (Reaction element : model.getReactions()) {
for (AbstractNode node: element.getNodes()) {
node.getLine().setWidth(12.7);
}
}
Model model2 = getModelAfterSerializing(model);
assertEquals(0, comparator.compare(model, model2));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment