From ad0743b4acdcfee15e75dcdf539e5ebecfc0ad03 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 7 Nov 2018 11:27:50 +0100 Subject: [PATCH] line width of species is exported/imported --- .../converter/model/sbml/SbmlElementParser.java | 2 +- .../model/sbml/species/SbmlSpeciesExporter.java | 7 +++++++ .../model/sbml/species/SbmlSpeciesParser.java | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlElementParser.java b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlElementParser.java index 0f9972fd83..8f630430f0 100644 --- a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlElementParser.java +++ b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlElementParser.java @@ -117,7 +117,7 @@ public abstract class SbmlElementParser<T extends org.sbml.jsbml.Symbol> extends return elementWithLayout; } - private void applyStyleToElement(Element elementWithLayout, LocalStyle style) { + protected void applyStyleToElement(Element elementWithLayout, LocalStyle style) { if (style.getGroup().getFill() != null) { Color backgroundColor = getColorByColorDefinition(style.getGroup().getFill()); elementWithLayout.setColor(backgroundColor); diff --git a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java index 795058f679..def1bc2fad 100644 --- a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java +++ b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java @@ -5,6 +5,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.sbml.jsbml.ext.layout.AbstractReferenceGlyph; import org.sbml.jsbml.ext.layout.Layout; +import org.sbml.jsbml.ext.render.LocalStyle; import lcsb.mapviewer.converter.model.sbml.SbmlCompartmentExporter; import lcsb.mapviewer.converter.model.sbml.SbmlElementExporter; @@ -54,4 +55,10 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j return element.getClass().getSimpleName() + "\n" + element.getName() + "\n" + compartmentName; } + protected LocalStyle createStyle(Species element) { + LocalStyle style = super.createStyle(element); + style.getGroup().setStrokeWidth(element.getLineWidth()); + return style; + } + } diff --git a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java index 39b6489a4f..920775107e 100644 --- a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java +++ b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java @@ -1,5 +1,6 @@ package lcsb.mapviewer.converter.model.sbml.species; +import java.awt.Color; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -11,6 +12,7 @@ import org.sbml.jsbml.ext.layout.AbstractReferenceGlyph; import org.sbml.jsbml.ext.layout.CompartmentGlyph; import org.sbml.jsbml.ext.layout.Layout; import org.sbml.jsbml.ext.layout.SpeciesGlyph; +import org.sbml.jsbml.ext.render.LocalStyle; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidStateException; @@ -99,4 +101,14 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species> return result; } + + @Override + protected void applyStyleToElement(Element elementWithLayout, LocalStyle style) { + super.applyStyleToElement(elementWithLayout, style); + Species specisWithLayout = (Species) elementWithLayout; + if (style.getGroup().getStrokeWidth() != null) { + specisWithLayout.setLineWidth(style.getGroup().getStrokeWidth()); + } + } + } -- GitLab