Skip to content
Snippets Groups Projects
Commit 9b0c8eb1 authored by Daniel Schramm's avatar Daniel Schramm
Browse files

Feature point weights displayed next to the FP-radius slider

parent c63de423
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import cz.fidentis.analyst.symmetry.SymmetryPanel; ...@@ -9,6 +9,7 @@ import cz.fidentis.analyst.symmetry.SymmetryPanel;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
...@@ -17,7 +18,6 @@ import javax.swing.JButton; ...@@ -17,7 +18,6 @@ import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
/** /**
...@@ -51,7 +51,7 @@ public class DistancePanel extends ControlPanel { ...@@ -51,7 +51,7 @@ public class DistancePanel extends ControlPanel {
public static final String STRATEGY_POINT_TO_POINT = "Point to point"; public static final String STRATEGY_POINT_TO_POINT = "Point to point";
public static final String STRATEGY_POINT_TO_TRIANGLE = "Point to triangle"; public static final String STRATEGY_POINT_TO_TRIANGLE = "Point to triangle";
private final JPanel featurePointsStats; private final Map<FeaturePointType, JLabel> featurePointStats;
private final JLabel avgHD, maxHD, minHD; private final JLabel avgHD, maxHD, minHD;
/** /**
...@@ -94,6 +94,7 @@ public class DistancePanel extends ControlPanel { ...@@ -94,6 +94,7 @@ public class DistancePanel extends ControlPanel {
final ControlPanelBuilder fpBuilder = new ControlPanelBuilder(featurePointsPanel); final ControlPanelBuilder fpBuilder = new ControlPanelBuilder(featurePointsPanel);
final List<JCheckBox> fpCheckBoxes = new ArrayList<>(featurePoints.size()); final List<JCheckBox> fpCheckBoxes = new ArrayList<>(featurePoints.size());
final List<JTextField> fpSliderInputs = new ArrayList<>(featurePoints.size()); final List<JTextField> fpSliderInputs = new ArrayList<>(featurePoints.size());
featurePointStats = new HashMap<>(featurePoints.size());
for (int i = 0; i < featurePoints.size(); i++) { for (int i = 0; i < featurePoints.size(); i++) {
final FeaturePoint featurePoint = featurePoints.get(i); final FeaturePoint featurePoint = featurePoints.get(i);
...@@ -114,6 +115,10 @@ public class DistancePanel extends ControlPanel { ...@@ -114,6 +115,10 @@ public class DistancePanel extends ControlPanel {
sliderInput.postActionEvent(); sliderInput.postActionEvent();
fpSliderInputs.add(sliderInput); fpSliderInputs.add(sliderInput);
fpBuilder.addGap();
featurePointStats.put(featurePoint.getFeaturePointType(), fpBuilder.addLabelLine(null));
fpBuilder.addGap();
fpBuilder.addLine(); fpBuilder.addLine();
} }
builder.addScrollPane(featurePointsPanel) builder.addScrollPane(featurePointsPanel)
...@@ -180,15 +185,6 @@ public class DistancePanel extends ControlPanel { ...@@ -180,15 +185,6 @@ public class DistancePanel extends ControlPanel {
builder.addGap(); builder.addGap();
builder.addLine(); builder.addLine();
featurePointsStats = new JPanel();
final JScrollPane fpStatsScrollPanel = builder.addScrollPane(featurePointsStats);
fpStatsScrollPanel.setBorder(BorderFactory.createTitledBorder("Feature point weights"));
fpStatsScrollPanel.setVisible(false);
weightedDistChBx.addActionListener((ActionEvent ae) -> {
fpStatsScrollPanel.setVisible(weightedDistChBx.isSelected());
});
builder.addLine();
builder.addVerticalStrut(); builder.addVerticalStrut();
} }
...@@ -226,17 +222,10 @@ public class DistancePanel extends ControlPanel { ...@@ -226,17 +222,10 @@ public class DistancePanel extends ControlPanel {
* @param featurePointWeights Map of feature point types and their weights * @param featurePointWeights Map of feature point types and their weights
*/ */
public void updateFeaturePointWeights(Map<FeaturePointType, Double> featurePointWeights) { public void updateFeaturePointWeights(Map<FeaturePointType, Double> featurePointWeights) {
featurePointsStats.removeAll(); featurePointStats.forEach((fpType, fpWeightLabel) -> {
final Double fpWeight = featurePointWeights.get(fpType);
final ControlPanelBuilder fpBuilder = new ControlPanelBuilder(featurePointsStats); fpWeightLabel.setText(fpWeight == null ? "" : Double.toString(fpWeight));
for (final Map.Entry<FeaturePointType, Double> fpStats: featurePointWeights.entrySet()) { });
fpBuilder.addOptionText(fpStats.getKey().getName());
fpBuilder.addGap();
fpBuilder.addLabelLine(Double.toString(fpStats.getValue()));
fpBuilder.addGap();
fpBuilder.addLine();
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment