Startup
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
#Mon Nov 04 14:37:52 CET 2019
|
||||
FileSequentialNumber=112
|
||||
#Mon Nov 04 14:42:13 CET 2019
|
||||
FileSequentialNumber=114
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="renderer" pref="505" max="32767" attributes="0"/>
|
||||
<Component id="renderer" pref="491" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
@@ -203,7 +203,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="19" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
@@ -217,7 +217,12 @@
|
||||
<Component id="edit_x_fit_mean" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
<Component id="edit_y_fit_mean" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="20" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="27" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -244,7 +249,8 @@
|
||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="edit_y_fit_mean" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="33" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -294,6 +300,14 @@
|
||||
<Property name="text" type="java.lang.String" value="y_fit_mean"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Plot"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
|
||||
@@ -3,12 +3,19 @@ import ch.psi.pshell.bs.StreamValue;
|
||||
import ch.psi.pshell.core.CommandSource;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
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.imaging.Overlay;
|
||||
import ch.psi.pshell.imaging.Overlays;
|
||||
import ch.psi.pshell.scan.MonitorScan;
|
||||
import ch.psi.pshell.swing.DataPanel;
|
||||
import ch.psi.pshell.swing.DeviceValueChart;
|
||||
import ch.psi.pshell.ui.App;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.Convert;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.Threading;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
@@ -18,11 +25,14 @@ import java.awt.Font;
|
||||
import java.awt.Point;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
@@ -239,6 +249,65 @@ public class AthosCameras extends Panel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void showPlot(String field) throws Exception{
|
||||
DeviceListener listener;
|
||||
Object obj = dataPipeline.getValue(field);
|
||||
if (field.equals("processing_parameters")) {
|
||||
} 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(dataPipeline.getValue(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return Array.getLength(dataPipeline.getValue(field));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dev = new ReadableRegisterNumber(new ReadableNumber() {
|
||||
@Override
|
||||
public Object read() throws IOException, InterruptedException {
|
||||
return Convert.toDouble(dataPipeline.getValue(field));
|
||||
}
|
||||
});
|
||||
}
|
||||
//dev.setPolling(1000);
|
||||
Device finalDev = dev;
|
||||
|
||||
listener = new DeviceAdapter() {
|
||||
@Override
|
||||
public void onCacheChanged(Device device, Object value, Object former, long timestamp, boolean valueChange) {
|
||||
finalDev.updateAsync();
|
||||
}
|
||||
};
|
||||
dataPipeline.getStream().addListener(listener);
|
||||
|
||||
|
||||
JDialog dlg = SwingUtils.showDialog(AthosCameras.this.getTopLevel(), cameraName + " " + field, null, chart);
|
||||
|
||||
chart.setAsyncUpdates(true);
|
||||
chart.setDevice(dev);
|
||||
//chart.setAsyncUpdates(true);
|
||||
System.out.println(chart.getAsyncUpdates());
|
||||
|
||||
SwingUtils.invokeDelayed(()->{chart.setAsyncUpdates(true);}, 3000);
|
||||
//TODO:
|
||||
//PlotBase plot = chart.getPlot();
|
||||
//if (plot!=null){
|
||||
// plot.setPlotBackgroundColor(Color.BLACK);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@@ -262,6 +331,7 @@ public class AthosCameras extends Panel {
|
||||
edit_x_fit_mean = new javax.swing.JTextField();
|
||||
edit_y_fit_mean = new javax.swing.JTextField();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
textCamera = new javax.swing.JTextField();
|
||||
|
||||
@@ -375,12 +445,19 @@ public class AthosCameras extends Panel {
|
||||
|
||||
jLabel4.setText("y_fit_mean");
|
||||
|
||||
jButton1.setText("Plot");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap(19, Short.MAX_VALUE)
|
||||
.addContainerGap(26, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel2)
|
||||
@@ -392,7 +469,11 @@ public class AthosCameras extends Panel {
|
||||
.addComponent(edit_x_center_of_mass, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(edit_x_fit_mean, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(edit_y_fit_mean, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(20, Short.MAX_VALUE))
|
||||
.addContainerGap(27, Short.MAX_VALUE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jButton1)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -413,7 +494,8 @@ public class AthosCameras extends Panel {
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(edit_y_fit_mean, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(33, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jButton1))
|
||||
);
|
||||
|
||||
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Camera"));
|
||||
@@ -443,7 +525,7 @@ public class AthosCameras extends Panel {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
|
||||
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
@@ -495,6 +577,15 @@ public class AthosCameras extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_buttonOpenActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
try{
|
||||
|
||||
showPlot("x_center_of_mass");
|
||||
} catch (Exception ex){
|
||||
this.showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonOpen;
|
||||
private javax.swing.JToggleButton buttonRec;
|
||||
@@ -503,6 +594,7 @@ public class AthosCameras extends Panel {
|
||||
private javax.swing.JTextField edit_x_fit_mean;
|
||||
private javax.swing.JTextField edit_y_center_of_mass;
|
||||
private javax.swing.JTextField edit_y_fit_mean;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
|
||||
Reference in New Issue
Block a user