/* @(#)Methods.java   15 September 2005 */

/* Useful imports */

import edu.neu.ccs.*;
import edu.neu.ccs.gui.*;
import edu.neu.ccs.codec.*;
import edu.neu.ccs.console.*;
import edu.neu.ccs.filter.*;
import edu.neu.ccs.jpf.*;
import edu.neu.ccs.parser.*;
import edu.neu.ccs.pedagogy.*;
import edu.neu.ccs.quick.*;
import edu.neu.ccs.util.*;

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.font.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.border.*;
import java.io.*;
import java.util.*;
import java.math.*;
import java.beans.*;
import java.lang.reflect.*;
import java.net.URL;
import java.util.regex.*;
import java.text.ParseException;

/** The sample starter class for Java Power Framework. */
public class Methods extends JPF 
{
    
    public static void main(String[] args) { 
        LookAndFeelTools.adjustAllDefaultFontSizes(5);
        
        new Methods();
    }
    
    
    public void UnionCircles(double radius) {
        XCircle circle1 = new XCircle(100, 200, radius);
        XCircle circle2 = new XCircle(300, 200, radius);
        
        Shape union = ShapeTools.union(circle1, circle2);
        
        ShapePaintable sp1 = new ShapePaintable(circle1);
        ShapePaintable sp2 = new ShapePaintable(circle2);
        ShapePaintable sp3 =
            new ShapePaintable(union, PaintMode.FILL, Colors.green);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        
        window.appendPaintable(sp1);
        window.appendPaintable(sp2);
        window.appendPaintable(sp3);
        
        window.repaint();
    }
    
    
    public void IntersectCircles(double radius) {
        XCircle circle1 = new XCircle(100, 200, radius);
        XCircle circle2 = new XCircle(300, 200, radius);
        
        Shape intersect = ShapeTools.intersect(circle1, circle2);
        
        ShapePaintable sp1 = new ShapePaintable(circle1);
        ShapePaintable sp2 = new ShapePaintable(circle2);
        ShapePaintable sp3 =
            new ShapePaintable(intersect, PaintMode.FILL, Colors.green);
        
        String message = ShapeTools.intersects(circle1, circle2)
            ? "Circles Intersect"
            : "Circles Do Not Intersect";
    
        TextPaintable tp =
            new TextPaintable(message, TextAnchor.CENTER_BASELINE, 200, 390);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        
        window.appendPaintable(tp);
        window.appendPaintable(sp1);
        window.appendPaintable(sp2);
        window.appendPaintable(sp3);
        
        window.repaint();
    }
    
    
    public void ExclusiveOrCircles(double radius) {
        XCircle circle1 = new XCircle(100, 200, radius);
        XCircle circle2 = new XCircle(300, 200, radius);
        
        Shape exclusiveOr = ShapeTools.exclusiveOr(circle1, circle2);
        
        ShapePaintable sp1 = new ShapePaintable(circle1);
        ShapePaintable sp2 = new ShapePaintable(circle2);
        ShapePaintable sp3 =
            new ShapePaintable(exclusiveOr, PaintMode.FILL, Colors.green);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        
        window.appendPaintable(sp1);
        window.appendPaintable(sp2);
        window.appendPaintable(sp3);
        
        window.repaint();
    }
    
    
    public void SubtractCircles(double radius) {
        XCircle circle1 = new XCircle(100, 200, radius);
        XCircle circle2 = new XCircle(300, 200, radius);
        
        Shape subtract = ShapeTools.subtract(circle1, circle2);
        
        ShapePaintable sp1 = new ShapePaintable(circle1);
        ShapePaintable sp2 = new ShapePaintable(circle2);
        ShapePaintable sp3 =
            new ShapePaintable(subtract, PaintMode.FILL, Colors.green);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        
        window.appendPaintable(sp1);
        window.appendPaintable(sp2);
        window.appendPaintable(sp3);
        
        window.repaint();
    }
    
    
    public void PolygonTest(int N, double r) {
        Shape shape = Shapes.regularPolygon(N, r, 200, 200);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        window.appendPaintable(shape);
        window.repaint();
    }
    
    
    public void WavygonTest(int N, double r) {
        Shape shape = Shapes.regularWavygon(N, r, 200, 200);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        window.appendPaintable(shape);
        window.repaint();
    }
    
    
    public void StarTest(int N, int K, double r) {
        Shape shape = Shapes.regularStar(N, K, r, 200, 200);
        
        window.clearSequence();
        window.installSimpleMouseActions();
        window.appendPaintable(shape);
        window.repaint();
    }
    
    
    public void IntersectTest() {
        new IntersectTest();
    }
    
    
    public void CheckerBoard() {
        new CheckerBoard();
    }
}
