diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/BottomSquareCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/BottomSquareCompartmentConverter.java index 862cdb82efa56b106a3f560cb038e447d77adf4a..de023622f39a0f46f708c8f4b8d30dab0f67b8dd 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/BottomSquareCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/BottomSquareCompartmentConverter.java @@ -13,6 +13,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.BottomSquareCompartment; import lcsb.mapviewer.model.map.layout.ColorSchema; @@ -44,7 +45,7 @@ public class BottomSquareCompartmentConverter extends CompartmentConverter<Botto } @Override - public void draw(final BottomSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final BottomSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { // keep the old values of colors and line Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke(); diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/CompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/CompartmentConverter.java index 2221b5a5d7acac56a3492111056ef1bf19917165..d9194ae326a28a7476ce04eb7dcc219003aefd79 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/CompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/CompartmentConverter.java @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.geometry.EllipseTransformation; import lcsb.mapviewer.common.geometry.LineTransformation; import lcsb.mapviewer.converter.graphics.ConverterParams; @@ -21,6 +20,7 @@ import lcsb.mapviewer.converter.graphics.geometry.RectangleTooSmallException; import lcsb.mapviewer.converter.graphics.placefinder.PlaceFinder; import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.layout.ColorSchema; +import lcsb.mapviewer.modelutils.map.ElementUtils; /** * Abstract class responsible for common methods to draw compartmentAliases on @@ -98,10 +98,9 @@ public abstract class CompartmentConverter<T extends Compartment> extends Elemen }; @Override - public void drawText(final T compartment, final Graphics2D graphics, final ConverterParams params) { + public void drawText(final T compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { if (compartment.getWidth() < Configuration.EPSILON || compartment.getHeight() < Configuration.EPSILON) { - throw new InvalidArgumentException( - "Dimension of the alias must be bigger than 0. Alias id: " + compartment.getElementId() + " (name: \"" + compartment.getName() + "\")"); + throw new DrawingException(new ElementUtils().getElementTag(compartment) + "Dimension of the alias must be bigger than 0."); } Rectangle2D border = compartment.getBorder(); if (isVisible(compartment, params) && !isTransparent(compartment, params)) { diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/LeftSquareCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/LeftSquareCompartmentConverter.java index cacd7fa860b2fac75d447b62ccac7d998e12cb46..5b8b989f13044bdbd7bbf99b95c03bd66c5d0f63 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/LeftSquareCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/LeftSquareCompartmentConverter.java @@ -11,6 +11,7 @@ import java.awt.geom.Rectangle2D; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.LeftSquareCompartment; import lcsb.mapviewer.model.map.layout.ColorSchema; @@ -44,7 +45,7 @@ public class LeftSquareCompartmentConverter extends CompartmentConverter<LeftSqu } @Override - public void draw(final LeftSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final LeftSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { // keep the old values of color and line type Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke(); diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/OvalCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/OvalCompartmentConverter.java index 94bf3c470241e0fe1c5c09feeaef1c03c3be91a2..f570a7937d439535143be54b70251589ac45900b 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/OvalCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/OvalCompartmentConverter.java @@ -10,6 +10,7 @@ import java.awt.geom.Point2D; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.compartment.OvalCompartment; @@ -47,7 +48,7 @@ public class OvalCompartmentConverter extends CompartmentConverter<OvalCompartme } @Override - public void draw(final OvalCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final OvalCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { // keep the old values of color and line type Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke(); diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/PathwayCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/PathwayCompartmentConverter.java index fb3518522110b69d730092da16c54e940b3063e1..9440065afb029eeb5dac45d12ab563041b64ea4e 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/PathwayCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/PathwayCompartmentConverter.java @@ -9,6 +9,7 @@ import java.awt.geom.Rectangle2D; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.PathwayCompartment; import lcsb.mapviewer.model.map.layout.ColorSchema; @@ -40,7 +41,7 @@ public class PathwayCompartmentConverter extends CompartmentConverter<PathwayCom private Color backgroundColor = Color.LIGHT_GRAY; @Override - public void draw(final PathwayCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final PathwayCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { // keep the old values of colors and line Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke(); diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/RightSquareCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/RightSquareCompartmentConverter.java index a9461ebb57a23f986f6502d192abbe30f10ad1ea..0dde9a347eb5f22c52c779b49b8835d5b5e5668a 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/RightSquareCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/RightSquareCompartmentConverter.java @@ -11,6 +11,7 @@ import java.awt.geom.Rectangle2D; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.RightSquareCompartment; import lcsb.mapviewer.model.map.layout.ColorSchema; @@ -44,7 +45,7 @@ public class RightSquareCompartmentConverter extends CompartmentConverter<RightS } @Override - public void draw(final RightSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final RightSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { // keep the old values of color and line type Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke(); diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/SquareCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/SquareCompartmentConverter.java index 2cd4017c5eaefa760d42456e522be50c03cdf9e2..8f320bf9a3958527c194af918f3371d7bf9207f2 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/SquareCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/SquareCompartmentConverter.java @@ -12,6 +12,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.compartment.SquareCompartment; @@ -60,7 +61,7 @@ public class SquareCompartmentConverter extends CompartmentConverter<SquareCompa } @Override - public void draw(final SquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final SquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { // keep the old values of color and line type Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke(); diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/TopSquareCompartmentConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/TopSquareCompartmentConverter.java index 7832bd282364731c4245f950f3e5959ff1ea4a01..2e1ef6dfcd8b922dc489f34e81d712a313a2c692 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/TopSquareCompartmentConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/TopSquareCompartmentConverter.java @@ -11,6 +11,7 @@ import java.awt.geom.Rectangle2D; import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.map.compartment.TopSquareCompartment; import lcsb.mapviewer.model.map.layout.ColorSchema; @@ -44,7 +45,7 @@ public class TopSquareCompartmentConverter extends CompartmentConverter<TopSquar } @Override - public void draw(final TopSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) { + public void draw(final TopSquareCompartment compartment, final Graphics2D graphics, final ConverterParams params) throws DrawingException { Color oldColor = graphics.getColor(); Stroke oldStroke = graphics.getStroke();