Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Feature"/> class, and records it
        /// as part of the map model.
        /// </summary>
        /// <param name="creator">The editing operation that created the feature (never null).</param>
        /// <param name="id">The internal of this feature within the
        /// project that created it. Specify an internal ID value of 0 for a temporary feature that should not be added
        /// to the model.</param>
        /// <param name="entityType">The type of real-world object that the feature corresponds to.</param>
        /// <param name="featureId">The user-perceived ID (if any) for the feature. This is the ID that
        /// is used to associate the feature with any miscellaneous attributes
        /// that may be held in a database.</param>
        protected Feature(Operation creator, InternalIdValue id, IEntity entityType, FeatureId featureId)
        {
            if (creator == null)
            {
                throw new ArgumentNullException("Creating operation must be defined");
            }

            if (entityType == null)
            {
                throw new ArgumentNullException("Entity type must be defined");
            }

            //if (sessionSequence == 0)
            //    throw new ArgumentException("Session sequence must be defined");

            m_Creator    = creator;
            m_InternalId = id;
            m_What       = entityType;
            m_References = null;
            m_Flag       = 0;

            // If a user-defined ID is present, ensure it knows about this feature, and vice versa
            m_Id = featureId;
            if (m_Id != null)
            {
                m_Id.AddReference(this);
            }

            // Remember this feature as part of the model
            if (!m_InternalId.IsEmpty)
            {
                m_Creator.MapModel.AddFeature(this);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Feature"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        protected Feature(EditDeserializer editDeserializer)
        {
            m_Creator = editDeserializer.CurrentEdit;
            Debug.Assert(m_Creator != null);
            ReadData(editDeserializer, out m_InternalId, out m_What, out m_Id);
            m_References = null;
            m_Flag       = 0;

            // If a user-defined ID is present, ensure it knows about this feature, and vice versa
            if (m_Id != null)
            {
                m_Id.AddReference(this);
            }

            // Remember this feature as part of the model
            m_Creator.MapModel.AddFeature(this);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Row"/> class,
        /// forming a two-way association with the ID
        /// </summary>
        /// <param name="id">The ID for the row (not null). Modified to refer to
        /// the newly created <c>Row</c> object.</param>
        /// <param name="table">The definition of the table this row is part of (not null).</param>
        /// <param name="data">Data for the row (not null).</param>
        /// <exception cref="ArgumentNullException">If any parameter is null</exception>
        internal Row(FeatureId id, ITable table, DataRow data)
        {
            if (id == null || table == null || data == null)
            {
                throw new ArgumentNullException();
            }

            m_Id    = id;
            m_Table = table;
            m_Data  = data;

            // Relate the ID to this row
            id.AddReference(this);
        }