/// <summary> /// Generates a <see cref="GeoQueryMsg" /> from the instance. /// </summary> /// <returns>The query message.</returns> internal GeoQueryMsg ToMessage() { var queryMsg = new GeoQueryMsg(); var options = Options; if (options == null) { options = new GeoEntityQueryOptions(); } options.Save(queryMsg); if (EntityFilters != null) { for (int i = 0; i < EntityFilters.Length; i++) { queryMsg[string.Format("EntityFilter[{0}]", i)] = EntityFilters[i]; } } if (GroupFilters != null) { for (int i = 0; i < GroupFilters.Length; i++) { queryMsg[string.Format("GroupFilter[{0}]", i)] = GroupFilters[i]; } } if (Region != null) { queryMsg["Region"] = Region.ToString(); } if (MinTimeUtc.HasValue) { queryMsg._Set("MinTimeUtc", MinTimeUtc.Value); } if (MaxTimeUtc.HasValue) { queryMsg._Set("MaxTimeUtc", MaxTimeUtc.Value); } return(queryMsg); }
/// <summary> /// Derived classes must implement this to save the option fields to the /// query message passed. /// </summary> /// <param name="queryMsg">The target message.</param> /// <remarks> /// The derived class must store its values as <see cref="PropertyMsg" /> fields /// using <b>"Option."</b> as the key prefix for each value's property name. /// </remarks> protected override void SaveTo(GeoQueryMsg queryMsg) { queryMsg._Set("Option.FixCount", this.FixCount); queryMsg._Set("Option.MinFixTimeUtc", this.MinFixTimeUtc); queryMsg._Set("Option.FixFields", (int)this.FixFields); }