/// <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);
        }
Exemple #2
0
 /// <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);
 }
Exemple #3
0
 /// <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);
 }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LineExtensionOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal LineExtensionOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_ExtendLine      = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line);
            m_IsExtendFromEnd = editDeserializer.ReadBool(DataField.ExtendFromEnd);
            m_Length          = editDeserializer.ReadPersistent <Distance>(DataField.Distance);
            FeatureStub newPoint = editDeserializer.ReadPersistent <FeatureStub>(DataField.NewPoint);
            FeatureStub newLine  = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.NewLine);

            DeserializationFactory dff = new DeserializationFactory(this);

            dff.AddFeatureStub(DataField.NewPoint, newPoint);
            dff.AddFeatureStub(DataField.NewLine, newLine);
            ProcessFeatures(dff);
        }
        /// <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="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="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);
            }
        }
Exemple #9
0
        /// <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="SimpleLineSubdivisionOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal SimpleLineSubdivisionOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Line      = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line);
            m_Distance  = editDeserializer.ReadPersistent <Distance>(DataField.Distance);
            m_IsFromEnd = editDeserializer.ReadBool(DataField.EntryFromEnd);
            FeatureStub newPoint = editDeserializer.ReadPersistent <FeatureStub>(DataField.NewPoint);
            string      dataId1  = editDeserializer.ReadString(DataField.NewLine1);
            string      dataId2  = editDeserializer.ReadString(DataField.NewLine2);

            DeserializationFactory dff = new DeserializationFactory(this);

            dff.AddFeatureStub(DataField.NewPoint, newPoint);
            dff.AddLineSplit(m_Line, DataField.NewLine1, dataId1);
            dff.AddLineSplit(m_Line, DataField.NewLine2, dataId2);
            ProcessFeatures(dff);
        }
 /// <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="IntersectDirectionAndDistanceOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal IntersectDirectionAndDistanceOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Direction = editDeserializer.ReadPersistent <Direction>(DataField.Direction);
            m_Distance  = editDeserializer.ReadPersistent <Observation>(DataField.Distance);
            m_From      = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.From);
            m_Default   = editDeserializer.ReadBool(DataField.Default);
            FeatureStub to       = editDeserializer.ReadPersistent <FeatureStub>(DataField.To);
            FeatureStub dirLine  = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.DirLine);
            FeatureStub distLine = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.DistLine);

            DeserializationFactory dff = new DeserializationFactory(this);

            dff.AddFeatureStub(DataField.To, to);
            dff.AddFeatureStub(DataField.DirLine, dirLine);
            dff.AddFeatureStub(DataField.DistLine, distLine);
            ProcessFeatures(dff);
        }
 /// <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);
 }
Exemple #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IntersectTwoDistancesOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal IntersectTwoDistancesOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Distance1 = editDeserializer.ReadPersistent <Observation>(DataField.Distance1);
            m_From1     = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.From1);
            m_Distance2 = editDeserializer.ReadPersistent <Observation>(DataField.Distance2);
            m_From2     = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.From2);
            m_Default   = editDeserializer.ReadBool(DataField.Default);
            FeatureStub to    = editDeserializer.ReadPersistent <FeatureStub>(DataField.To);
            FeatureStub line1 = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.Line1);
            FeatureStub line2 = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.Line2);

            DeserializationFactory dff = new DeserializationFactory(this);

            dff.AddFeatureStub(DataField.To, to);
            dff.AddFeatureStub(DataField.Line1, line1);
            dff.AddFeatureStub(DataField.Line2, line2);
            ProcessFeatures(dff);
        }
Exemple #15
0
        /// <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);
        }
Exemple #16
0
 /// <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="IntersectDirectionAndLineOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal IntersectDirectionAndLineOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Direction = editDeserializer.ReadPersistent <Direction>(DataField.Direction);
            ForwardFeatureRef fwRef;

            m_Line    = editDeserializer.ReadFeatureRef <LineFeature>(this, DataField.Line, out fwRef);
            m_CloseTo = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.CloseTo);
            FeatureStub to      = editDeserializer.ReadPersistent <FeatureStub>(DataField.To);
            FeatureStub dirLine = editDeserializer.ReadPersistentOrNull <FeatureStub>(DataField.DirLine);
            string      idLineA = (editDeserializer.IsNextField(DataField.SplitBefore) ? editDeserializer.ReadString(DataField.SplitBefore) : null);
            string      idLineB = (editDeserializer.IsNextField(DataField.SplitAfter) ? editDeserializer.ReadString(DataField.SplitAfter) : null);

            m_IsSplit = (idLineA != null && idLineB != null);

            // TODO (perhaps): If the line is a forward-reference (from CEdit export), we'd have to handle
            // AddLineSplit a bit differently, and do some more in ApplyFeatureRef.
            if (m_Line == null && m_IsSplit)
            {
                if (fwRef == null)
                {
                    int junk = 0;
                }
                Debug.Assert(fwRef != null);
                editDeserializer.AddForwardSplit(fwRef, idLineA, idLineB);
            }

            DeserializationFactory dff = new DeserializationFactory(this);

            dff.AddFeatureStub(DataField.To, to);
            dff.AddFeatureStub(DataField.DirLine, dirLine);

            if (m_Line != null)
            {
                dff.AddLineSplit(m_Line, DataField.SplitBefore, idLineA);
                dff.AddLineSplit(m_Line, DataField.SplitAfter, idLineB);
            }
            ProcessFeatures(dff);
        }
