/// <summary> /// Reads an array of spatial features (using their unique IDs the read them from the map model). /// </summary> /// <typeparam name="T">The type of spatial feature expected by the caller</typeparam> /// <param name="referenceFrom">The object that is making the reference</param> /// <param name="field">A tag associated with the array</param> /// <returns>The features that were read (should all be not null).</returns> internal T[] ReadFeatureRefArray <T>(IFeatureRefArray referenceFrom, DataField field) where T : Feature { string[] ids = ReadSimpleArray <string>(field); T[] result = new T[ids.Length]; List <ForwardRefArrayItem> fwRefs = null; for (int i = 0; i < result.Length; i++) { InternalIdValue id = new InternalIdValue(ids[i]); result[i] = MapModel.Find <T>(id); if (result[i] == null) { if (fwRefs == null) { fwRefs = new List <ForwardRefArrayItem>(); } fwRefs.Add(new ForwardRefArrayItem(id, i)); } } if (fwRefs != null) { m_ForwardRefs.Add(new ForwardFeatureRefArray(referenceFrom, field, fwRefs.ToArray())); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="ForwardFeatureRefArray"/> class. /// </summary> /// <param name="referenceFrom">The object that makes the forward-reference (not null).</param> /// <param name="field">The ID of the persistent array field.</param> /// <param name="items">The items that need to be resolved.</param> /// <exception cref="ArgumentNullException">If <paramref name="referenceFrom"/> is not defined.</exception> internal ForwardFeatureRefArray(IFeatureRefArray referenceFrom, DataField field, ForwardRefArrayItem[] items) : base(field) { if (referenceFrom == null || items == null) throw new ArgumentNullException(); if (items.Length == 0) throw new ArgumentException(); ReferenceFrom = referenceFrom; Items = items; }
/// <summary> /// Initializes a new instance of the <see cref="ForwardFeatureRefArray"/> class. /// </summary> /// <param name="referenceFrom">The object that makes the forward-reference (not null).</param> /// <param name="field">The ID of the persistent array field.</param> /// <param name="items">The items that need to be resolved.</param> /// <exception cref="ArgumentNullException">If <paramref name="referenceFrom"/> is not defined.</exception> internal ForwardFeatureRefArray(IFeatureRefArray referenceFrom, DataField field, ForwardRefArrayItem[] items) : base(field) { if (referenceFrom == null || items == null) { throw new ArgumentNullException(); } if (items.Length == 0) { throw new ArgumentException(); } ReferenceFrom = referenceFrom; Items = items; }