diff --git a/GUI/src/main/java/cz/fidentis/analyst/batch/BatchAction.java b/GUI/src/main/java/cz/fidentis/analyst/batch/BatchAction.java index ae5c2b58e9af52b3330e0d1a52cd40410e290e5a..a7d3211c6e2a1e25c4e9f79b718a1a87f492da74 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/batch/BatchAction.java +++ b/GUI/src/main/java/cz/fidentis/analyst/batch/BatchAction.java @@ -16,6 +16,8 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Path; +import java.util.List; import javax.swing.JOptionPane; import javax.swing.JTabbedPane; import javax.swing.SwingWorker; @@ -38,25 +40,24 @@ public class BatchAction extends ControlPanelAction implements HumanFaceListener * Constructor. * * @param canvas OpenGL canvas + * @param faces Paths to faces * @param topControlPanel Top component for placing control panels */ - public BatchAction(Canvas canvas, JTabbedPane topControlPanel) { + public BatchAction(Canvas canvas, JTabbedPane topControlPanel, List<Path> faces) { super(canvas, topControlPanel); - this.controlPanel = new BatchPanel(this); + this.controlPanel = new BatchPanel(this, faces); // Place control panel to the topControlPanel topControlPanel.addTab(controlPanel.getName(), controlPanel.getIcon(), controlPanel); topControlPanel.addChangeListener(e -> { - // If the registration panel is focused... + // If the panel is focused... if (((JTabbedPane) e.getSource()).getSelectedComponent() instanceof BatchPanel) { // TODO } }); topControlPanel.setSelectedComponent(controlPanel); // Focus registration panel - // Be informed about changes in faces perfomed by other GUI elements - //getPrimaryDrawableFace().getHumanFace().registerListener(this); - //getSecondaryDrawableFace().getHumanFace().registerListener(this); + showSelectedFace(); } @Override @@ -70,7 +71,7 @@ public class BatchAction extends ControlPanelAction implements HumanFaceListener computeSimilarity(); break; case BatchPanel.ACTION_COMMAND_SHOW_SELECTED_FACE: - showSelectedIcpFace(); + showSelectedFace(); break; case BatchPanel.ACTION_COMMAND_EXPORT_SIMILARITY: exportDistanceResults(); @@ -163,7 +164,7 @@ public class BatchAction extends ControlPanelAction implements HumanFaceListener progressBar.runTask(task); } - private void showSelectedIcpFace() { + private void showSelectedFace() { HumanFace face = controlPanel.getSelectedFace(); if (face != null) { if (faceSceneSlot == -1) { diff --git a/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.form b/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.form index aa6f9a1a3069f34bf462e80b97e8883d14650e94..831516dd0d672de61e1f03b6ecf324a3731b9c58 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.form +++ b/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.form @@ -197,14 +197,12 @@ <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jButton2" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jButton3" 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="jComboBox1" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButtonInfo2" min="-2" max="-2" attributes="0"/> <EmptySpace max="32767" attributes="0"/> </Group> </Group> @@ -213,11 +211,12 @@ <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButtonInfo2" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> </Group> <EmptySpace pref="23" max="32767" attributes="0"/> </Group> @@ -225,20 +224,6 @@ </DimensionLayout> </Layout> <SubComponents> - <Component class="javax.swing.JButton" name="jButton2"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="cz/fidentis/analyst/batch/Bundle.properties" key="BatchPanel.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JButton" name="jButton3"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="cz/fidentis/analyst/batch/Bundle.properties" key="BatchPanel.jButton3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - </Component> <Component class="javax.swing.JLabel" name="jLabel1"> <Properties> <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> @@ -259,6 +244,26 @@ <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> </AuxValues> </Component> + <Component class="javax.swing.JButton" name="jButtonInfo2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/info.png"/> + </Property> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="cz/fidentis/analyst/batch/Bundle.properties" key="BatchPanel.jButtonInfo2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> + <EmptyBorder/> + </Border> + </Property> + <Property name="borderPainted" type="boolean" value="false"/> + <Property name="focusPainted" type="boolean" value="false"/> + <Property name="focusable" type="boolean" value="false"/> + <Property name="requestFocusEnabled" type="boolean" value="false"/> + <Property name="rolloverEnabled" type="boolean" value="false"/> + </Properties> + </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="jPanel3"> @@ -300,12 +305,12 @@ <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" max="-2" attributes="0"> - <Component id="jButtonInfo1" max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jComboBox2" alignment="3" max="32767" attributes="0"/> + <Component id="jComboBox2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jCheckBox5" alignment="3" min="-2" max="-2" attributes="0"/> </Group> + <Component id="jButtonInfo1" alignment="0" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> diff --git a/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.java b/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.java index 49ae71c148b8407424c0bb76a3b54e6ab5fbbb7d..1be2375c85b26cafe3b9270085628018caa59e0a 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.java +++ b/GUI/src/main/java/cz/fidentis/analyst/batch/BatchPanel.java @@ -12,11 +12,9 @@ import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; @@ -43,8 +41,8 @@ public class BatchPanel extends ControlPanel { public static final String ICON = "registration28x28.png"; public static final String NAME = "Batch Processing"; - private List<Path> paths = new ArrayList<>(); - private HumanFaceFactory factory = new HumanFaceFactory(); + private final List<Path> paths = new ArrayList<>(); + private final HumanFaceFactory factory = new HumanFaceFactory(); private boolean haveAvgFace = false; /** @@ -56,41 +54,21 @@ public class BatchPanel extends ControlPanel { /** * Constructor. * @param action Action listener + * @param faces Paths to faces * @throws IllegalArgumentException if the {@code faces} argument is empty or missing */ - public BatchPanel(ActionListener action) { + public BatchPanel(ActionListener action, List<Path> faces) { this.setName(NAME); initComponents(); - jButton2.addActionListener(new AbstractAction() { // [Add faces] - @Override - public void actionPerformed(ActionEvent e) { - File[] files = new FileChooserBuilder(ProjectTopComp.class) - .setTitle("Open human face(s)") - .setDefaultWorkingDirectory(new File(System.getProperty("user.home"))) - .setFileFilter(new FileNameExtensionFilter("obj files (*.obj)", "obj")) - .setAcceptAllFileFilterUsed(true) - .showMultiOpenDialog(); - - if (files != null) { - for (File file : files) { - paths.add(Paths.get(file.getAbsolutePath())); - } - } - - paths.stream().forEach(f -> { - String name = f.toString(); - name = name.substring(name.lastIndexOf(File.separatorChar) + 1, name.length()); - jComboBox1.addItem(name); - }); // Action event is triggered automatically by the jComboBox1 with the first item set as selected - } - }); + this.paths.addAll(faces); - jButton3.addActionListener((ActionEvent e) -> { - paths.clear(); - jComboBox1.removeAllItems(); - }); + paths.stream().forEach(f -> { + String name = f.toString(); + name = name.substring(name.lastIndexOf(File.separatorChar) + 1, name.length()); + jComboBox1.addItem(name); + }); // Action event is triggered automatically by the jComboBox1 with the first item set as selected jButton1.addActionListener(createListener(action, ACTION_COMMAND_COMPUTE_ICP)); @@ -117,6 +95,10 @@ public class BatchPanel extends ControlPanel { jButtonInfo1.addActionListener((ActionEvent e) -> { showSimilarityInfo(); }); + + jButtonInfo2.addActionListener((ActionEvent e) -> { + showDatasetInfo(); + }); } @Override @@ -290,6 +272,25 @@ public class BatchPanel extends ControlPanel { ); } + private void showDatasetInfo() { + JOptionPane.showMessageDialog( + this, + "<html>" + + "In the <strong>Registration</strong> step, the selected face is used<br>" + + "as an initial face for the computation of average face.<br/>" + + "Newly computed average face is automatically added to the dataset and selected.<br/>" + + "<br/>" + + "In the <strong>Similarity computation</strong> step, the selected face is used<br/>" + + "as a template (intermediate) face through which the mutual distances are computed.<br/>" + + "<br/>" + + "Selected face is shown in the scene.<br/>" + + "<br/>" + + "</html>", + "Distance computation strategies", + JOptionPane.INFORMATION_MESSAGE + ); + } + private void exportAvgFace() { if (!haveAvgFace) { return; @@ -330,10 +331,9 @@ public class BatchPanel extends ControlPanel { jCheckBox4 = new javax.swing.JCheckBox(); jButton5 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); - jButton2 = new javax.swing.JButton(); - jButton3 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox<>(); + jButtonInfo2 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jComboBox2 = new javax.swing.JComboBox<>(); jButton4 = new javax.swing.JButton(); @@ -425,37 +425,40 @@ public class BatchPanel extends ControlPanel { jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, org.openide.util.NbBundle.getMessage(BatchPanel.class, "BatchPanel.jPanel2.border.title_1"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 12))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(BatchPanel.class, "BatchPanel.jButton2.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage(BatchPanel.class, "BatchPanel.jButton3.text")); // NOI18N - jLabel1.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(BatchPanel.class, "BatchPanel.jLabel1.text")); // NOI18N + jButtonInfo2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/info.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jButtonInfo2, org.openide.util.NbBundle.getMessage(BatchPanel.class, "BatchPanel.jButtonInfo2.text")); // NOI18N + jButtonInfo2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); + jButtonInfo2.setBorderPainted(false); + jButtonInfo2.setFocusPainted(false); + jButtonInfo2.setFocusable(false); + jButtonInfo2.setRequestFocusEnabled(false); + jButtonInfo2.setRolloverEnabled(false); + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() - .addComponent(jButton2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButtonInfo2) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jButton2) - .addComponent(jButton3) - .addComponent(jLabel1) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButtonInfo2) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(23, Short.MAX_VALUE)) ); @@ -501,11 +504,11 @@ public class BatchPanel extends ControlPanel { jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(14, 14, 14) - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jButtonInfo1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jComboBox2) - .addComponent(jCheckBox5))) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jCheckBox5)) + .addComponent(jButtonInfo1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton4) @@ -554,12 +557,11 @@ public class BatchPanel extends ControlPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private cz.fidentis.analyst.core.ComboSliderInteger comboSliderInteger1; private javax.swing.JButton jButton1; - private javax.swing.JButton jButton2; - private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButtonInfo1; + private javax.swing.JButton jButtonInfo2; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JCheckBox jCheckBox3; diff --git a/GUI/src/main/java/cz/fidentis/analyst/core/FaceTab.java b/GUI/src/main/java/cz/fidentis/analyst/core/FaceTab.java index edbfc4a039a86c99708b2e207a4750468da01c8d..ee6301ec11140ebca95709fb7a9a0efa486b3955 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/core/FaceTab.java +++ b/GUI/src/main/java/cz/fidentis/analyst/core/FaceTab.java @@ -14,6 +14,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; +import java.nio.file.Path; +import java.util.List; import java.util.Objects; import javax.swing.GroupLayout; import javax.swing.JScrollPane; @@ -36,7 +38,8 @@ public class FaceTab extends TopComponent { private ActionListener listener = null; /** - * Constructor. + * Constructor for single face analysis and 1:1. + * * @param primary Primary face * @param secondary Secondary face * @param name Tab name @@ -46,24 +49,19 @@ public class FaceTab extends TopComponent { canvas = new Canvas(); this.listener = listener; - if (primary == null) { // N:N - canvas.addToolBox(new SceneToolboxSingleFace(canvas)); - - } else { - nameOfFace1 = primary.getShortName(); - - canvas.addPrimaryFace(primary); + nameOfFace1 = primary.getShortName(); - if (secondary == null) { // single face analysis - canvas.getScene().setDefaultColors(); - canvas.addToolBox(new SceneToolboxSingleFace(canvas)); - nameOfFace2 = null; - } else { // 1:1 - canvas.addSecondaryFace(secondary); - canvas.getScene().setDefaultColors(); - canvas.addToolBox(new SceneToolboxFaceToFace(canvas)); - nameOfFace2 = secondary.getShortName(); - } + canvas.addPrimaryFace(primary); + + if (secondary == null) { // single face analysis + canvas.getScene().setDefaultColors(); + canvas.addToolBox(new SceneToolboxSingleFace(canvas)); + nameOfFace2 = null; + } else { // 1:1 + canvas.addSecondaryFace(secondary); + canvas.getScene().setDefaultColors(); + canvas.addToolBox(new SceneToolboxFaceToFace(canvas)); + nameOfFace2 = secondary.getShortName(); } controlPanel = new TopControlPanel(); @@ -82,22 +80,48 @@ public class FaceTab extends TopComponent { controlPanel.addChangeListener(e -> getCanvas().renderScene()); - if (primary == null) { // N:N - new BatchAction(canvas, controlPanel); - } else { - if (secondary == null) { // single face analysis - new CurvatureAction(getCanvas(), controlPanel); - new SymmetryAction(getCanvas(), controlPanel); - new ProfilesAction(getCanvas(), controlPanel); - } else { // 1:1 - new RegistrationAction(canvas, controlPanel); - new DistanceAction(canvas, controlPanel); - new SymmetryAction(canvas, controlPanel); - new ProfilesAction(canvas, controlPanel); - } + if (secondary == null) { // single face analysis + new CurvatureAction(getCanvas(), controlPanel); + new SymmetryAction(getCanvas(), controlPanel); + new ProfilesAction(getCanvas(), controlPanel); + } else { // 1:1 + new RegistrationAction(canvas, controlPanel); + new DistanceAction(canvas, controlPanel); + new SymmetryAction(canvas, controlPanel); + new ProfilesAction(canvas, controlPanel); } + } + + /** + * Constructor for N:N + * + * @param faces Paths to faces + * @param name Tab name + * @param listener action listener + */ + public FaceTab(List<Path> faces, String name, ActionListener listener) { + canvas = new Canvas(); + this.listener = listener; + canvas.addToolBox(new SceneToolboxSingleFace(canvas)); + controlPanel = new TopControlPanel(); + scrollPane = new JScrollPane(controlPanel); + + setName(name); + initComponents(); + + // change the height so that it corresponds to the height of the OpenGL window + canvas.addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { + scrollPane.setSize(ControlPanel.CONTROL_PANEL_WIDTH, canvas.getHeight()); + } + }); + + controlPanel.addChangeListener(e -> getCanvas().renderScene()); + + new BatchAction(canvas, controlPanel, faces); } @Override diff --git a/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java b/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java index bfea4b25deb5e15b4c50c57644cac8c7257b2803..0a6bddff7342f9bffbd003602fdc23af01b9253a 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java +++ b/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java @@ -14,6 +14,7 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JFileChooser; @@ -359,7 +360,16 @@ public class ProjectPanel extends JPanel { }//GEN-LAST:event_analyseButtonMouseClicked private void manyToManyButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_manyToManyButtonMouseClicked - createManyToManyTab("N:N"); + List<Path> faces = selectedRows.stream() + .map(i -> model.getValueAt(selectedRows.get(i), 1).toString()) + .map(s -> project.getCfg().getPathToFaceByName(s)) + .collect(Collectors.toList()); + + if (faces.size() > 2) { + createManyToManyTab("N:N", faces); + } else { + JOptionPane.showMessageDialog(this, "Select at least three models"); + } }//GEN-LAST:event_manyToManyButtonMouseClicked private void oneOnOneButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_oneOnOneButtonMouseClicked @@ -637,14 +647,14 @@ public class ProjectPanel extends JPanel { * @param faces faces to be analyzed * @param name name of the tab */ - private void createManyToManyTab(String name) { + private void createManyToManyTab(String name, List<Path> faces) { ActionListener tabCloseListener = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { closeTab(e); } }; - FaceTab newTab = new FaceTab(null, null, name, tabCloseListener); + FaceTab newTab = new FaceTab(faces, name, tabCloseListener); if (!tabs.contains(newTab)) { tabs.add(newTab); } diff --git a/GUI/src/main/resources/cz/fidentis/analyst/batch/Bundle.properties b/GUI/src/main/resources/cz/fidentis/analyst/batch/Bundle.properties index 514fde3eed2937c3596290d58cfdf169f0c71965..4c560d531bf6448cfb43b5aa05ad6c22751822d3 100644 --- a/GUI/src/main/resources/cz/fidentis/analyst/batch/Bundle.properties +++ b/GUI/src/main/resources/cz/fidentis/analyst/batch/Bundle.properties @@ -1,9 +1,4 @@ BatchPanel.jPanel3.border.title_1=Similarity computation -BatchPanel.jButton3.text=Clear faces -# To change this license header, choose License Headers in Project Properties. -# To change this template file, choose Tools | Templates -# and open the template in the editor. -BatchPanel.jButton2.text=Add faces BatchPanel.jPanel2.border.title_1=Dataset BatchPanel.jButton4.text=Compute BatchPanel.jPanel1.border.title=Registration and average face computation @@ -18,3 +13,4 @@ BatchPanel.jButton1.text=Compute BatchPanel.jButtonInfo1.text= BatchPanel.jButton6.text=Export results BatchPanel.jCheckBox5.text=HD auto-crop +BatchPanel.jButtonInfo2.text=