Exemple #18
0
        /// <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>
        internal static 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>
        /// Reads data that was previously written using <see cref="WriteData"/>
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        /// <param name="from">The point at the start of the line</param>
        /// <param name="to">The point at the end of the line</param>
        /// <param name="isTopological">Does the line act as a polygon boundary </param>
        /// <param name="geom">The geometry for the line.</param>
        static void ReadData(EditDeserializer editDeserializer, out PointFeature from, out PointFeature to, out bool isTopological,
            out LineGeometry geom)
        {
            from = editDeserializer.ReadFeatureRef<PointFeature>(DataField.From);
            to = editDeserializer.ReadFeatureRef<PointFeature>(DataField.To);
            isTopological = editDeserializer.ReadBool(DataField.Topological);

            if (editDeserializer.IsNextField(DataField.Type))
            {
                geom = editDeserializer.ReadPersistent<LineGeometry>(DataField.Type);

                // Ensure terminals have been defined (since there was no easy way to pass them
                // through to the LineGeometry constructor).
                geom.StartTerminal = from;
                geom.EndTerminal = to;

                // If we're dealing with a circular arc, and the bc/ec points have defined
                // positions (e.g. coming from an import), we can calculate the radius now.
                // Otherwise we'll need to wait until geometry has been calculated.

                // The radius is defined here only because it's consistent with older code.
                // It may well be better to leave the definition of circle radius till later
                // (i.e. do all circles after geometry has been calculated).

                ArcGeometry arc = (geom as ArcGeometry);
                if (arc != null)
                {
                    Circle c = (Circle)arc.Circle;
                    PointFeature center = c.CenterPoint;

                    if (center.PointGeometry != null && from.PointGeometry != null)
                        c.Radius = Geom.Distance(center.PointGeometry, from.PointGeometry);
                }

            }
            else
            {
                geom = new SegmentGeometry(from, to);
            }
        }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewTextOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 protected NewTextOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     m_NewText = editDeserializer.ReadPersistent <TextFeature>(DataField.Text);
 }
        /// <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="NewTextOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 protected NewTextOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     m_NewText = editDeserializer.ReadPersistent<TextFeature>(DataField.Text);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleLineSubdivisionOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal SimpleLineSubdivisionOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Line = editDeserializer.ReadFeatureRef<LineFeature>(DataField.Line);
            m_Distance = editDeserializer.ReadPersistent<Distance>(DataField.Distance);
            m_IsFromEnd = editDeserializer.ReadBool(DataField.EntryFromEnd);
            FeatureStub newPoint = editDeserializer.ReadPersistent<FeatureStub>(DataField.NewPoint);
            string dataId1 = editDeserializer.ReadString(DataField.NewLine1);
            string dataId2 = editDeserializer.ReadString(DataField.NewLine2);

            DeserializationFactory dff = new DeserializationFactory(this);
            dff.AddFeatureStub(DataField.NewPoint, newPoint);
            dff.AddLineSplit(m_Line, DataField.NewLine1, dataId1);
            dff.AddLineSplit(m_Line, DataField.NewLine2, dataId2);
            ProcessFeatures(dff);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NewPointOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal NewPointOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     m_NewPoint = editDeserializer.ReadPersistent <PointFeature>(DataField.Point);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="LineExtensionOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal LineExtensionOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_ExtendLine = editDeserializer.ReadFeatureRef<LineFeature>(DataField.Line);
            m_IsExtendFromEnd = editDeserializer.ReadBool(DataField.ExtendFromEnd);
            m_Length = editDeserializer.ReadPersistent<Distance>(DataField.Distance);
            FeatureStub newPoint = editDeserializer.ReadPersistent<FeatureStub>(DataField.NewPoint);
            FeatureStub newLine = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.NewLine);

            DeserializationFactory dff = new DeserializationFactory(this);
            dff.AddFeatureStub(DataField.NewPoint, newPoint);
            dff.AddFeatureStub(DataField.NewLine, newLine);
            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="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>
        /// 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);
        }
 /// <summary>
 /// Reads data that was previously written using <see cref="WriteData"/>
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 /// <param name="offset">The offset</param>
 /// <param name="isLeft">Is the offset to the left of the object that acts as the reference for the offset.</param>
 static void ReadData(EditDeserializer editDeserializer, out Distance offset, out bool isLeft)
 {
     offset = editDeserializer.ReadPersistent<Distance>(DataField.Offset);
     isLeft = editDeserializer.ReadBool(DataField.Left);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IntersectDirectionAndLineOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal IntersectDirectionAndLineOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Direction = editDeserializer.ReadPersistent<Direction>(DataField.Direction);
            ForwardFeatureRef fwRef;
            m_Line = editDeserializer.ReadFeatureRef<LineFeature>(this, DataField.Line, out fwRef);
            m_CloseTo = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.CloseTo);
            FeatureStub to = editDeserializer.ReadPersistent<FeatureStub>(DataField.To);
            FeatureStub dirLine = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.DirLine);
            string idLineA = (editDeserializer.IsNextField(DataField.SplitBefore) ? editDeserializer.ReadString(DataField.SplitBefore) : null);
            string idLineB = (editDeserializer.IsNextField(DataField.SplitAfter) ? editDeserializer.ReadString(DataField.SplitAfter) : null);

            m_IsSplit = (idLineA != null && idLineB != null);

            // TODO (perhaps): If the line is a forward-reference (from CEdit export), we'd have to handle
            // AddLineSplit a bit differently, and do some more in ApplyFeatureRef.
            if (m_Line == null && m_IsSplit)
            {
                if (fwRef == null)
                {
                    int junk = 0;
                }
                Debug.Assert(fwRef != null);
                editDeserializer.AddForwardSplit(fwRef, idLineA, idLineB);
            }

            DeserializationFactory dff = new DeserializationFactory(this);
            dff.AddFeatureStub(DataField.To, to);
            dff.AddFeatureStub(DataField.DirLine, dirLine);

            if (m_Line != null)
            {
                dff.AddLineSplit(m_Line, DataField.SplitBefore, idLineA);
                dff.AddLineSplit(m_Line, DataField.SplitAfter, idLineB);
            }
            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="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="NewPointOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal NewPointOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     m_NewPoint = editDeserializer.ReadPersistent<PointFeature>(DataField.Point);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IntersectTwoDistancesOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal IntersectTwoDistancesOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Distance1 = editDeserializer.ReadPersistent<Observation>(DataField.Distance1);
            m_From1 = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.From1);
            m_Distance2 = editDeserializer.ReadPersistent<Observation>(DataField.Distance2);
            m_From2 = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.From2);
            m_Default = editDeserializer.ReadBool(DataField.Default);
            FeatureStub to = editDeserializer.ReadPersistent<FeatureStub>(DataField.To);
            FeatureStub line1 = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.Line1);
            FeatureStub line2 = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.Line2);

            DeserializationFactory dff = new DeserializationFactory(this);
            dff.AddFeatureStub(DataField.To, to);
            dff.AddFeatureStub(DataField.Line1, line1);
            dff.AddFeatureStub(DataField.Line2, line2);
            ProcessFeatures(dff);
        }
