package automatvgi.components;

import java.awt.Graphics;

import automatvgi.Direction;
import automatvgi.LatexColor;
import automatvgi.Projection;
import automatvgi.tools.Point;
import automatvgi.edit.LabelColorSetter;
/**
 * 
 * @author sylvain
 * Chaque composant d'un automate est un AutomatonComponent
 */
public abstract class AutomatonComponent implements LabelColorSetter{
	/**
	 * Permet d'identifier le type de composant
	 * et d'utiliser switch .. case
	 */
	public enum Kind{ State, Transition, Loop, Initial, Final}
	
	protected Kind kind;

	public Kind kind(){
		return this.kind;
	}
	
	/**
	 * Draw this automaton component
	 * @param g The graphical object of the panel on which the automaton is drawn
	 * @param j The projection that converts the state coordinates into panel coordinates
	 */
	abstract public void draw(Graphics g, Projection j);

	/**
	 * The handle of a component defines the zone on which
	 * one has to clic to select this compo-nent
	 * @return the coordinates of the handle
	 */
	abstract public Point handle();
	
	protected LatexColor lineColor=null;
	protected LatexColor labelColor=null;
	

	public void setLineColor(LatexColor lineColor) {
		this.lineColor = lineColor;
	}

	public void setLabelColor(LatexColor labelColor) {
		this.labelColor = labelColor;
	}

	public void setDirection(Direction d){
		throw new UnsupportedOperationException();
	}

	public Direction getDirection(){
		throw new UnsupportedOperationException();
	}

	
	abstract public void edit();
}
