/** MapItemFactory
* A Singleton class that provides methods for creating markers, polygons, and polylines
* 
* @class MapItemFactory
*	@singleton
* @returns {void}
*/
MapItemFactory = new function() {
	
		
	/** createMarker
	* Creates a map marker
	*
	* @method createMarker
	* @param {GLatLng} point
	* @param [String} iconURL : Used to get the icon URL from the database to show the icon image for the appropriate marker
	* @returns {GMarker} : The map marker created
	*/	
	
	this.createMarker = function( point, iconURL ) {
		var icon = new GIcon( G_DEFAULT_ICON, iconURL );
		icon.shadow = "icons/shadow/shadow.png";
		var gMarker = new GMarker( point, icon );		
		return gMarker;
	}
	
	/** createPolygon
	* Creates a filled polygon (for a building)
	*
	* @method createPolygon
	* @param {String} fillColor
	* @param {String} points : The encoded points string
	* @param {String} levels : The encoded levels string
	* @return {GPolygon}
	*/
	this.createPolygon = function( fillColor, points, levels ){		
		var gPolygon = new GPolygon.fromEncoded( {
			polylines: [{
				color: "#000000",
				weight: 1,
				opacity: 0.8,
				points: points,
				levels: levels,
				zoomFactor: 2,
				numLevels: 18
			}],
			fill: true,
			color: fillColor,
			opacity: 0.5,
			outline: true,
			clickable: true 
		} );
		
		return gPolygon;
	}
	
	
	
	/** createPolyline
	* Creates a poly line (for the bus routes)
	*
	* @method createPolyline
	* @param {String} lineColor
	* @param {String} points
	* @param {String} levels
	* @returns {GPolyline}
	*/
	this.createPolyline = function( lineColor, points, levels ){
		var gPolyline = GPolyline.fromEncoded( {
			color: lineColor,
			weight: 6,
			opacity: 0.9,
			points: points,
			levels: levels,
			zoomFactor: 2,
			numLevels: 18
		} );
		
		return gPolyline;
	}
	
}