From dcc11a46523f91db686f5943093ddb6a3b82c12b Mon Sep 17 00:00:00 2001 From: Alexandre Gobbo Date: Mon, 27 Aug 2018 15:59:26 +0200 Subject: [PATCH] Bug fix --- src/main/java/ch/psi/mxsc/PuckGraphics.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/ch/psi/mxsc/PuckGraphics.java b/src/main/java/ch/psi/mxsc/PuckGraphics.java index 8cc7c72..c9d5c3b 100644 --- a/src/main/java/ch/psi/mxsc/PuckGraphics.java +++ b/src/main/java/ch/psi/mxsc/PuckGraphics.java @@ -129,8 +129,8 @@ public class PuckGraphics { //All pucks if (basePlateGraphics!=null) { Rectangle rect = basePlateGraphics.getBoundingBox(); //TODO - int ret = Math.min((int) ((puck.getSize().getWidth() / basePlate.getSize().getWidth()) * rect.width), - (int) ((puck.getSize().getHeight() / basePlate.getSize().getHeight()) * rect.height) + int ret = Math.min((int) Math.round(((double)puck.getSize().getWidth() / basePlate.getSize().getWidth()) * rect.width), + (int) Math.round(((double)puck.getSize().getHeight() / basePlate.getSize().getHeight()) * rect.height) ); if (puck.isSelected()) { ret += 2; @@ -155,8 +155,8 @@ public class PuckGraphics { Rectangle rect = basePlateGraphics.getBoundingBox(); DimensionDouble plateSize = basePlate.getSize(); PointDouble pos = basePlate.getPuckPosition(puck); - return new Point((int) ((pos.x / plateSize.getWidth()) * rect.width + rect.getCenterX()), - (int) ((pos.y / plateSize.getHeight()) * rect.height + rect.getCenterY()) + return new Point( (int) Math.round(((double)pos.x / plateSize.getWidth()) * rect.width + rect.getCenterX()), + (int) Math.round(((double)pos.y / plateSize.getHeight()) * rect.height + rect.getCenterY()) ); } else { //Single puck plot @@ -249,9 +249,12 @@ public class PuckGraphics { position = getReferenceDrawPosition(); size = getReferenceDrawSize(); //size+=1; - g.fillArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (180 + (rotated ? puck.angle : 0)), 180); + g.fillOval(position.x - size / 2, position.y - size / 2, size, size); g.setColor(getBorderColor(drawBackground)); - g.drawArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (180 + (rotated ? puck.angle : 0)), 180); + //size-=1; + g.setStroke(new BasicStroke(getBorderWidth(drawBackground))); + g.drawArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (194 + (rotated ? puck.angle : 0)), 152); + g.setStroke(new BasicStroke(1f)); } else { Point pu = getDrawUnipuckLedPosition(); Point pm = getDrawMinispineLedPosition();