Preliminary implementation of SwissMX RT

This commit is contained in:
2023-04-26 09:22:59 +02:00
parent f961ee0758
commit a904eac8eb
9 changed files with 321 additions and 137 deletions

View File

@@ -104,7 +104,7 @@ public class PuckGraphics {
if (puck.isDisabled()){
return basePlateGraphics.getColor();
}
switch (puck.detection) {
switch (puck.getDetection()) {
case Empty:
//ret = isHighlithted() ? new Color(224, 224, 224) : Color.LIGHT_GRAY;
ret = getEmptyColor();
@@ -142,9 +142,14 @@ public class PuckGraphics {
int getDrawSize() {
//All pucks
if (basePlateGraphics!=null) {
DimensionDouble puckSize = puck.getSize();
if (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt){
puckSize = new DimensionDouble(100,100);
}
Rectangle rect = basePlateGraphics.getBoundingBox(); //TODO
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)
int ret = Math.min((int) Math.round(((double)puckSize.getWidth() / basePlate.getSize().getWidth()) * rect.width),
(int) Math.round(((double)puckSize.getHeight() / basePlate.getSize().getHeight()) * rect.height)
);
if (puck.isSelected()) {
ret += 2;
@@ -228,10 +233,16 @@ public class PuckGraphics {
}
int getReferenceDrawSize() {
if (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt){
return getDrawSize(10.0) ;
}
return getDrawSize(puck.referenceSize) ;
}
Point getReferenceDrawPosition() {
if (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt){
return getDrawPosition(new PointDouble(-67.0, 0.0));
}
return getDrawPosition(new PointDouble(0, -67.0));
}
@@ -270,13 +281,23 @@ public class PuckGraphics {
g.setColor(refColor);
position = getReferenceDrawPosition();
size = getReferenceDrawSize();
//size+=1;
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
g.setColor(getBorderColor(drawBackground));
//size-=1;
g.setStroke(new BasicStroke(getBorderWidth(drawBackground)));
g.drawArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (190 + (rotated ? puck.angle : 0)), 154);
g.setStroke(new BasicStroke(1f));
if (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt){
g.fillRect(position.x-1, position.y - size*3 , size+1, size*6);
g.setColor(getBorderColor(drawBackground));
//size-=1;
g.setStroke(new BasicStroke(getBorderWidth(drawBackground)));
int height = (int)(size*2.4);
g.drawLine(position.x+size, position.y -height , position.x +size, position.y +height);
g.setStroke(new BasicStroke(1f));
} else {
//size+=1;
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
g.setColor(getBorderColor(drawBackground));
//size-=1;
g.setStroke(new BasicStroke(getBorderWidth(drawBackground)));
g.drawArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (190 + (rotated ? puck.angle : 0)), 154);
g.setStroke(new BasicStroke(1f));
}
} else {
Point pu = getDrawUnipuckLedPosition();
Point pm = getDrawMinispineLedPosition();