DefaultMutableTreeNode object = null;
DefaultMutableTreeNode field = null;
DefaultMutableTreeNode subField = null;
Vector<GeometricalObject> assocObjects;
for (int i = 0; i<objects.size(); i++) {
GeometricalObject o = objects.elementAt(i);
if (o.getType() == type) {//should be added to top
object = new DefaultMutableTreeNode(String.valueOf(o.getNumber()));
top.add(object);
switch (type) {
case 2: //point
Point p = ((Point)o);
field = new DefaultMutableTreeNode(
new FieldInfo("X Co-ordinate", p.getX()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("Y Co-ordinate", p.getY()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("Visibility", p.isVisible()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("AssociatedObjects", "Empty"));
object.add(field);
assocObjects = p.getAssocObjects();
for (int j = 0; j<assocObjects.size(); j++) {
GeometricalObject ob = assocObjects.elementAt(j);
subField = new DefaultMutableTreeNode(
new FieldInfo(Integer.toString(ob.getNumber()), ob));
field.add(subField);
}
break;
case 3: //line
Line l = ((Line)o);
field = new DefaultMutableTreeNode(
new FieldInfo("Start Point", l.getStart()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("End Point", l.getEnd()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("Slope (Degrees)",
Math.toDegrees(l.getSlope().getAngle())));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("Length", l.getLength()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("Visibility", l.isVisible()));
object.add(field);
field = new DefaultMutableTreeNode(
new FieldInfo("AssociatedObjects", "Empty"));
object.add(field);
assocObjects = l.getAssocObjects();
for (int j = 0; j<assocObjects.size(); j++) {
GeometricalObject ob = assocObjects.elementAt(j);
subField = new DefaultMutableTreeNode(
new FieldInfo(Integer.toString(ob.getNumber()), ob));
field.add(subField);
}
break;
case 4:
Circle c = ((Circle)o);