Commit 6e1b429b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

sbgnml did not export text label border properly

parent 0e438f45
......@@ -494,6 +494,12 @@ public class SbgnmlXmlExporter {
private Label getGlyphLabelFromAlias(Element element) {
Label label = new Label();
label.setText(element.getName());
Bbox box = new Bbox();
box.setX(element.getNameX().floatValue());
box.setY(element.getNameY().floatValue());
box.setW(element.getNameWidth().floatValue());
box.setH(element.getNameHeight().floatValue());
label.setBbox(box);
return label;
}
......
......@@ -766,9 +766,12 @@ public class SbgnmlXmlParser {
newSpecies.setNameWidth(g.getLabel().getBbox().getW());
newSpecies.setNameHeight(g.getLabel().getBbox().getH());
newSpecies.setNameHorizontalAlign(HorizontalAlign.CENTER);
newSpecies.setNameVerticalAlign(VerticalAlign.MIDDLE);
if (newSpecies instanceof Complex) {
newSpecies.setNameVerticalAlign(VerticalAlign.BOTTOM);
} else {
newSpecies.setNameVerticalAlign(VerticalAlign.MIDDLE);
}
}
} else {
newSpecies.setName("");
}
......
......@@ -80,7 +80,7 @@ public class SbgnmlSerializationTest extends SbgnmlTestFunctions {
e.setPositionToCompartment(null);
}
assertEquals("Import/export shouldn't produce any wanrnings", 0, super.getWarnings().size());
assertEquals("Import/export shouldn't produce any warnings", 0, super.getWarnings().size());
ModelComparator mc = new ModelComparator(0.001);
assertEquals(0, mc.compare(model, model2));
}
......
......@@ -118,6 +118,7 @@ public class SbgnmlXmlExporterTest extends SbgnmlTestFunctions {
ion.setHeight(100);
ion.setX(200 * (id % 2 + 1));
ion.setY(50 * (id / 2 + 1));
ion.setNameBorder(ion.getBorder());
ion.setOnlySubstanceUnits(true);
ion.setConstant(true);
ion.setInitialAmount(2.0);
......
Supports Markdown
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