using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CoordinateSharp { /// /// Turn on/off eager loading of certain properties. /// [Serializable] public class EagerLoad { /// /// Create an EagerLoad object /// public EagerLoad() { Celestial = true; UTM_MGRS = true; Cartesian = true; ECEF = true; } /// /// Create an EagerLoad object with all options on or off /// /// Turns EagerLoad on or off public EagerLoad(bool isOn) { Celestial = isOn; UTM_MGRS = isOn; Cartesian = isOn; ECEF = isOn; } /// /// Create an EagerLoad object with only the specified flag options turned on. /// /// EagerLoadType public EagerLoad(EagerLoadType et) { Cartesian = false; Celestial = false; UTM_MGRS = false; ECEF = false; if (et.HasFlag(EagerLoadType.Cartesian)) { Cartesian = true; } if (et.HasFlag(EagerLoadType.Celestial)) { Celestial = true; } if (et.HasFlag(EagerLoadType.UTM_MGRS)) { UTM_MGRS = true; } if (et.HasFlag(EagerLoadType.ECEF)) { 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 bool Celestial { get; set; } /// /// Eager load UTM and MGRS information /// public bool UTM_MGRS { get; set; } /// /// Eager load Cartesian information /// public bool Cartesian { get; set; } /// /// Eager load ECEF information /// public bool 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 } }