Exemple #33
0
 /// <summary>
 /// Reads data that was previously written using <see cref="WriteData"/>
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 /// <param name="offset">The offset</param>
 /// <param name="isLeft">Is the offset to the left of the object that acts as the reference for the offset.</param>
 static void ReadData(EditDeserializer editDeserializer, out Distance offset, out bool isLeft)
 {
     offset = editDeserializer.ReadPersistent <Distance>(DataField.Offset);
     isLeft = editDeserializer.ReadBool(DataField.Left);
 }
 /// <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>
 /// 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="IntersectDirectionAndDistanceOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal IntersectDirectionAndDistanceOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            m_Direction = editDeserializer.ReadPersistent<Direction>(DataField.Direction);
            m_Distance = editDeserializer.ReadPersistent<Observation>(DataField.Distance);
            m_From = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.From);
            m_Default = editDeserializer.ReadBool(DataField.Default);
            FeatureStub to = editDeserializer.ReadPersistent<FeatureStub>(DataField.To);
            FeatureStub dirLine = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.DirLine);
            FeatureStub distLine = editDeserializer.ReadPersistentOrNull<FeatureStub>(DataField.DistLine);

            DeserializationFactory dff = new DeserializationFactory(this);
            dff.AddFeatureStub(DataField.To, to);
            dff.AddFeatureStub(DataField.DirLine, dirLine);
            dff.AddFeatureStub(DataField.DistLine, distLine);
            ProcessFeatures(dff);
        }