/**
 * @(#)SVGPath.java
 * Copyright 2001 
 * @author  Intelligent Technology Inc.
 * @version 0.00 2001/08/22
 */
package jp.co.iti.fagot.xml;

/* java */

/* W3C DOM */
import	org.w3c.dom.Document;

/* fagot */

/**
 * SVGPath
 */
public class SVGPathdata	implements	ISVGPathdata{
	protected	String	pathdata	=	null;
	
	/**
	 * コンストラクタ
	 * @param	String RootElementName ルートエレメント名("ProjrctUnit"等)
	 * @param	String SystemID        システムID("site.dtd"等)
	 * @return	none
//	 * @exception
//	 * @see
	 * @since	0.00
//	 * @deprecated 
	 * DOMツリーを新規に作成する
	 *   ・docフィールドに新規に作成したDOMツリーのDocumentを設定
	 *   ・rootフィールドに新規に作成したDOMツリーのDocumentの
	 *     ルートエレメントを設定
	 */
	public SVGPathdata(){ super(); }
	
	private	void	setPathdata(String s){
		if(null==pathdata)	pathdata = s;
		else	pathdata = pathdata + D_SEPARATOR + s;
	}
	
	public	void	moveto(double x ,double y){
		String s = ABSOLUTE_M + D_SEPARATOR + String.valueOf(x) + D_SEPARATOR + String.valueOf(y);
		setPathdata(s);
	}
	
	public	void	closepath(){
		setPathdata(ABSOLUTE_Z);
	}
	
	public	void	lineto(double x ,double y){
		String s = ABSOLUTE_L + D_SEPARATOR + String.valueOf(x) + D_SEPARATOR + String.valueOf(y);
		setPathdata(s);
	}
	
	public	void	horizontalto(double x){
		String s = ABSOLUTE_H + D_SEPARATOR + String.valueOf(x);
		setPathdata(s);
	}
	
	public	void	verticalto(double y){
		String s = ABSOLUTE_V + D_SEPARATOR + String.valueOf(y);
		setPathdata(s);
	}
	
	public	void	curveto(double x1 ,double y1 ,double x2 ,double y2 ,double x3 ,double y3){
		String s = ABSOLUTE_C + D_SEPARATOR
				 + String.valueOf(x1) + D_SEPARATOR + String.valueOf(y1) + D_SEPARATOR
				 + String.valueOf(x2) + D_SEPARATOR + String.valueOf(y2) + D_SEPARATOR
				 + String.valueOf(x3) + D_SEPARATOR + String.valueOf(y3);
		setPathdata(s);
	}
	
	public	void	curveto(double x1 ,double y1 ,double x2 ,double y2){
		String s = ABSOLUTE_S + D_SEPARATOR
				 + String.valueOf(x1) + D_SEPARATOR + String.valueOf(y1) + D_SEPARATOR
				 + String.valueOf(x2) + D_SEPARATOR + String.valueOf(y2);
		setPathdata(s);
	}
	
	public	void	quadto(double x1 ,double y1 ,double x2 ,double y2){
		String s = ABSOLUTE_Q + D_SEPARATOR
				 + String.valueOf(x1) + D_SEPARATOR + String.valueOf(y1) + D_SEPARATOR
				 + String.valueOf(x2) + D_SEPARATOR + String.valueOf(y2);
		setPathdata(s);
	}
	
	public	void	quadto(double x ,double y){
		String s = ABSOLUTE_T + D_SEPARATOR
				 + String.valueOf(x) + D_SEPARATOR + String.valueOf(y);
		setPathdata(s);
	}
	
	public	void	arcto(){
		String s = ABSOLUTE_A;
		setPathdata(s);
	}
	
	public	String	toString(){
		return(new String(pathdata));
	}
}