From 18c9885a22ff24d27583c48f21882b31c712d50d Mon Sep 17 00:00:00 2001 From: sfop Date: Wed, 8 Mar 2017 11:40:14 +0100 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 10 ++--- plugins/ScreenPanel.form | 17 ++++++-- plugins/ScreenPanel.java | 66 +++++++++++++++++++++++++++----- 3 files changed, 76 insertions(+), 17 deletions(-) diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index aa2c888..b9d07c8 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,4 +1,4 @@ -#Tue Mar 07 13:34:34 CET 2017 +#Wed Mar 08 11:38:47 CET 2017 colormap=Temperature colormapAutomatic=true colormapMax=0.0 @@ -19,9 +19,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=9324.4111328125 -spatialCalOffsetY=11107.228515625 -spatialCalScaleX=-13.612279109045152 -spatialCalScaleY=-12.708499394975416 +spatialCalOffsetX=8751.115234375 +spatialCalOffsetY=16090.42578125 +spatialCalScaleX=-26.761820720381525 +spatialCalScaleY=-26.595745478002502 spatialCalUnits=mm transpose=false diff --git a/plugins/ScreenPanel.form b/plugins/ScreenPanel.form index 0da7c7a..86d93b7 100644 --- a/plugins/ScreenPanel.form +++ b/plugins/ScreenPanel.form @@ -186,15 +186,17 @@ - + - + + + - + @@ -210,6 +212,7 @@ + @@ -261,6 +264,14 @@ + + + + + + + + diff --git a/plugins/ScreenPanel.java b/plugins/ScreenPanel.java index 5d025d3..0a03999 100644 --- a/plugins/ScreenPanel.java +++ b/plugins/ScreenPanel.java @@ -210,7 +210,6 @@ public class ScreenPanel extends Panel { ((Camtool) camera).setRoi(new int[]{roi.x + cur[0], roi.y + cur[1], roi.width, roi.height}); } else { ((Camtool) camera).setRoi(new int[]{roi.x, roi.y, roi.width, roi.height}); - ((Camtool) camera).setRoiEnabled(true); } } catch (Exception ex) { } finally { @@ -233,7 +232,7 @@ public class ScreenPanel extends Panel { renderer.abortSelection(); if (camera instanceof Camtool) { try { - ((Camtool) camera).setRoiEnabled(false); + ((Camtool) camera).resetRoi(); } catch (IOException ex) { showException(ex); } @@ -400,7 +399,9 @@ public class ScreenPanel extends Panel { } } catch (Exception ex) { ex.printStackTrace(); - } + } finally{ + updateStop(); + } } void manageFit(BufferedImage bi, Data data) { @@ -627,7 +628,7 @@ public class ScreenPanel extends Panel { ((Camtool) camera).startPipeline(cameraName, null); updateCamtoolControls(); } else { - ((Camtool) camera).startPipeline(cameraName, null, checkBackground.isSelected(), null, null, null); + ((Camtool) camera).startPipeline(cameraName, null, checkBackground.isSelected(), null, checkThreshold.isSelected() ? (Double) spinnerThreshold.getValue() : null, null); } spinnerThreshold.setEnabled(true); checkThreshold.setEnabled(true); @@ -867,6 +868,21 @@ public class ScreenPanel extends Panel { } } + boolean isCameraStopped(){ + if ((camera!=null) && (camera instanceof Camtool)) { + if (!((Camtool) camera).isPipelineStarted()){ + return true; + } + } + return ((camera == null) || (camera.isClosed()) || !buttonStop.isEnabled()); + } + + void updateStop(){ + buttonStop.setEnabled(comboCameras.getSelectedItem()!=null); + buttonStop.setText(isCameraStopped() ? "Start": "Stop"); + + } + @Override protected void onTimer() { for (Device dev : new Device[]{screen, filter}) { @@ -898,6 +914,7 @@ public class ScreenPanel extends Panel { } updateZoom(); updateColormap(); + updateStop(); buttonSave.setSelected(renderer.isSnapshotDialogVisible()); checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing())); } @@ -1456,6 +1473,7 @@ public class ScreenPanel extends Panel { buttonSetup = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); buttonConfig = new javax.swing.JButton(); + buttonStop = new javax.swing.JButton(); renderer = new ch.psi.pshell.imaging.Renderer(); jPanel4 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); @@ -1607,6 +1625,13 @@ public class ScreenPanel extends Panel { } }); + buttonStop.setText("Stop"); + buttonStop.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonStopActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( @@ -1615,19 +1640,21 @@ public class ScreenPanel extends Panel { .addGap(0, 0, 0) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(comboCameras, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(comboCameras, 0, 178, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(buttonConfig) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(buttonSetup) - .addGap(50, 50, 50) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonStop) + .addGap(18, 18, 18) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0)) ); - jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfig, buttonSetup}); + jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfig, buttonSetup, buttonStop}); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1639,7 +1666,8 @@ public class ScreenPanel extends Panel { .addComponent(jLabel2) .addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(buttonConfig) - .addComponent(buttonSetup)) + .addComponent(buttonSetup) + .addComponent(buttonStop)) .addGap(0, 0, 0)) ); @@ -2124,6 +2152,7 @@ public class ScreenPanel extends Panel { } catch (Exception ex) { ex.printStackTrace(); } finally { + updateStop(); comboCameras.setEnabled(true); buttonCamtool.setEnabled(true); buttonDirect.setEnabled(true); @@ -2458,6 +2487,24 @@ public class ScreenPanel extends Panel { } }//GEN-LAST:event_checkThresholdActionPerformed + private void buttonStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopActionPerformed + try { + if (buttonStop.getText().equals("Stop")){ + if ((camera!=null) && !camera.isClosed()){ + camera.close(); + } + } else { + if (isCameraStopped()){ + comboCamerasActionPerformed(null); + } + } + } catch (Exception ex) { + showException(ex); + } finally { + updateStop(); + } + }//GEN-LAST:event_buttonStopActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton buttonAutomatic; private javax.swing.JRadioButton buttonCamtool; @@ -2478,6 +2525,7 @@ public class ScreenPanel extends Panel { private javax.swing.JToggleButton buttonReticle; private javax.swing.JToggleButton buttonSave; private javax.swing.JButton buttonSetup; + private javax.swing.JButton buttonStop; private javax.swing.JRadioButton buttonTemperature; private javax.swing.JRadioButton buttonZoom025; private javax.swing.JRadioButton buttonZoom05;