////////////////////////////////////////////////////////////////////////////////////////////
// StylesControl Styles client-side script
////////////////////////////////////////////////////////////////////////////////////////////

addNamespace("Mapping");

////////////////////////////////////////////////////////////////////////////////////////////

Mapping.MapSymbol = Class.create();
Mapping.MapSymbol.prototype =
{
	initialize: function(type, id, color, backColor, haloColor, centroid, size)
	{
		this.__type = "Torbay.GIS.MappingService.MapSymbol, Torbay.GIS.MappingService, Version=2006.11.1.0, Culture=neutral, PublicKeyToken=0e8421ff7ecab46a";
		
        this._create(type, id, color, backColor, haloColor, centroid, size);
	},
	
	_create: function(type, id, color, backColor, haloColor, centroid, size)
	{
		this.type = Mapping.SymbolType.Circle;
		this.id = "";
		this.color = Drawing.Colors.Red;
		this.backColor = Drawing.Colors.Transparent;
		this.haloColor = Drawing.Colors.Transparent;
		this.centroid = new Mapping.DoublePoint();
		this.size = 14;
		
		if (type) this.type = type;
		if (id) this.id = id;
		if (color) this.color = color;
		if (backColor) this.backColor = backColor;
		if (haloColor) this.haloColor = haloColor;
		if (centroid) this.centroid = centroid;
		if (size) this.size = size;
	},
	
	getAdditionalJSON: function()
	{
	    return null;
	},
	
	toJSON: function()
	{
		return "{\"__type\":\"" + this.__type + "\"," + 
			"\"Type\":" + this.type.toJSON() + ",\"ID\":\"" + this.id + "\",\"Color\":" + this.color.toJSON() + ",\"BackColor\":" + this.backColor.toJSON() + ",\"HaloColor\":" + this.haloColor.toJSON() + 
			",\"Centroid\":" + this.centroid.toJSON() + ",\"Size\":" + this.size + (this.getAdditionalJSON() ? "," + this.getAdditionalJSON() : "") + "}";
	}
};

////////////////////////////////////////////////////////////////////////////////////////////

Mapping.BitmapMapSymbol = Class.inherit(Mapping.MapSymbol, 
{
	initialize: function(image, id, color, backColor, haloColor, centroid, size)
	{
		this.__type = "Torbay.GIS.MappingService.BitmapMapSymbol, Torbay.GIS.MappingService, Version=2006.11.1.0, Culture=neutral, PublicKeyToken=0e8421ff7ecab46a";
		
		this.image = "";
		
		if (image) this.image = image;
		
		this._create(Mapping.SymbolType.Bitmap, id, color, backColor, haloColor, centroid, size); 
	},
	
	getAdditionalJSON: function()
	{
	    return "\"Image\":\"" + this.image + "\"";
	}	
});




