/// <summary> /// Initializes a new instance of the <see cref="LineSubdivisionOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal LineSubdivisionOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Line = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line); m_Face = editDeserializer.ReadPersistent <LineSubdivisionFace>(DataField.Face); //FeatureStub[] sections = editDeserializer.ReadFeatureStubArray(DataField.Result); if (editDeserializer.IsNextField(DataField.OtherSide)) { InternalIdValue id = editDeserializer.ReadInternalId(DataField.OtherSide); OtherSide = (LineSubdivisionOperation)editDeserializer.MapModel.FindOperation(id); Debug.Assert(OtherSide != null); OtherSide.OtherSide = this; } Project p = editDeserializer.Project; IEntity pointType = editDeserializer.ReadEntity(DataField.PointType); FeatureStub[] sections = CreateStubs(p, pointType, m_Line.EntityType); DeserializationFactory result = new DeserializationFactory(this, sections); ProcessFeatures(result); // Apply any IDs if (editDeserializer.IsNextField(DataField.Ids)) { editDeserializer.ReadIdMappings(DataField.Ids); } }
/// <summary> /// Initializes a new instance of the <see cref="LineSubdivisionOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal LineSubdivisionOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Line = editDeserializer.ReadFeatureRef<LineFeature>(DataField.Line); m_Face = editDeserializer.ReadPersistent<LineSubdivisionFace>(DataField.Face); //FeatureStub[] sections = editDeserializer.ReadFeatureStubArray(DataField.Result); if (editDeserializer.IsNextField(DataField.OtherSide)) { InternalIdValue id = editDeserializer.ReadInternalId(DataField.OtherSide); OtherSide = (LineSubdivisionOperation)editDeserializer.MapModel.FindOperation(id); Debug.Assert(OtherSide != null); OtherSide.OtherSide = this; } Project p = editDeserializer.Project; IEntity pointType = editDeserializer.ReadEntity(DataField.PointType); FeatureStub[] sections = CreateStubs(p, pointType, m_Line.EntityType); DeserializationFactory result = new DeserializationFactory(this, sections); ProcessFeatures(result); // Apply any IDs if (editDeserializer.IsNextField(DataField.Ids)) editDeserializer.ReadIdMappings(DataField.Ids); }
/// <summary> /// Initializes a new instance of the <see cref="RevisedEdit"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal RevisedEdit(EditDeserializer editDeserializer) { InternalIdValue id = editDeserializer.ReadInternalId(DataField.RevisedEdit); m_Edit = editDeserializer.MapModel.FindOperation(id); m_Changes = (m_Edit as IRevisable).ReadUpdateItems(editDeserializer); }
/// <summary> /// Initializes a new instance of the <see cref="LegFace"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal LegFace(EditDeserializer editDeserializer) { // Only connection paths should generate LegFace instances PathOperation op = (editDeserializer.CurrentEdit as PathOperation); if (op == null) throw new ApplicationException("Unexpected creating edit for a leg face"); this.Sequence = editDeserializer.ReadInternalId(DataField.Id); if (editDeserializer.IsNextField(DataField.PrimaryFaceId)) { InternalIdValue primaryFaceId = editDeserializer.ReadInternalId(DataField.PrimaryFaceId); LegFace face = op.FindFace(primaryFaceId); if (face == null) throw new ApplicationException("Cannot locate primary face " + primaryFaceId); Leg = face.Leg; Leg.AlternateFace = this; } else { // This should never happen. Primary faces are not serialized using the LegFace // class (we only use LegFace as part of a PathOperation to simplify import of // extra legs from old CEdit files). throw new ApplicationException(); } // Convert the data entry string into observed spans string entryString = editDeserializer.ReadString(DataField.EntryString); DistanceUnit defaultEntryUnit = EditingController.Current.EntryUnit; Distance[] dists = LineSubdivisionFace.GetDistances(entryString, defaultEntryUnit, false); m_Spans = new SpanInfo[dists.Length]; for (int i=0; i<m_Spans.Length; i++) { m_Spans[i] = new SpanInfo() { ObservedDistance = dists[i] }; } }
/// <summary> /// Initializes a new instance of the <see cref="IdMapping"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal IdMapping(EditDeserializer editDeserializer) { m_InternalId = editDeserializer.ReadInternalId(DataField.Id); m_RawId = editDeserializer.ReadUInt32(DataField.Key); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="id">The internal of the feature within the project that created it.</param> /// <param name="entity">The type of real-world object that the feature corresponds to.</param> /// <param name="fid">The ID of the feature (may be null).</param> static void ReadData(EditDeserializer editDeserializer, out InternalIdValue id, out IEntity entity, out FeatureId fid) { id = editDeserializer.ReadInternalId(DataField.Id); entity = editDeserializer.ReadEntity(DataField.Entity); fid = editDeserializer.ReadFeatureId(); }