Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
 /// <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);
 }
Ejemplo n.º 3
0
 /// <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);
 }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
 /// <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);
 }
Ejemplo n.º 6
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);
 }
Ejemplo n.º 7
0
        /// <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;
            //}
        }
Ejemplo n.º 8
0
        /// <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="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);
        }
Ejemplo n.º 10
0
        /// <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);
            }
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        /// <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();
        }
Ejemplo n.º 13
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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 15
0
        /// <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="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);
        }
Ejemplo n.º 17
0
        /// <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="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);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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="label">The polygon label that was modified</param>
        /// <param name="newPosition">The revised position of the reference point.</param>
        /// <param name="oldPosition">The original position of the reference point.</param>
        static void ReadData(EditDeserializer editDeserializer, out TextFeature label, out PointGeometry newPosition,
                             out PointGeometry oldPosition)
        {
            label       = editDeserializer.ReadFeatureRef <TextFeature>(DataField.Label);
            newPosition = editDeserializer.ReadPointGeometry(DataField.NewX, DataField.NewY);

            if (editDeserializer.IsNextField(DataField.OldX))
            {
                oldPosition = editDeserializer.ReadPointGeometry(DataField.OldX, DataField.OldY);
            }
            else
            {
                oldPosition = null;
            }
        }
Ejemplo n.º 21
0
        /// <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="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="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);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OffsetPoint"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal OffsetPoint(EditDeserializer editDeserializer)
 {
     m_Point = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.Point);
 }
Ejemplo n.º 25
0
        /// <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;
            //}
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OffsetPoint"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal OffsetPoint(EditDeserializer editDeserializer)
 {
     m_Point = editDeserializer.ReadFeatureRef<PointFeature>(this, DataField.Point);
 }
        /// <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);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetTopologyOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal SetTopologyOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     m_Line        = editDeserializer.ReadFeatureRef <LineFeature>(DataField.Line);
     m_Topological = editDeserializer.ReadBool(DataField.Topological);
 }
        /// <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);
        }
Ejemplo n.º 30
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="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);
            }
        }
        /// <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);
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetTopologyOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal SetTopologyOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     m_Line = editDeserializer.ReadFeatureRef<LineFeature>(DataField.Line);
     m_Topological = editDeserializer.ReadBool(DataField.Topological);
 }
        /// <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);
        }
Ejemplo n.º 34
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);
 }
        /// <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>
        /// Reads data that was previously written using <see cref="WriteData"/>
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        /// <param name="label">The polygon label that was modified</param>
        /// <param name="newPosition">The revised position of the reference point.</param>
        /// <param name="oldPosition">The original position of the reference point.</param>
        static void ReadData(EditDeserializer editDeserializer, out TextFeature label, out PointGeometry newPosition,
            out PointGeometry oldPosition)
        {
            label = editDeserializer.ReadFeatureRef<TextFeature>(DataField.Label);
            newPosition = editDeserializer.ReadPointGeometry(DataField.NewX, DataField.NewY);

            if (editDeserializer.IsNextField(DataField.OldX))
                oldPosition = editDeserializer.ReadPointGeometry(DataField.OldX, DataField.OldY);
            else
                oldPosition = null;
        }
Ejemplo n.º 37
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>
 /// 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);
 }