|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
namespace Initia.Google.GStaticMap
{
#region Enumerators
/// <summary>
/// Available Google Static Marker colors
/// </summary>
public enum GMarkerColor
{
Red,
Blue,
Green
}
#endregion
/// <summary>
/// Represent a Google Marker
/// {latitude} (required) specifies a latitudinal value with precision to 6 decimal places.
/// {longitude} (required) specifies a longitudinal value with precision to 6 decimal places.
/// {color} (optional) specifies a color from the set {red,blue,green}.
/// {alpha-character} (optional) specifies a single lowercase alphabetic character from the set {a-z}.
/// </summary>
[Serializable]
[ToolboxData("<{0}:GMarker Latitude='' Longitude='' Letter='a' Color='Red' runat=server></{0}:GMarker>")]
public class GMarker : GCoordinate
{
#region Instance members
/// <summary>
/// Marker color
/// </summary>
private GMarkerColor _color;
/// <summary>
/// Marker letter (optionnal)
/// </summary>
private char? _letter;
#endregion
#region Accessors
/// <summary>
/// Marker color
/// </summary>
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("Red")]
[Localizable(false)]
public GMarkerColor Color
{
get { return _color; }
set { _color = value; }
}
/// <summary>
/// Marker letter (optionnal)
/// </summary>
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("a")]
[Localizable(false)]
public char? Letter
{
get { return _letter; }
set { _letter = value; }
}
#endregion
#region Constructors
public GMarker()
{
}
public GMarker(double latitude, double longitude, GMarkerColor color)
: base(latitude, longitude)
{
_color = color;
}
public GMarker(double latitude, double longitude, GMarkerColor color, char letter)
: this(latitude, longitude, color)
{
_letter = letter;
}
#endregion
#region Utilities
/// <summary>
/// Serialize data as a query string part
/// Format : {latitude},{longitude},{color}{alpha-character}
/// </summary>
/// <returns></returns>
internal override string SerializeAsQueryString()
{
return string.Format
(
"{0},{1}{2}",
base.SerializeAsQueryString(),
Enum.GetName(typeof(GMarkerColor), Color).ToLower(),
(Letter == null ? "" : Letter.ToString())
);
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.