From eef0fb76459bf7849af507d789941e7cc6df7ffb Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Fri, 14 Aug 2020 14:53:07 +0200 Subject: [PATCH] Fix 6d layout --- src/main/java/ch/psi/mxsc/BasePlate.java | 56 +++++++------- src/main/java/ch/psi/mxsc/MainPanel.java | 2 +- src/main/java/ch/psi/mxsc/Puck.java | 93 ++++++++++++++++++++---- 3 files changed, 109 insertions(+), 42 deletions(-) diff --git a/src/main/java/ch/psi/mxsc/BasePlate.java b/src/main/java/ch/psi/mxsc/BasePlate.java index 83e1185..a6c7e14 100644 --- a/src/main/java/ch/psi/mxsc/BasePlate.java +++ b/src/main/java/ch/psi/mxsc/BasePlate.java @@ -98,41 +98,41 @@ public class BasePlate extends DeviceBase { }; final static PointDouble[] pucksPosition6s = new PointDouble[]{ - new PointDouble(0, -75), + new PointDouble(0, -75), new PointDouble(0, -150), - new PointDouble(-64.95, -187.5), - new PointDouble(-129.9, -150), - new PointDouble(-64.95, -112.5), + new PointDouble(64.95, -112.5), + new PointDouble(64.95, -187.5), + new PointDouble(129.9, -150), - new PointDouble(-64.95, -37.5), - new PointDouble(-129.9, -75), - new PointDouble(-194.85, -37.5), - new PointDouble(-194.85, 37.5), - new PointDouble(-129.9, 0), - - new PointDouble(-64.95, 37.5), - new PointDouble(-129.9, 75), - new PointDouble(-129.9, 150), - new PointDouble(-64.95, 187.5), - new PointDouble(-64.95, 112.5) , + new PointDouble(64.95, -37.5), + new PointDouble(129.9, -75), + new PointDouble(129.9, 0), + new PointDouble(194.85, -37.5), + new PointDouble(194.85, 37.5), + new PointDouble(64.95, 37.5), + new PointDouble(129.9, 75), + new PointDouble(64.95, 112.5), + new PointDouble(129.9, 150), + new PointDouble(64.95, 187.5), + new PointDouble(0, 75), new PointDouble(0, 150), - new PointDouble(64.95, 187.5), - new PointDouble(129.9, 150), - new PointDouble(64.95, 112.5), + new PointDouble(-64.95, 112.5), + new PointDouble(-64.95, 187.5), + new PointDouble(-129.9, 150), - new PointDouble(64.95, 37.5), - new PointDouble(129.9, 75), - new PointDouble(194.85, 37.5), - new PointDouble(194.85, -37.5), - new PointDouble(129.9, 0), + new PointDouble(-64.95, 37.5), + new PointDouble(-129.9, 75), + new PointDouble(-129.9, 0), + new PointDouble(-194.85, 37.5), + new PointDouble(-194.85, -37.5), - new PointDouble(64.95, -37.5), - new PointDouble(129.9, -75), - new PointDouble(129.9, -150), - new PointDouble(64.95, -187.5), - new PointDouble(64.95, -112.5), + new PointDouble(-64.95, -37.5), + new PointDouble(-129.9, -75), + new PointDouble(-64.95, -112.5), + new PointDouble(-129.9, -150), + new PointDouble(-64.95, -187.5), }; //TODO: Fix SF only to change address based on BASE_PLATE_LAYOUT diff --git a/src/main/java/ch/psi/mxsc/MainPanel.java b/src/main/java/ch/psi/mxsc/MainPanel.java index a0485b4..7d09c81 100644 --- a/src/main/java/ch/psi/mxsc/MainPanel.java +++ b/src/main/java/ch/psi/mxsc/MainPanel.java @@ -58,7 +58,7 @@ public class MainPanel extends Panel { x06da } public static final BasePlateLayout BASE_PLATE_LAYOUT = App.hasArgument("sf") ? BasePlateLayout.sf : - ( App.hasArgument("x06da") ? BasePlateLayout.x06da : BasePlateLayout.normal); + ( App.hasArgument("6d") ? BasePlateLayout.x06da : BasePlateLayout.normal); public MainPanel() { initComponents(); diff --git a/src/main/java/ch/psi/mxsc/Puck.java b/src/main/java/ch/psi/mxsc/Puck.java index 0926741..5f0ccd9 100644 --- a/src/main/java/ch/psi/mxsc/Puck.java +++ b/src/main/java/ch/psi/mxsc/Puck.java @@ -36,64 +36,131 @@ public class Puck extends DeviceBase { new PointDouble(-47.7738724 * signalX, 21.81759648), new PointDouble(-28.39445573 * signalX, 44.18263554) }; - - static final Character[] SEGMENTS = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? new Character[]{ + + static final Character[] SEGMENTS_NORMAL =new Character[]{ 'A', 'A','A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'F', 'F', 'F', - } : new Character[]{'A', 'A', + }; + + static final Character[] SEGMENTS_SF = new Character[]{ + 'A', 'A', 'F', 'F', 'F', 'F', 'F', 'E', 'E', 'E', 'E', 'E', 'D', 'D', 'D', 'D', 'D', 'C', 'C', 'C', 'C', 'C', 'B', 'B', 'B', 'B', 'B', - 'A', 'A', 'A'};; - static final int[] NUMBERS = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ?new int[]{ + 'A', 'A', 'A'} ; + + static final Character[] SEGMENTS_6D =new Character[]{ + 'A', 'A','A', 'A', 'A', + 'B', 'B', 'B', 'B', 'B', + 'C', 'C', 'C', 'C', 'C', + 'D', 'D', 'D', 'D', 'D', + 'E', 'E', 'E', 'E', 'E', + 'F', 'F', 'F', 'F', 'F', + }; + + static final int[] NUMBERS_NORMAL = new int[]{ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, - } : new int[]{1, 2, + }; + + static final int[] NUMBERS_SF = new int[] + {1, 2, 5, 4, 3, 1, 2, 5, 4, 3, 1, 2, 5, 4, 3, 1, 2, 5, 4, 3, 1, 2, 5, 4, 3, 1, 2, - 5, 4, 3}; ; - static final int[] ADDRESSES =(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? new int[]{ + 5, 4, 3}; + + static final int[] NUMBERS_6D = new int[]{ + 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, + }; + + static final int[] ADDRESSES_NORMAL = new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 - } : new int[]{6, 7, + }; + static final int[] ADDRESSES_SF = new int[] + {6, 7, 5, 4, 3, 1, 2, 20, 19, 18, 16, 17, 15, 14, 13, 11, 12, 30, 29, 28, 26, 27, 25, 24, 23, 21, 22, - 10, 9, 8};; + 10, 9, 8}; - static final double[] ANGLES = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ?new double[]{ + static final int[] ADDRESSES_6D = new int[]{ + 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, + 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, + 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, + }; + + static final double[] ANGLES_NORMAL = new double[]{ 0.00, 0.00, 330.00, 340.89, 319.11, 300.00, 300.00, 270.00, 280.89, 259.11, 240.00, 240.00, 210.00, 220.89, 199.11, 180.00, 180.00, 150.00, 160.89, 139.11, 120.00, 120.00, 90.00, 100.89, 79.11, 60.00, 60.00, 30.00, 40.89, 19.11 - } : new double[]{ + }; + + static final double[] ANGLES_SF = new double[]{ 0.00, 0.00, 19.11, 40.89, 30.00, 60.00, 60.00, 79.11, 100.89, 90.00, 120.00, 120.00, 139.11, 160.89, 150.00, 180.00, 180.00, 199.11, 220.89, 210.00, 240.00, 240.00, 259.11, 280.89, 270.00, - 300.00, 300.00, 319.11, 340.89, 330.00}; ; + 300.00, 300.00, 319.11, 340.89, 330.00 + }; + + static final double[] ANGLES_6D = new double[]{ + 0.00, 0.00, 330.00, 340.89, 319.11, + 300.00, 300.00, 270.00, 280.89, 259.11, + 240.00, 240.00, 210.00, 220.89, 199.11, + 180.00, 180.00, 150.00, 160.89, 139.11, + 120.00, 120.00, 90.00, 100.89, 79.11, + 60.00, 60.00, 30.00, 40.89, 19.11 + }; + + static final Character[] SEGMENTS = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? SEGMENTS_NORMAL : ( + (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? SEGMENTS_SF : SEGMENTS_6D + ); + + static final int[] NUMBERS = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? NUMBERS_NORMAL : ( + (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? NUMBERS_SF : NUMBERS_6D + ); + + + static final int[] ADDRESSES =(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? ADDRESSES_NORMAL : ( + (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? ADDRESSES_SF : ADDRESSES_6D + ); + + + static final double[] ANGLES = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? ANGLES_NORMAL : ( + (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? ANGLES_SF : ANGLES_6D + ); final static PointDouble referencePosition = new PointDouble(0.0, -66.9 - 0.2); final static Double referenceSize = 6.2 + 0.2;