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

modification glyphs reference glyph is provided properly and bounding box is defined

parent a5a07982
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",!591Resolve "SBML Reaction glyphs missing curve segment result in NullPointer exception"
Pipeline #8426 passed
......@@ -527,8 +527,14 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
GeneralGlyph modificationGlyph = getLayout().createGeneralGlyph("modification_" + (idCounter++),
modificationFeatureValue.getId());
ReferenceGlyph referenceGlyph = new ReferenceGlyph("modification_reference_" + (idCounter++));
referenceGlyph.setReference(speciesGlyph.getId());
referenceGlyph.setGlyph(speciesGlyph.getId());
referenceGlyph.setBoundingBox(createBoundingBoxForModification(mr));
modificationGlyph.addReferenceGlyph(referenceGlyph);
modificationGlyph.setBoundingBox(createBoundingBoxForModification(mr));
}
private BoundingBox createBoundingBoxForModification(ModificationResidue mr) {
double width, height;
if (mr instanceof AbstractRegionModification) {
width = ((AbstractRegionModification) mr).getWidth();
......@@ -545,7 +551,7 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
dimensions.setWidth(width);
dimensions.setHeight(height);
boundingBox.setDimensions(dimensions);
modificationGlyph.setBoundingBox(boundingBox);
return boundingBox;
}
private int modificationResidueCounter = 0;
......
......@@ -414,7 +414,7 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species>
if (((GeneralGlyph) graphicalObject).getListOfReferenceGlyphs().size() > 0) {
// find a reference to the alias in layout, so we know it's the proper value
ReferenceGlyph referenceGlyph = ((GeneralGlyph) graphicalObject).getListOfReferenceGlyphs().get(0);
if (referenceGlyph.getReference().equals(mr.getSpecies().getElementId())) {
if (referenceGlyph.getGlyph().equals(mr.getSpecies().getElementId())) {
residueGlyph = (GeneralGlyph) graphicalObject;
}
} else {
......
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