Initial commit V2
This commit is contained in:
+46
-46
@@ -1,46 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<actions>
|
||||
<action>
|
||||
<actionName>run</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>debug</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
<jpda.listen>true</jpda.listen>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>profile</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
</actions>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<actions>
|
||||
<action>
|
||||
<actionName>run</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>debug</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=D:\dev\pshell\home -r</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
<jpda.listen>true</jpda.listen>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>profile</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
</actions>
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>MXSC</artifactId>
|
||||
<version>1.19.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>pshell</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zeromq</groupId>
|
||||
<artifactId>jeromq</artifactId>
|
||||
<version>0.5.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter</name>
|
||||
<url>https://jcenter.bintray.com/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bintray-hltools</id>
|
||||
<name>bintray</name>
|
||||
<url>https://dl.bintray.com/paulscherrerinstitute/hltools</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>imagej</id>
|
||||
<name>imagej</name>
|
||||
<url>http://maven.imagej.net/content/repositories/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>libs-snapshots-local</id>
|
||||
<name>libs-snapshots-local</name>
|
||||
<url>https://artifacts.psi.ch/artifactory/libs-snapshots-local/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>scijava-pub</id>
|
||||
<name>scijava-pub</name>
|
||||
<url>https://maven.scijava.org/content/repositories/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>scijava</id>
|
||||
<name>scijava</name>
|
||||
<url>https://maven.scijava.org/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>releases</id>
|
||||
<name>releases</name>
|
||||
<url>https://artifacts.psi.ch/artifactory/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<name>MXSC</name>
|
||||
|
||||
<build>
|
||||
<!-- To remove the version numnber from jar
|
||||
<finalName>${project.name}</finalName>
|
||||
-->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<outputDirectory>../../config/mxsc/plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>MXSC</artifactId>
|
||||
<version>1.21.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>pshell</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zeromq</groupId>
|
||||
<artifactId>jeromq</artifactId>
|
||||
<version>0.5.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter</name>
|
||||
<url>https://jcenter.bintray.com/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bintray-hltools</id>
|
||||
<name>bintray</name>
|
||||
<url>https://dl.bintray.com/paulscherrerinstitute/hltools</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>imagej</id>
|
||||
<name>imagej</name>
|
||||
<url>http://maven.imagej.net/content/repositories/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>libs-snapshots-local</id>
|
||||
<name>libs-snapshots-local</name>
|
||||
<url>https://artifacts.psi.ch/artifactory/libs-snapshots-local/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>scijava-pub</id>
|
||||
<name>scijava-pub</name>
|
||||
<url>https://maven.scijava.org/content/repositories/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>scijava</id>
|
||||
<name>scijava</name>
|
||||
<url>https://maven.scijava.org/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>releases</id>
|
||||
<name>releases</name>
|
||||
<url>https://artifacts.psi.ch/artifactory/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<name>MXSC</name>
|
||||
|
||||
<build>
|
||||
<!-- To remove the version numnber from jar
|
||||
<finalName>${project.name}</finalName>
|
||||
-->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<outputDirectory>../pshell/home/plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -2,10 +2,12 @@ package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.imaging.Utils;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
@@ -60,6 +62,17 @@ public class BasePlateGraphics {
|
||||
top,
|
||||
bottom
|
||||
}
|
||||
|
||||
Rectangle imageRoi;
|
||||
|
||||
public void setImageRoi( Rectangle roi){
|
||||
this.imageRoi = roi;
|
||||
}
|
||||
|
||||
Point detection;
|
||||
public void setDetection( Point detection){
|
||||
this.detection = detection;
|
||||
}
|
||||
|
||||
void draw(Graphics2D g, Rectangle plotRect, boolean drawSamples, boolean drawIds, boolean drawContour, DrawMode mode, BufferedImage img) {
|
||||
if (mode != DrawMode.fill){
|
||||
@@ -85,7 +98,19 @@ public class BasePlateGraphics {
|
||||
this.plotRect = plotRect;
|
||||
this.drawContour = drawContour;
|
||||
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));
|
||||
int center_x=0, center_y=0;
|
||||
if (img!=null){
|
||||
Point detection = this.detection;
|
||||
if (imageRoi!=null){
|
||||
img = img.getSubimage(imageRoi.x, imageRoi.y, imageRoi.width, imageRoi.height);
|
||||
if (detection!=null){
|
||||
//detection = new Point(detection.x-imageRoi.x, detection.y-imageRoi.y);
|
||||
center_x = detection.x * boundingBox.width / img.getWidth() + boundingBox.x;
|
||||
center_y = detection.y * boundingBox.height / img.getHeight() + boundingBox.y;
|
||||
center_x -= imageRoi.x * boundingBox.width / img.getWidth();
|
||||
center_y -= imageRoi.y * boundingBox.height / img.getHeight();
|
||||
}
|
||||
}
|
||||
img = Utils.stretch(img, boundingBox.width, boundingBox.height);
|
||||
g.setClip(new Ellipse2D.Float(boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height));
|
||||
g.drawImage(img, boundingBox.x, boundingBox.y, null);
|
||||
@@ -104,6 +129,16 @@ public class BasePlateGraphics {
|
||||
for (PuckGraphics pg : puckGraphics) {
|
||||
pg.draw(g, null, drawSamples, drawIds, drawBackground) ;
|
||||
}
|
||||
if (img!=null){
|
||||
if (detection!=null){
|
||||
int size=15;
|
||||
g.setColor(new Color(86, 193, 255));
|
||||
g.setStroke(new BasicStroke(2f));
|
||||
g.drawLine(center_x-size, center_y, center_x+size, center_y);
|
||||
g.drawLine(center_x, center_y-size, center_x, center_y+size);
|
||||
//g.drawOval(center_x-size, center_y-size, 2*size, 2*size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ public class Controller {
|
||||
final BasePlate basePlate;
|
||||
RoomTemperatureBasePlate roomTemperatureBasePlate;
|
||||
static /*Panel*/ MainPanel mainFrame;
|
||||
Device hexiposi;
|
||||
Device barcode_reader;
|
||||
Device barcode_reader_puck;
|
||||
Device puck_detection;
|
||||
@@ -305,12 +304,6 @@ public class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
final DeviceListener hexiposiListener = new DeviceAdapter() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateView();
|
||||
}
|
||||
};
|
||||
|
||||
final DeviceListener barcodeReaderListener = new DeviceAdapter() {
|
||||
@Override
|
||||
@@ -346,22 +339,6 @@ public class Controller {
|
||||
};
|
||||
|
||||
void updateDevices() {
|
||||
if (hexiposi != null) {
|
||||
hexiposi.removeListener(hexiposiListener);
|
||||
}
|
||||
if (barcode_reader != null) {
|
||||
hexiposi.removeListener(barcodeReaderListener);
|
||||
}
|
||||
if (puck_detection != null) {
|
||||
hexiposi.removeListener(puckDetectionListener);
|
||||
}
|
||||
hexiposi = (Device) getMainFrame().getDevice("hexiposi");
|
||||
if (hexiposi != null) {
|
||||
hexiposi.addListener(hexiposiListener);
|
||||
} else {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "No hexiposi detected.");
|
||||
}
|
||||
mainFrame.hexiposiPanel.setDevice(hexiposi);
|
||||
barcode_reader = (Device) getDevice("barcode_reader");
|
||||
if (barcode_reader != null) {
|
||||
barcode_reader.addListener(barcodeReaderListener);
|
||||
@@ -429,16 +406,8 @@ public class Controller {
|
||||
updateView();
|
||||
}
|
||||
|
||||
public String getHexiposiPosition() {
|
||||
try {
|
||||
return (String) ((ReadbackDevice) hexiposi).getReadback().take();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSelectedPuck(Puck puck) {
|
||||
return ("" + puck.getSegment()).equalsIgnoreCase(getHexiposiPosition());
|
||||
return puck.isSegmentSelected();
|
||||
}
|
||||
|
||||
public List<Puck> getSelectedPucks() {
|
||||
@@ -773,7 +742,7 @@ public class Controller {
|
||||
Puck.Detection[] detection = basePlate.getDetection();
|
||||
for (int i = 0; i < Controller.NUMBER_OF_PUCKS; i++) {
|
||||
Puck puck = basePlate.getPucks()[i];
|
||||
//Only manage pucks for current hexiposi position
|
||||
|
||||
if (isSelectedPuck(puck)) {
|
||||
boolean detectedPuckInserted = (currentDetection[i] != Puck.Detection.Present) && (detection[i] == Puck.Detection.Present);
|
||||
boolean detectedPuckRemoved = (currentDetection[i] != Puck.Detection.Empty) && (detection[i] == Puck.Detection.Empty);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.6" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1030, 530]"/>
|
||||
@@ -31,7 +35,7 @@
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="panelTop" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="panelBottom" pref="80" max="32767" attributes="0"/>
|
||||
<Component id="panelBottom" pref="79" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -89,14 +93,14 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="panelDetection" linkSize="23" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="panelLegend" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="panelLegend" max="32767" attributes="0"/>
|
||||
<Component id="panelDetection" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="234" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="panelHexiposi" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="panelViewType" linkSize="23" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="255" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="panelHexiposi" max="32767" attributes="0"/>
|
||||
<Component id="panelViewType" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -278,12 +282,12 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="buttonClearDet" linkSize="4" max="32767" attributes="0"/>
|
||||
<Component id="buttonPuckDet" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="buttonDetectionCalibrate" linkSize="4" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonCalibrationPanel" linkSize="4" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -291,29 +295,29 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonPuckDet" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDetectionCalibrate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="buttonClearDet" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonCalibrationPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="buttonClearDet">
|
||||
<Component class="javax.swing.JButton" name="buttonCalibrationPanel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Clear"/>
|
||||
<Property name="text" type="java.lang.String" value="Panel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearDetActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCalibrationPanelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonPuckDet">
|
||||
<Component class="javax.swing.JButton" name="buttonDetectionCalibrate">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Start"/>
|
||||
<Property name="text" type="java.lang.String" value="Calibrate"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDetectionCalibrateActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
@@ -333,41 +337,66 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="14" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="buttonDetectCover" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hexiposiPanel" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" max="32767" attributes="0"/>
|
||||
<Component id="textCoverDet" max="32767" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="textCoverMove" alignment="0" pref="90" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="15" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace pref="18" max="32767" attributes="0"/>
|
||||
<Component id="hexiposiPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="13" max="32767" attributes="0"/>
|
||||
<Component id="buttonDetectCover" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textCoverDet" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textCoverMove" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="18" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="ch.psi.mxsc.HexiposiPanel" name="hexiposiPanel">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonDetectCover">
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Image"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="Detection:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textCoverDet">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="Last Move:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textCoverMove">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDetectCoverActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
@@ -384,12 +413,12 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="buttonDrawing" linkSize="25" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonCamera" linkSize="25" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -408,6 +437,10 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JToggleButton" name="buttonCamera">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="buttonGroup1"/>
|
||||
</Property>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Image"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
@@ -416,7 +449,9 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="buttonDrawing">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="buttonGroup1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Design"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
@@ -1004,9 +1039,9 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="devicesPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="25" max="32767" attributes="0"/>
|
||||
<Component id="panelExpert" min="-2" pref="93" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="27" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -1170,7 +1205,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="panelTableSamples" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="panelTableSamples" alignment="1" pref="676" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
@@ -7,6 +7,9 @@ import ch.psi.mxsc.BasePlatePanel.SelectionMode;
|
||||
import ch.psi.pshell.core.Plugin;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.DeviceBase;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.imaging.PointDouble;
|
||||
import ch.psi.pshell.imaging.Renderer;
|
||||
import ch.psi.pshell.imaging.RendererMode;
|
||||
import ch.psi.pshell.imaging.Source;
|
||||
@@ -28,11 +31,14 @@ import java.awt.Dialog;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -416,7 +422,11 @@ public class MainPanel extends Panel {
|
||||
updateMode(((Device) getDevice("robot")).take());
|
||||
} catch (Exception ex) {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
DeviceBase dev = (DeviceBase) this.getDevice("cover_detection");
|
||||
dev.addListener(cover_detection_listener);
|
||||
|
||||
setPuckDatamatrix(null);
|
||||
setSampleDatamatrix(null);
|
||||
setBackgroundUpdate(true);
|
||||
@@ -578,6 +588,21 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
|
||||
void updateCameraView() {
|
||||
try{
|
||||
if (buttonCamera.isSelected()){
|
||||
int center_x = ((Number)this.eval("cover_detection.config.center_x", true)).intValue();
|
||||
int center_y = ((Number)this.eval("cover_detection.config.center_y", true)).intValue();
|
||||
int diam_dewar = ((Number)this.eval("cover_detection.config.diameter_dewar", true)).intValue();
|
||||
double dewar_wall = ((Number)this.eval("cover_detection.config.dewar_wall", true)).doubleValue();
|
||||
int diam =(int) (dewar_wall * diam_dewar);
|
||||
Rectangle roi = new Rectangle(center_x-diam/2,center_y - diam/2, diam, diam );
|
||||
basePlatePanel.basePlateGraphics.setImageRoi(roi);
|
||||
}
|
||||
} catch (Exception ex){
|
||||
if (getState().isInitialized()){
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
Source source = buttonCamera.isSelected() ? (Source) this.getDevice("img") : null;
|
||||
basePlatePanel.setCameraView(source);
|
||||
}
|
||||
@@ -683,20 +708,20 @@ public class MainPanel extends Panel {
|
||||
buttonCalibrateImage.setVisible(expert);
|
||||
buttonCalibrateCover.setVisible(expert);
|
||||
devicesPanel.setActive(expert);
|
||||
panelViewType.setVisible(expert);
|
||||
//panelViewType.setVisible(expert);
|
||||
panelDetection.setVisible(expert && !isRt());
|
||||
buttonDetectCover.setVisible(expert);
|
||||
buttonConfig.setVisible(expert);
|
||||
Puck.setDisplayDetectionError(expert);
|
||||
|
||||
if (checkExpert.isSelected() != expert) {
|
||||
checkExpert.setSelected(expert);
|
||||
}
|
||||
if (expert == false) {
|
||||
buttonCamera.setSelected(false);
|
||||
buttonDrawing.setSelected(true);
|
||||
updateViewType();
|
||||
}
|
||||
//if (expert == false) {
|
||||
// buttonCamera.setSelected(true);
|
||||
// buttonDrawing.setSelected(false);
|
||||
// updateViewType();
|
||||
//}
|
||||
|
||||
if (current != expert) {
|
||||
onModeChange(expert);
|
||||
}
|
||||
@@ -935,6 +960,24 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
}
|
||||
|
||||
DeviceListener cover_detection_listener = new DeviceAdapter() {
|
||||
@Override
|
||||
public void onCacheChanged(Device device, Object value, Object former, long timestamp, boolean valueChange) {
|
||||
Point mm = null;
|
||||
Point det = null;
|
||||
try{
|
||||
mm = new Point(Array.getInt(value, 4), Array.getInt(value, 5));
|
||||
det = new Point(Array.getInt(value, 0), Array.getInt(value, 1));
|
||||
basePlatePanel.basePlateGraphics.setDetection(det);
|
||||
} catch (Exception ex){
|
||||
}
|
||||
Point aux = mm;
|
||||
SwingUtilities.invokeLater(()->{
|
||||
textCoverDet.setText((aux==null) ? "" :aux.x + ", " + aux.y);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@@ -945,6 +988,7 @@ public class MainPanel extends Panel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
buttonGroup1 = new javax.swing.ButtonGroup();
|
||||
panelTop = new javax.swing.JPanel();
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
|
||||
panelLegend = new javax.swing.JPanel();
|
||||
@@ -959,11 +1003,13 @@ public class MainPanel extends Panel {
|
||||
ledLidControlActive5 = new ch.psi.pshell.swing.Led();
|
||||
jLabel23 = new javax.swing.JLabel();
|
||||
panelDetection = new javax.swing.JPanel();
|
||||
buttonClearDet = new javax.swing.JButton();
|
||||
buttonPuckDet = new javax.swing.JButton();
|
||||
buttonCalibrationPanel = new javax.swing.JButton();
|
||||
buttonDetectionCalibrate = new javax.swing.JButton();
|
||||
panelHexiposi = new javax.swing.JPanel();
|
||||
hexiposiPanel = new ch.psi.mxsc.HexiposiPanel();
|
||||
buttonDetectCover = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
textCoverDet = new javax.swing.JTextField();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
textCoverMove = new javax.swing.JTextField();
|
||||
panelViewType = new javax.swing.JPanel();
|
||||
buttonCamera = new javax.swing.JToggleButton();
|
||||
buttonDrawing = new javax.swing.JToggleButton();
|
||||
@@ -1112,17 +1158,17 @@ public class MainPanel extends Panel {
|
||||
|
||||
panelDetection.setBorder(javax.swing.BorderFactory.createTitledBorder("Detection"));
|
||||
|
||||
buttonClearDet.setText("Clear");
|
||||
buttonClearDet.addActionListener(new java.awt.event.ActionListener() {
|
||||
buttonCalibrationPanel.setText("Panel");
|
||||
buttonCalibrationPanel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonClearDetActionPerformed(evt);
|
||||
buttonCalibrationPanelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonPuckDet.setText("Start");
|
||||
buttonPuckDet.addActionListener(new java.awt.event.ActionListener() {
|
||||
buttonDetectionCalibrate.setText("Calibrate");
|
||||
buttonDetectionCalibrate.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonPuckDetActionPerformed(evt);
|
||||
buttonDetectionCalibrateActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1131,55 +1177,75 @@ public class MainPanel extends Panel {
|
||||
panelDetectionLayout.setHorizontalGroup(
|
||||
panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDetectionLayout.createSequentialGroup()
|
||||
.addContainerGap(26, Short.MAX_VALUE)
|
||||
.addGroup(panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(buttonClearDet, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonPuckDet, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(26, Short.MAX_VALUE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(buttonDetectionCalibrate)
|
||||
.addComponent(buttonCalibrationPanel))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
panelDetectionLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCalibrationPanel, buttonDetectionCalibrate});
|
||||
|
||||
panelDetectionLayout.setVerticalGroup(
|
||||
panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelDetectionLayout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonPuckDet)
|
||||
.addComponent(buttonDetectionCalibrate)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(buttonClearDet)
|
||||
.addComponent(buttonCalibrationPanel)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
panelHexiposi.setBorder(javax.swing.BorderFactory.createTitledBorder("Cover"));
|
||||
panelHexiposi.setPreferredSize(new java.awt.Dimension(112, 153));
|
||||
|
||||
buttonDetectCover.setText("Image");
|
||||
buttonDetectCover.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDetectCoverActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel1.setText("Detection:");
|
||||
|
||||
textCoverDet.setEditable(false);
|
||||
textCoverDet.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
textCoverDet.setDisabledTextColor(new java.awt.Color(0, 0, 0));
|
||||
textCoverDet.setEnabled(false);
|
||||
|
||||
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel2.setText("Last Move:");
|
||||
|
||||
textCoverMove.setEditable(false);
|
||||
textCoverMove.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
textCoverMove.setDisabledTextColor(new java.awt.Color(0, 0, 0));
|
||||
textCoverMove.setEnabled(false);
|
||||
|
||||
javax.swing.GroupLayout panelHexiposiLayout = new javax.swing.GroupLayout(panelHexiposi);
|
||||
panelHexiposi.setLayout(panelHexiposiLayout);
|
||||
panelHexiposiLayout.setHorizontalGroup(
|
||||
panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelHexiposiLayout.createSequentialGroup()
|
||||
.addContainerGap(14, Short.MAX_VALUE)
|
||||
.addGroup(panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(buttonDetectCover)
|
||||
.addComponent(hexiposiPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(15, Short.MAX_VALUE))
|
||||
.addGroup(panelHexiposiLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(textCoverDet)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(textCoverMove, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
panelHexiposiLayout.setVerticalGroup(
|
||||
panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelHexiposiLayout.createSequentialGroup()
|
||||
.addContainerGap(18, Short.MAX_VALUE)
|
||||
.addComponent(hexiposiPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
|
||||
.addComponent(buttonDetectCover)
|
||||
.addContainerGap())
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textCoverDet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textCoverMove, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(18, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
panelViewType.setBorder(javax.swing.BorderFactory.createTitledBorder("View"));
|
||||
|
||||
buttonGroup1.add(buttonCamera);
|
||||
buttonCamera.setSelected(true);
|
||||
buttonCamera.setText("Image");
|
||||
buttonCamera.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@@ -1187,7 +1253,7 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
buttonDrawing.setSelected(true);
|
||||
buttonGroup1.add(buttonDrawing);
|
||||
buttonDrawing.setText("Design");
|
||||
buttonDrawing.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@@ -1200,11 +1266,11 @@ public class MainPanel extends Panel {
|
||||
panelViewTypeLayout.setHorizontalGroup(
|
||||
panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelViewTypeLayout.createSequentialGroup()
|
||||
.addContainerGap(21, Short.MAX_VALUE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(buttonDrawing)
|
||||
.addComponent(buttonCamera))
|
||||
.addContainerGap(21, Short.MAX_VALUE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
panelViewTypeLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCamera, buttonDrawing});
|
||||
@@ -1225,18 +1291,15 @@ public class MainPanel extends Panel {
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panelDetection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(panelLegend, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 234, Short.MAX_VALUE)
|
||||
.addGroup(basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panelHexiposi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(panelViewType, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(panelLegend, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(panelDetection, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 255, Short.MAX_VALUE)
|
||||
.addGroup(basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(panelHexiposi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(panelViewType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
basePlatePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {panelDetection, panelViewType});
|
||||
|
||||
basePlatePanelLayout.setVerticalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
@@ -1660,9 +1723,9 @@ public class MainPanel extends Panel {
|
||||
.addGroup(panelDevicesLayout.createSequentialGroup()
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(devicesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
|
||||
.addComponent(panelExpert, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(27, Short.MAX_VALUE))
|
||||
.addContainerGap(26, Short.MAX_VALUE))
|
||||
);
|
||||
panelDevicesLayout.setVerticalGroup(
|
||||
panelDevicesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -1747,7 +1810,7 @@ public class MainPanel extends Panel {
|
||||
panelSamplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelSamplesLayout.createSequentialGroup()
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(panelTableSamples)
|
||||
.addComponent(panelTableSamples, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
panelSamplesLayout.setVerticalGroup(
|
||||
@@ -1861,7 +1924,7 @@ public class MainPanel extends Panel {
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(panelTop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(panelBottom, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
|
||||
.addComponent(panelBottom, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
|
||||
.addGap(1, 1, 1))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
@@ -1887,41 +1950,21 @@ public class MainPanel extends Panel {
|
||||
JComponent dlgDetTextComp;
|
||||
JComponent dlgDetRendererComp;
|
||||
|
||||
private void buttonPuckDetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetActionPerformed
|
||||
private void buttonDetectionCalibrateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDetectionCalibrateActionPerformed
|
||||
try {
|
||||
/*
|
||||
if ((dlgDetPlot == null) || (!dlgDetPlot.isShowing())){
|
||||
dlgDetPlotComp = new ch.psi.pshell.plot.LinePlotJFree();
|
||||
((ch.psi.pshell.plot.LinePlotJFree) dlgDetPlotComp).setTitle("");
|
||||
dlgDetPlot = SwingUtils.showDialog(getTopLevel(), "Puck Detection", new Dimension(600,400), dlgDetPlotComp);
|
||||
}
|
||||
if ((dlgDetText == null)|| (!dlgDetText.isShowing())){
|
||||
dlgDetTextComp = new javax.swing.JTextArea();
|
||||
((javax.swing.JTextArea)dlgDetTextComp).setEditable(false);
|
||||
dlgDetText = SwingUtils.showDialog(getTopLevel(), "Puck Detection", new Dimension(600,400), dlgDetTextComp);
|
||||
}
|
||||
*/
|
||||
if (!App.isDetached()) {
|
||||
if ((dlgDetRenderer == null) || (!dlgDetRenderer.isShowing())) {
|
||||
dlgDetRendererComp = new Renderer();
|
||||
((Renderer) dlgDetRendererComp).setMode(RendererMode.Fit);
|
||||
dlgDetRenderer = SwingUtils.showDialog(getTopLevel(), "Puck Detection", new Dimension(600, 400), dlgDetRendererComp);
|
||||
}
|
||||
}
|
||||
Controller.getInstance().imageDetectPucks(dlgDetPlotComp, dlgDetRendererComp, dlgDetTextComp);
|
||||
|
||||
this.runAsync("imgproc/NewCoverCalibration", this, false);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonPuckDetActionPerformed
|
||||
}//GEN-LAST:event_buttonDetectionCalibrateActionPerformed
|
||||
|
||||
private void buttonClearDetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearDetActionPerformed
|
||||
private void buttonCalibrationPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCalibrationPanelActionPerformed
|
||||
try {
|
||||
Controller.getInstance().clearImageDetection();
|
||||
this.evalAsync("cover_detection.set_renderer(show_panel(img))", true);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearDetActionPerformed
|
||||
}//GEN-LAST:event_buttonCalibrationPanelActionPerformed
|
||||
|
||||
|
||||
private void checkExpertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkExpertActionPerformed
|
||||
@@ -1973,23 +2016,6 @@ public class MainPanel extends Panel {
|
||||
execute("imgproc/CameraCalibration", null, false, true);
|
||||
}//GEN-LAST:event_buttonCalibrateImageActionPerformed
|
||||
|
||||
private void buttonDetectCoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDetectCoverActionPerformed
|
||||
try {
|
||||
execute("cover_detection_debug=True");
|
||||
runAsync("imgproc/CoverDetection", null, false).handle((ret, ex) -> {
|
||||
execute("cover_detection_debug=False", true);
|
||||
if (ex != null) {
|
||||
showException((Exception) ex);
|
||||
} else {
|
||||
showMessage("Return", String.valueOf(ret));
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonDetectCoverActionPerformed
|
||||
|
||||
private void buttonCalibrateCoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCalibrateCoverActionPerformed
|
||||
onExpertCommand(null);
|
||||
execute("imgproc/CoverDetectionCalibration", null, false, true);
|
||||
@@ -2033,24 +2059,25 @@ public class MainPanel extends Panel {
|
||||
private javax.swing.JToggleButton btViewRT;
|
||||
private javax.swing.JButton buttonCalibrateCover;
|
||||
private javax.swing.JButton buttonCalibrateImage;
|
||||
private javax.swing.JButton buttonCalibrationPanel;
|
||||
private javax.swing.JToggleButton buttonCamera;
|
||||
private javax.swing.JButton buttonClearDet;
|
||||
private javax.swing.JButton buttonConfig;
|
||||
private javax.swing.JButton buttonDetectCover;
|
||||
private javax.swing.JButton buttonDetectionCalibrate;
|
||||
private javax.swing.JToggleButton buttonDrawing;
|
||||
private javax.swing.JButton buttonExpertCommands;
|
||||
private javax.swing.JButton buttonPuckDet;
|
||||
private javax.swing.ButtonGroup buttonGroup1;
|
||||
private javax.swing.JButton buttonRecovery;
|
||||
private javax.swing.JButton buttonRelease;
|
||||
private javax.swing.JCheckBox checkExpert;
|
||||
private ch.psi.mxsc.DevicesPanel devicesPanel;
|
||||
private javax.swing.Box.Filler filler1;
|
||||
ch.psi.mxsc.HexiposiPanel hexiposiPanel;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel13;
|
||||
private javax.swing.JLabel jLabel15;
|
||||
private javax.swing.JLabel jLabel16;
|
||||
private javax.swing.JLabel jLabel19;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel20;
|
||||
private javax.swing.JLabel jLabel23;
|
||||
private javax.swing.JLabel jLabel24;
|
||||
@@ -2104,6 +2131,8 @@ public class MainPanel extends Panel {
|
||||
private javax.swing.JProgressBar progressLN2;
|
||||
private javax.swing.JTable tablePucks;
|
||||
private javax.swing.JTable tableSamples;
|
||||
private javax.swing.JTextField textCoverDet;
|
||||
private javax.swing.JTextField textCoverMove;
|
||||
private javax.swing.JTextField textPuckDatamatrix;
|
||||
private javax.swing.JTextField textSampleDatamatrix;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@@ -332,20 +332,7 @@ public class Puck extends DeviceBase {
|
||||
|
||||
|
||||
public boolean isSegmentSelected() {
|
||||
/*
|
||||
switch(Integer.valueOf(Controller.getInstance().getHexaposiPosition())){
|
||||
case 1: return getSegment()=='A';
|
||||
case 2: return getSegment()=='B';
|
||||
case 3: return getSegment()=='C';
|
||||
case 4: return getSegment()=='D';
|
||||
case 5: return getSegment()=='E';
|
||||
case 6: return getSegment()=='F';
|
||||
}
|
||||
} catch(Exception ex){
|
||||
}
|
||||
return false;
|
||||
*/
|
||||
return ("" + getSegment()).equalsIgnoreCase(Controller.getInstance().getHexiposiPosition());
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
|
||||
Reference in New Issue
Block a user