Commit 64d2a989 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1458-glyphs-are-displayed-in-a-suboptimal-resolution' into...

Merge branch '1458-glyphs-are-displayed-in-a-suboptimal-resolution' into 1472-missing-info-about-species-id-for-sbml-import-warnings
parents 26dc4763 abc345c9
......@@ -4,6 +4,7 @@ minerva (16.0.0~alpha.2) stable; urgency=medium
* Small improvement: homomultimer information is provided in API (#1468)
* Small improvement: missing info about species for SBML parsing warning
(#1472)
* Small improvement: glyph quality is improved (#1458)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 26 Mar 2021 10:00:00 +0200
......
......@@ -99,10 +99,11 @@ public abstract class ElementConverter<T extends Element> extends BioEntityConve
protected void drawGlyph(T bioEntity, Graphics2D graphics) throws DrawingException {
try {
Image img = ImageIO.read(new ByteArrayInputStream(bioEntity.getGlyph().getFile().getFileContent()));
graphics.drawImage(img,
Image scaledImage = img.getScaledInstance(bioEntity.getWidth().intValue(), bioEntity.getHeight().intValue(), Image.SCALE_SMOOTH);
graphics.drawImage(scaledImage,
bioEntity.getX().intValue(), bioEntity.getY().intValue(),
(int) (bioEntity.getX() + bioEntity.getWidth()), (int) (bioEntity.getY() + bioEntity.getHeight()),
0, 0, img.getWidth(null), img.getHeight(null),
null);
} catch (IOException e) {
throw new DrawingException(
......
......@@ -16,6 +16,7 @@ import lcsb.mapviewer.common.UnitTestFailedWatcher;
import lcsb.mapviewer.model.graphics.*;
import lcsb.mapviewer.model.map.compartment.PathwayCompartment;
import lcsb.mapviewer.model.map.compartment.SquareCompartment;
import lcsb.mapviewer.model.map.layout.graphics.LayerText;
import lcsb.mapviewer.model.map.modifier.Catalysis;
import lcsb.mapviewer.model.map.reaction.*;
import lcsb.mapviewer.model.map.species.*;
......@@ -93,6 +94,19 @@ public abstract class GraphicsTestFunctions {
return complex;
}
protected LayerText createText() {
LayerText layerText = new LayerText();
layerText.setX(256.0);
layerText.setY(79.0);
layerText.setWidth(233.0);
layerText.setHeight(188.0);
layerText.setZ(0);
layerText.setNotes("asd as");
layerText.setColor(Color.BLACK);
return layerText;
}
protected List<Color> removeAlpha(List<Color> allValues) {
List<Color> result = new ArrayList<>();
for (Color color : allValues) {
......
package lcsb.mapviewer.converter.graphics;
import java.awt.*;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.nio.file.Files;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -10,12 +13,12 @@ import org.junit.*;
import lcsb.mapviewer.commands.CreateHierarchyCommand;
import lcsb.mapviewer.converter.graphics.AbstractImageGenerator.Params;
import lcsb.mapviewer.model.cache.UploadedFileEntry;
import lcsb.mapviewer.model.graphics.PolylineData;
import lcsb.mapviewer.model.map.layout.graphics.Layer;
import lcsb.mapviewer.model.map.layout.graphics.LayerText;
import lcsb.mapviewer.model.map.layout.graphics.*;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelFullIndexed;
import lcsb.mapviewer.model.map.species.Complex;
import lcsb.mapviewer.model.map.species.*;
public class NormalImageGeneratorTest extends GraphicsTestFunctions {
static Logger logger = LogManager.getLogger();
......@@ -33,27 +36,15 @@ public class NormalImageGeneratorTest extends GraphicsTestFunctions {
model.setWidth(526);
model.setHeight(346);
LayerText compAlias = new LayerText();
compAlias.setX(256.0);
compAlias.setY(79.0);
compAlias.setWidth(233.0);
compAlias.setHeight(188.0);
compAlias.setNotes("asd as");
compAlias.setColor(Color.BLACK);
LayerText layerText = createText();
Layer layer = new Layer();
layer.addLayerText(compAlias);
layer.addLayerText(layerText);
layer.setVisible(true);
model.addLayer(layer);
layer.addLayerLine(new PolylineData(new Point2D.Double(0, 0), new Point2D.Double(100, 100)));
Complex alias = new Complex("1");
alias.setName("a");
alias.setX(300);
alias.setY(90);
alias.setWidth(100);
alias.setHeight(50);
model.addElement(alias);
model.addElement(createComplex());
return 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