Pointer display
This commit is contained in:
@@ -436,6 +436,18 @@ public class BasePlatePanel extends DevicePanel {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void pointPuck(Puck puck){
|
||||
if (puck != null){
|
||||
puck.setPointed(true);
|
||||
} else {
|
||||
for (Puck p : getDevice().getPucks()) {
|
||||
p.setPointed(false);
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
void onPuckPressed(MouseEvent e, Puck puck){
|
||||
if (getSelectionMode()!=SelectionMode.None){
|
||||
if (TOGGLE_SELECTION){
|
||||
|
||||
@@ -759,6 +759,7 @@ public class Controller {
|
||||
public void setLaserPos(String pos){
|
||||
try {
|
||||
getMainFrame().evalAsync("set_laser_pos(" + ((pos==null) ? "" : ("'" + pos + "'") ) + ")" ,true);
|
||||
getMainFrame().basePlatePanel.pointPuck((pos==null) ? null : basePlate.getPuckByName(pos));
|
||||
} catch (Interpreter.InterpreterStateException ex) {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@@ -454,6 +454,26 @@ public class Puck extends DeviceBase {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean pointed;
|
||||
|
||||
public boolean isPointed() {
|
||||
return pointed;
|
||||
}
|
||||
|
||||
public void setPointed(boolean value) {
|
||||
if (value != pointed) {
|
||||
if (value == true) {
|
||||
for (Device d : getParent().getChildren()) {
|
||||
if (d instanceof Puck puck) {
|
||||
puck.pointed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
pointed = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getNumberOfSamples() {
|
||||
return numberOfSamples;
|
||||
}
|
||||
|
||||
@@ -315,6 +315,13 @@ public class PuckGraphics {
|
||||
g.drawOval(pu.x - unipuckSize / 2, pu.y - unipuckSize / 2, unipuckSize, unipuckSize);
|
||||
g.drawOval(pm.x - minispineSize / 2, pm.y - minispineSize / 2, minispineSize, minispineSize);
|
||||
}
|
||||
//Draw pointed
|
||||
|
||||
if (puck.isPointed()){
|
||||
int pointerSize = 8;
|
||||
g.setColor(Color.red);
|
||||
g.drawOval(position.x - pointerSize / 2, position.y - pointerSize / 2, pointerSize, pointerSize);
|
||||
}
|
||||
|
||||
//Draw text
|
||||
String id = puck.getId();
|
||||
|
||||
Reference in New Issue
Block a user