Drawing over image
This commit is contained in:
@@ -7,10 +7,14 @@ import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceBase;
|
||||
import ch.psi.pshell.imaging.DimensionDouble;
|
||||
import ch.psi.pshell.imaging.PointDouble;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
import ch.psi.pshell.imaging.Utils;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -155,19 +159,57 @@ public class BasePlate extends DeviceBase {
|
||||
}
|
||||
|
||||
boolean drawContour;
|
||||
|
||||
enum DrawMode{
|
||||
fill,
|
||||
center,
|
||||
left,
|
||||
right,
|
||||
top,
|
||||
bottom
|
||||
}
|
||||
|
||||
void draw(Graphics2D g, Rectangle plotRect, boolean drawSamples, boolean drawIds, boolean drawContour) {
|
||||
this.plotRect = plotRect;
|
||||
this.drawContour = drawContour;
|
||||
if (drawContour){
|
||||
g.setColor(getColor());
|
||||
g.fillOval((int)(plotRect.width*0.05), (int)(plotRect.height * 0.05), (int)(plotRect.width*0.90), (int)(plotRect.height*0.90));
|
||||
void draw(Graphics2D g, Rectangle plotRect, boolean drawSamples, boolean drawIds, boolean drawContour, DrawMode mode, BufferedImage img) {
|
||||
if (mode != DrawMode.fill){
|
||||
int length = Math.min(plotRect.width, plotRect.height);
|
||||
Point center= new Point(plotRect.x + plotRect.width/2, plotRect.y + plotRect.height/2); //center;
|
||||
switch (mode){
|
||||
case left:
|
||||
center.setLocation(length/2, center.y);
|
||||
break;
|
||||
case right:
|
||||
center.setLocation(plotRect.width - length/2, center.y);
|
||||
break;
|
||||
case top:
|
||||
center.setLocation(center.x, length/2);
|
||||
break;
|
||||
case bottom:
|
||||
center.setLocation(center.x, plotRect.height - length/2);
|
||||
break;
|
||||
}
|
||||
|
||||
plotRect = new Rectangle(center.x - length/2, center.y - length/2, length, length);
|
||||
}
|
||||
this.plotRect = plotRect;
|
||||
this.drawContour = drawContour;
|
||||
Rectangle boundingBox = new Rectangle((int)(plotRect.x+plotRect.width*0.05), (int)(plotRect.y+plotRect.height * 0.05), (int)(plotRect.width*0.90), (int)(plotRect.height*0.90));
|
||||
if (img!=null){
|
||||
img = Utils.stretch(img, boundingBox.width, boundingBox.height);
|
||||
g.drawImage(img, boundingBox.x, boundingBox.y, null);
|
||||
}
|
||||
boolean drawBackground = (img==null);
|
||||
|
||||
if (drawContour){
|
||||
if (drawBackground){
|
||||
g.setColor(getColor());
|
||||
g.fillOval(boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height);
|
||||
}
|
||||
g.setColor(getBorderColor());
|
||||
g.drawOval((int)(plotRect.width*0.05), (int)(plotRect.height * 0.05), (int)(plotRect.width*0.90), (int)(plotRect.height*0.90));
|
||||
g.drawOval(boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height);
|
||||
|
||||
}
|
||||
for (Puck puck : getPucks()) {
|
||||
puck.draw(g, null, drawSamples, drawIds, this) ;
|
||||
puck.draw(g, null, drawSamples, drawIds, drawBackground, this) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,15 @@
|
||||
*/
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.mxsc.BasePlate.DrawMode;
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.imaging.Data;
|
||||
import ch.psi.pshell.imaging.ImageListener;
|
||||
import ch.psi.pshell.imaging.Source;
|
||||
import ch.psi.pshell.swing.DevicePanel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
@@ -14,6 +20,7 @@ import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JMenuItem;
|
||||
@@ -103,11 +110,12 @@ public class BasePlatePanel extends DevicePanel {
|
||||
|
||||
Rectangle platePlotRect;
|
||||
Rectangle puckPlotRect;
|
||||
Source source;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
if (getDevice() != null) {
|
||||
if (getDevice() != null) {
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
Dimension size = getSize();
|
||||
if ((size.width > 40) && (size.height > 40)) {
|
||||
@@ -122,38 +130,64 @@ public class BasePlatePanel extends DevicePanel {
|
||||
case single:
|
||||
platePlotRect = plotRect;
|
||||
puckPlotRect = null;
|
||||
getDevice().draw(g2d, platePlotRect, true, false, true);
|
||||
getDevice().draw(g2d, platePlotRect, true, false, true, DrawMode.center, img);
|
||||
break;
|
||||
case horizontal:
|
||||
platePlotRect = new Rectangle(plotRect.x, plotRect.y, plotRect.width / 2, plotRect.height);
|
||||
getDevice().draw(g2d, platePlotRect, false, true, true);
|
||||
getDevice().draw(g2d, platePlotRect, false, true, true, DrawMode.fill, null);
|
||||
if (selectedPuck!=null){
|
||||
puckPlotRect = new Rectangle(plotRect.x + plotRect.width / 2 + borderPuck, plotRect.y + borderPuck, plotRect.width / 2 - 2 * borderPuck, plotRect.height - 2 * borderPuck);
|
||||
selectedPuck.draw(g2d, puckPlotRect, true, false, null);
|
||||
selectedPuck.draw(g2d, puckPlotRect, true, false, true, null);
|
||||
}
|
||||
break;
|
||||
case vertical:
|
||||
platePlotRect = new Rectangle(plotRect.x, plotRect.y, plotRect.width, plotRect.height / 2);
|
||||
getDevice().draw(g2d, platePlotRect, false, true, true);
|
||||
getDevice().draw(g2d, platePlotRect, false, true, true, DrawMode.fill, null);
|
||||
if (selectedPuck!=null){
|
||||
puckPlotRect = new Rectangle(plotRect.x + borderPuck, plotRect.y + plotRect.height / 2 + borderPuck, plotRect.width - 2 * borderPuck, plotRect.height / 2 - 2 * borderPuck);
|
||||
selectedPuck.draw(g2d, puckPlotRect, true, false, null);
|
||||
selectedPuck.draw(g2d, puckPlotRect, true, false, true, null);
|
||||
}
|
||||
break;
|
||||
case overlapped:
|
||||
//getDevice().draw(g2d, plotRect, false, true);
|
||||
platePlotRect = new Rectangle(plotRect.x - ((int) (plotRect.width * 0.14)), plotRect.y - ((int) (plotRect.height * 0.14)), (int) (plotRect.width * 1.28), (int) (plotRect.height * 1.28));
|
||||
getDevice().draw(g2d, platePlotRect, false, true, false);
|
||||
getDevice().draw(g2d, platePlotRect, false, true, false, DrawMode.fill, null);
|
||||
if (selectedPuck!=null){
|
||||
int overlappedSize = (int) (1.5 * selectedPuck.getDrawSize());
|
||||
puckPlotRect = new Rectangle((int) (plotRect.getCenterX() - overlappedSize / 2), (int) (plotRect.getCenterY() - overlappedSize / 2), overlappedSize, overlappedSize);
|
||||
selectedPuck.draw(g2d, puckPlotRect, true, false, null);
|
||||
selectedPuck.draw(g2d, puckPlotRect, true, false, true, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BufferedImage img;
|
||||
ImageListener imageListener = new ImageListener() {
|
||||
@Override
|
||||
public void onImage(Object origin, BufferedImage image, Data data) {
|
||||
img = image;
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Object origin, Exception ex) {
|
||||
img = null;
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
void setCameraView(Source source){
|
||||
img = null;
|
||||
if (this.source!=null){
|
||||
this.source.removeListener(imageListener);
|
||||
}
|
||||
this.source = source;
|
||||
if (source!=null){
|
||||
source.addListener(imageListener);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
MouseAdapter mouseAdapter = new MouseAdapter() {
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="roomTempBasePlatePanel1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<Component id="panelDewar" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
@@ -47,8 +48,10 @@
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="roomTempBasePlatePanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelDewar" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
@@ -72,7 +75,7 @@
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Puck Positions"/>
|
||||
<TitledBorder title="Dewar"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
@@ -81,32 +84,28 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="314" max="32767" attributes="0"/>
|
||||
<Component id="processVariablePanel1" min="-2" pref="266" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="487" max="32767" attributes="0"/>
|
||||
<Component id="buttonCamera" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="processVariablePanel1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="buttonCamera" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="636" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="ch.psi.pshell.swing.ProcessVariablePanel" name="processVariablePanel1">
|
||||
<Component class="javax.swing.JToggleButton" name="buttonCamera">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder justification="3" title="Dewar Light"/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="showAdvanced" type="boolean" value="false"/>
|
||||
<Property name="showButtons" type="boolean" value="false"/>
|
||||
<Property name="showSlider" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Image"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCameraActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
@@ -180,7 +179,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="progressLN2" alignment="0" pref="635" max="32767" attributes="0"/>
|
||||
<Component id="progressLN2" alignment="0" pref="653" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
|
||||
@@ -332,7 +331,7 @@
|
||||
</Group>
|
||||
<Component id="jToggleButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="40" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -405,7 +404,7 @@
|
||||
</Group>
|
||||
<Component id="jButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="40" max="32767" attributes="0"/>
|
||||
<Component id="hexiposiPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -491,7 +490,7 @@
|
||||
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="44" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -560,7 +559,7 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel13" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textSample" max="32767" attributes="0"/>
|
||||
<Component id="textSample" pref="175" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel12" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
@@ -570,7 +569,7 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel11" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textType" pref="98" max="32767" attributes="0"/>
|
||||
<Component id="textType" pref="141" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
@@ -659,7 +658,7 @@
|
||||
<Component id="jLabel18" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="40" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -698,5 +697,19 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="ch.psi.pshell.swing.ProcessVariablePanel" name="panelDewar">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder justification="1" title="Dewar Light"/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="showAdvanced" type="boolean" value="false"/>
|
||||
<Property name="showButtons" type="boolean" value="false"/>
|
||||
<Property name="showLimitButtons" type="boolean" value="false"/>
|
||||
<Property name="showSlider" type="boolean" value="true"/>
|
||||
<Property name="showStop" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.imaging.Source;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -20,7 +25,7 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
Controller.getInstance().onInitialize(runCount);
|
||||
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
|
||||
@@ -39,7 +44,7 @@ public class MainPanel extends Panel {
|
||||
private void initComponents() {
|
||||
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
|
||||
processVariablePanel1 = new ch.psi.pshell.swing.ProcessVariablePanel();
|
||||
buttonCamera = new javax.swing.JToggleButton();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jSeparator1 = new javax.swing.JSeparator();
|
||||
@@ -85,27 +90,30 @@ public class MainPanel extends Panel {
|
||||
led15 = new ch.psi.pshell.swing.Led();
|
||||
jLabel17 = new javax.swing.JLabel();
|
||||
jLabel18 = new javax.swing.JLabel();
|
||||
panelDewar = new ch.psi.pshell.swing.ProcessVariablePanel();
|
||||
|
||||
basePlatePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Puck Positions"));
|
||||
basePlatePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Dewar"));
|
||||
|
||||
processVariablePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dewar Light", javax.swing.border.TitledBorder.RIGHT, javax.swing.border.TitledBorder.DEFAULT_POSITION));
|
||||
processVariablePanel1.setShowAdvanced(false);
|
||||
processVariablePanel1.setShowButtons(false);
|
||||
processVariablePanel1.setShowSlider(true);
|
||||
buttonCamera.setText("Image");
|
||||
buttonCamera.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonCameraActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout basePlatePanelLayout = new javax.swing.GroupLayout(basePlatePanel);
|
||||
basePlatePanel.setLayout(basePlatePanelLayout);
|
||||
basePlatePanelLayout.setHorizontalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
.addGap(0, 314, Short.MAX_VALUE)
|
||||
.addComponent(processVariablePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(487, Short.MAX_VALUE)
|
||||
.addComponent(buttonCamera))
|
||||
);
|
||||
basePlatePanelLayout.setVerticalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(processVariablePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(basePlatePanelLayout.createSequentialGroup()
|
||||
.addComponent(buttonCamera)
|
||||
.addGap(0, 636, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("LN2 Level"));
|
||||
@@ -132,7 +140,7 @@ public class MainPanel extends Panel {
|
||||
.addGap(4, 4, 4)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jSeparator2)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)))
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 35, Short.MAX_VALUE)))
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
@@ -150,7 +158,7 @@ public class MainPanel extends Panel {
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(progressLN2, javax.swing.GroupLayout.DEFAULT_SIZE, 635, Short.MAX_VALUE)
|
||||
.addComponent(progressLN2, javax.swing.GroupLayout.DEFAULT_SIZE, 653, Short.MAX_VALUE)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
@@ -247,7 +255,7 @@ public class MainPanel extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel5))
|
||||
.addComponent(jToggleButton1))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(40, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -289,7 +297,7 @@ public class MainPanel extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel7))
|
||||
.addComponent(jButton1))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
|
||||
.addComponent(hexiposiPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
@@ -339,7 +347,7 @@ public class MainPanel extends Panel {
|
||||
.addComponent(led7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel10)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(44, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel7Layout.setVerticalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -383,7 +391,7 @@ public class MainPanel extends Panel {
|
||||
.addGroup(jPanel8Layout.createSequentialGroup()
|
||||
.addComponent(jLabel13)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textSample))
|
||||
.addComponent(textSample, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))
|
||||
.addGroup(jPanel8Layout.createSequentialGroup()
|
||||
.addComponent(jLabel12)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@@ -391,7 +399,7 @@ public class MainPanel extends Panel {
|
||||
.addGroup(jPanel8Layout.createSequentialGroup()
|
||||
.addComponent(jLabel11)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textType, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)))
|
||||
.addComponent(textType, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -436,7 +444,7 @@ public class MainPanel extends Panel {
|
||||
.addComponent(led15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel18)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(40, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel10Layout.setVerticalGroup(
|
||||
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -452,6 +460,13 @@ public class MainPanel extends Panel {
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
panelDewar.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dewar Light", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION));
|
||||
panelDewar.setShowAdvanced(false);
|
||||
panelDewar.setShowButtons(false);
|
||||
panelDewar.setShowLimitButtons(false);
|
||||
panelDewar.setShowSlider(true);
|
||||
panelDewar.setShowStop(false);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -463,7 +478,8 @@ public class MainPanel extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(roomTempBasePlatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(panelDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
@@ -484,7 +500,9 @@ public class MainPanel extends Panel {
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addComponent(roomTempBasePlatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(panelDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
@@ -499,9 +517,19 @@ public class MainPanel extends Panel {
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonCameraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCameraActionPerformed
|
||||
try{
|
||||
Source source = buttonCamera.isSelected() ? (Source)this.getDevice("img"): null;
|
||||
basePlatePanel.setCameraView(source);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonCameraActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private ch.psi.mxsc.BasePlatePanel basePlatePanel;
|
||||
private javax.swing.JToggleButton buttonCamera;
|
||||
private ch.psi.mxsc.HexiposiPanel hexiposiPanel1;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
@@ -541,7 +569,7 @@ public class MainPanel extends Panel {
|
||||
private ch.psi.pshell.swing.Led led5;
|
||||
private ch.psi.pshell.swing.Led led6;
|
||||
private ch.psi.pshell.swing.Led led7;
|
||||
private ch.psi.pshell.swing.ProcessVariablePanel processVariablePanel1;
|
||||
private ch.psi.pshell.swing.ProcessVariablePanel panelDewar;
|
||||
private javax.swing.JProgressBar progressLN2;
|
||||
private javax.swing.JProgressBar progressWater;
|
||||
private ch.psi.mxsc.RoomTempBasePlatePanel roomTempBasePlatePanel1;
|
||||
|
||||
@@ -255,19 +255,21 @@ public class Puck extends DeviceBase {
|
||||
|
||||
|
||||
Rectangle plotRect;
|
||||
void draw (Graphics2D g, Rectangle plotRect, boolean drawSamples, boolean drawId, BasePlate enclosingPlate){
|
||||
void draw (Graphics2D g, Rectangle plotRect, boolean drawSamples, boolean drawId, boolean drawBackground, BasePlate enclosingPlate){
|
||||
this.plotRect = plotRect;
|
||||
Point position = getDrawPosition();
|
||||
int size = getDrawSize();
|
||||
g.setColor(getColor());
|
||||
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
if (drawBackground){
|
||||
g.setColor(getColor());
|
||||
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
}
|
||||
g.setColor(getBorderColor());
|
||||
g.drawOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
|
||||
if (drawSamples){
|
||||
//Draw samples
|
||||
for (Sample sample: getSamples()) {
|
||||
sample.draw(g);
|
||||
sample.draw(g, drawBackground);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,12 +164,14 @@ public class Sample extends DeviceBase {
|
||||
return Color.GRAY;
|
||||
}
|
||||
|
||||
void draw (Graphics2D g){
|
||||
void draw (Graphics2D g, boolean drawBackground){
|
||||
Point position = getDrawPosition();
|
||||
int size = getDrawSize();
|
||||
|
||||
g.setColor(getColor());
|
||||
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
if (drawBackground){
|
||||
g.setColor(getColor());
|
||||
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
}
|
||||
g.setColor(getBorderColor());
|
||||
g.drawOval(position.x - size / 2, position.y - size / 2, size, size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user