Ejemplo n.º 1
0
        /// <summary>
        /// Writes the content of this instance to a persistent storage area.
        /// </summary>
        /// <param name="editSerializer">The mechanism for storing content.</param>
        public override void WriteData(EditSerializer editSerializer)
        {
            base.WriteData(editSerializer);

            editSerializer.WriteBool(DataField.Topological, IsTopological);

            IPointGeometry tp = Position;
            IPointGeometry pp = GetPolPosition();

            if (pp != null)
            {
                if (pp.Easting.Microns != tp.Easting.Microns || pp.Northing.Microns != tp.Northing.Microns)
                {
                    editSerializer.WriteInt64(DataField.PolygonX, pp.Easting.Microns);
                    editSerializer.WriteInt64(DataField.PolygonY, pp.Northing.Microns);
                }
            }

            // RowText is problematic on deserialization because the database rows might not
            // be there. To cover that possibility, use a proxy object.
            if (m_Geom is RowTextGeometry)
            {
                editSerializer.WritePersistent <TextGeometry>(DataField.Type, new RowTextContent((RowTextGeometry)m_Geom));
            }
            else
            {
                editSerializer.WritePersistent <TextGeometry>(DataField.Type, m_Geom);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Represents this editing operation as a text string.
        /// </summary>
        /// <returns>A string that can be used to save a persistent version of this edit.</returns>
        internal string GetEditString()
        {
            EditSerializer es = new EditSerializer();

            es.WritePersistent <Operation>(DataField.Edit, this);
            return(es.ToSerializedString());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Serializes an object as a text string.
        /// </summary>
        /// <typeparam name="T">The type of object being written (as it is known to the instance
        /// that contains it)</typeparam>
        /// <param name="field">The tag that identifies the item.</param>
        /// <param name="value">The object to write (may be null)</param>
        /// <returns>The result of serializing the supplied object</returns>
        internal static string GetSerializedString <T>(DataField field, T value) where T : IPersistent
        {
            EditSerializer es = new EditSerializer();

            es.WritePersistent(field.ToString(), value);
            return(es.ToSerializedString());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Writes an observation to a storage medium if the item is present as part of this collection.
        /// </summary>
        /// <typeparam name="T">The type of object being written (as it is known to the edit
        /// that contains it)</typeparam>
        /// <param name="editSerializer">The mechanism for storing content.</param>
        /// <param name="field">The tag that identifies the item.</param>
        /// <returns>True if an observation was written, false if the item with the specific name is not present
        /// in this collection.</returns>
        internal bool WriteObservation <T>(EditSerializer editSerializer, DataField field) where T : Observation
        {
            UpdateItem item;

            if (m_Changes.TryGetValue(field, out item))
            {
                editSerializer.WritePersistent <T>(field, (T)item.Value);
                return(true);
            }

            return(false);
        }