Commit 61074fc5 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

jsbml upgraded to 1.5

parent 6ca0573d
......@@ -300,14 +300,10 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
result.getGroup().setFill(getColorDefinition(Color.WHITE).getId());
result.setBoundingBox(boundingBox);
Ellipse ellipse = new Ellipse();
ellipse.setAbsoluteCx(false);
ellipse.setAbsoluteCy(false);
ellipse.setAbsoluteRx(true);
ellipse.setAbsoluteRy(true);
ellipse.setCx(0.0);
ellipse.setCy(0.0);
ellipse.setRx(4.0);
ellipse.setRy(4.0);
ellipse.setCx(new RelAbsVector(0, 0));
ellipse.setCy(new RelAbsVector(0, 0));
ellipse.setRx(new RelAbsVector(4, 0));
ellipse.setRy(new RelAbsVector(4, 0));
result.getGroup().addElement(ellipse);
}
......@@ -385,10 +381,8 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
protected RenderPoint createRenderPoint(double percentX, int percentY) {
RenderPoint result = new RenderPoint();
result.setAbsoluteX(false);
result.setX(percentX);
result.setAbsoluteY(false);
result.setY(percentY);
result.setX(new RelAbsVector(0, percentX));
result.setY(new RelAbsVector(0, percentY));
return result;
}
......
......@@ -51,12 +51,7 @@ public class SbmlExporter {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
SBMLWriter.write(doc, stream, "minerva", Configuration.getSystemVersion(null));
return stream.toString("UTF-8")
// TODO bug: https://github.com/sbmlteam/jsbml/issues/158
.replace("<listOfSpeciesFeatures>", "<multi:listOfSpeciesFeatures>")
.replace("</listOfSpeciesFeatures>", "</multi:listOfSpeciesFeatures>")
//TODO bug: https://github.com/sbmlteam/jsbml/pull/222
.replace("render:basepoint", "render:basePoint");
return stream.toString("UTF-8");
} catch (UnsupportedEncodingException | XMLStreamException e) {
throw new InvalidStateException(e);
}
......
......@@ -99,29 +99,19 @@ public class SbmlCompartmentExporter extends SbmlElementExporter<Compartment, or
style.getGroup().setStroke(getColorDefinition(element.getBorderColor()).getId());
if (element instanceof OvalCompartment) {
Ellipse ellipse = new Ellipse();
ellipse.setAbsoluteRx(false);
ellipse.setAbsoluteRy(false);
ellipse.setAbsoluteCx(false);
ellipse.setAbsoluteCy(false);
ellipse.setCx(50);
ellipse.setCy(50.0);
ellipse.setRx(50.0);
ellipse.setRy(50.0);
ellipse.setCx(new RelAbsVector(0, 50));
ellipse.setCy(new RelAbsVector(0, 50));
ellipse.setRx(new RelAbsVector(0, 50));
ellipse.setRy(new RelAbsVector(0, 50));
style.getGroup().addElement(ellipse);
} else {
Rectangle rectangle = new Rectangle();
rectangle.setAbsoluteRx(false);
rectangle.setAbsoluteRy(false);
rectangle.setAbsoluteX(false);
rectangle.setAbsoluteY(false);
rectangle.setAbsoluteHeight(false);
rectangle.setAbsoluteWidth(false);
rectangle.setRx(0);
rectangle.setRy(0);
rectangle.setX(0);
rectangle.setY(0);
rectangle.setWidth(100);
rectangle.setHeight(100);
rectangle.setRx(new RelAbsVector(0, 0));
rectangle.setRy(new RelAbsVector(0, 0));
rectangle.setX(new RelAbsVector(0, 0));
rectangle.setY(new RelAbsVector(0, 0));
rectangle.setWidth(new RelAbsVector(0, 100));
rectangle.setHeight(new RelAbsVector(0, 100));
style.getGroup().addElement(rectangle);
}
......
package lcsb.mapviewer.converter.model.sbml.species;
import java.lang.reflect.Method;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
......@@ -11,7 +10,6 @@ import org.sbml.jsbml.ext.layout.*;
import org.sbml.jsbml.ext.multi.*;
import org.sbml.jsbml.ext.render.*;
import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.converter.model.sbml.SbmlElementExporter;
import lcsb.mapviewer.converter.model.sbml.SbmlExtension;
import lcsb.mapviewer.converter.model.sbml.compartment.SbmlCompartmentExporter;
......@@ -507,14 +505,10 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
}
Ellipse ellipse = new Ellipse();
ellipse.setAbsoluteRx(true);
ellipse.setAbsoluteRy(true);
ellipse.setAbsoluteCx(true);
ellipse.setAbsoluteCy(true);
ellipse.setCx(degraded.getWidth() / 2);
ellipse.setCy(diameter / 2 + DEGRADED_CROSS_LINE_EXTENDED_LENGTH);
ellipse.setRx(diameter / 2);
ellipse.setRy(diameter / 2);
ellipse.setCx(new RelAbsVector(degraded.getWidth() / 2));
ellipse.setCy(new RelAbsVector(diameter / 2 + DEGRADED_CROSS_LINE_EXTENDED_LENGTH));
ellipse.setRx(new RelAbsVector(diameter / 2));
ellipse.setRy(new RelAbsVector(diameter / 2));
result.add(ellipse);
......@@ -685,31 +679,21 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
private Rectangle createDeafultShape() {
Rectangle rectangle = new Rectangle();
rectangle.setAbsoluteRx(false);
rectangle.setAbsoluteRy(false);
rectangle.setAbsoluteX(false);
rectangle.setAbsoluteY(false);
rectangle.setAbsoluteHeight(false);
rectangle.setAbsoluteWidth(false);
rectangle.setRx(0);
rectangle.setRy(0);
rectangle.setX(0);
rectangle.setY(0);
rectangle.setWidth(100);
rectangle.setHeight(100);
rectangle.setRx(new RelAbsVector(0, 0));
rectangle.setRy(new RelAbsVector(0, 0));
rectangle.setX(new RelAbsVector(0, 0));
rectangle.setY(new RelAbsVector(0, 0));
rectangle.setWidth(new RelAbsVector(0, 100));
rectangle.setHeight(new RelAbsVector(0, 100));
return rectangle;
}
private Ellipse createEllipseShape() {
Ellipse ellipse = new Ellipse();
ellipse.setAbsoluteRx(false);
ellipse.setAbsoluteRy(false);
ellipse.setAbsoluteCx(false);
ellipse.setAbsoluteCy(false);
ellipse.setCx(50);
ellipse.setCy(50.0);
ellipse.setRx(50.0);
ellipse.setRy(50.0);
ellipse.setCx(new RelAbsVector(0, 50));
ellipse.setCy(new RelAbsVector(0, 50));
ellipse.setRx(new RelAbsVector(0, 50));
ellipse.setRy(new RelAbsVector(0, 50));
return ellipse;
}
......@@ -754,44 +738,25 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
private void createRelativePoint(Polygon polygon, double x, double y) {
RenderPoint p1 = polygon.createRenderPoint();
p1.setAbsoluteX(false);
p1.setAbsoluteY(false);
p1.setX(x);
p1.setY(y);
p1.setX(new RelAbsVector(0, x));
p1.setY(new RelAbsVector(0, y));
}
private void createAbsolutePoint(Polygon polygon, double x, double y) {
RenderPoint p1 = polygon.createRenderPoint();
p1.setAbsoluteX(true);
p1.setAbsoluteY(true);
p1.setX(Math.round(x));
p1.setY(Math.round(y));
p1.setX(new RelAbsVector(Math.round(x)));
p1.setY(new RelAbsVector(Math.round(y)));
}
private void createAbsoluteBezierPoint(Polygon polygon, double x, double y, double x1, double y1, double x2,
double y2) {
RenderCubicBezier result = (RenderCubicBezier) polygon.createRenderCubicBezier();
result.setAbsoluteX(true);
result.setAbsoluteY(true);
result.setX(Math.round(x));
result.setY(Math.round(y));
result.setAbsoluteX1(true);
result.setAbsoluteY1(true);
result.setX1(Math.round(x1));
result.setY1(Math.round(y1));
result.setAbsoluteX2(true);
result.setAbsoluteY2(true);
result.setX2(Math.round(x2));
result.setY2(Math.round(y2));
try {
Method method = RenderCurveSegment.class.getDeclaredMethod("setType", RenderCurveSegment.Type.class);
method.setAccessible(true);
method.invoke(result, RenderCurveSegment.Type.RENDER_CUBIC_BEZIER);
} catch (Exception e) {
throw new InvalidStateException("Problem with JSBML", e);
}
result.setX(new RelAbsVector(Math.round(x)));
result.setY(new RelAbsVector(Math.round(y)));
result.setX1(new RelAbsVector(Math.round(x1)));
result.setY1(new RelAbsVector(Math.round(y1)));
result.setX2(new RelAbsVector(Math.round(x2)));
result.setY2(new RelAbsVector(Math.round(y2)));
}
@Override
......
......@@ -100,7 +100,7 @@
<commons-validator.version>1.6</commons-validator.version>
<jsbml.version>1.4</jsbml.version>
<jsbml.version>1.5</jsbml.version>
<chebi-ws.version>2.4</chebi-ws.version>
......
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