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

error reporting includes more info when there is a problem with exporting some elements to sbml

parent 17135d36
......@@ -37,6 +37,7 @@ import lcsb.mapviewer.converter.annotation.XmlAnnotationParser;
import lcsb.mapviewer.model.graphics.ArrowType;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.InconsistentModelException;
import lcsb.mapviewer.modelutils.map.ElementUtils;
public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.sbml.jsbml.AbstractNamedSBase>
extends XmlParser {
......@@ -81,18 +82,28 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
public void exportElements() throws InconsistentModelException {
Collection<T> speciesList = getElementList();
for (T species : speciesList) {
S sbmlElement = getSbmlElement(species);
for (T bioEntity : speciesList) {
try {
S sbmlElement = getSbmlElement(bioEntity);
if (sbmlElementByElementId.get(species.getElementId()) != null) {
throw new InconsistentModelException("More than one species with id: " + species.getElementId());
if (sbmlElementByElementId.get(bioEntity.getElementId()) != null) {
throw new InconsistentModelException("More than one species with id: " + bioEntity.getElementId());
}
sbmlElementByElementId.put(bioEntity.getElementId(), sbmlElement);
} catch (Exception e) {
throw new InconsistentModelException(new ElementUtils().getElementTag(bioEntity) +
"Problem with exporting bioEntity", e);
}
sbmlElementByElementId.put(species.getElementId(), sbmlElement);
}
if (isExtensionEnabled(SbmlExtension.LAYOUT)) {
for (T species : speciesList) {
AbstractReferenceGlyph elementGlyph = createGlyph(species);
sbmlGlyphByElementId.put(species.getElementId(), elementGlyph);
for (T bioEntity : speciesList) {
try {
AbstractReferenceGlyph elementGlyph = createGlyph(bioEntity);
sbmlGlyphByElementId.put(bioEntity.getElementId(), elementGlyph);
} catch (Exception e) {
throw new InconsistentModelException(new ElementUtils().getElementTag(bioEntity) +
"Problem with exporting bioEntity", e);
}
}
}
}
......@@ -294,7 +305,7 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
BoundingBox boundingBox = createBoundingBox(-2, 0, 4, 4);
result.getGroup().setFill(getColorDefinition(Color.WHITE).getId());
result.setBoundingBox(boundingBox);
Ellipse ellipse= new Ellipse();
Ellipse ellipse = new Ellipse();
ellipse.setAbsoluteCx(false);
ellipse.setAbsoluteCy(false);
ellipse.setAbsoluteRx(true);
......@@ -366,7 +377,7 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
polygon.addElement(createRenderPoint(33, 100));
polygon.addElement(createRenderPoint(33, 0));
result.getGroup().addElement(polygon);
Polygon crossBar = new Polygon();
crossBar.addElement(createRenderPoint(0, 0));
crossBar.addElement(createRenderPoint(0, 100));
......@@ -408,12 +419,11 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
}
public void setProvideDefaults(boolean provideDefaults) {
this.provideDefaults= provideDefaults;
this.provideDefaults = provideDefaults;
}
protected boolean isProvideDefaults() {
return provideDefaults;
}
}
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