Skip to content
Snippets Groups Projects
Commit 9d87335d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '664-unknown-inhibition-is-displayed-incorrectly-in-minerva' into 'master'

Resolve "Unknown inhibition is displayed incorrectly in Minerva"

Closes #664

See merge request !707
parents c7b5c331 1d7653a2
No related branches found
No related tags found
1 merge request!707Resolve "Unknown inhibition is displayed incorrectly in Minerva"
Pipeline #9332 passed
......@@ -28,6 +28,10 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
(#728)
* Bug fix: when editing project Disease and Organism could not be removed
(#616)
* Bug fix: dashed line partially wasn't dashed in "Unknown Catalysis" and
"Unknown Inhibition" reactions (#664)
* Bug fix: "Unknown Catalysis" and "Unknown Inhibition" reaction end is
slightly separated from target phenotype (#664)
minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: order of the overlays is defined explicitly also for general
......
......@@ -67,7 +67,7 @@ public enum ReactionLineData {
/**
* Information about arrows/lines for {@link InhibitionReaction} class.
*/
INHIBITION(InhibitionReaction.class, "INHIBITION", LineType.SOLID, ArrowType.CROSSBAR),
INHIBITION(InhibitionReaction.class, "INHIBITION", LineType.SOLID, ArrowType.CROSSBAR, 3),
/**
* Information about arrows/lines for {@link KnownTransitionOmittedReaction}
......@@ -150,7 +150,7 @@ public enum ReactionLineData {
/**
* Information about arrows/lines for {@link UnknownInhibitionReaction} class.
*/
UNKNOWN_INHIBITION(UnknownInhibitionReaction.class, "UNKNOWN_INHIBITION", LineType.DASHED, ArrowType.CROSSBAR),
UNKNOWN_INHIBITION(UnknownInhibitionReaction.class, "UNKNOWN_INHIBITION", LineType.DASHED, ArrowType.CROSSBAR, 3),
/**
* Information about arrows/lines for {@link UnknownNegativeInfluenceReaction}
......
......@@ -135,19 +135,26 @@ public class ReactionConverter extends BioEntityConverter<Reaction> {
* where the rectangle should be drawn
*/
protected void drawRectangleData(final Line2D line, final ReactionRect insideType, final Graphics2D graphics) {
Point2D startPoint = line.getP1();
Point2D endPoint = line.getP2();
double pointX = (startPoint.getX() + endPoint.getX()) / 2;
double pointY = (startPoint.getY() + endPoint.getY()) / 2;
Point2D centerPoint = new Point2D.Double(pointX, pointY);
double dx = endPoint.getX() - startPoint.getX();
double dy = endPoint.getY() - startPoint.getY();
double angle = Math.atan2(dy, dx);
if (insideType == null) {
graphics.draw(line);
Point2D topPoint = new Point2D.Double(pointX + RECT_SIZE / 2, pointY);
topPoint = new PointTransformation().rotatePoint(topPoint , angle, centerPoint);
Point2D bottomPoint = new Point2D.Double(pointX - RECT_SIZE / 2, pointY);
bottomPoint = new PointTransformation().rotatePoint(bottomPoint , angle, centerPoint);
graphics.draw(new Line2D.Double(topPoint, bottomPoint));
} else {
Point2D startPoint = line.getP1();
Point2D endPoint = line.getP2();
double dx = endPoint.getX() - startPoint.getX();
double dy = endPoint.getY() - startPoint.getY();
double angle = Math.atan2(dy, dx);
// find rectangle
Rectangle2D rect = new Rectangle2D.Double();
double pointX = (startPoint.getX() + endPoint.getX()) / 2;
double pointY = (startPoint.getY() + endPoint.getY()) / 2;
rect.setRect(pointX - RECT_SIZE / 2, pointY - RECT_SIZE / 2, RECT_SIZE, RECT_SIZE);
// rotate graphics by the angle defined by line (instead of rotating
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment