MainPanel prototype

This commit is contained in:
gac-S_Changer
2018-05-02 16:09:06 +02:00
parent 8f3409060b
commit 01528ae2b1
7 changed files with 725 additions and 546 deletions

View File

@@ -82,7 +82,7 @@ public class Puck extends DeviceBase {
final static PointDouble labelPositionWithImage = new PointDouble(0.0, 36.0);
ImageDetection imageDetection = null;
ImageDetection imageDetection = ImageDetection.Unknown;
public ImageDetection getImageDetection(){
return imageDetection;
@@ -97,6 +97,7 @@ public class Puck extends DeviceBase {
Minispine,
Unipuck,
Error,
Unknown,
}
public double getAngle() {
@@ -270,12 +271,19 @@ public class Puck extends DeviceBase {
return selected && getBasePlate().isSelectable();
}
public void toggleSelected(boolean value) {
setSelected(!selected);
}
public void setSelected(boolean value) {
if (value != selected) {
if (value == true) {
for (Device d : getParent().getChildren()) {
if (d instanceof Puck) {
((Puck) d).selected = false;
for (Sample sample : ((Puck) d).getSamples()) {
sample.selected = false;
}
}
}
}
@@ -297,7 +305,7 @@ public class Puck extends DeviceBase {
ret = isHighlithted() ? new Color(224, 224, 224) : Color.LIGHT_GRAY;
break;
case Present:
if (imageDetection != null){
if ((imageDetection != null) && (imageDetection != ImageDetection.Unknown)){
switch (imageDetection){
case Minispine:
ret = isHighlithted() ? new Color(0, 200, 80) : new Color(128, 232, 152);
@@ -337,7 +345,7 @@ public class Puck extends DeviceBase {
(int) ((getSize().getWidth() / getBasePlate().getSize().getWidth()) * plotRect.width),
(int) ((getSize().getHeight() / getBasePlate().getSize().getHeight()) * plotRect.height)
);
if (isHighlithted()) {
if (isSelected()) {
ret += 2;
}
return ret;
@@ -396,7 +404,7 @@ public class Puck extends DeviceBase {
}
int getBorderWidth(boolean drawBackground) {
return drawBackground ? isHighlithted() ? 2 : 1 : isHighlithted() ? 2 : 1;
return drawBackground ? isSegmentSelected() ? 2 : 1 : isSegmentSelected() ? 2 : 1;
}
int getReferenceDrawSize() {