if ((object1.canIntersect(object2)) && (object1.getType() != Point.TYPE)) {
intersectionPoints = (Point[])object1.intersect(object2);
intersectionPoints[0].addToObjects(objects);
clearAndHide();
step.setOutputs(intersectionPoints);
fireUndoableEditUpdate(new UndoableEditEvent(this, step));
}
else {
JOptionPane.showMessageDialog(this, "Objects cannot intersect",
"Try Again", JOptionPane.ERROR_MESSAGE);
initDialog();
}
}
else if (step.getConstructionType() == INTERSECT_TWO_POINTS) {
GeometricalObject object1 = (GeometricalObject)step.getInputs()[0];
GeometricalObject object2 = (GeometricalObject)step.getInputs()[1];
Point[] intersectionPoints = new Point[2];
if ((object1.canIntersect(object2)) && (object1.getType() != Point.TYPE)) {
intersectionPoints = (Point[])object1.intersect(object2);
intersectionPoints[0].addToObjects(objects);
intersectionPoints[1].addToObjects(objects);
clearAndHide();
step.setOutputs(intersectionPoints);
fireUndoableEditUpdate(new UndoableEditEvent(this, step));
}
else {
JOptionPane.showMessageDialog(this, "Objects cannot intersect",
"Try Again", JOptionPane.ERROR_MESSAGE);
initDialog();