using System; namespace CoordinateSharp { /// /// Turn on/off eager loading of certain properties. /// [Serializable] public class EagerLoad { /// /// Create an EagerLoad object /// public EagerLoad() { this.Celestial = true; this.UTM_MGRS = true; this.Cartesian = true; this.ECEF = true; } /// /// Create an EagerLoad object with all options on or off /// /// Turns EagerLoad on or off public EagerLoad(Boolean isOn) { this.Celestial = isOn; this.UTM_MGRS = isOn; this.Cartesian = isOn; this.ECEF = isOn; } /// /// Create an EagerLoad object with only the specified flag options turned on. /// /// EagerLoadType public EagerLoad(EagerLoadType et) { this.Cartesian = false; this.Celestial = false; this.UTM_MGRS = false; this.ECEF = false; if (et.HasFlag(EagerLoadType.Cartesian)) { this.Cartesian = true; } if (et.HasFlag(EagerLoadType.Celestial)) { this.Celestial = true; } if (et.HasFlag(EagerLoadType.UTM_MGRS)) { this.UTM_MGRS = true; } if (et.HasFlag(EagerLoadType.ECEF)) { this.ECEF = true; } } /// /// Creates an EagerLoad object. Only the specified flags will be set to EagerLoad. /// /// EagerLoadType /// EagerLoad public static EagerLoad Create(EagerLoadType et) { EagerLoad el = new EagerLoad(et); return el; } /// /// Eager load celestial information. /// public Boolean Celestial { get; set; } /// /// Eager load UTM and MGRS information /// public Boolean UTM_MGRS { get; set; } /// /// Eager load Cartesian information /// public Boolean Cartesian { get; set; } /// /// Eager load ECEF information /// public Boolean ECEF { get; set; } } /// /// EagerLoad Enumerator /// [Serializable] [Flags] public enum EagerLoadType { /// /// UTM and MGRS /// UTM_MGRS = 1, /// /// Celestial /// Celestial = 2, /// /// Cartesian /// Cartesian = 4, /// /// ECEF /// ECEF = 8 } }