use of org.twak.tweed.gen.VizSkelGen.Mode in project chordatlas by twak.
the class ProfileGen method getUI.
@Override
public JComponent getUI() {
JSlider slider = new JSlider(JSlider.HORIZONTAL, -1, gNode.getChildren().size(), -1);
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
tweed.enqueue(new Runnable() {
@Override
public void run() {
int value = slider.getValue();
for (Spatial s : gNode.getChildren()) {
if (s instanceof Node) {
Integer i = s.getUserData(ProfileGen.class.getSimpleName());
if (i != null && s instanceof Node)
if (value == -1 || i == value)
s.setCullHint(CullHint.Inherit);
else
s.setCullHint(CullHint.Always);
}
}
tweed.gainFocus();
}
});
}
});
JButton skel = new JButton("optimize");
skel.addActionListener(ae -> doSkel());
JComboBox<Mode> vizMode = new JComboBox<>(Mode.values());
vizMode.addActionListener(e -> doViz((Mode) vizMode.getSelectedItem()));
// JButton writeProfiles = new JButton("dump profs");
// writeProfiles.addActionListener( ae -> writeProfiles() );
JButton stateBuilder = new JButton("segmenter ui");
stateBuilder.addActionListener(ae -> new SSBuilder(this, tweed.features));
JButton profs = new JButton("2d profiles");
profs.addActionListener(ae -> new ProfileAssignmentViewer(faces));
JPanel out = new JPanel(new ListDownLayout());
out.add(skel);
out.add(new JLabel("profiles rendered:"));
out.add(slider);
out.add(new JLabel("viz:"));
out.add(vizMode);
// out.add( writeProfiles );
out.add(stateBuilder);
out.add(profs);
return out;
}
Aggregations