/// <summary> /// Loads the content of an editing event. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The created editing event object</returns> static internal Change Deserialize(EditDeserializer editDeserializer) { Change result = editDeserializer.ReadPersistent <Change>(DataField.Edit); // Note that calculated geometry is NOT defined at this stage. That happens // when the model is asked to index the data. // Associate referenced features with the edit result.AddReferences(); // If we're dealing with an update, exchange update items. Do this NOW (rather than at it's natural // spot in the editing sequence) so as to avoid repeated calculation loops during loading. When an // update is applied during regular editing work, we have to rework the calculation sequence and // rollforward all the subsequent edits. So we'd have to do that for every update. By applying changes // now, we'll end up doing a single calculation loop. UpdateOperation upo = (result as UpdateOperation); if (upo != null) { upo.ApplyChanges(); } return(result); }
/// <summary> /// Loads an observation back from a storage medium (so long as it comes next in the supplied /// deserialization stream). /// </summary> /// <typeparam name="T">The type of object expected by the caller.</typeparam> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="field">The tag that identifies the item.</param> /// <returns>True if an observation was loaded, false if the next item in the deserialization /// stream does not have the specified name.</returns> internal bool ReadObservation <T>(EditDeserializer editDeserializer, DataField field) where T : Observation { if (editDeserializer.IsNextField(field)) { T result = editDeserializer.ReadPersistent <T>(field); Add(new UpdateItem(field, result)); return(true); } return(false); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="isTopological">Are we dealing with a polygon label</param> /// <param name="polPos">The label reference point (usually applies onlt to polygon labels). Null if it's /// identical to the position recorded via the geometry object.</param> /// <param name="geom">The geometry for the text.</param> static void ReadData(EditDeserializer editDeserializer, out bool isTopological, out PointGeometry polPos, out TextGeometry geom) { isTopological = editDeserializer.ReadBool(DataField.Topological); if (editDeserializer.IsNextField(DataField.PolygonX)) { polPos = editDeserializer.ReadPointGeometry(DataField.PolygonX, DataField.PolygonY); } else { polPos = null; } geom = editDeserializer.ReadPersistent <TextGeometry>(DataField.Type); }