
///////////////////////////////
//	Author : colm
///////////////////////////////
/////
//created 18-08-2002
// basically all we need out of this is the copyconstructor
// so that we can save simple arcs to database.
///////////////////////
/**********************************************
Arc TOOL
***********************************************/
simpleArcTool.prototype = new DrawingTool(); 
simpleArcTool.prototype.constructor = simpleArcTool;
simpleArcTool.superclass = DrawingTool.prototype;

function simpleArcTool(){}

simpleArcTool.prototype.initTool = function(){ 
  this.actionState="click0";
	this.radius = 0;
	this.large_flag = 0;
	this.sweep = 0;
	this.ax = 0;
	this.ay = 0;
	this.bx = 0;
	this.by = 0;
	this.axis_rot = 0;
}

simpleArcTool.prototype.parsePath = function( path ){
 	var str_arr = new Array();
 	var l_index = 0;
	for (var i =0; i < path.length; i++){
		if(path.charAt(i) == " "){
			str_arr.push(path.substring(l_index,  i));
			l_index = i;	
		} 	 	
	}
	str_arr.push(path.substring(l_index, path.length));
	var ind = str_arr[1].indexOf("A");
	this.ay = Number(str_arr[1].substring(0, ind));
	this.radius = Number(str_arr[2]);
	this.ax = Number(str_arr[0].substring(1, str_arr[0].length -1));	
	this.bx = Number(str_arr[str_arr.length - 2]);
	this.by = Number(str_arr[str_arr.length - 1]);
	this.sweep = Number(str_arr[str_arr.length - 3]);
	this.large_flag = Number(str_arr[str_arr.length - 4].charAt(1));  
	this.axis_rot = Number(str_arr[str_arr.length - 5]);	
}




simpleArcTool.prototype.copyconstructor = function( svgNode ){
	var path = svgNode.getAttribute("d");
	this.parsePath(path);
	this.myArc = new simpleArc(this.ax, this.ay, this.bx, this.by, this.radius, this.sweep, this.large_flag, this.axis_rot, false);
	this.myArc.copyconstructor( svgNode );
  return this.myArc;
}

var simpleArcTool = new simpleArcTool();
