This commit is contained in:
2015-12-02 09:01:31 +01:00
parent 15285dc291
commit 8e909e9603
2 changed files with 274 additions and 49 deletions
+124 -26
View File
@@ -17,34 +17,40 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="renderer" pref="342" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="123" max="-2" attributes="0"/>
<Component id="buttonDefineBeam" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="motorPanel1" linkSize="1" max="32767" attributes="0"/>
<Component id="motorPanel2" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="processVariablePanel1" linkSize="1" alignment="1" min="-2" pref="324" max="-2" attributes="0"/>
<Component id="processVariablePanel2" linkSize="1" alignment="0" min="-2" pref="324" max="-2" attributes="0"/>
<Component id="renderer" pref="330" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="123" max="-2" attributes="0"/>
<Component id="buttonDefineBeam" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="motorPanel1" linkSize="1" max="32767" attributes="0"/>
<Component id="motorPanel2" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="processVariablePanel1" linkSize="1" alignment="1" min="-2" pref="324" max="-2" attributes="0"/>
<Component id="processVariablePanel2" linkSize="1" alignment="0" min="-2" pref="324" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="checkHighDef" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="button0" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="button90" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="button180" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="button270" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="checkHighDef" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="button0" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="button90" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="button180" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="button270" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -72,7 +78,9 @@
<Component id="button180" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="button270" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="158" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="checkHighDef" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonDefineBeam" min="-2" max="-2" attributes="0"/>
@@ -203,5 +211,95 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="button270ActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="96" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="buttonLeft" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
<Component id="buttonRight" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="44" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonDown" min="-2" max="-2" attributes="0"/>
<Component id="buttonUp" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="44" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="104" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="20" max="32767" attributes="0"/>
<Component id="buttonUp" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonRight" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonLeft" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonDown" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="48" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonLeft">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&lt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonLeftActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonRight">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&gt;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRightActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonUp">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="^"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonUpActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDown">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="v"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDownActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
+150 -23
View File
@@ -3,6 +3,7 @@
*/
import ch.psi.pshell.device.Motor;
import ch.psi.pshell.device.Positionable;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays;
@@ -59,6 +60,11 @@ public class Microscope extends Panel {
button90 = new javax.swing.JButton();
button180 = new javax.swing.JButton();
button270 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
buttonLeft = new javax.swing.JButton();
buttonRight = new javax.swing.JButton();
buttonUp = new javax.swing.JButton();
buttonDown = new javax.swing.JButton();
renderer.setAutoscrolls(true);
renderer.setDeviceName("mic-high");
@@ -142,35 +148,104 @@ public class Microscope extends Panel {
}
});
buttonLeft.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
buttonLeft.setText("<");
buttonLeft.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonLeftActionPerformed(evt);
}
});
buttonRight.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
buttonRight.setText(">");
buttonRight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRightActionPerformed(evt);
}
});
buttonUp.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
buttonUp.setText("^");
buttonUp.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonUpActionPerformed(evt);
}
});
buttonDown.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
buttonDown.setText("v");
buttonDown.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDownActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(96, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(buttonLeft)
.addGap(42, 42, 42)
.addComponent(buttonRight))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(44, 44, 44)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonDown)
.addComponent(buttonUp))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(104, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(20, Short.MAX_VALUE)
.addComponent(buttonUp)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonRight)
.addComponent(buttonLeft))
.addGap(18, 18, 18)
.addComponent(buttonDown)
.addContainerGap(48, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(123, 123, 123)
.addComponent(buttonDefineBeam))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(motorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(motorPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(processVariablePanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(processVariablePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(123, 123, 123)
.addComponent(buttonDefineBeam))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(motorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(motorPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(processVariablePanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(processVariablePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(checkHighDef))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(button0)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button90)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button180)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button270)))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(checkHighDef))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(button0)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button90)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button180)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(button270)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
@@ -197,7 +272,9 @@ public class Microscope extends Panel {
.addComponent(button90)
.addComponent(button180)
.addComponent(button270))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(checkHighDef)
.addGap(18, 18, 18)
.addComponent(buttonDefineBeam)
@@ -284,13 +361,63 @@ public class Microscope extends Panel {
}
}//GEN-LAST:event_button270ActionPerformed
double step = 0.01;
private void buttonLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLeftActionPerformed
try{
((ch.psi.pshell.epics.Positionable)getDevice("x")).moveRelAsync(-step);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_buttonLeftActionPerformed
private void buttonRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRightActionPerformed
try{
((ch.psi.pshell.epics.Positionable)getDevice("x")).moveRelAsync(step);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_buttonRightActionPerformed
private void buttonUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUpActionPerformed
try{
doVerticalStep(step);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_buttonUpActionPerformed
private void buttonDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDownActionPerformed
try{
doVerticalStep(-step);
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_buttonDownActionPerformed
public void doVerticalStep(double offset) throws Exception
{
double omega = Math.toRadians((Double) ((Positionable)getDevice("omega")).getPosition());
double y = -offset * Math.sin(omega);
double z = offset * Math.cos(omega);
((Motor)getDevice("cy")).moveRelAsync(y);
((Motor)getDevice("cz")).moveRelAsync(z);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton button0;
private javax.swing.JButton button180;
private javax.swing.JButton button270;
private javax.swing.JButton button90;
private javax.swing.JButton buttonDefineBeam;
private javax.swing.JButton buttonDown;
private javax.swing.JButton buttonLeft;
private javax.swing.JButton buttonRight;
private javax.swing.JButton buttonUp;
private javax.swing.JCheckBox checkHighDef;
private javax.swing.JPanel jPanel1;
private ch.psi.pshell.swing.MotorPanel motorPanel1;
private ch.psi.pshell.swing.MotorPanel motorPanel2;
private ch.psi.pshell.swing.ProcessVariablePanel processVariablePanel1;