/**
 * Area-Class
 */
var Area = Class.create(OFCData, {
	/* supported subtypes */
	/*public*/ supported: [
		'hollow'
	],
	
	/**
	 * @constructor
	 * @class Area
	 * @extends OFCData
	 * @param {String} sub subtype
	 */
	initialize: function($super, sub) {
		if (typeof sub == 'undefined') sub = 'hollow';
		$super('area', sub);
		
		/**
		 * area style specific
		 */
		/* line-width */
		this.width = null;
		
		/* alpha of area */
		this.alpha = 70;
		
		/* line color */
		this.colors.update({
			line: OFC.defaultColors[0]
		,	area: OFC.defaultColors[1]
		});
		
		/* circle size */
		this.dotSize = 3;
		
	},
	
	/**
	 * @see OFCData#toData
	 */
	toData: function() {
		var values = [];
		
		if (this.width != null) values[0] = this.width;
		if (typeof values[0] == 'undefined') values[0] = 2;
		
		if (this.dotSize != null) values[1] = this.dotSize;
		
		values[2] = this.alpha;
		
		if (this.colors.get('line') != null) values[3] = this.colors.get('line');
		if (typeof values[3] == 'undefined') values[3] = OFC.defaultColors[0];
		
		if (this.key != null) values[4] = this.key;
		if (typeof values[4] == 'undefined') values[4] = 'Unnamed Area';
		if (this.keySize != null) values[5] = this.keySize;
		if (typeof values[5] == 'undefined') values[5] = 10;
		
		if (this.colors.get('area') != null) values[6] = this.colors.get('area');
		else values[6] = OFC.defaultColors[1];
		
		return values;
	},
	
	/**
	 * @see OFCData#fromData
	 */
	fromData: function(info) {
		this.width = info[0];
		this.dotSize = info[1];
		this.alpha = info[2]
		this.colors.set('line', '#'+info[3].substr(-6));
		this.setKey(info[4], info[5]);
		if (info.length > 6) {
			this.colors.set('area', '#'+info[6].substr(-6));
		} else {
			this.colors.set('area', this.colors.get('line'));
		}
	},
	
	/**
	 * @see OFCData#getRequiredColors
	 */
	getRequiredColors: function() {
		return new Hash({
			line:	"Line"
		,	area:	"Area"
		});
	},
	
	/**
	 * @see OFCData#getFullName
	 */
	getFullName: function() {
		
		var name = 'area';
		
		if (this.subType != null) {
			name += '_'+this.subType;
		}
		
		if (this.number != 0) {
			name += '_'+this.number;
		}
		
		return name;
	}
});