// Decompiled by Jad v1.5.7b. Copyright 1997-99 Pavel Kouznetsov.
|
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
|
// Decompiler options: packimports(3)
|
// Source File Name: CSGEditor.java
|
|
import java.awt.*;
|
import java.awt.event.*;
|
import javax.swing.*;
|
import javax.swing.event.*;
|
|
import java.util.Vector;
|
|
class CSGEditor extends ObjEditor implements ChangeListener, ActionListener, ObjectUI
|
{
|
|
CSGEditor(CSG t, GroupEditor callee)
|
{
|
super(t, callee); // , false);
|
//objEditor = new GroupEditor(t, this, callee);
|
objEditor = callee.GetEditor();
|
|
csg = t;
|
|
System.out.println("constructor1 = " + csg.tolerance);
|
|
SetupUI2(GetEditor());
|
}
|
|
CSGEditor(CSG t, Object3D copy, GroupEditor callee)
|
{
|
super(t, copy, callee);
|
|
//objEditor = new GroupEditor(t, copy, callee);
|
objEditor = this;
|
|
csg = (CSG) copy;
|
|
System.out.println("constructor2 = " + csg.tolerance);
|
SetupUI2(GetEditor());
|
}
|
|
void SetupUI2(ObjEditor oe)
|
{
|
super.SetupUI2(oe); // Shows composite UI !!
|
//super.SetupName(oe);
|
|
oe.aConstraints.weighty = 0;
|
|
oe.aConstraints.fill = 0;
|
oe.aConstraints.gridwidth = 1;
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(refreshButton = new JButton("Refresh"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridwidth = 1;
|
oe.aConstraints.gridx /* = 0;
|
oe.aConstraints.gridy */ += 1;
|
|
oe.aConstraints.fill = 0;
|
oe.aConstraints.gridwidth = 1;
|
//this.csg = (CSG) copy;
|
/*
|
oe.ctrlPanel.add(typeLabel = new JLabel("Type"), oe.aConstraints);
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.aConstraints.gridx += 1;
|
*/
|
Vector list = new Vector();
|
list.add("Union");
|
list.add("Merge");
|
list.add("Intersection");
|
list.add("Difference");
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(typeMenu = new JComboBox(new ObjEditor.cListModel(list, csg.csgType - 1)), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
//typeMenu.select(csg.csgType - 1);
|
|
oe.aConstraints.gridx += 1;
|
//oe.aConstraints.gridy += 1;
|
//oe.aConstraints.gridx = 0;
|
|
list = new Vector();
|
list.add("Surface");
|
list.add("Volume");
|
list.add("Inner");
|
list.add("Outer");
|
list.add("Boundary");
|
/*
|
oe.aConstraints.fill = 0;
|
oe.ctrlPanel.add(genLabel = new JLabel("Generation"), oe.aConstraints);
|
oe.aConstraints.gridx += 1;
|
*/
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(genMenu = new JComboBox(new ObjEditor.cListModel(list, 0)), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
//typeMenu.select(csg.csgType - 1);
|
//oe.aConstraints.gridy += 1;
|
oe.aConstraints.gridx += 1;
|
|
Return();
|
|
list = new Vector();
|
list.add("Smooth");
|
list.add("Flat");
|
/*
|
oe.aConstraints.fill = 0;
|
oe.ctrlPanel.add(normalsLabel = new JLabel("Shading"), oe.aConstraints);
|
oe.aConstraints.gridx += 1;
|
*/
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(normalsMenu = new JComboBox(new ObjEditor.cListModel(list, 0)), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
//typeMenu.select(csg.csgType - 1);
|
oe.aConstraints.gridx += 1;
|
oe.aConstraints.gridwidth = 1;
|
|
list = new Vector();
|
list.add("Strip");
|
list.add("No strip");
|
list.add("No trim");
|
/*
|
oe.aConstraints.fill = 0;
|
oe.ctrlPanel.add(normalsLabel = new JLabel("Shading"), oe.aConstraints);
|
oe.aConstraints.gridx += 1;
|
*/
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(stripifyMenu = new JComboBox(new ObjEditor.cListModel(list, 0)), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
//typeMenu.select(csg.csgType - 1);
|
oe.aConstraints.gridy += 1;
|
oe.aConstraints.gridx = 0;
|
oe.aConstraints.gridwidth = 1;
|
|
//oe.aConstraints.fill = 0;
|
oe.ctrlPanel.add(sizeLabel = new JLabel("Depth"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridx += 1;
|
oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(sizeField = new NumberSlider(0,10), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridy += 1;
|
oe.aConstraints.gridx = 0;
|
|
oe.aConstraints.fill = 0;
|
oe.aConstraints.gridwidth = 1;
|
oe.ctrlPanel.add(size2Label = new JLabel("Depth2"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridx += 1;
|
oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(size2Field = new NumberSlider(0,10), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridy += 1;
|
oe.aConstraints.gridx = 0;
|
|
oe.aConstraints.gridwidth = 1;
|
oe.aConstraints.fill = 0;
|
oe.ctrlPanel.add(tolLabel = new JLabel("Tolerance"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridx += 1;
|
oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.ctrlPanel.add(tolField = new NumberSlider(0,10,1), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.aConstraints.gridy += 1;
|
oe.aConstraints.gridx = 0;
|
oe.aConstraints.gridwidth = 1;
|
|
sizeField.setInteger(csg.cellSize);
|
size2Field.setInteger(csg.cellSize2);
|
System.out.println("csg.tolerance = " + csg.tolerance);
|
tolField.setFloat(csg.tolerance);
|
normalsMenu.setSelectedIndex(csg.normals?0:1);
|
typeMenu.setSelectedIndex(csg.csgType - 1);
|
genMenu.setSelectedIndex(csg.genType);
|
stripifyMenu.setSelectedIndex(csg.userType); // ==0?0:1);
|
|
sizeField.addChangeListener(this);
|
size2Field.addChangeListener(this);
|
tolField.addChangeListener(this);
|
|
typeMenu.addActionListener(this);
|
genMenu.addActionListener(this);
|
normalsMenu.addActionListener(this);
|
stripifyMenu.addActionListener(this);
|
|
refreshButton.addActionListener(this);
|
}
|
|
public ObjEditor GetEditor()
|
{
|
return objEditor.GetEditor();
|
}
|
|
void Clear()
|
{
|
objEditor.Clear();
|
|
csg = null;
|
}
|
|
public void closeUI()
|
{
|
ObjEditor oe = GetEditor();
|
|
//if (oe == null)
|
// return;
|
|
typeMenu.removeActionListener(this);
|
genMenu.removeActionListener(this);
|
normalsMenu.removeActionListener(this);
|
refreshButton.removeActionListener(this);
|
|
sizeField.removeChangeListener(this);
|
size2Field.removeChangeListener(this);
|
tolField.removeChangeListener(this);
|
oe.ctrlPanel.remove(sizeField);
|
oe.ctrlPanel.remove(size2Field);
|
oe.ctrlPanel.remove(tolField);
|
oe.ctrlPanel.remove(sizeLabel);
|
oe.ctrlPanel.remove(size2Label);
|
oe.ctrlPanel.remove(tolLabel);
|
oe.ctrlPanel.remove(typeMenu);
|
//oe.ctrlPanel.remove(typeLabel);
|
oe.ctrlPanel.remove(genMenu);
|
//oe.ctrlPanel.remove(genLabel);
|
oe.ctrlPanel.remove(normalsMenu);
|
oe.ctrlPanel.remove(stripifyMenu);
|
//oe.ctrlPanel.remove(normalsLabel);
|
oe.ctrlPanel.remove(refreshButton);
|
//oe.ctrlPanel.repaint();
|
|
super.closeUI();
|
}
|
|
/*
|
public void doLayout()
|
{
|
super.doLayout();
|
labelAndField(typeLabel, typeMenu);
|
labelAndField(sizeLabel, sizeField);
|
widgetPos += 5;
|
}
|
*/
|
|
public void actionPerformed(ActionEvent e)
|
{
|
//System.out.println("CSGEditor " + e);
|
if (e.getSource() == refreshButton ||
|
e.getSource() == typeMenu ||
|
e.getSource() == genMenu ||
|
e.getSource() == normalsMenu ||
|
e.getSource() == stripifyMenu)
|
{
|
csg.aCellSize = -1;
|
csg.aTolerance = -1;
|
applySelf();
|
//refreshContents();
|
csg.refreshEditWindow();
|
}
|
else
|
super.actionPerformed(e);
|
}
|
|
public void stateChanged(ChangeEvent e)
|
{
|
if (e.getSource() == sizeField ||
|
e.getSource() == size2Field ||
|
e.getSource() == tolField)
|
{
|
// Can't choose...
|
//applySelf();
|
//objEditor.refreshContents();
|
}
|
else
|
super.stateChanged(e);
|
}
|
|
public void applySelf()
|
{
|
// june 2013 super.applySelf();
|
|
csg.csgType = typeMenu.getSelectedIndex() + 1;
|
csg.genType = genMenu.getSelectedIndex();
|
csg.normals = normalsMenu.getSelectedIndex() == 0;
|
csg.userType = stripifyMenu.getSelectedIndex();
|
csg.cellSize = sizeField.getInteger();
|
csg.cellSize2 = size2Field.getInteger();
|
csg.tolerance = tolField.getFloat();
|
|
if (csg.link2master)
|
csg.retile();
|
}
|
|
CSG csg;
|
JLabel typeLabel;
|
JLabel genLabel;
|
JLabel normalsLabel;
|
JLabel sizeLabel;
|
JLabel size2Label;
|
JLabel tolLabel;
|
JComboBox typeMenu;
|
JComboBox genMenu;
|
JComboBox normalsMenu;
|
JComboBox stripifyMenu;
|
NumberSlider sizeField;
|
NumberSlider size2Field;
|
NumberSlider tolField;
|
|
JButton refreshButton;
|
|
//GroupEditor objEditor;
|
}
|