/// <summary> /// Initializes a new instance of the <see cref="Operation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> protected Operation(EditDeserializer editDeserializer) : base(editDeserializer) { editDeserializer.CurrentEdit = this; m_Session = editDeserializer.MapModel.LastSession; Debug.Assert(m_Session != null); }
/// <summary> /// Initializes a new instance of the <see cref="ParallelLineOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ParallelLineOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_RefLine = editDeserializer.ReadFeatureRef <LineFeature>(this, DataField.RefLine); if (editDeserializer.IsNextField(DataField.Term1)) { m_Term1 = editDeserializer.ReadFeatureRef <LineFeature>(this, DataField.Term1); } if (editDeserializer.IsNextField(DataField.Term2)) { m_Term2 = editDeserializer.ReadFeatureRef <LineFeature>(this, DataField.Term2); } if (editDeserializer.IsNextField(DataField.ReverseArc) && editDeserializer.ReadBool(DataField.ReverseArc) == true) { m_Flags = 1; } m_Offset = editDeserializer.ReadPersistent <Observation>(DataField.Offset); DeserializationFactory dff = new DeserializationFactory(this); dff.AddFeatureStub(DataField.From, editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.From)); dff.AddFeatureStub(DataField.To, editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.To)); dff.AddFeatureStub(DataField.NewLine, editDeserializer.ReadPersistent <FeatureStub>(DataField.NewLine)); ProcessFeatures(dff); }
/// <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="ParallelDirection"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ParallelDirection(EditDeserializer editDeserializer) : base(editDeserializer) { m_From = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.From); m_Par1 = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.Start); m_Par2 = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.End); }
/// <summary> /// Initializes a new instance of the <see cref="AngleDirection"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal AngleDirection(EditDeserializer editDeserializer) : base(editDeserializer) { m_Backsight = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.Backsight); m_From = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.From); m_Observation = editDeserializer.ReadRadians(DataField.Value); }
/// <summary> /// Initializes a new instance of the <see cref="ArcGeometry"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ArcGeometry(EditDeserializer editDeserializer) : base(editDeserializer) { m_IsClockwise = editDeserializer.ReadBool(DataField.Clockwise); if (editDeserializer.IsNextField(DataField.Center)) { PointFeature center = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.Center); // The arc is the first arc attached to the circle. However, we cannot // calculate the radius just yet because the bc/ec points are not persisted // as part of the ArcGeometry definition (they are defined as part of the // LineFeature object that utilizes the ArcGeometry). // Even if we did have the bc/ec points at this stage, their positions will // only be available if the data came from an import (they will still be // undefined if the geometry is calculated, since calculation only occurs // after deserialization has been completed). if (center != null) ApplyFeatureRef(DataField.Center, center); } else { ArcFeature firstArc = editDeserializer.ReadFeatureRef<ArcFeature>(this, DataField.FirstArc); if (firstArc != null) ApplyFeatureRef(DataField.FirstArc, firstArc); } }
/// <summary> /// Initializes a new instance of the <see cref="IntersectOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> protected IntersectOperation(EditDeserializer editDeserializer) : base(editDeserializer) { // If the data was produced via export from an old CEdit file, we'll have the absolute position if (editDeserializer.IsNextField(DataField.X)) CheckPosition = editDeserializer.ReadPointGeometry(DataField.X, DataField.Y); }
/// <summary> /// Initializes a new instance of the <see cref="NewLineOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> protected NewLineOperation(EditDeserializer editDeserializer) : base(editDeserializer) { // Bit of a hack - does NewCircleOperation actually need to extend NewLineOperation? if (!(this is NewCircleOperation) && !(this is NewArcOperation)) m_NewLine = editDeserializer.ReadPersistent<LineFeature>(DataField.Line); }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); throw new NotImplementedException(); return(result); }
/// <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="Distance"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal Distance(EditDeserializer editDeserializer) { double distance = editDeserializer.ReadDouble(DataField.Value); DistanceUnitType unitType = (DistanceUnitType)editDeserializer.ReadByte(DataField.Unit); m_EnteredUnit = EditingController.GetUnits(unitType); m_ObservedMetric = m_EnteredUnit.ToMetric(distance); if (editDeserializer.IsNextField(DataField.Fixed)) { m_IsFixed = editDeserializer.ReadBool(DataField.Fixed); } else { m_IsFixed = false; } if (editDeserializer.IsNextField(DataField.Flipped)) { IsAnnotationFlipped = editDeserializer.ReadBool(DataField.Flipped); } else { IsAnnotationFlipped = false; } }
/// <summary> /// Initializes a new instance of the <see cref="TextRotationOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal TextRotationOperation(EditDeserializer editDeserializer) : base(editDeserializer) { RadianValue value = editDeserializer.ReadRadians(DataField.Value); m_Rotation = value.Radians; }
/// <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="IdAllocation"/> class. /// </summary> /// <param name="ed">The mechanism for reading back content.</param> internal IdAllocation(EditDeserializer ed) : base(ed) { this.GroupId = ed.ReadInt32(DataField.GroupId); this.LowestId = ed.ReadInt32(DataField.LowestId); this.HighestId = ed.ReadInt32(DataField.HighestId); }
/// <summary> /// Initializes a new instance of the <see cref="ParallelDirection"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ParallelDirection(EditDeserializer editDeserializer) : base(editDeserializer) { m_From = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.From); m_Par1 = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.Start); m_Par2 = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.End); }
/// <summary> /// Initializes a new instance of the <see cref="NewCircleOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal NewCircleOperation(EditDeserializer editDeserializer) : base(editDeserializer) { FeatureStub closingPoint, arc; ReadData(editDeserializer, out m_Center, out m_Radius, out closingPoint, out arc); DeserializationFactory dff = new DeserializationFactory(this); dff.AddFeatureStub(DataField.ClosingPoint, closingPoint); dff.AddFeatureStub(DataField.Arc, arc); ProcessFeatures(dff); /* * try * { * ProcessFeatures(dff); * } * * catch * { * ProcessFeatures(dff); * } */ }
/// <summary> /// Initializes a new instance of the <see cref="AngleDirection"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal AngleDirection(EditDeserializer editDeserializer) : base(editDeserializer) { m_Backsight = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.Backsight); m_From = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.From); m_Observation = editDeserializer.ReadRadians(DataField.Value); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="line">The line the point should appear on </param> /// <param name="positionRatio">The position ratio of the attached point.</param> /// <param name="point">The point that was created.</param> static void ReadData(EditDeserializer editDeserializer, out LineFeature line, out uint positionRatio, out PointFeature point) { line = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line); positionRatio = editDeserializer.ReadUInt32(DataField.PositionRatio); FeatureStub stub = editDeserializer.ReadPersistent <FeatureStub>(DataField.Point); point = new PointFeature(stub, null); }
/// <summary> /// Initializes a new instance of the <see cref="LineGeometry"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> protected LineGeometry(EditDeserializer editDeserializer) { // When deserializing line geometry (in the context of line features), passing // the terminal down via the EditDeserializer is a bit too contrived. Instead, // we'll set the terminals back in LineFeature.ReadData. m_Start = m_End = null; }
/// <summary> /// Initializes a new instance of the <see cref="TrimLineOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal TrimLineOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Lines = editDeserializer.ReadFeatureRefArray<LineFeature>(this, DataField.Lines); m_Points = editDeserializer.ReadFeatureRefArray<PointFeature>(this, DataField.Points); ProcessFeatures(null); }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); result.ReadItem <double>(editDeserializer, DataField.X); result.ReadItem <double>(editDeserializer, DataField.Y); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="LineSubdivisionFace"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal LineSubdivisionFace(EditDeserializer editDeserializer) { m_IsEntryFromEnd = editDeserializer.ReadBool(DataField.EntryFromEnd); m_Distances = editDeserializer.ReadPersistentArray<Distance>(DataField.Sections); // The sections are calculated ?? m_Sections = null; }
/// <summary> /// Initializes a new instance of the <see cref="LineSubdivisionFace"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal LineSubdivisionFace(EditDeserializer editDeserializer) { m_IsEntryFromEnd = editDeserializer.ReadBool(DataField.EntryFromEnd); m_Distances = editDeserializer.ReadPersistentArray <Distance>(DataField.Sections); // The sections are calculated ?? m_Sections = null; }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); result.ReadObservation <Direction>(editDeserializer, DataField.Direction1); result.ReadObservation <Direction>(editDeserializer, DataField.Direction2); return(result); }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); result.ReadItem <bool>(editDeserializer, DataField.ExtendFromEnd); result.ReadObservation <Distance>(editDeserializer, DataField.Distance); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="SectionGeometry"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal SectionGeometry(EditDeserializer editDeserializer) : base(editDeserializer) { m_Base = editDeserializer.ReadFeatureRef<LineFeature>(DataField.Base); if (m_Base == null) throw new ArgumentNullException(); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="center">Point at the center of the circle.</param> /// <param name="radius">The radius of the circle.</param> /// <param name="arc">The arc running around the circumference of the circle</param> /// <param name="closingPoint">The closing point of the circle (if it was created by this edit). Null /// if the radius was specified using an offset point.</param> static void ReadData(EditDeserializer editDeserializer, out PointFeature center, out Observation radius, out FeatureStub closingPoint, out FeatureStub arc) { center = editDeserializer.ReadFeatureRef <PointFeature>(DataField.Center); radius = editDeserializer.ReadPersistent <Observation>(DataField.Radius); closingPoint = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.ClosingPoint); arc = editDeserializer.ReadPersistent <FeatureStub>(DataField.Arc); }
/// <summary> /// Initializes a new instance of the <see cref="TrimLineOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal TrimLineOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Lines = editDeserializer.ReadFeatureRefArray <LineFeature>(this, DataField.Lines); m_Points = editDeserializer.ReadFeatureRefArray <PointFeature>(this, DataField.Points); ProcessFeatures(null); }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); result.ReadObservation <Direction>(editDeserializer, DataField.Direction); result.ReadFeature <LineFeature>(editDeserializer, DataField.Line); result.ReadFeature <PointFeature>(editDeserializer, DataField.CloseTo); return(result); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="dir1">The first observed direction.</param> /// <param name="dir2">The second observed direction</param> /// <param name="to">The created intersection point.</param> /// <param name="line1">The first line created (if any).</param> /// <param name="line1">The second line created (if any).</param> static void ReadData(EditDeserializer editDeserializer, out Direction dir1, out Direction dir2, out FeatureStub to, out FeatureStub line1, out FeatureStub line2) { dir1 = editDeserializer.ReadPersistent <Direction>(DataField.Direction1); dir2 = editDeserializer.ReadPersistent <Direction>(DataField.Direction2); to = editDeserializer.ReadPersistent <FeatureStub>(DataField.To); line1 = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.Line1); line2 = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.Line2); }
/// <summary> /// Initializes a new instance of the <see cref="NewArcOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal NewArcOperation(EditDeserializer editDeserializer) : base(editDeserializer) { // I originally let the base class do it, but it needs to be an instance // of ArcFeature. This is a bit rough - does NewArcOperation really need // to extend NewLineOperation? ArcFeature arc = editDeserializer.ReadPersistent<ArcFeature>(DataField.Line); SetNewLine(arc); }
/// <summary> /// Initializes a new instance of the <see cref="IntersectOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> protected IntersectOperation(EditDeserializer editDeserializer) : base(editDeserializer) { // If the data was produced via export from an old CEdit file, we'll have the absolute position if (editDeserializer.IsNextField(DataField.X)) { CheckPosition = editDeserializer.ReadPointGeometry(DataField.X, DataField.Y); } }
/// <summary> /// Initializes a new instance of the <see cref="NewLineOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> protected NewLineOperation(EditDeserializer editDeserializer) : base(editDeserializer) { // Bit of a hack - does NewCircleOperation actually need to extend NewLineOperation? if (!(this is NewCircleOperation) && !(this is NewArcOperation)) { m_NewLine = editDeserializer.ReadPersistent <LineFeature>(DataField.Line); } }
/// <summary> /// Initializes a new instance of the <see cref="ImportOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ImportOperation(EditDeserializer editDeserializer) : base(editDeserializer) { if (editDeserializer.IsNextField(DataField.Source)) m_Source = editDeserializer.ReadString(DataField.Source); else m_Source = String.Empty; m_Data = editDeserializer.ReadPersistentArray<Feature>(DataField.Features); }
/// <summary> /// Initializes a new instance of the <see cref="NewArcOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal NewArcOperation(EditDeserializer editDeserializer) : base(editDeserializer) { // I originally let the base class do it, but it needs to be an instance // of ArcFeature. This is a bit rough - does NewArcOperation really need // to extend NewLineOperation? ArcFeature arc = editDeserializer.ReadPersistent <ArcFeature>(DataField.Line); SetNewLine(arc); }
/// <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="TextFeature"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal TextFeature(EditDeserializer editDeserializer) : base(editDeserializer) { bool isTopological; ReadData(editDeserializer, out isTopological, out m_PolygonPosition, out m_Geom); SetTopology(isTopological); if (m_Geom is KeyTextGeometry) (m_Geom as KeyTextGeometry).Label = this; }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); result.ReadObservation <Direction>(editDeserializer, DataField.Direction); result.ReadObservation <Observation>(editDeserializer, DataField.Distance); result.ReadFeature <PointFeature>(editDeserializer, DataField.From); result.ReadItem <bool>(editDeserializer, DataField.Default); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="PolygonSubdivisionOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal PolygonSubdivisionOperation(EditDeserializer editDeserializer) : base(editDeserializer) { if (editDeserializer.IsNextField(DataField.DeactivatedLabel)) { m_Label = editDeserializer.ReadFeatureRef<TextFeature>(DataField.DeactivatedLabel); m_Label.IsInactive = true; // later ? } m_Lines = editDeserializer.ReadPersistentArray<LineFeature>(DataField.Lines); }
/// <summary> /// Initializes a new instance of the <see cref="Change"/> class /// using the data read from persistent storage. /// </summary> /// <param name="ed">The mechanism for reading back content.</param> protected Change(EditDeserializer ed) { m_Sequence = ed.ReadUInt32(DataField.Id); m_When = ed.ReadDateTime(DataField.When); // Handle old files //if (ed.IsNextField(DataField.When)) // m_When = ed.ReadDateTime(DataField.When); //else // m_When = DateTime.Now; // could perhaps grab the session start time }
/// <summary> /// Initializes a new instance of the <see cref="PolygonSubdivisionOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal PolygonSubdivisionOperation(EditDeserializer editDeserializer) : base(editDeserializer) { if (editDeserializer.IsNextField(DataField.DeactivatedLabel)) { m_Label = editDeserializer.ReadFeatureRef <TextFeature>(DataField.DeactivatedLabel); m_Label.IsInactive = true; // later ? } m_Lines = editDeserializer.ReadPersistentArray <LineFeature>(DataField.Lines); }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); result.ReadFeature <LineFeature>(editDeserializer, DataField.RefLine); result.ReadObservation <Observation>(editDeserializer, DataField.Offset); result.ReadFeature <LineFeature>(editDeserializer, DataField.Term1); result.ReadFeature <LineFeature>(editDeserializer, DataField.Term2); result.ReadItem <bool>(editDeserializer, DataField.ReverseArc); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="RadialOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal RadialOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Direction = editDeserializer.ReadPersistent<Direction>(DataField.Direction); m_Length = editDeserializer.ReadPersistent<Observation>(DataField.Length); DeserializationFactory dff = new DeserializationFactory(this); dff.AddFeatureStub(DataField.To, editDeserializer.ReadPersistent<FeatureStub>(DataField.To)); dff.AddFeatureStub(DataField.Line, editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.Line)); ProcessFeatures(dff); }
/// <summary> /// Initializes a new instance of the <see cref="MoveTextOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal MoveTextOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Text = editDeserializer.ReadFeatureRef<TextFeature>(DataField.Text); m_OldPosition = editDeserializer.ReadPointGeometry(DataField.OldX, DataField.OldY); m_NewPosition = editDeserializer.ReadPointGeometry(DataField.NewX, DataField.NewY); if (editDeserializer.IsNextField(DataField.OldPolygonX)) m_OldPolPosition = editDeserializer.ReadPointGeometry(DataField.OldPolygonX, DataField.OldPolygonY); else m_OldPolPosition = null; }
/// <summary> /// Initializes a new instance of the <see cref="RadialOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal RadialOperation(EditDeserializer editDeserializer) : base(editDeserializer) { m_Direction = editDeserializer.ReadPersistent <Direction>(DataField.Direction); m_Length = editDeserializer.ReadPersistent <Observation>(DataField.Length); DeserializationFactory dff = new DeserializationFactory(this); dff.AddFeatureStub(DataField.To, editDeserializer.ReadPersistent <FeatureStub>(DataField.To)); dff.AddFeatureStub(DataField.Line, editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.Line)); ProcessFeatures(dff); }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); if (editDeserializer.IsNextField(DataField.Face)) { Distance[] face = editDeserializer.ReadPersistentArray <Distance>(DataField.Face); result.Add(new UpdateItem(DataField.Face, face)); } return(result); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="line1">The 1st line to intersect.</param> /// <param name="line2">The 2nd line to intersect.</param> /// <param name="closeTo">The point closest to the intersection.</param> /// <param name="to">The created intersection point (if any). May have existed previously.</param> /// <param name="idLine1a">The ID of the portion of the first line prior to the intersection (null if no split).</param> /// <param name="idLine1b">The ID of the portion of the first line after the intersection (null if no split).</param> /// <param name="idLine2a">The ID of the portion of the second line prior to the intersection (null if no split).</param> /// <param name="idLine2b">The ID of the portion of the second line after the intersection (null if no split).</param> static void ReadData(EditDeserializer editDeserializer, out LineFeature line1, out LineFeature line2, out PointFeature closeTo, out FeatureStub to, out string idLine1a, out string idLine1b, out string idLine2a, out string idLine2b) { line1 = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line1); line2 = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line2); closeTo = editDeserializer.ReadFeatureRef <PointFeature>(DataField.CloseTo); to = editDeserializer.ReadPersistent <FeatureStub>(DataField.To); idLine1a = (editDeserializer.IsNextField(DataField.SplitBefore1) ? editDeserializer.ReadString(DataField.SplitBefore1) : null); idLine1b = (editDeserializer.IsNextField(DataField.SplitAfter1) ? editDeserializer.ReadString(DataField.SplitAfter1) : null); idLine2a = (editDeserializer.IsNextField(DataField.SplitBefore2) ? editDeserializer.ReadString(DataField.SplitBefore2) : null); idLine2b = (editDeserializer.IsNextField(DataField.SplitAfter2) ? editDeserializer.ReadString(DataField.SplitAfter2) : null); }
/// <summary> /// Initializes a new instance of the <see cref="IntersectTwoDirectionsOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal IntersectTwoDirectionsOperation(EditDeserializer editDeserializer) : base(editDeserializer) { FeatureStub to, line1, line2; ReadData(editDeserializer, out m_Direction1, out m_Direction2, out to, out line1, out line2); DeserializationFactory dff = new DeserializationFactory(this); dff.AddFeatureStub(DataField.To, to); dff.AddFeatureStub(DataField.Line1, line1); dff.AddFeatureStub(DataField.Line2, line2); ProcessFeatures(dff); }
/// <summary> /// Initializes a new instance of the <see cref="PathOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal PathOperation(EditDeserializer editDeserializer) : base(editDeserializer) { //try //{ m_From = editDeserializer.ReadFeatureRef <PointFeature>(DataField.From); m_To = editDeserializer.ReadFeatureRef <PointFeature>(DataField.To); m_EntryString = editDeserializer.ReadString(DataField.EntryString); m_DefaultEntryUnit = editDeserializer.ReadDistanceUnit(DataField.DefaultEntryUnit); Leg[] legs = PathParser.CreateLegs(m_EntryString, m_DefaultEntryUnit); PrepareLegs(this.EditSequence, legs); m_Legs = new List <Leg>(legs); Project p = editDeserializer.Project; IEntity pointType = editDeserializer.ReadEntity(DataField.PointType); IEntity lineType = editDeserializer.ReadEntity(DataField.LineType); // Pick up any alternate faces (these may be defined ONLY when dealing with // data files that were derived from old CEdit files). The deserializaing // constructor will connect the alternate faces to the legs we've just // created. if (editDeserializer.IsNextField(DataField.AlternateFaces)) { editDeserializer.ReadPersistentArray <LegFace>(DataField.AlternateFaces); } // Create stubs for everything that we could conceivably create (including // any alternate faces). FeatureStub[] stubs = CreateStubs(p, pointType, lineType); var result = new DeserializationFactory(this, stubs); result.PointType = pointType; result.LineType = lineType; // Create feature objects ProcessFeatures(result); // Apply any IDs if (editDeserializer.IsNextField(DataField.Ids)) { editDeserializer.ReadIdMappings(DataField.Ids); } //} //catch (Exception ex) //{ // throw ex; //} }
/// <summary> /// Initializes a new instance of the <see cref="ImportOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ImportOperation(EditDeserializer editDeserializer) : base(editDeserializer) { if (editDeserializer.IsNextField(DataField.Source)) { m_Source = editDeserializer.ReadString(DataField.Source); } else { m_Source = String.Empty; } m_Data = editDeserializer.ReadPersistentArray <Feature>(DataField.Features); }
/// <summary> /// Initializes a new instance of the <see cref="UpdateOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal UpdateOperation(EditDeserializer editDeserializer) : base(editDeserializer) { if (editDeserializer.IsNextField(DataField.RevisedEdits)) { m_Revisions = editDeserializer.ReadPersistentArray<RevisedEdit>(DataField.RevisedEdits); } else { RevisedEdit rev = new RevisedEdit(editDeserializer); m_Revisions = new RevisedEdit[] { rev }; } m_IsApplied = false; }
/// <summary> /// Initializes a new instance of the <see cref="DeletionOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal DeletionOperation(EditDeserializer editDeserializer) : base(editDeserializer) { try { Feature[] dels = editDeserializer.ReadFeatureRefArray<Feature>(this, DataField.Delete); m_Deletions = new List<Feature>(dels); // Deactivate features (means they will never make it into the spatial index, and // any lines will be invisible as far as intersection tests are concerned). DeserializationFactory dff = new DeserializationFactory(this); ProcessFeatures(dff); } catch (Exception ex) { throw new ApplicationException("Error loading edit " + this.EditSequence, ex); } }
/// <summary> /// Initializes a new instance of the <see cref="NewCircleOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal NewCircleOperation(EditDeserializer editDeserializer) : base(editDeserializer) { FeatureStub closingPoint, arc; ReadData(editDeserializer, out m_Center, out m_Radius, out closingPoint, out arc); DeserializationFactory dff = new DeserializationFactory(this); dff.AddFeatureStub(DataField.ClosingPoint, closingPoint); dff.AddFeatureStub(DataField.Arc, arc); ProcessFeatures(dff); /* try { ProcessFeatures(dff); } catch { ProcessFeatures(dff); } */ }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="center">Point at the center of the circle.</param> /// <param name="radius">The radius of the circle.</param> /// <param name="arc">The arc running around the circumference of the circle</param> /// <param name="closingPoint">The closing point of the circle (if it was created by this edit). Null /// if the radius was specified using an offset point.</param> static void ReadData(EditDeserializer editDeserializer, out PointFeature center, out Observation radius, out FeatureStub closingPoint, out FeatureStub arc) { center = editDeserializer.ReadFeatureRef<PointFeature>(DataField.Center); radius = editDeserializer.ReadPersistent<Observation>(DataField.Radius); closingPoint = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.ClosingPoint); arc = editDeserializer.ReadPersistent<FeatureStub>(DataField.Arc); }
/// <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="PathOperation"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal PathOperation(EditDeserializer editDeserializer) : base(editDeserializer) { //try //{ m_From = editDeserializer.ReadFeatureRef<PointFeature>(DataField.From); m_To = editDeserializer.ReadFeatureRef<PointFeature>(DataField.To); m_EntryString = editDeserializer.ReadString(DataField.EntryString); m_DefaultEntryUnit = editDeserializer.ReadDistanceUnit(DataField.DefaultEntryUnit); Leg[] legs = PathParser.CreateLegs(m_EntryString, m_DefaultEntryUnit); PrepareLegs(this.EditSequence, legs); m_Legs = new List<Leg>(legs); Project p = editDeserializer.Project; IEntity pointType = editDeserializer.ReadEntity(DataField.PointType); IEntity lineType = editDeserializer.ReadEntity(DataField.LineType); // Pick up any alternate faces (these may be defined ONLY when dealing with // data files that were derived from old CEdit files). The deserializaing // constructor will connect the alternate faces to the legs we've just // created. if (editDeserializer.IsNextField(DataField.AlternateFaces)) editDeserializer.ReadPersistentArray<LegFace>(DataField.AlternateFaces); // Create stubs for everything that we could conceivably create (including // any alternate faces). FeatureStub[] stubs = CreateStubs(p, pointType, lineType); var result = new DeserializationFactory(this, stubs); result.PointType = pointType; result.LineType = lineType; // Create feature objects ProcessFeatures(result); // Apply any IDs if (editDeserializer.IsNextField(DataField.Ids)) editDeserializer.ReadIdMappings(DataField.Ids); //} //catch (Exception ex) //{ // throw ex; //} }
/// <summary> /// Reads back updates made to an editing operation. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <returns>The changes made to the edit</returns> public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer) { UpdateItemCollection result = new UpdateItemCollection(); throw new NotImplementedException(); return result; }