Ejemplo n.º 1
0
        /// <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;
            }
        }
Ejemplo n.º 2
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.º 3
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);
            }
        }
Ejemplo n.º 4
0
        /// <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;
        }
Ejemplo n.º 5
0
        /// <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;
        }
Ejemplo n.º 6
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="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.º 9
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.º 10
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);
 }
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="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);
            }
        }
Ejemplo n.º 12
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="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>
        /// 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="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);
        }
        /// <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);
        }
Ejemplo n.º 16
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="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.º 18
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);
 }
Ejemplo n.º 19
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);
 }