package graphmatcher.gui.optionpanel;
import graphmatcher.gui.LabeledTextField;
import graphmatcher.matcher.MatchingOptions;
import graphmatcher.matcher.shapecontext.ShapeContextGraphMatcher;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
public class ShapeContextOptionPanel extends IOptionPanel {
// private LabeledTextField numbersOfNeighboursField;
private LabeledTextField numberOfAngleBinsField, numberOfRadiusBinsField;
// private JTextField gpField, cpField, npField, vpField, epField;
private JCheckBox rotationCheckBox;
// private JCheckBox normalizeMatrixCheckBox;
public ShapeContextOptionPanel() {
setBorder(BorderFactory.createTitledBorder("Optionen"));
setLayout(new GridLayout(0, 1));
// numbersOfNeighboursField = new LabeledTextField("Nachbarn", "-1",
// true);
// add(numbersOfNeighboursField);
numberOfAngleBinsField = new LabeledTextField("#Kreissektoren", "8", true);
add(numberOfAngleBinsField);
numberOfRadiusBinsField = new LabeledTextField("#Ringe", "4", true);
add(numberOfRadiusBinsField);
rotationCheckBox = new JCheckBox("Rotation ber�cksichtigen", true);
add(rotationCheckBox);
// JPanel weightPanel = new JPanel();
// weightPanel.setLayout(new GridLayout(2, 5));
// weightPanel.add(new JLabel("GP"));
// weightPanel.add(new JLabel("CP"));
// weightPanel.add(new JLabel("NP"));
// weightPanel.add(new JLabel("VP"));
// weightPanel.add(new JLabel("EP"));
// FocusListener focusListener = new FocusListener() {
// @Override
// public void focusGained(FocusEvent e) {
// JTextField textField = (JTextField) e.getSource();
// textField.setSelectionStart(2);
// textField.setSelectionEnd(textField.getText().length());
// }
//
// @Override
// public void focusLost(FocusEvent e) {
// }
// };
// MatchingOptions defaultOptions = new
// MatchingOptions(ShapeContextGraphMatcher.matcherID);
// gpField = new JTextField("" + defaultOptions.gpWeight);
// gpField.addFocusListener(focusListener);
// weightPanel.add(gpField);
// cpField = new JTextField("" + defaultOptions.cpWeight);
// cpField.addFocusListener(focusListener);
// weightPanel.add(cpField);
// npField = new JTextField("" + defaultOptions.npWeight);
// npField.addFocusListener(focusListener);
// weightPanel.add(npField);
// vpField = new JTextField("" + defaultOptions.vpWeight);
// vpField.addFocusListener(focusListener);
// weightPanel.add(vpField);
// epField = new JTextField("" + defaultOptions.epWeight);
// epField.addFocusListener(focusListener);
// weightPanel.add(epField);
// add(weightPanel, new TableLayoutConstraints(0, gridY, 2, gridY));
// gridY++;
// normalizeMatrixCheckBox = new JCheckBox("Matrix normalisieren");
// normalizeMatrixCheckBox.setSelected(false);
// add(normalizeMatrixCheckBox, new TableLayoutConstraints(0, gridY, 1,
// gridY));
}
// public boolean normalizeMatrix() {
// return normalizeMatrixCheckBox.isSelected();
// }
@Override
public String getMatcherID() {
return ShapeContextGraphMatcher.matcherID;
}
@Override
public MatchingOptions getMatchingOptions() {
MatchingOptions options = new MatchingOptions(ShapeContextGraphMatcher.matcherID);
// options.numberOfNeighbours =
// Integer.parseInt(numbersOfNeighboursField.getText());
options.numberOfAngleBins = Integer.parseInt(numberOfAngleBinsField.getText());
options.numberOfRadiusBins = Integer.parseInt(numberOfRadiusBinsField.getText());
// options.gpWeight = Double.parseDouble(gpField.getText());
// options.cpWeight = Double.parseDouble(cpField.getText());
// options.npWeight = Double.parseDouble(npField.getText());
// options.vpWeight = Double.parseDouble(vpField.getText());
// options.epWeight = Double.parseDouble(epField.getText());
options.setNoRotation(!rotationCheckBox.isSelected());
return options;
}
@Override
public String getDefaultFileName() {
return "shapecontextMatcher.txt";
}
@Override
public void setEditable(boolean editable) {
numberOfAngleBinsField.setEditable(editable);
numberOfRadiusBinsField.setEditable(editable);
rotationCheckBox.setEnabled(editable);
}
}