/// <summary> /// Initializes a new instance of the <see cref="NewProjectEvent"/> class. /// </summary> /// <param name="ed">The mechanism for reading back content.</param> internal NewProjectEvent(EditDeserializer ed) : base(ed) { this.ProjectId = new Guid(ed.ReadString(DataField.ProjectId)); this.ProjectName = ed.ReadString(DataField.ProjectName); this.LayerId = ed.ReadInt32(DataField.LayerId); this.DefaultSystem = ed.ReadString(DataField.CoordinateSystem); this.UserName = ed.ReadString(DataField.UserName); this.MachineName = ed.ReadString(DataField.MachineName); }
/// <summary> /// Initializes a new instance of the <see cref="MultiSegmentGeometry"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal MultiSegmentGeometry(EditDeserializer editDeserializer) : base(editDeserializer) { // LineString assumes 2D, with X preceding Y. Each coordinate pair is separated // with a comma, with a space between each X and Y (e.g. "123 345,124 349,129 341") string s = editDeserializer.ReadString(DataField.LineString); string[] xys = s.Split(','); m_Data = new IPointGeometry[xys.Length]; for (int i = 0; i < xys.Length; i++) { string xy = xys[i].Trim(); int blankPos = xy.IndexOf(' '); if (blankPos <= 0) { throw new FormatException(); } double x = Double.Parse(xy.Substring(0, blankPos)); double y = Double.Parse(xy.Substring(blankPos + 1)); m_Data[i] = new PointGeometry(x, y); } m_Extent = LineStringGeometry.GetExtent(this); }
/// <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="MiscTextGeometry"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal MiscTextGeometry(EditDeserializer editDeserializer) : base(editDeserializer) { m_Text = editDeserializer.ReadString(DataField.Text); }
/// <summary> /// Initializes a new instance of the <see cref="NewSessionEvent"/> class. /// </summary> /// <param name="ed">The mechanism for reading back content.</param> internal NewSessionEvent(EditDeserializer ed) : base(ed) { this.UserName = ed.ReadString(DataField.UserName); this.MachineName = ed.ReadString(DataField.MachineName); }