This commit is contained in:
@@ -62,6 +62,7 @@ import ch.psi.utils.swing.SwingUtils.OptionType;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Point;
|
||||
@@ -147,7 +148,7 @@ public class ScreenPanel3 extends Panel {
|
||||
String instanceName;
|
||||
Overlay titleOv = null;
|
||||
int integration = 0;
|
||||
|
||||
|
||||
String pipelineSuffix = "_sp";
|
||||
|
||||
Double getServerDouble(String name) {
|
||||
@@ -183,7 +184,7 @@ public class ScreenPanel3 extends Panel {
|
||||
x_center_of_mass = getServerDouble("x_center_of_mass", cache);
|
||||
y_center_of_mass = getServerDouble("y_center_of_mass", cache);
|
||||
x_rms = getServerDouble("x_rms", cache);
|
||||
y_rms = getServerDouble("y_rms", cache);
|
||||
y_rms = getServerDouble("y_rms", cache);
|
||||
if (goodRegion) {
|
||||
double[] gX2 = new double[x_profile.length];
|
||||
Arrays.fill(gX2, Double.NaN);
|
||||
@@ -191,7 +192,7 @@ public class ScreenPanel3 extends Panel {
|
||||
double x = getServerDoubleArray("gr_x_axis", cache)[0];
|
||||
gr_size_x = x_fit_gauss_function.length;
|
||||
gr_pos_x = (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageX(x) : x);
|
||||
System.arraycopy(x_fit_gauss_function, 0, gX2, gr_pos_x , gr_size_x);
|
||||
System.arraycopy(x_fit_gauss_function, 0, gX2, gr_pos_x, gr_size_x);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
x_fit_gauss_function = gX2;
|
||||
@@ -200,7 +201,7 @@ public class ScreenPanel3 extends Panel {
|
||||
try {
|
||||
double y = getServerDoubleArray("gr_y_axis", cache)[0];
|
||||
gr_size_y = y_fit_gauss_function.length;
|
||||
gr_pos_y = (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageY(y) : y);
|
||||
gr_pos_y = (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageY(y) : y);
|
||||
System.arraycopy(y_fit_gauss_function, 0, gY2, gr_pos_y, y_fit_gauss_function.length);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
@@ -251,7 +252,7 @@ public class ScreenPanel3 extends Panel {
|
||||
final ArrayList<Frame> imageBuffer = new ArrayList();
|
||||
Frame currentFrame;
|
||||
int imageBufferLenght = 1;
|
||||
Text imageBufferOverlay;
|
||||
Text imagePauseOverlay;
|
||||
|
||||
public ScreenPanel3() {
|
||||
try {
|
||||
@@ -314,19 +315,19 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
if (App.hasArgument("suffix")) {
|
||||
pipelineSuffix = App.getArgumentValue("suffix");
|
||||
}
|
||||
}
|
||||
if (App.hasArgument("integration")) {
|
||||
try {
|
||||
integration = Integer.valueOf(App.getArgumentValue("integration"));
|
||||
if (integration !=0){
|
||||
if (integration != 0) {
|
||||
buttonFit.setSelected(false);
|
||||
buttonProfile.setSelected(false);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setProfileNormalized(true);
|
||||
renderer.setShowProfileLimits(false);
|
||||
|
||||
@@ -382,20 +383,18 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
JMenuItem menuSetImageBufferSize = new JMenuItem("Set Stack Size...");
|
||||
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){
|
||||
if (ret != null) {
|
||||
this.setImageBufferSize(Integer.valueOf(ret));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
JMenuItem menuSaveStack = new JMenuItem("Save Stack");
|
||||
menuSaveStack.addActionListener((ActionEvent e) -> {
|
||||
try {
|
||||
@@ -403,8 +402,7 @@ public class ScreenPanel3 extends Panel {
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
JMenuItem menuSetROI = new JMenuItem("Set ROI...");
|
||||
menuSetROI.addActionListener((ActionEvent e) -> {
|
||||
@@ -496,9 +494,6 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
}
|
||||
});
|
||||
imageBufferOverlay = new Text(renderer.getPenErrorText(), "", new Font("Verdana", Font.PLAIN, 12), new Point(-100, 42));
|
||||
imageBufferOverlay.setFixed(true);
|
||||
imageBufferOverlay.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
|
||||
if (MainFrame.isDark()) {
|
||||
textState.setDisabledTextColor(textState.getForeground());
|
||||
}
|
||||
@@ -786,7 +781,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
if (renderer.isPaused()) {
|
||||
renderer.resume();
|
||||
renderer.removeOverlay(imageBufferOverlay);
|
||||
removePauseOverlay();
|
||||
pauseSelection.setVisible(false);
|
||||
panelCameraSelection.setVisible(true);
|
||||
}
|
||||
@@ -820,7 +815,7 @@ public class ScreenPanel3 extends Panel {
|
||||
if (server != null) {
|
||||
//server.start(cameraName, false);
|
||||
String pipelineName = cameraName + pipelineSuffix;
|
||||
instanceName = cameraName + pipelineSuffix +"1";
|
||||
instanceName = cameraName + pipelineSuffix + "1";
|
||||
if (!server.getPipelines().contains(pipelineName)) {
|
||||
System.out.println("Creating pipeline: " + pipelineName);
|
||||
HashMap<String, Object> config = new HashMap<>();
|
||||
@@ -845,7 +840,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
updateButtons();
|
||||
camera.getConfig().save();
|
||||
if (Math.abs(integration)>1) {
|
||||
if (Math.abs(integration) > 1) {
|
||||
renderer.setDevice(new ImageIntegrator(integration));
|
||||
} else {
|
||||
renderer.setDevice(camera);
|
||||
@@ -883,6 +878,10 @@ public class ScreenPanel3 extends Panel {
|
||||
imageBuffer.remove(0);
|
||||
}
|
||||
}
|
||||
//Update data
|
||||
if (!renderer.isPaused()) {
|
||||
updateStreamData();
|
||||
}
|
||||
}
|
||||
}
|
||||
manageFit(bi, data);
|
||||
@@ -970,58 +969,60 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ImageIntegrator extends ColormapSource {
|
||||
|
||||
|
||||
ImageIntegrator(int num) {
|
||||
super("Image Averager", camera.getConfig());
|
||||
boolean continuous = (num<0);
|
||||
boolean continuous = (num < 0);
|
||||
final int numImages = Math.abs(num);
|
||||
|
||||
|
||||
camera.addListener(new ImageListener() {
|
||||
final ArrayList<Data> buffer = new ArrayList();
|
||||
Data integration = null;
|
||||
|
||||
@Override
|
||||
public void onImage(Object o, BufferedImage bi, Data data) {
|
||||
if (continuous){
|
||||
if (continuous) {
|
||||
buffer.add(data);
|
||||
if (buffer.size()>=numImages){
|
||||
for (Data d: buffer){
|
||||
if (buffer.size() >= numImages) {
|
||||
for (Data d : buffer) {
|
||||
process(d);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buffer.add(null); //Just to count
|
||||
process(data);
|
||||
}
|
||||
if (buffer.size()>=numImages){
|
||||
if (continuous){
|
||||
}
|
||||
if (buffer.size() >= numImages) {
|
||||
if (continuous) {
|
||||
buffer.remove(0);
|
||||
} else {
|
||||
buffer.clear();
|
||||
}
|
||||
if (integration!=null){
|
||||
if (integration != null) {
|
||||
//integration.div(numImages);
|
||||
ImageIntegrator.this.pushData(integration);
|
||||
}
|
||||
}
|
||||
integration = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
void process(Data data){
|
||||
if (integration == null){
|
||||
|
||||
void process(Data data) {
|
||||
if (integration == null) {
|
||||
integration = new Data(data);
|
||||
} else {
|
||||
integration.sum(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Object origin, Exception ex) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
volatile Dimension imageSize;
|
||||
|
||||
@@ -1226,9 +1227,6 @@ public class ScreenPanel3 extends Panel {
|
||||
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
if (!renderer.isPaused() && (dataTableDialog != null) && (dataTableDialog.isShowing())) {
|
||||
updateStreamData();
|
||||
}
|
||||
updateZoom();
|
||||
updateColormap();
|
||||
updateButtons();
|
||||
@@ -1283,7 +1281,7 @@ public class ScreenPanel3 extends Panel {
|
||||
//Double xCom=null, yCom=null;
|
||||
if (data != null) {
|
||||
int height = data.getHeight();
|
||||
int width = data.getWidth();
|
||||
int width = data.getWidth();
|
||||
int profileSize = renderer.getProfileSize();
|
||||
if ((useServerStats) && (server != null)) {
|
||||
try {
|
||||
@@ -1318,33 +1316,33 @@ public class ScreenPanel3 extends Panel {
|
||||
double maxProfile = Collections.max(l);
|
||||
double rangeProfile = maxProfile - minProfile;
|
||||
double minGauss = minProfile;
|
||||
double rangeGauss = rangeProfile;
|
||||
double rangeGauss = rangeProfile;
|
||||
//If not good region, range of profile and fit are similar so save this calcultion
|
||||
if (goodRegion && id.gr_size_x>0){
|
||||
l = Arrays.asList( (Double[]) Convert.toWrapperArray(Arrays.copyOfRange(gX, id.gr_pos_x, id.gr_pos_x + id.gr_size_x)));
|
||||
minGauss = Collections.min(l);
|
||||
if (goodRegion && id.gr_size_x > 0) {
|
||||
l = Arrays.asList((Double[]) Convert.toWrapperArray(Arrays.copyOfRange(gX, id.gr_pos_x, id.gr_pos_x + id.gr_size_x)));
|
||||
minGauss = Collections.min(l);
|
||||
rangeGauss = Collections.max(l) - minGauss;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < xp.length; i++) {
|
||||
if (gX != null) {
|
||||
yg[i] = (int) (height - 1 - (((gX[i] - minGauss) / rangeGauss) * profileSize));
|
||||
}
|
||||
yp[i] = (int) (height - 1 - (((pX[i] - minProfile) / rangeProfile) * profileSize));
|
||||
}
|
||||
|
||||
if (goodRegion && id.gr_size_x>0){
|
||||
|
||||
if (goodRegion && id.gr_size_x > 0) {
|
||||
xg = Arrays.copyOfRange(xg, id.gr_pos_x, id.gr_pos_x + id.gr_size_x);
|
||||
yg = Arrays.copyOfRange(yg, id.gr_pos_x, id.gr_pos_x + id.gr_size_x);
|
||||
}
|
||||
|
||||
|
||||
vgaussian = new Overlays.Polyline(penFit, xg, yg);
|
||||
vprofile = new Overlays.Polyline(renderer.getPenProfile(), xp, yp);
|
||||
}
|
||||
|
||||
if (pY != null) {
|
||||
int[] xp = new int[pY.length];
|
||||
int[] xg = new int[pY.length];
|
||||
int[] xg = new int[pY.length];
|
||||
int[] yp = Arr.indexesInt(pY.length);
|
||||
int[] yg = yp;
|
||||
|
||||
@@ -1353,12 +1351,12 @@ public class ScreenPanel3 extends Panel {
|
||||
double maxProfile = Collections.max(l);
|
||||
double rangeProfile = maxProfile - minProfile;
|
||||
double minGauss = minProfile;
|
||||
double rangeGauss = rangeProfile;
|
||||
double rangeGauss = rangeProfile;
|
||||
//If not good region, range of profile and fit are similar so save this calcultion
|
||||
if (goodRegion && id.gr_size_y>0){
|
||||
l = Arrays.asList( (Double[]) Convert.toWrapperArray(Arrays.copyOfRange(gY, id.gr_pos_y, id.gr_pos_y + id.gr_size_y)));
|
||||
if (goodRegion && id.gr_size_y > 0) {
|
||||
l = Arrays.asList((Double[]) Convert.toWrapperArray(Arrays.copyOfRange(gY, id.gr_pos_y, id.gr_pos_y + id.gr_size_y)));
|
||||
minGauss = Collections.min(l);
|
||||
rangeGauss = Collections.max(l) - minGauss;
|
||||
rangeGauss = Collections.max(l) - minGauss;
|
||||
}
|
||||
|
||||
for (int i = 0; i < xp.length; i++) {
|
||||
@@ -1368,7 +1366,7 @@ public class ScreenPanel3 extends Panel {
|
||||
xp[i] = (int) (((pY[i] - minProfile) / rangeProfile) * profileSize);
|
||||
}
|
||||
|
||||
if (goodRegion && id.gr_size_x>0){
|
||||
if (goodRegion && id.gr_size_x > 0) {
|
||||
xg = Arrays.copyOfRange(xg, id.gr_pos_y, id.gr_pos_y + id.gr_size_y);
|
||||
yg = Arrays.copyOfRange(yg, id.gr_pos_y, id.gr_pos_y + id.gr_size_y);
|
||||
}
|
||||
@@ -1876,16 +1874,31 @@ public class ScreenPanel3 extends Panel {
|
||||
synchronized (imageBuffer) {
|
||||
if (index < imageBuffer.size()) {
|
||||
Data data = imageBuffer.get(index).data;
|
||||
long pid = imageBuffer.get(index).cache.getPulseId();
|
||||
BufferedImage image = camera.generateImage(data);
|
||||
renderer.setImage(renderer.getOrigin(), image, data);
|
||||
imageBufferOverlay.update(Chrono.getTimeStr(data.getTimestamp(), "HH:mm:ss.SSS"));
|
||||
|
||||
String text = "PID: " + pid;
|
||||
if (imagePauseOverlay == null) {
|
||||
Font font = new Font("Verdana", Font.PLAIN, 12);
|
||||
Dimension d = SwingUtils.getTextSize(text, renderer.getFontMetrics(font));
|
||||
imagePauseOverlay = new Text(renderer.getPenErrorText(), "", font, new Point(-20 - d.width, 42));
|
||||
imagePauseOverlay.setFixed(true);
|
||||
imagePauseOverlay.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
|
||||
renderer.addOverlay(imagePauseOverlay);
|
||||
}
|
||||
//imagePauseOverlay.update(Chrono.getTimeStr(data.getTimestamp(), "HH:mm:ss.SSS"));
|
||||
imagePauseOverlay.update(text);
|
||||
manageFit(image, data);
|
||||
manageUserOverlays(image, data);
|
||||
}
|
||||
}
|
||||
if ((dataTableDialog != null) && (dataTableDialog.isShowing())) {
|
||||
updateStreamData();
|
||||
}
|
||||
updateStreamData();
|
||||
}
|
||||
|
||||
void removePauseOverlay() {
|
||||
renderer.removeOverlay(imagePauseOverlay);
|
||||
imagePauseOverlay = null;
|
||||
}
|
||||
|
||||
void saveSnapshot() throws Exception {
|
||||
@@ -2145,16 +2158,17 @@ public class ScreenPanel3 extends Panel {
|
||||
int row = dataTable.getSelectedRow();
|
||||
int col = dataTable.getSelectedColumn();
|
||||
dataTable.setToolTipText(null);
|
||||
if (row>1){
|
||||
String id = String.valueOf(dataTable.getModel().getValueAt(row, 0));
|
||||
if (row > 1) {
|
||||
String id = String.valueOf(dataTable.getModel().getValueAt(row, 0));
|
||||
String locator = String.valueOf(dataTable.getModel().getValueAt(0, 1));
|
||||
String channelId = locator + " " + id;
|
||||
dataTable.setToolTipText(channelId);
|
||||
if ((e.getClickCount() == 2) && (!e.isPopupTrigger())) {
|
||||
if (col == 0){
|
||||
dataTable.setToolTipText(channelId);
|
||||
if ((e.getClickCount() == 2) && (!e.isPopupTrigger())) {
|
||||
if (col == 0) {
|
||||
SwingUtils.showMessage(dataTableDialog, "Channel Identifier", "Copied to clipboard: " + channelId);
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
clipboard.setContents(new StringSelection(channelId), (Clipboard clipboard1, Transferable contents) -> {});
|
||||
clipboard.setContents(new StringSelection(channelId), (Clipboard clipboard1, Transferable contents) -> {
|
||||
});
|
||||
} else {
|
||||
Object obj = getCurrentFrame().cache.getValue(id);
|
||||
if (id.equals("image")) {
|
||||
@@ -2163,107 +2177,112 @@ public class ScreenPanel3 extends Panel {
|
||||
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))) {
|
||||
} else if ((obj != null) && (obj.getClass().isArray() || (obj instanceof Number))) {
|
||||
DeviceValueChart chart = new DeviceValueChart();
|
||||
Device dev = null;
|
||||
if (obj.getClass().isArray()){
|
||||
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 {
|
||||
} 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);
|
||||
JDialog dlg = SwingUtils.showDialog(dataTableDialog, cameraName + " " + id, null, chart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
SwingUtils.centerComponent(getTopLevel(), dataTableDialog);
|
||||
updateStreamData();
|
||||
}
|
||||
}
|
||||
|
||||
volatile boolean updatingStreamData = false;
|
||||
|
||||
void updateStreamData() {
|
||||
if ((dataTableModel != null) && (server != null)) {
|
||||
StreamValue value = server.getValue();
|
||||
int[] sel_rows = (dataTable==null) ? null : dataTable.getSelectedRows();
|
||||
int[] sel_cols = (dataTable==null) ? null : dataTable.getSelectedColumns();
|
||||
List<String> ids = (value == null) ? new ArrayList<>() : new ArrayList(value.getIdentifiers());
|
||||
if (ids.size() + 2 != dataTableModel.getRowCount()) {
|
||||
dataTableModel.setNumRows(0);
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"Locator", server.getUrl() + "/" + ((value == null) ? instanceName : server.getCurrentInstance())});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Locator", ex.getMessage()});
|
||||
}
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"Stream", server.getStreamAddress()});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Stream", ex.getMessage()});
|
||||
}
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"PID", value.getPulseId()});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"PID", ex.getMessage()});
|
||||
}
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"Timestamp", value.getTimestamp()});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Timestamp", ex.getMessage()});
|
||||
}
|
||||
Collections.sort(ids);
|
||||
for (String id : ids) {
|
||||
dataTableModel.addRow(new Object[]{id, ""});
|
||||
}
|
||||
}
|
||||
|
||||
Frame frame = getCurrentFrame();
|
||||
if ((frame != null) && (frame.cache!=null)){
|
||||
for (int i = 4; i < dataTableModel.getRowCount(); i++) {
|
||||
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
|
||||
//Object obj = server.getValue(id);
|
||||
Object obj = frame.cache.getValue(id);
|
||||
if (obj != null) {
|
||||
if (obj.getClass().isArray()) {
|
||||
obj = obj.getClass().getComponentType().getSimpleName() + "[" + Array.getLength(obj) + "]";
|
||||
} else if (obj instanceof Double) {
|
||||
obj = Convert.roundDouble((Double) obj, 1);
|
||||
} else if (obj instanceof Float) {
|
||||
obj = Convert.roundDouble((Float) obj, 1);
|
||||
}
|
||||
}
|
||||
dataTableModel.setValueAt(String.valueOf(obj), i, 1);
|
||||
}
|
||||
}
|
||||
if ((sel_rows!=null) && (sel_rows.length>0)){
|
||||
//dataTable.setRowSelectionInterval((Integer)Arr.getMin(sel_rows), (Integer)Arr.getMax(sel_rows));
|
||||
dataTable.setRowSelectionInterval(sel_rows[0], sel_rows[sel_rows.length-1]);
|
||||
}
|
||||
if ((sel_cols!=null) && (sel_cols.length>0)){
|
||||
//dataTable.setColumnSelectionInterval((Integer)Arr.getMin(sel_cols), (Integer)Arr.getMax(sel_cols));
|
||||
dataTable.setColumnSelectionInterval(sel_cols[0], sel_cols[sel_cols.length-1]);
|
||||
}
|
||||
if ((dataTableDialog == null) || !dataTableDialog.isShowing() || updatingStreamData) {
|
||||
return;
|
||||
}
|
||||
updatingStreamData = true;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
updatingStreamData = false;
|
||||
if ((dataTableModel != null) && (server != null)) {
|
||||
StreamValue value = server.getValue();
|
||||
Frame frame = getCurrentFrame();
|
||||
int[] sel_rows = (dataTable == null) ? null : dataTable.getSelectedRows();
|
||||
int[] sel_cols = (dataTable == null) ? null : dataTable.getSelectedColumns();
|
||||
List<String> ids = (value == null) ? new ArrayList<>() : new ArrayList(value.getIdentifiers());
|
||||
if (ids.size() + 4 != dataTableModel.getRowCount()) {
|
||||
dataTableModel.setNumRows(0);
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"Locator", server.getUrl() + "/" + ((value == null) ? instanceName : server.getCurrentInstance())});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Locator", ex.getMessage()});
|
||||
}
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"Stream", server.getStreamAddress()});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Stream", ex.getMessage()});
|
||||
}
|
||||
dataTableModel.addRow(new Object[]{"PID", ""});
|
||||
dataTableModel.addRow(new Object[]{"Timestamp", ""});
|
||||
Collections.sort(ids);
|
||||
for (String id : ids) {
|
||||
dataTableModel.addRow(new Object[]{id, ""});
|
||||
}
|
||||
}
|
||||
|
||||
if ((frame != null) && (frame.cache != null)) {
|
||||
dataTableModel.setValueAt(frame.cache.getPulseId(), 2, 1); //PID
|
||||
dataTableModel.setValueAt(frame.cache.getTimestamp(), 3, 1); //Timestamp
|
||||
for (int i = 4; i < dataTableModel.getRowCount(); i++) {
|
||||
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
|
||||
//Object obj = server.getValue(id);
|
||||
Object obj = frame.cache.getValue(id);
|
||||
if (obj != null) {
|
||||
if (obj.getClass().isArray()) {
|
||||
obj = obj.getClass().getComponentType().getSimpleName() + "[" + Array.getLength(obj) + "]";
|
||||
} else if (obj instanceof Double) {
|
||||
obj = Convert.roundDouble((Double) obj, 1);
|
||||
} else if (obj instanceof Float) {
|
||||
obj = Convert.roundDouble((Float) obj, 1);
|
||||
}
|
||||
}
|
||||
dataTableModel.setValueAt(String.valueOf(obj), i, 1);
|
||||
}
|
||||
}
|
||||
if ((sel_rows != null) && (sel_rows.length > 0)) {
|
||||
//dataTable.setRowSelectionInterval((Integer)Arr.getMin(sel_rows), (Integer)Arr.getMax(sel_rows));
|
||||
dataTable.setRowSelectionInterval(sel_rows[0], sel_rows[sel_rows.length - 1]);
|
||||
}
|
||||
if ((sel_cols != null) && (sel_cols.length > 0)) {
|
||||
//dataTable.setColumnSelectionInterval((Integer)Arr.getMin(sel_cols), (Integer)Arr.getMax(sel_cols));
|
||||
dataTable.setColumnSelectionInterval(sel_cols[0], sel_cols[sel_cols.length - 1]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ImageIcon getIcon(String name) {
|
||||
@@ -3193,7 +3212,7 @@ public class ScreenPanel3 extends Panel {
|
||||
Color colorReticule = new Color(16, 16, 16);
|
||||
Color colorMarker = new Color(128, 128, 128);
|
||||
Colormap colormap = (Colormap) comboColormap.getSelectedItem();
|
||||
source.getConfig().colormap = (colormap==null) ? Colormap.Flame: colormap;
|
||||
source.getConfig().colormap = (colormap == null) ? Colormap.Flame : colormap;
|
||||
switch (source.getConfig().colormap) {
|
||||
case Grayscale:
|
||||
case Inverted:
|
||||
@@ -3508,26 +3527,29 @@ public class ScreenPanel3 extends Panel {
|
||||
|
||||
private void buttonPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPauseActionPerformed
|
||||
try {
|
||||
if (!updatingButtons){
|
||||
renderer.removeOverlay(imageBufferOverlay);
|
||||
if (!updatingButtons) {
|
||||
removePauseOverlay();
|
||||
if (camera != null) {
|
||||
boolean pause = !renderer.isPaused();
|
||||
synchronized (imageBuffer) {
|
||||
if (pause) {
|
||||
renderer.pause();
|
||||
panelCameraSelection.setVisible(false);
|
||||
pauseSelection.setVisible(true);
|
||||
if (imageBuffer.size() > 0) {
|
||||
pauseSelection.setEnabled(true);
|
||||
pauseSelection.setMaxValue(imageBuffer.size());
|
||||
pauseSelection.setValue(imageBuffer.size());
|
||||
updatePause();
|
||||
} else {
|
||||
pauseSelection.setEnabled(false);
|
||||
pauseSelection.setMaxValue(1);
|
||||
pauseSelection.setValue(1);
|
||||
}
|
||||
} else {
|
||||
imageBuffer.clear();
|
||||
renderer.resume();
|
||||
}
|
||||
|
||||
if (pause && (imageBuffer.size() > 1)) {
|
||||
panelCameraSelection.setVisible(false);
|
||||
pauseSelection.setVisible(true);
|
||||
renderer.addOverlay(imageBufferOverlay);
|
||||
pauseSelection.setMaxValue(imageBuffer.size());
|
||||
pauseSelection.setValue(imageBuffer.size());;
|
||||
updatePause();
|
||||
} else {
|
||||
//renderer.clear();
|
||||
pauseSelection.setVisible(false);
|
||||
panelCameraSelection.setVisible(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user