Included copy/paste on ScanEditorPanel vector table
This commit is contained in:
@@ -445,14 +445,16 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="buttonServer" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="buttonDirect" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="3" attributes="0">
|
|
||||||
<Component id="textState" linkSize="2" min="-2" max="-2" attributes="0"/>
|
<Component id="textState" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="buttonServer" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="buttonDirect" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
|||||||
+163
-326
@@ -18,10 +18,6 @@ import ch.psi.pshell.bs.StreamValue;
|
|||||||
import ch.psi.pshell.core.JsonSerializer;
|
import ch.psi.pshell.core.JsonSerializer;
|
||||||
import ch.psi.pshell.data.DataManager;
|
import ch.psi.pshell.data.DataManager;
|
||||||
import ch.psi.pshell.device.Device;
|
import ch.psi.pshell.device.Device;
|
||||||
import ch.psi.pshell.device.Readable.ReadableArray;
|
|
||||||
import ch.psi.pshell.device.Readable.ReadableNumber;
|
|
||||||
import ch.psi.pshell.device.ReadableRegister.ReadableRegisterArray;
|
|
||||||
import ch.psi.pshell.device.ReadableRegister.ReadableRegisterNumber;
|
|
||||||
import ch.psi.pshell.epics.ChannelInteger;
|
import ch.psi.pshell.epics.ChannelInteger;
|
||||||
import ch.psi.pshell.epics.DiscretePositioner;
|
import ch.psi.pshell.epics.DiscretePositioner;
|
||||||
import ch.psi.pshell.epics.Epics;
|
import ch.psi.pshell.epics.Epics;
|
||||||
@@ -44,13 +40,11 @@ import ch.psi.pshell.imaging.RendererMode;
|
|||||||
import ch.psi.pshell.imaging.Source;
|
import ch.psi.pshell.imaging.Source;
|
||||||
import ch.psi.pshell.scripting.InterpreterResult;
|
import ch.psi.pshell.scripting.InterpreterResult;
|
||||||
import ch.psi.pshell.scripting.ScriptManager;
|
import ch.psi.pshell.scripting.ScriptManager;
|
||||||
import ch.psi.pshell.swing.DeviceValueChart;
|
|
||||||
import ch.psi.pshell.swing.ValueSelection;
|
import ch.psi.pshell.swing.ValueSelection;
|
||||||
import ch.psi.pshell.swing.ValueSelection.ValueSelectionListener;
|
import ch.psi.pshell.swing.ValueSelection.ValueSelectionListener;
|
||||||
import ch.psi.utils.Arr;
|
import ch.psi.utils.Arr;
|
||||||
import ch.psi.utils.ArrayProperties;
|
import ch.psi.utils.ArrayProperties;
|
||||||
import ch.psi.utils.Convert;
|
import ch.psi.utils.Convert;
|
||||||
import ch.psi.utils.Str;
|
|
||||||
import ch.psi.utils.swing.Editor.EditorDialog;
|
import ch.psi.utils.swing.Editor.EditorDialog;
|
||||||
import ch.psi.utils.swing.MainFrame;
|
import ch.psi.utils.swing.MainFrame;
|
||||||
import ch.psi.utils.swing.StandardDialog;
|
import ch.psi.utils.swing.StandardDialog;
|
||||||
@@ -58,19 +52,14 @@ import ch.psi.utils.swing.StandardDialog.StandardDialogListener;
|
|||||||
import ch.psi.utils.swing.SwingUtils.OptionResult;
|
import ch.psi.utils.swing.SwingUtils.OptionResult;
|
||||||
import ch.psi.utils.swing.SwingUtils.OptionType;
|
import ch.psi.utils.swing.SwingUtils.OptionType;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.datatransfer.Clipboard;
|
|
||||||
import java.awt.datatransfer.StringSelection;
|
|
||||||
import java.awt.datatransfer.Transferable;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -88,6 +77,7 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import javax.swing.AbstractButton;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
@@ -143,7 +133,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
String serverUrl;
|
String serverUrl;
|
||||||
String camServerUrl;
|
String camServerUrl;
|
||||||
String instanceName;
|
String instanceName;
|
||||||
Overlay titleOv = null;
|
|
||||||
|
|
||||||
Double getServerDouble(String name) {
|
Double getServerDouble(String name) {
|
||||||
return (Double) Convert.toDouble(server.getValue(name));
|
return (Double) Convert.toDouble(server.getValue(name));
|
||||||
@@ -252,7 +241,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
((JSpinner.DefaultEditor) editor).getTextField().setHorizontalAlignment(JTextField.RIGHT);
|
((JSpinner.DefaultEditor) editor).getTextField().setHorizontalAlignment(JTextField.RIGHT);
|
||||||
}
|
}
|
||||||
renderer.setPersistenceFile(Paths.get(getContext().getSetup().getContextPath(), "Renderer_Cameras.bin"));
|
renderer.setPersistenceFile(Paths.get(getContext().getSetup().getContextPath(), "Renderer_Cameras.bin"));
|
||||||
//setPersistedComponents(new Component[]{buttonServer, buttonDirect});
|
setPersistedComponents(new Component[]{buttonServer, buttonDirect});
|
||||||
comboCameras.setEnabled(false);
|
comboCameras.setEnabled(false);
|
||||||
comboType.setEnabled(false);
|
comboType.setEnabled(false);
|
||||||
|
|
||||||
@@ -312,8 +301,8 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenuItem menuRendererConfig = new JMenuItem("Renderer Parameters");
|
JMenuItem menuCameraConfig = new JMenuItem("Renderer Config");
|
||||||
menuRendererConfig.addActionListener((ActionEvent e) -> {
|
menuCameraConfig.addActionListener((ActionEvent e) -> {
|
||||||
try {
|
try {
|
||||||
if (camera != null) {
|
if (camera != null) {
|
||||||
this.showDeviceConfigDialog(camera, false);
|
this.showDeviceConfigDialog(camera, false);
|
||||||
@@ -323,52 +312,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenuItem menuCameraConfig = new JMenuItem("Camera Configurarion");
|
|
||||||
menuCameraConfig.addActionListener((ActionEvent e) -> {
|
|
||||||
try {
|
|
||||||
if (camera != null) {
|
|
||||||
String cameraConfigJson = null;
|
|
||||||
if (usingServer) {
|
|
||||||
String cameraServerUrl = (camServerUrl == null) ? server.getUrl().substring(0, server.getUrl().length() - 1) + "8" : camServerUrl;
|
|
||||||
try (CameraServer srv = new CameraServer("CamServer", cameraServerUrl)) {
|
|
||||||
srv.initialize();
|
|
||||||
//TODO: replace into encodeMultiline
|
|
||||||
cameraConfigJson = JsonSerializer.encode(srv.getConfig(cameraName), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
String configFolder = (String) getContext().getClassByName("SfCamera").getMethod("getConfigFolder", new Class[]{}).invoke(null);
|
|
||||||
Path configFile = Paths.get(configFolder, cameraName + ".json");
|
|
||||||
cameraConfigJson = configFile.toFile().exists() ? new String(Files.readAllBytes(configFile)) : null;
|
|
||||||
}
|
|
||||||
TextEditor configEditor = new TextEditor();
|
|
||||||
configEditor.setText(cameraConfigJson);
|
|
||||||
configEditor.setReadOnly(true);
|
|
||||||
configEditor.setTitle(cameraName);
|
|
||||||
EditorDialog dlg = configEditor.getDialog(getTopLevel(), false);
|
|
||||||
dlg.setSize(480, 640);
|
|
||||||
dlg.setVisible(true);
|
|
||||||
SwingUtils.centerComponent(getTopLevel(), dlg);
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showException(ex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JMenuItem menuSetImageBufferSize = new JMenuItem("Set Stack Size...");
|
|
||||||
menuSetImageBufferSize.addActionListener((ActionEvent e) -> {
|
|
||||||
try {
|
|
||||||
String ret = SwingUtils.getString(getTopLevel(), "Enter size of image buffer: ", String.valueOf(imageBufferLenght));
|
|
||||||
if (ret!=null){
|
|
||||||
this.setImageBufferSize(Integer.valueOf(ret));
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showException(ex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JMenuItem menuSaveStack = new JMenuItem("Save Stack");
|
JMenuItem menuSaveStack = new JMenuItem("Save Stack");
|
||||||
menuSaveStack.addActionListener((ActionEvent e) -> {
|
menuSaveStack.addActionListener((ActionEvent e) -> {
|
||||||
try {
|
try {
|
||||||
@@ -376,8 +319,8 @@ public class ScreenPanel2 extends Panel {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
showException(ex);
|
showException(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
menuSaveStack.setEnabled(imageBufferLenght > 0);
|
||||||
|
|
||||||
JMenuItem menuSetROI = new JMenuItem("Set ROI...");
|
JMenuItem menuSetROI = new JMenuItem("Set ROI...");
|
||||||
menuSetROI.addActionListener((ActionEvent e) -> {
|
menuSetROI.addActionListener((ActionEvent e) -> {
|
||||||
@@ -426,12 +369,9 @@ public class ScreenPanel2 extends Panel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
renderer.getPopupMenu().addSeparator();
|
renderer.getPopupMenu().addSeparator();
|
||||||
renderer.getPopupMenu().add(menuRendererConfig);
|
|
||||||
renderer.getPopupMenu().add(menuCameraConfig);
|
renderer.getPopupMenu().add(menuCameraConfig);
|
||||||
renderer.getPopupMenu().add(menuSetImageBufferSize);
|
|
||||||
renderer.getPopupMenu().add(menuSaveStack);
|
|
||||||
renderer.getPopupMenu().addSeparator();
|
|
||||||
renderer.getPopupMenu().add(menuCalibrate);
|
renderer.getPopupMenu().add(menuCalibrate);
|
||||||
|
renderer.getPopupMenu().add(menuSaveStack);
|
||||||
renderer.getPopupMenu().addSeparator();
|
renderer.getPopupMenu().addSeparator();
|
||||||
renderer.getPopupMenu().add(menuSetROI);
|
renderer.getPopupMenu().add(menuSetROI);
|
||||||
renderer.getPopupMenu().add(menuResetROI);
|
renderer.getPopupMenu().add(menuResetROI);
|
||||||
@@ -442,8 +382,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
menuSetROI.setEnabled(server != null);
|
menuSetROI.setEnabled(server != null);
|
||||||
menuCalibrate.setVisible(server != null);
|
menuCalibrate.setVisible(server != null);
|
||||||
menuCalibrate.setEnabled((calibrationDialolg == null) || (!calibrationDialolg.isShowing()));
|
menuCalibrate.setEnabled((calibrationDialolg == null) || (!calibrationDialolg.isShowing()));
|
||||||
menuSaveStack.setEnabled(imageBufferLenght > 0);
|
|
||||||
menuSetImageBufferSize.setEnabled(!renderer.isPaused());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -469,9 +407,9 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
imageBufferOverlay = new Text(renderer.getPenErrorText(), "", new Font("Verdana", Font.PLAIN, 12), new Point(-100, 42));
|
imageBufferOverlay = new Text(renderer.getPenErrorText(), "", new Font("Verdana", Font.PLAIN, 12), new Point(-100, 20));
|
||||||
imageBufferOverlay.setFixed(true);
|
imageBufferOverlay.setFixed(true);
|
||||||
imageBufferOverlay.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
|
imageBufferOverlay.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_RIGHT);
|
||||||
if (MainFrame.isDark()) {
|
if (MainFrame.isDark()) {
|
||||||
textState.setDisabledTextColor(textState.getForeground());
|
textState.setDisabledTextColor(textState.getForeground());
|
||||||
}
|
}
|
||||||
@@ -665,21 +603,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void manageTitleOverlay() {
|
|
||||||
Overlay to = null;
|
|
||||||
if ((buttonTitle.isSelected()) && (cameraName != null)) {
|
|
||||||
Font font = new Font("Arial", Font.PLAIN, 28);
|
|
||||||
to = new Text(renderer.getPenErrorText(), cameraName, font, new Point(-SwingUtils.getTextSize(cameraName, renderer.getGraphics().getFontMetrics(font)).width - 14, 26));
|
|
||||||
to.setFixed(true);
|
|
||||||
to.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (lockOverlays) {
|
|
||||||
renderer.updateOverlays(to, titleOv);
|
|
||||||
titleOv = to;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStateChange(State state, State former) {
|
public void onStateChange(State state, State former) {
|
||||||
|
|
||||||
@@ -757,21 +680,16 @@ public class ScreenPanel2 extends Panel {
|
|||||||
filter.close();
|
filter.close();
|
||||||
filter = null;
|
filter = null;
|
||||||
}
|
}
|
||||||
if (renderer.isPaused()) {
|
if (renderer.isPaused()){
|
||||||
renderer.resume();
|
renderer.resume();
|
||||||
renderer.removeOverlay(imageBufferOverlay);
|
renderer.removeOverlay(imageBufferOverlay);
|
||||||
pauseSelection.setVisible(false);
|
pauseSelection.setVisible(false);
|
||||||
panelCameraSelection.setVisible(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manageTitleOverlay();
|
|
||||||
if (App.isDetached()) {
|
|
||||||
getTopLevel().setTitle(cameraName == null ? "ScreenPanel" : cameraName);
|
|
||||||
}
|
|
||||||
if (cameraName == null) {
|
if (cameraName == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Setting camera: " + cameraName + " [" + (buttonServer.isSelected() ? "server" : "direct") + "]");
|
System.out.println("Setting camera: " + cameraName + " [" + (buttonServer.isSelected() ? "server" : "direct") + "]");
|
||||||
try {
|
try {
|
||||||
if (buttonServer.isSelected()) {
|
if (buttonServer.isSelected()) {
|
||||||
@@ -816,7 +734,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
camera.setBackgroundEnabled(checkBackground.isSelected());
|
camera.setBackgroundEnabled(checkBackground.isSelected());
|
||||||
}
|
}
|
||||||
updateButtons();
|
updateButtons();
|
||||||
camera.getConfig().save();
|
camera.getConfig().save();
|
||||||
renderer.setDevice(camera);
|
renderer.setDevice(camera);
|
||||||
renderer.setAutoScroll(true);
|
renderer.setAutoScroll(true);
|
||||||
@@ -1083,31 +1001,31 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isCameraStopped() {
|
boolean isCameraStopped() {
|
||||||
if ((server != null) && !server.isStarted()) {
|
if ((server != null) && !server.isStarted()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ((camera == null) || camera.isClosed());
|
return ((camera == null) || camera.isClosed());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean updatingButtons;
|
boolean updatingButtons;
|
||||||
|
void updateButtons(){
|
||||||
void updateButtons() {
|
|
||||||
updatingButtons = true;
|
updatingButtons = true;
|
||||||
try {
|
try{
|
||||||
boolean active = !isCameraStopped();//(camera != null);
|
boolean active = !isCameraStopped() ;//(camera != null);
|
||||||
|
buttonArgs.setEnabled(active);
|
||||||
buttonSave.setEnabled(active);
|
buttonSave.setEnabled(active);
|
||||||
buttonGrabBackground.setEnabled(active);
|
buttonGrabBackground.setEnabled(active);
|
||||||
buttonMarker.setEnabled(active);
|
buttonMarker.setEnabled(active);
|
||||||
buttonProfile.setEnabled(active);
|
buttonProfile.setEnabled(active);
|
||||||
buttonFit.setEnabled(active);
|
buttonFit.setEnabled(active);
|
||||||
buttonReticle.setEnabled(active && camera.getConfig().isCalibrated());
|
buttonReticle.setEnabled(active && camera.getConfig().isCalibrated());
|
||||||
buttonStreamData.setEnabled(active && (server != null));
|
buttonStreamData.setEnabled(active && (server!=null));
|
||||||
buttonPause.setEnabled(active);
|
buttonPause.setEnabled(active);
|
||||||
//buttonPause.setIcon(getIcon("Play"));
|
//buttonPause.setIcon(getIcon("Play"));
|
||||||
//buttonPause.setToolTipText("Resume");
|
//buttonPause.setToolTipText("Resume");
|
||||||
//buttonPause.setIcon(getIcon("Pause"));
|
//buttonPause.setIcon(getIcon("Pause"));
|
||||||
//buttonPause.setToolTipText("Pause");
|
//buttonPause.setToolTipText("Pause");
|
||||||
|
|
||||||
if (renderer.isPaused() != buttonPause.isSelected()) {
|
if (renderer.isPaused() != buttonPause.isSelected()) {
|
||||||
buttonPause.setSelected(renderer.isPaused());
|
buttonPause.setSelected(renderer.isPaused());
|
||||||
buttonPauseActionPerformed(null);
|
buttonPauseActionPerformed(null);
|
||||||
@@ -1119,8 +1037,8 @@ public class ScreenPanel2 extends Panel {
|
|||||||
buttonMarker.setSelected(false);
|
buttonMarker.setSelected(false);
|
||||||
}
|
}
|
||||||
buttonSave.setSelected(renderer.isSnapshotDialogVisible());
|
buttonSave.setSelected(renderer.isSnapshotDialogVisible());
|
||||||
|
|
||||||
} finally {
|
} finally{
|
||||||
updatingButtons = false;
|
updatingButtons = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1133,7 +1051,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textState.setText((camera == null) ? "" : camera.getState().toString());
|
textState.setText((camera == null) ? "" : camera.getState().toString());
|
||||||
if (App.hasArgument("s")) {
|
if (App.hasArgument("s")) {
|
||||||
try {
|
try {
|
||||||
((Source) getDevice("image")).initialize();
|
((Source) getDevice("image")).initialize();
|
||||||
@@ -1148,7 +1066,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
updateZoom();
|
updateZoom();
|
||||||
updateColormap();
|
updateColormap();
|
||||||
updateButtons();
|
updateButtons();
|
||||||
checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing()));
|
checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1177,17 +1095,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setImageBufferSize(int size) {
|
|
||||||
if (renderer.isPaused()) {
|
|
||||||
throw new RuntimeException("Cannot change buffer size whn paused");
|
|
||||||
}
|
|
||||||
synchronized (imageBuffer) {
|
|
||||||
imageBufferLenght = size;
|
|
||||||
imageBuffer.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Overlay[][] getFitOverlays(Data data) {
|
Overlay[][] getFitOverlays(Data data) {
|
||||||
Overlays.Polyline hgaussian = null;
|
Overlays.Polyline hgaussian = null;
|
||||||
Overlays.Polyline vgaussian = null;
|
Overlays.Polyline vgaussian = null;
|
||||||
@@ -1785,9 +1692,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
manageUserOverlays(image, data);
|
manageUserOverlays(image, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((dataTableDialog != null) && (dataTableDialog.isShowing())) {
|
|
||||||
updateStreamData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSnapshot() throws Exception {
|
void saveSnapshot() throws Exception {
|
||||||
@@ -2032,6 +1936,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
scrollPane.setPreferredSize(new Dimension(300, 400));
|
scrollPane.setPreferredSize(new Dimension(300, 400));
|
||||||
dataTableDialog.setContentPane(scrollPane);
|
dataTableDialog.setContentPane(scrollPane);
|
||||||
dataTableDialog.pack();
|
dataTableDialog.pack();
|
||||||
|
SwingUtils.centerComponent(getTopLevel(), dataTableDialog);
|
||||||
dataTableDialog.setVisible(true);
|
dataTableDialog.setVisible(true);
|
||||||
dataTableDialog.addWindowListener(new WindowAdapter() {
|
dataTableDialog.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -2039,62 +1944,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
dataTableModel = null;
|
dataTableModel = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dataTable.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
try {
|
|
||||||
int index = dataTable.getSelectedRow();
|
|
||||||
dataTable.setToolTipText(null);
|
|
||||||
if (index>1){
|
|
||||||
String id = String.valueOf(dataTable.getModel().getValueAt(index, 0));
|
|
||||||
String locator = String.valueOf(dataTable.getModel().getValueAt(0, 1));
|
|
||||||
dataTable.setToolTipText(locator + " " + id);
|
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
|
||||||
clipboard.setContents(new StringSelection(locator+ " " + id), (Clipboard clipboard1, Transferable contents) -> {});
|
|
||||||
if ((e.getClickCount() == 2) && (!e.isPopupTrigger())) {
|
|
||||||
Object obj = getCurrentFrame().cache.getValue(id);
|
|
||||||
if (id.equals("image")) {
|
|
||||||
} else if (id.equals("processing_parameters")) {
|
|
||||||
Map<String, Object> pars = getProcessingParameters(getCurrentFrame().cache);
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (String key : pars.keySet()) {
|
|
||||||
sb.append(key).append(" = ").append(Str.toString(pars.get(key), 10)).append("\n");
|
|
||||||
}
|
|
||||||
SwingUtils.showMessage(dataTableDialog, "Processing Parameters", sb.toString());
|
|
||||||
} else if ((obj!=null) && (obj.getClass().isArray() || (obj instanceof Number))) {
|
|
||||||
DeviceValueChart chart = new DeviceValueChart();
|
|
||||||
Device dev = null;
|
|
||||||
if (obj.getClass().isArray()){
|
|
||||||
dev = new ReadableRegisterArray(new ReadableArray() {
|
|
||||||
@Override
|
|
||||||
public Object read() throws IOException, InterruptedException {
|
|
||||||
return Convert.toDouble(getCurrentFrame().cache.getValue(id));
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int getSize() {
|
|
||||||
return Array.getLength(getCurrentFrame().cache.getValue(id));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
dev = new ReadableRegisterNumber(new ReadableNumber() {
|
|
||||||
@Override
|
|
||||||
public Object read() throws IOException, InterruptedException {
|
|
||||||
return Convert.toDouble(getCurrentFrame().cache.getValue(id));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
dev.setPolling(1000);
|
|
||||||
chart.setDevice(dev);
|
|
||||||
JDialog dlg = SwingUtils.showDialog(dataTableDialog, cameraName +" " + id, null, chart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
SwingUtils.centerComponent(getTopLevel(), dataTableDialog);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2120,34 +1969,30 @@ public class ScreenPanel2 extends Panel {
|
|||||||
dataTableModel.addRow(new Object[]{id, ""});
|
dataTableModel.addRow(new Object[]{id, ""});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Frame frame = getCurrentFrame();
|
for (int i = 2; i < dataTableModel.getRowCount(); i++) {
|
||||||
if ((frame != null) && (frame.cache!=null)){
|
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
|
||||||
for (int i = 2; i < dataTableModel.getRowCount(); i++) {
|
Object obj = server.getValue(id);
|
||||||
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
|
if (obj != null) {
|
||||||
//Object obj = server.getValue(id);
|
if (obj.getClass().isArray()) {
|
||||||
Object obj = frame.cache.getValue(id);
|
obj = obj.getClass().getComponentType().getSimpleName() + "[" + Array.getLength(obj) + "]";
|
||||||
if (obj != null) {
|
} else if (obj instanceof Double) {
|
||||||
if (obj.getClass().isArray()) {
|
obj = Convert.roundDouble((Double) obj, 1);
|
||||||
obj = obj.getClass().getComponentType().getSimpleName() + "[" + Array.getLength(obj) + "]";
|
} else if (obj instanceof Float) {
|
||||||
} else if (obj instanceof Double) {
|
obj = Convert.roundDouble((Float) obj, 1);
|
||||||
obj = Convert.roundDouble((Double) obj, 1);
|
|
||||||
} else if (obj instanceof Float) {
|
|
||||||
obj = Convert.roundDouble((Float) obj, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dataTableModel.setValueAt(String.valueOf(obj), i, 1);
|
|
||||||
}
|
}
|
||||||
|
dataTableModel.setValueAt(String.valueOf(obj), i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageIcon getIcon(String name) {
|
ImageIcon getIcon(String name) {
|
||||||
ImageIcon ret = null;
|
ImageIcon ret = null;
|
||||||
try {
|
try {
|
||||||
//Path path = Paths.get(getClass().getProtectionDomain().getCodeSource().getLocation().getPath(),"resources", name + ".png");
|
//Path path = Paths.get(getClass().getProtectionDomain().getCodeSource().getLocation().getPath(),"resources", name + ".png");
|
||||||
String dir = getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + "resources/";
|
String dir = getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + "resources/";
|
||||||
if (new File(dir + name + ".png").exists()) {
|
if (new File(dir + name + ".png").exists()){
|
||||||
ret = new javax.swing.ImageIcon(dir + name + ".png");
|
ret =new javax.swing.ImageIcon(dir + name + ".png");
|
||||||
} else {
|
} else {
|
||||||
ret = new ImageIcon(ch.psi.pshell.ui.App.class.getResource("/ch/psi/pshell/ui/" + name + ".png"));
|
ret = new ImageIcon(ch.psi.pshell.ui.App.class.getResource("/ch/psi/pshell/ui/" + name + ".png"));
|
||||||
if (MainFrame.isDark()) {
|
if (MainFrame.isDark()) {
|
||||||
@@ -2155,7 +2000,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
ret = new ImageIcon(ch.psi.pshell.ui.App.class.getResource("/ch/psi/pshell/ui/dark/" + name + ".png"));
|
ret = new ImageIcon(ch.psi.pshell.ui.App.class.getResource("/ch/psi/pshell/ui/dark/" + name + ".png"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@@ -2206,7 +2051,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
buttonServer = new javax.swing.JRadioButton();
|
buttonServer = new javax.swing.JRadioButton();
|
||||||
buttonDirect = new javax.swing.JRadioButton();
|
buttonDirect = new javax.swing.JRadioButton();
|
||||||
textState = new javax.swing.JTextField();
|
textState = new javax.swing.JTextField();
|
||||||
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
|
|
||||||
panelScreen = new javax.swing.JPanel();
|
panelScreen = new javax.swing.JPanel();
|
||||||
valueScreen = new ch.psi.pshell.swing.DeviceValuePanel();
|
valueScreen = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||||
comboScreen = new javax.swing.JComboBox();
|
comboScreen = new javax.swing.JComboBox();
|
||||||
@@ -2231,9 +2075,15 @@ public class ScreenPanel2 extends Panel {
|
|||||||
labelSlOrientation = new javax.swing.JLabel();
|
labelSlOrientation = new javax.swing.JLabel();
|
||||||
spinnerSlOrientation = new javax.swing.JSpinner();
|
spinnerSlOrientation = new javax.swing.JSpinner();
|
||||||
topPanel = new javax.swing.JPanel();
|
topPanel = new javax.swing.JPanel();
|
||||||
|
comboCameras = new javax.swing.JComboBox();
|
||||||
|
jLabel1 = new javax.swing.JLabel();
|
||||||
|
jLabel5 = new javax.swing.JLabel();
|
||||||
|
comboType = new javax.swing.JComboBox();
|
||||||
toolBar = new javax.swing.JToolBar();
|
toolBar = new javax.swing.JToolBar();
|
||||||
buttonSidePanel = new javax.swing.JToggleButton();
|
buttonSidePanel = new javax.swing.JToggleButton();
|
||||||
buttonStreamData = new javax.swing.JButton();
|
buttonStreamData = new javax.swing.JButton();
|
||||||
|
buttonArgs = new javax.swing.JButton();
|
||||||
|
jSeparator5 = new javax.swing.JToolBar.Separator();
|
||||||
buttonSave = new javax.swing.JToggleButton();
|
buttonSave = new javax.swing.JToggleButton();
|
||||||
buttonGrabBackground = new javax.swing.JButton();
|
buttonGrabBackground = new javax.swing.JButton();
|
||||||
buttonPause = new javax.swing.JToggleButton();
|
buttonPause = new javax.swing.JToggleButton();
|
||||||
@@ -2242,13 +2092,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
buttonProfile = new javax.swing.JToggleButton();
|
buttonProfile = new javax.swing.JToggleButton();
|
||||||
buttonFit = new javax.swing.JToggleButton();
|
buttonFit = new javax.swing.JToggleButton();
|
||||||
buttonReticle = new javax.swing.JToggleButton();
|
buttonReticle = new javax.swing.JToggleButton();
|
||||||
buttonTitle = new javax.swing.JToggleButton();
|
|
||||||
pauseSelection = new ch.psi.pshell.swing.ValueSelection();
|
pauseSelection = new ch.psi.pshell.swing.ValueSelection();
|
||||||
panelCameraSelection = new javax.swing.JPanel();
|
|
||||||
jLabel1 = new javax.swing.JLabel();
|
|
||||||
comboCameras = new javax.swing.JComboBox();
|
|
||||||
jLabel5 = new javax.swing.JLabel();
|
|
||||||
comboType = new javax.swing.JComboBox();
|
|
||||||
renderer = new ch.psi.pshell.imaging.Renderer();
|
renderer = new ch.psi.pshell.imaging.Renderer();
|
||||||
|
|
||||||
setPreferredSize(new java.awt.Dimension(873, 600));
|
setPreferredSize(new java.awt.Dimension(873, 600));
|
||||||
@@ -2508,10 +2352,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
|
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(56, 56, 56))
|
|
||||||
);
|
);
|
||||||
jPanel5Layout.setVerticalGroup(
|
jPanel5Layout.setVerticalGroup(
|
||||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
@@ -2520,10 +2360,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(buttonServer)
|
.addComponent(buttonServer)
|
||||||
.addComponent(buttonDirect)
|
.addComponent(buttonDirect)
|
||||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2790,7 +2627,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
.addComponent(panelScreen2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(panelScreen2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(panelScreen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(panelScreen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(panelFilter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addComponent(panelFilter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
sidePanelLayout.setVerticalGroup(
|
sidePanelLayout.setVerticalGroup(
|
||||||
sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
@@ -2806,10 +2643,30 @@ public class ScreenPanel2 extends Panel {
|
|||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(panelScreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(panelScreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
comboCameras.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||||
|
comboCameras.setMaximumRowCount(30);
|
||||||
|
comboCameras.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
comboCamerasActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jLabel1.setText("Camera:");
|
||||||
|
|
||||||
|
jLabel5.setText("Type:");
|
||||||
|
|
||||||
|
comboType.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||||
|
comboType.setMaximumRowCount(30);
|
||||||
|
comboType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Laser", "Electrons", "Photonics" }));
|
||||||
|
comboType.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
comboTypeActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
toolBar.setFloatable(false);
|
toolBar.setFloatable(false);
|
||||||
toolBar.setRollover(true);
|
toolBar.setRollover(true);
|
||||||
|
|
||||||
@@ -2838,6 +2695,22 @@ public class ScreenPanel2 extends Panel {
|
|||||||
});
|
});
|
||||||
toolBar.add(buttonStreamData);
|
toolBar.add(buttonStreamData);
|
||||||
|
|
||||||
|
buttonArgs.setIcon(getIcon("Data"));
|
||||||
|
buttonArgs.setText(" ");
|
||||||
|
buttonArgs.setToolTipText("Camera Setup");
|
||||||
|
buttonArgs.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
|
buttonArgs.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
buttonArgsActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolBar.add(buttonArgs);
|
||||||
|
|
||||||
|
jSeparator5.setMaximumSize(new java.awt.Dimension(20, 32767));
|
||||||
|
jSeparator5.setPreferredSize(new java.awt.Dimension(20, 0));
|
||||||
|
jSeparator5.setRequestFocusEnabled(false);
|
||||||
|
toolBar.add(jSeparator5);
|
||||||
|
|
||||||
buttonSave.setIcon(getIcon("Save"));
|
buttonSave.setIcon(getIcon("Save"));
|
||||||
buttonSave.setText(" ");
|
buttonSave.setText(" ");
|
||||||
buttonSave.setToolTipText("Save Snapshot");
|
buttonSave.setToolTipText("Save Snapshot");
|
||||||
@@ -2924,91 +2797,42 @@ public class ScreenPanel2 extends Panel {
|
|||||||
});
|
});
|
||||||
toolBar.add(buttonReticle);
|
toolBar.add(buttonReticle);
|
||||||
|
|
||||||
buttonTitle.setIcon(getIcon("Title"));
|
|
||||||
buttonTitle.setText(" ");
|
|
||||||
buttonTitle.setToolTipText("Show Camera Name");
|
|
||||||
buttonTitle.setFocusable(false);
|
|
||||||
buttonTitle.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
|
||||||
buttonTitle.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonTitleActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolBar.add(buttonTitle);
|
|
||||||
|
|
||||||
pauseSelection.setDecimals(0);
|
pauseSelection.setDecimals(0);
|
||||||
|
|
||||||
jLabel1.setText("Camera:");
|
|
||||||
|
|
||||||
comboCameras.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
|
||||||
comboCameras.setMaximumRowCount(30);
|
|
||||||
comboCameras.setMinimumSize(new java.awt.Dimension(127, 27));
|
|
||||||
comboCameras.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
comboCamerasActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel5.setText("Type:");
|
|
||||||
|
|
||||||
comboType.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
|
||||||
comboType.setMaximumRowCount(30);
|
|
||||||
comboType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Laser", "Electrons", "Photonics" }));
|
|
||||||
comboType.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
comboTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout panelCameraSelectionLayout = new javax.swing.GroupLayout(panelCameraSelection);
|
|
||||||
panelCameraSelection.setLayout(panelCameraSelectionLayout);
|
|
||||||
panelCameraSelectionLayout.setHorizontalGroup(
|
|
||||||
panelCameraSelectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelCameraSelectionLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addGap(0, 0, 0)
|
|
||||||
.addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jLabel5)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(0, 0, 0))
|
|
||||||
);
|
|
||||||
panelCameraSelectionLayout.setVerticalGroup(
|
|
||||||
panelCameraSelectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelCameraSelectionLayout.createSequentialGroup()
|
|
||||||
.addGap(0, 0, 0)
|
|
||||||
.addGroup(panelCameraSelectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
||||||
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jLabel5)
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(0, 0, 0))
|
|
||||||
);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
|
javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
|
||||||
topPanel.setLayout(topPanelLayout);
|
topPanel.setLayout(topPanelLayout);
|
||||||
topPanelLayout.setHorizontalGroup(
|
topPanelLayout.setHorizontalGroup(
|
||||||
topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, topPanelLayout.createSequentialGroup()
|
.addGroup(topPanelLayout.createSequentialGroup()
|
||||||
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(panelCameraSelection, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(jLabel1)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(comboCameras, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jLabel5)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(pauseSelection, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(pauseSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap())
|
.addGap(0, 0, 0))
|
||||||
);
|
);
|
||||||
topPanelLayout.setVerticalGroup(
|
topPanelLayout.setVerticalGroup(
|
||||||
topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
.addGroup(topPanelLayout.createSequentialGroup()
|
.addGroup(topPanelLayout.createSequentialGroup()
|
||||||
.addGap(1, 1, 1)
|
.addGap(1, 1, 1)
|
||||||
.addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
.addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(pauseSelection, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(panelCameraSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
.addComponent(jLabel1)
|
||||||
|
.addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(jLabel5)
|
||||||
|
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||||
|
.addComponent(pauseSelection, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
topPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboCameras, comboType, toolBar});
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@@ -3018,7 +2842,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||||
.addComponent(sidePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(sidePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 594, Short.MAX_VALUE))
|
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE))
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
.addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||||
@@ -3031,7 +2855,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(sidePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(sidePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 739, Short.MAX_VALUE)))
|
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
@@ -3381,32 +3205,24 @@ public class ScreenPanel2 extends Panel {
|
|||||||
|
|
||||||
private void buttonPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPauseActionPerformed
|
private void buttonPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPauseActionPerformed
|
||||||
try {
|
try {
|
||||||
if (!updatingButtons){
|
renderer.removeOverlay(imageBufferOverlay);
|
||||||
renderer.removeOverlay(imageBufferOverlay);
|
if (camera != null) {
|
||||||
if (camera != null) {
|
boolean pause = !renderer.isPaused();
|
||||||
boolean pause = !renderer.isPaused();
|
synchronized (imageBuffer) {
|
||||||
synchronized (imageBuffer) {
|
if (pause) {
|
||||||
if (pause) {
|
renderer.pause();
|
||||||
renderer.pause();
|
} else {
|
||||||
} else {
|
imageBuffer.clear();
|
||||||
imageBuffer.clear();
|
renderer.resume();
|
||||||
renderer.resume();
|
}
|
||||||
}
|
pauseSelection.setVisible(pause && (imageBuffer.size() > 1));
|
||||||
|
if (pauseSelection.isVisible()) {
|
||||||
if (pause && (imageBuffer.size() > 1)) {
|
renderer.addOverlay(imageBufferOverlay);
|
||||||
panelCameraSelection.setVisible(false);
|
pauseSelection.setMaxValue(imageBuffer.size());
|
||||||
pauseSelection.setVisible(true);
|
pauseSelection.setValue(imageBuffer.size());;
|
||||||
renderer.addOverlay(imageBufferOverlay);
|
|
||||||
pauseSelection.setMaxValue(imageBuffer.size());
|
|
||||||
pauseSelection.setValue(imageBuffer.size());;
|
|
||||||
updatePause();
|
|
||||||
} else {
|
|
||||||
pauseSelection.setVisible(false);
|
|
||||||
panelCameraSelection.setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
updateStreamData();
|
|
||||||
}
|
}
|
||||||
|
updateStreamData();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
showException(ex);
|
showException(ex);
|
||||||
@@ -3461,6 +3277,37 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
}//GEN-LAST:event_buttonSaveActionPerformed
|
}//GEN-LAST:event_buttonSaveActionPerformed
|
||||||
|
|
||||||
|
private void buttonArgsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonArgsActionPerformed
|
||||||
|
try {
|
||||||
|
if (camera != null) {
|
||||||
|
String cameraConfigJson = null;
|
||||||
|
if (usingServer) {
|
||||||
|
String cameraServerUrl = (camServerUrl == null) ? server.getUrl().substring(0, server.getUrl().length() - 1) + "8" : camServerUrl;
|
||||||
|
try (CameraServer srv = new CameraServer("CamServer", cameraServerUrl)) {
|
||||||
|
srv.initialize();
|
||||||
|
//TODO: replace into encodeMultiline
|
||||||
|
cameraConfigJson = JsonSerializer.encode(srv.getConfig(cameraName), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
String configFolder = (String) getContext().getClassByName("SfCamera").getMethod("getConfigFolder", new Class[]{}).invoke(null);
|
||||||
|
Path configFile = Paths.get(configFolder, cameraName + ".json");
|
||||||
|
cameraConfigJson = configFile.toFile().exists() ? new String(Files.readAllBytes(configFile)) : null;
|
||||||
|
}
|
||||||
|
TextEditor editor = new TextEditor();
|
||||||
|
editor.setText(cameraConfigJson);
|
||||||
|
editor.setReadOnly(true);
|
||||||
|
editor.setTitle(cameraName);
|
||||||
|
EditorDialog dlg = editor.getDialog(getTopLevel(), false);
|
||||||
|
dlg.setSize(480, 640);
|
||||||
|
dlg.setVisible(true);
|
||||||
|
SwingUtils.centerComponent(getTopLevel(), dlg);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
showException(ex);
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_buttonArgsActionPerformed
|
||||||
|
|
||||||
private void buttonStreamDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStreamDataActionPerformed
|
private void buttonStreamDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStreamDataActionPerformed
|
||||||
try {
|
try {
|
||||||
showStreamData();
|
showStreamData();
|
||||||
@@ -3484,7 +3331,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
} finally {
|
} finally{
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_comboTypeActionPerformed
|
}//GEN-LAST:event_comboTypeActionPerformed
|
||||||
@@ -3530,17 +3377,9 @@ public class ScreenPanel2 extends Panel {
|
|||||||
}
|
}
|
||||||
}//GEN-LAST:event_comboCamerasActionPerformed
|
}//GEN-LAST:event_comboCamerasActionPerformed
|
||||||
|
|
||||||
private void buttonTitleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTitleActionPerformed
|
|
||||||
try {
|
|
||||||
manageTitleOverlay();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showException(ex);
|
|
||||||
} finally {
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_buttonTitleActionPerformed
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton btFixColormapRange;
|
private javax.swing.JButton btFixColormapRange;
|
||||||
|
private javax.swing.JButton buttonArgs;
|
||||||
private javax.swing.JRadioButton buttonAutomatic;
|
private javax.swing.JRadioButton buttonAutomatic;
|
||||||
private javax.swing.JRadioButton buttonDirect;
|
private javax.swing.JRadioButton buttonDirect;
|
||||||
private javax.swing.JToggleButton buttonFit;
|
private javax.swing.JToggleButton buttonFit;
|
||||||
@@ -3559,7 +3398,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
private javax.swing.JRadioButton buttonServer;
|
private javax.swing.JRadioButton buttonServer;
|
||||||
private javax.swing.JToggleButton buttonSidePanel;
|
private javax.swing.JToggleButton buttonSidePanel;
|
||||||
private javax.swing.JButton buttonStreamData;
|
private javax.swing.JButton buttonStreamData;
|
||||||
private javax.swing.JToggleButton buttonTitle;
|
|
||||||
private javax.swing.JRadioButton buttonZoom025;
|
private javax.swing.JRadioButton buttonZoom025;
|
||||||
private javax.swing.JRadioButton buttonZoom05;
|
private javax.swing.JRadioButton buttonZoom05;
|
||||||
private javax.swing.JRadioButton buttonZoom2;
|
private javax.swing.JRadioButton buttonZoom2;
|
||||||
@@ -3576,7 +3414,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
private javax.swing.JComboBox comboFilter;
|
private javax.swing.JComboBox comboFilter;
|
||||||
private javax.swing.JComboBox comboScreen;
|
private javax.swing.JComboBox comboScreen;
|
||||||
private javax.swing.JComboBox comboType;
|
private javax.swing.JComboBox comboType;
|
||||||
private javax.swing.Box.Filler filler1;
|
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
private javax.swing.JLabel jLabel3;
|
private javax.swing.JLabel jLabel3;
|
||||||
private javax.swing.JLabel jLabel4;
|
private javax.swing.JLabel jLabel4;
|
||||||
@@ -3585,6 +3422,7 @@ public class ScreenPanel2 extends Panel {
|
|||||||
private javax.swing.JPanel jPanel3;
|
private javax.swing.JPanel jPanel3;
|
||||||
private javax.swing.JPanel jPanel5;
|
private javax.swing.JPanel jPanel5;
|
||||||
private javax.swing.JProgressBar jProgressBar1;
|
private javax.swing.JProgressBar jProgressBar1;
|
||||||
|
private javax.swing.JToolBar.Separator jSeparator5;
|
||||||
private javax.swing.JToolBar.Separator jSeparator6;
|
private javax.swing.JToolBar.Separator jSeparator6;
|
||||||
private javax.swing.JLabel labelGrScale;
|
private javax.swing.JLabel labelGrScale;
|
||||||
private javax.swing.JLabel labelGrThreshold;
|
private javax.swing.JLabel labelGrThreshold;
|
||||||
@@ -3593,7 +3431,6 @@ public class ScreenPanel2 extends Panel {
|
|||||||
private javax.swing.JLabel labelSlNumber;
|
private javax.swing.JLabel labelSlNumber;
|
||||||
private javax.swing.JLabel labelSlOrientation;
|
private javax.swing.JLabel labelSlOrientation;
|
||||||
private javax.swing.JLabel labelSlScale;
|
private javax.swing.JLabel labelSlScale;
|
||||||
private javax.swing.JPanel panelCameraSelection;
|
|
||||||
private javax.swing.JPanel panelFilter;
|
private javax.swing.JPanel panelFilter;
|
||||||
private javax.swing.JPanel panelScreen;
|
private javax.swing.JPanel panelScreen;
|
||||||
private javax.swing.JPanel panelScreen2;
|
private javax.swing.JPanel panelScreen2;
|
||||||
|
|||||||
Reference in New Issue
Block a user