Beispiel #1
0
        /// <summary>
        /// Reads a reference to a spatial feature, using that reference to obtain the
        /// corresponding feature. If the feature cannot be found, the reference will be cached as
        /// a forward reference (on completion of deserialization, you then call <see cref="ApplyForwardRefs"/>
        /// to process the cache).
        /// </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 value</param>
        /// <returns>
        /// The feature that was read (null if not found, or the reference was undefined). May
        /// actually have a type that is derived from the supplied type.
        /// </returns>
        /// <remarks>This does not create a brand new feature. Rather, it uses a reference
        /// to try to obtain a feature that should have already been created.
        /// </remarks>
        internal T ReadFeatureRef <T>(IFeatureRef referenceFrom, DataField field) where T : Feature
        {
            InternalIdValue id = m_Reader.ReadInternalId(field.ToString());

            if (id.IsEmpty)
            {
                return(default(T));
            }

            T result = MapModel.Find <T>(id);

            if (result == null)
            {
                var fwRef = new ForwardFeatureRef(referenceFrom, field, id);
                m_ForwardRefs.Add(fwRef);
            }

            return(result);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ForwardFeatureRef"/> class.
 /// </summary>
 /// <param name="referenceFrom">The object that makes the forward-reference (not null).</param>
 /// <param name="field">The ID of the persistent field.</param>
 /// <param name="parentLineId">The internal ID that has been persisted for the field (relating to a feature
 /// that has not been created yet).</param>
 /// <param name="splitBeforeId">The ID of the line section prior to the split (null if no split)</param>
 /// <param name="splitAfterId">The ID of the line section after the the split (null if no split)</param>
 /// <exception cref="ArgumentNullException">If <paramref name="referenceFrom"/> is not defined.</exception>
 internal ForwardSplit(ForwardFeatureRef lineRef, string splitBeforeId, string splitAfterId)
 {
     m_LineRef       = lineRef;
     m_SplitBeforeId = splitBeforeId;
     m_SplitAfterId  = splitAfterId;
 }
Beispiel #3
0
        internal void AddForwardSplit(ForwardFeatureRef lineRef, string idBefore, string idAfter)
        {
            var fwSplit = new ForwardSplit(lineRef, idBefore, idAfter);

            m_ForwardSplits.Add(fwSplit);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ForwardFeatureRef"/> class.
 /// </summary>
 /// <param name="referenceFrom">The object that makes the forward-reference (not null).</param>
 /// <param name="field">The ID of the persistent field.</param>
 /// <param name="parentLineId">The internal ID that has been persisted for the field (relating to a feature
 /// that has not been created yet).</param>
 /// <param name="splitBeforeId">The ID of the line section prior to the split (null if no split)</param>
 /// <param name="splitAfterId">The ID of the line section after the the split (null if no split)</param>
 /// <exception cref="ArgumentNullException">If <paramref name="referenceFrom"/> is not defined.</exception>
 internal ForwardSplit(ForwardFeatureRef lineRef, string splitBeforeId, string splitAfterId)
 {
     m_LineRef = lineRef;
     m_SplitBeforeId = splitBeforeId;
     m_SplitAfterId = splitAfterId;
 }