﻿function _PolyLine() {	
	var PolyLine = Class.create( {
		initialize: function(parent, container) {
			this.coords = new Array();
		},
		add : function(coord) {
			this.coords[this.length()] = coord;
			
			return this.length() - 1;
		},
		modify : function(index, coord) {
			if(index < this.length() && index >= 0) {
				this.coords.splice(index, 1, coord)
			}
			else {
				index = null;
			}
			
			return index;
		},
		insert : function(index, coord) {
			this.coords.splice(index, 0, coord)
		},
		remove : function(index) {
			if(index < this.length() && index >= 0) {
				this.coords.splice(index, 1);
				return index;
			}
			else {
				return null;
			}
		},
		getCoord : function(index) {
			if(index < this.length() && index >= 0) {
				return this.coords[index];
			}
			else {
				return null;
			}
		},
		getCoords : function() {
			return this.coords;
		},
		length : function() {
			if(this.coords.length == undefined) {
				return 0;
			}
			else {
				return this.coords.length;
			}
		}
	});
	window.PolyLine = PolyLine;
};
_PolyLine();
