Commit 8c0a96c8 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

comaprtments are more scattered

parent c370fc55
minerva (15.0.0~alpha.0) stable; urgency=medium minerva (15.0.0~alpha.0) stable; urgency=medium
* Improvement: logs provided for validation data model are structurized (#325) * Improvement: logs provided for validation data model are structurized (#325)
* Small improvement: compartments in not layouted SBML file are more
scattered (#326)
* Small improvement: when downloading a map results in too big file (>1MB) * Small improvement: when downloading a map results in too big file (>1MB)
the content is compressed and returned as a zip file (#348) the content is compressed and returned as a zip file (#348)
* Small improvement: confirmation dialog when removing "general view" * Small improvement: confirmation dialog when removing "general view"
......
...@@ -31,6 +31,8 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { ...@@ -31,6 +31,8 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
private static final int SPECIES_WIDTH = 90; private static final int SPECIES_WIDTH = 90;
private static final int SPECIES_HEIGHT = 30; private static final int SPECIES_HEIGHT = 30;
private static final double COMPLEX_PADDING = 5; private static final double COMPLEX_PADDING = 5;
private double borderOffset = COMPARTMENT_BORDER;
/** /**
* Default class logger. * Default class logger.
*/ */
...@@ -113,7 +115,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { ...@@ -113,7 +115,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
Compartment compartment = compartments.iterator().next(); Compartment compartment = compartments.iterator().next();
Rectangle2D border = computeCompartmentBorder(compartment, elements, minPoint, dimension); Rectangle2D border = computeCompartmentBorder(compartment, elements, minPoint, dimension);
compartment.setBorder(border); compartment.setBorder(border);
compartment.setNamePoint(border.getX() + COMPARTMENT_BORDER, border.getY() + COMPARTMENT_BORDER); compartment.setNamePoint(border.getX() + COMPARTMENT_BORDER * 2, border.getY() + COMPARTMENT_BORDER * 2);
Point2D point = new Point2D.Double(border.getX(), border.getY()); Point2D point = new Point2D.Double(border.getX(), border.getY());
Dimension2D recursiveDimension = new DoubleDimension(border.getWidth(), border.getHeight()); Dimension2D recursiveDimension = new DoubleDimension(border.getWidth(), border.getHeight());
Set<Element> elementsToModify = new HashSet<>(compartment.getElements()); Set<Element> elementsToModify = new HashSet<>(compartment.getElements());
...@@ -170,9 +172,9 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { ...@@ -170,9 +172,9 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
private Rectangle2D computeCompartmentBorder(Compartment compartment, Collection<Element> elements, Point2D minPoint, private Rectangle2D computeCompartmentBorder(Compartment compartment, Collection<Element> elements, Point2D minPoint,
Dimension2D dimension) { Dimension2D dimension) {
Rectangle2D border = new Rectangle2D.Double(minPoint.getX() + COMPARTMENT_BORDER, Rectangle2D border = new Rectangle2D.Double(minPoint.getX() + borderOffset,
minPoint.getY() + COMPARTMENT_BORDER, dimension.getWidth() - COMPARTMENT_BORDER * 2, minPoint.getY() + borderOffset, dimension.getWidth() - borderOffset * 2,
dimension.getHeight() - COMPARTMENT_BORDER * 2); dimension.getHeight() - borderOffset * 2);
for (Element element : compartment.getElements()) { for (Element element : compartment.getElements()) {
if (!elements.contains(element) && element.getBorder() != null && element.getX() != 0 && element.getY() != 0) { if (!elements.contains(element) && element.getBorder() != null && element.getX() != 0 && element.getY() != 0) {
border.add(element.getBorder()); border.add(element.getBorder());
...@@ -405,6 +407,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { ...@@ -405,6 +407,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
height = Math.max(height, minPoint.getY() + dimension.getHeight()); height = Math.max(height, minPoint.getY() + dimension.getHeight());
model.setWidth(width); model.setWidth(width);
model.setHeight(height); model.setHeight(height);
borderOffset = Math.max(borderOffset, Math.max(width, height) * 0.01);
} }
protected Point2D estimateLayoutMinPoint(Model model) { protected Point2D estimateLayoutMinPoint(Model 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