Commit 5992ea86 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

export/import of border color works the same as before introducing border color

parent ffc1f543
......@@ -1514,6 +1514,7 @@ public class SbgnmlXmlParser {
compartment.setY(new Double(glyph.getBbox().getY()));
compartment.setThickness(1.0);
compartment.setFillColor(COMPARTMENT_COLOR);
compartment.setBorderColor(COMPARTMENT_COLOR);
if (glyph.getLabel() != null && glyph.getLabel().getBbox() != null) {
compartment.setNamePoint(glyph.getLabel().getBbox().getX(), glyph.getLabel().getBbox().getY());
......
......@@ -21,6 +21,7 @@ import lcsb.mapviewer.converter.annotation.XmlAnnotationParser;
import lcsb.mapviewer.converter.model.sbml.species.ElementColorEnum;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.model.Author;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.species.Element;
......@@ -147,6 +148,9 @@ public class SbmlBioEntityParser {
if (result instanceof Element) {
Element element = (Element) result;
element.setFillColor(ElementColorEnum.getColorByClass(element.getClass()));
if (result instanceof Compartment) {
element.setBorderColor(ElementColorEnum.getColorByClass(element.getClass()));
}
}
}
......
......@@ -13,6 +13,7 @@ import org.sbml.jsbml.ext.render.LocalStyle;
import lcsb.mapviewer.common.Pair;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.species.Element;
public abstract class SbmlElementParser<T extends org.sbml.jsbml.Symbol> extends SbmlBioEntityParser {
......@@ -116,6 +117,9 @@ public abstract class SbmlElementParser<T extends org.sbml.jsbml.Symbol> extends
if (style.getGroup().isSetFill()) {
Color backgroundColor = getColorByColorDefinition(style.getGroup().getFill());
elementWithLayout.setFillColor(backgroundColor);
if (elementWithLayout instanceof Compartment) {
elementWithLayout.setBorderColor(backgroundColor);
}
}
if (style.getGroup().isSetFontSize()) {
elementWithLayout.setFontSize(style.getGroup().getFontSize());
......
......@@ -81,6 +81,9 @@ public class SbmlCompartmentParser extends SbmlElementParser<org.sbml.jsbml.Comp
if (!style.getGroup().isSetFill() && style.getGroup().isSetStroke()) {
Color backgroundColor = getColorByColorDefinition(style.getGroup().getStroke());
elementWithLayout.setFillColor(backgroundColor);
if (elementWithLayout instanceof Compartment) {
elementWithLayout.setBorderColor(backgroundColor);
}
}
}
......
......@@ -242,7 +242,7 @@ public class SbmlExporterTest extends SbmlTestFunctions {
@Test
public void testColorParsing() throws Exception {
Model model = parser.createModel(new ConverterParams().filename("testFiles/layoutExample/example1.xml"));
for (Element element : model.getElements()) {
for (Species element : model.getSpeciesList()) {
element.setFillColor(Color.BLUE);
}
Model model2 = getModelAfterSerializing(model);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment