Exemplo n.º 1
0
        /// <summary>
        /// Reads a user-perceived feature ID using the specified naming tags.
        /// </summary>
        /// <param name="nativeField">The tag to use for a native ID.</param>
        /// <param name="foreignField">The tag to use for a foreign ID.</param>
        /// <returns>The user-perceived ID that was read (may be null)</returns>
        internal FeatureId ReadFeatureId(DataField nativeField, DataField foreignField)
        {
            if (IsNextField(nativeField))
            {
                uint     nativeKey = m_Reader.ReadUInt32(nativeField.ToString());
                NativeId nid       = MapModel.FindNativeId(nativeKey);

                if (nid == null)
                {
                    return(MapModel.AddNativeId(nativeKey));
                }
                else
                {
                    return(nid);
                }
            }

            if (IsNextField(foreignField))
            {
                string    key = m_Reader.ReadString(foreignField.ToString());
                ForeignId fid = MapModel.FindForeignId(key);

                if (fid == null)
                {
                    return(MapModel.AddForeignId(key));
                }
                else
                {
                    return(fid);
                }
            }

            return(null);
        }