Commit 610af114 authored by Nico Mack's avatar Nico Mack

Moved Attenuator Thresholds into Calibration File. Changes to ColorPair

class
parent 9d89d29b
......@@ -88,13 +88,19 @@ OUTER_RADIUS_NODE=outerRadius
START_ANGLE_NODE=startAngle
ARC_SPAN_NODE=arcSpan
GAP_NODE=gap
RELATIVE_NODE=relative
REFERENCE_NODE=reference
STROKE_WIDTH_NODE=strokeWidth
FILL_COLOUR_ELEMENT=fillColour
TEXT_COLOUR_ELEMENT=textColour
STROKE_COLOUR_ELEMENT=strokeColour
LABEL_COLOUR_ELEMENT=labelColour
FACE_COLOUR_ELEMENT=faceColour
BEZEL_COLOUR_ELEMENT=bezelColour
SELECTED_ELEMENT=selected
DESELECTED_ELEMENT=deselected
ABOVE_ELEMENT=above
BELOW_ELEMENT=below
RGB_COLOUR_NODE=rgb
PERSISTENT_NODE=persistent
PRESELECT_NODE=preselect
......
......@@ -101,6 +101,9 @@ public class Calibration {
/** Window height in millimetres, default 800. */
private static int windowHeight = 800;
private static float movementThreshold = 0.1f;
private static float rotationThreshold = 0.2f;
/**
* Method for transforming the coordinate mapping from the camera in the range [0;1] to the
* screen mapping in pixels. This method multiplies the ratio by the camera's width (also a
......@@ -397,6 +400,8 @@ public class Calibration {
rectangleWidth = Integer.parseInt(tableNode.getChildText("rectangleWidth")); //$NON-NLS-1$
rectangleHeight = Integer.parseInt(tableNode.getChildText("rectangleHeight")); //$NON-NLS-1$
cornerRadius = Integer.parseInt(tableNode.getChildText("cornerRadius")); //$NON-NLS-1$
movementThreshold = Float.parseFloat(tableNode.getChildText("movementThreshold")); //$NON-NLS-1$
rotationThreshold = Float.parseFloat(tableNode.getChildText("rotationThreshold")); //$NON-NLS-1$
Element windowNode = rootNode.getChild("window"); //$NON-NLS-1$
......@@ -637,6 +642,14 @@ public class Calibration {
return cornerRadius;
}
public static float getMovementThreshold() {
return movementThreshold;
}
public static float getRotationThreshold() {
return rotationThreshold;
}
/**
* Simple getter method for topLeftXCoordinate.
*
......
......@@ -24,67 +24,67 @@ import java.awt.Color;
* @version [major].[minor].[micro]
*/
public class ColorPair {
private Color selectedColor;
private Color deselectedColor;
private boolean isSelected;
private Color firstColor;
private Color secondColor;
private boolean switched;
/**
* @param deselectedColor
* @param selectedColor
* @param firstColor
* @param secondColor
*/
public ColorPair(Color selectedColor, Color deselectedColor) {
this.selectedColor = selectedColor;
this.deselectedColor = deselectedColor;
this.isSelected = false;
public ColorPair(Color firstColor, Color secondColor) {
this.firstColor = firstColor;
this.secondColor = secondColor;
this.switched = false;
}
/**
* @return
*/
public Color getSelectedColor() {
return selectedColor;
public Color getFirstColor() {
return firstColor;
}
/**
* @param selectedColor
* @param color
*/
public void setSelectedColor(Color selectedColor) {
this.selectedColor = selectedColor;
public void setFirstColor(Color color) {
this.firstColor = color;
}
/**
* @return
*/
public Color getDeselectedColor() {
return deselectedColor;
public Color getSecondColor() {
return secondColor;
}
/**
* @param deselectedColor
* @param color
*/
public void setDeselectedColor(Color deselectedColor) {
this.deselectedColor = deselectedColor;
public void setSecondColor(Color color) {
this.secondColor = color;
}
/**
* @return
*/
public boolean isSelected() {
return isSelected;
public boolean isSwitched() {
return switched;
}
/**
* @param isSelected
* @param switchIt
*/
public void setSelected(boolean isSelected) {
this.isSelected = isSelected;
public void setSwitched(boolean switchIt) {
this.switched = switchIt;
}
/**
* @return
*/
public Color getColor() {
return (isSelected) ? selectedColor : deselectedColor;
return (switched) ? firstColor : secondColor;
}
}
......@@ -33,8 +33,6 @@ import org.eclipse.osgi.util.NLS;
public class Externalization extends NLS {
private static final String BUNDLE_NAME = "externalization"; //$NON-NLS-1$
public static String ALPHA_NODE;
public static String ASSET_ELEMENT;
......@@ -129,13 +127,19 @@ public class Externalization extends NLS {
public static String START_ANGLE_NODE;
public static String ARC_SPAN_NODE;
public static String GAP_NODE;
public static String RELATIVE_NODE;
public static String REFERENCE_NODE;
public static String STROKE_WIDTH_NODE;
public static String FILL_COLOUR_ELEMENT;
public static String TEXT_COLOUR_ELEMENT;
public static String STROKE_COLOUR_ELEMENT;
public static String LABEL_COLOUR_ELEMENT;
public static String FACE_COLOUR_ELEMENT;
public static String BEZEL_COLOUR_ELEMENT;
public static String SELECTED_ELEMENT;
public static String DESELECTED_ELEMENT;
public static String ABOVE_ELEMENT;
public static String BELOW_ELEMENT;
public static String RGB_COLOUR_NODE;
public static String SHADE_ATTRIBUTE;
public static String SHADE_DARKER_VALUE;
......
......@@ -67,8 +67,8 @@ public class SplashScreen extends JPanel implements LogListener {
private static final Logger LOGGER = LoggerFactory.getLogger(SplashScreen.class.getSimpleName());
private static final String LOGO_PATH = "resources/TULIP.png"; //$NON-NLS-1$
private static final String COLUMN_SPECS = "left:pref, 5dlu, 60dlu:grow"; //$NON-NLS-1$
private static final String ROW_SPECS = "center:300dlu:grow, 5dlu, bottom:300dlu:grow"; //$NON-NLS-1$
private static final String COLUMN_SPECS = "5dlu, left:pref, 5dlu, 60dlu:grow,5dlu"; //$NON-NLS-1$
private static final String ROW_SPECS = "5dlu,center:300dlu:grow, 5dlu, bottom:300dlu:grow,5dlu"; //$NON-NLS-1$
// ---------------------------------------------------------------------------
// ***************************************************************************
......@@ -84,7 +84,7 @@ public class SplashScreen extends JPanel implements LogListener {
CellConstraints constraints = new CellConstraints();
Image scaledLogo = logo.getScaledInstance(640, 284, Image.SCALE_SMOOTH);
this.add(new JLabel(new ImageIcon(scaledLogo)), constraints.xy(1, 1));
this.add(new JLabel(new ImageIcon(scaledLogo)), constraints.xy(2, 2));
log = new JTextArea();
log.setLineWrap(false);
......@@ -101,7 +101,7 @@ public class SplashScreen extends JPanel implements LogListener {
logScroller.setOpaque(false);
logScroller.getViewport().setOpaque(false);
this.add(logScroller, constraints.xywh(1, 3, 3, 1));
this.add(logScroller, constraints.xywh(2, 4, 3, 1));
FontMetrics metrics = log.getFontMetrics(log.getFont());
int columns = (int) (screenWidth / (metrics.charWidth('A') * 1.4));
......
......@@ -140,9 +140,9 @@ public class Sector extends IndexedCorona {
@Override
public void setSelected(boolean selectIt) {
super.setSelected(selectIt);
this.fillColour.setSelected(selectIt);
this.strokeColour.setSelected(selectIt);
this.textColour.setSelected(selectIt);
this.fillColour.setSwitched(selectIt);
this.strokeColour.setSwitched(selectIt);
this.textColour.setSwitched(selectIt);
}
// ---------------------------------------------------------------------------
......
......@@ -22,6 +22,7 @@ package lu.list.itis.dkd.tui.widget.state;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.utility.Calibration;
import lu.list.itis.dkd.tui.utility.Point;
/**
......@@ -35,8 +36,8 @@ import lu.list.itis.dkd.tui.utility.Point;
*/
@NonNullByDefault
public class Attenuator {
private static final float ROTATION_THRESHOLD = 0.2f; // 0.1f
private static final float MOVEMENT_THRESHOLD = 0.02f; // 0.01f;
private static final float ROTATION_THRESHOLD = Calibration.getRotationThreshold(); // 0.1f
private static final float MOVEMENT_THRESHOLD = Calibration.getMovementThreshold(); // 0.01f;
private static final int MOVEMENT_COOLDOWN = 500;
private static final int ROTATION_COOLDOWN = 500;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment