コード例 #1
0
        /// <summary>
        /// Performs the data processing associated with this editing operation.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal override void CalculateGeometry(EditingContext ctx)
        {
            // Get the radius, in meters on the ground.
            double rad = m_Radius.GetDistance(m_Center).Meters;

            if (rad < Constants.TINY)
            {
                throw new Exception("NewCircleOperation.CalculateGeometry - Radius is too close to zero.");
            }

            // If the closing point was created by this edit, define it's position
            ArcFeature   arc = (ArcFeature)this.Line;
            PointFeature p   = arc.StartPoint;

            if (p.Creator == this)
            {
                PointGeometry pg = new PointGeometry(m_Center.X, m_Center.Y + rad);
                p.ApplyPointGeometry(ctx, pg);
            }

            // Define the radius of the circle and include in the map model
            Circle circle = arc.Circle;

            Debug.Assert(circle != null);
            circle.Radius = rad;

            // Refer the center point to the circle.
            circle.AddReferences();
        }
コード例 #2
0
        /// <summary>
        /// Performs the data processing associated with this editing operation.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal override void CalculateGeometry(EditingContext ctx)
        {
            IPosition     p  = Calculate();
            PointGeometry pg = PointGeometry.Create(p);

            m_NewPoint.ApplyPointGeometry(ctx, pg);

            // If the extension line was a circular arc, we also need to define it's geometry.
            // This COULD have been defined at an earlier stage (e.g. as part of CreateFeature),
            // but it's more consistent to do it as part of this method.

            if (m_NewLine is ArcFeature)
            {
                ArcFeature arc    = m_ExtendLine.GetArcBase();
                Circle     circle = arc.Circle;
                Debug.Assert(circle != null);

                bool iscw = arc.IsClockwise;
                if (!m_IsExtendFromEnd)
                {
                    iscw = !iscw;
                }

                ArcGeometry geom = new ArcGeometry(circle, m_NewLine.StartPoint, m_NewLine.EndPoint, iscw);
                (m_NewLine as ArcFeature).Geometry = geom;
            }
        }
コード例 #3
0
        /// <summary>
        /// Performs the data processing associated with this editing operation.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal override void CalculateGeometry(EditingContext ctx)
        {
            //IPosition p = (base.CheckPosition == null ? Calculate() : base.CheckPosition);
            IPosition p = Calculate();

            if (p == null)
            {
                p = CheckPosition;
                Log(String.Format("Id={0} (CEdit={1:0.0}E {2:0.0}N", this.EditSequence, p.X, p.Y));
            }
            else if (CheckPosition != null)
            {
                double d = Geom.Distance(p, CheckPosition);
                if (d > 1.0)
                {
                    Log(String.Format("Id={0} (CEdit={1:0.0}E {2:0.0}N)  (Backsight={3:0.0}E {4:0.0}N)  Delta={5:0.000}",
                                      this.EditSequence, CheckPosition.Easting.Meters, CheckPosition.Northing.Meters, p.X, p.Y, d));
                }
                p = CheckPosition;
            }

            PointGeometry pg = PointGeometry.Create(p);

            m_Intersection.ApplyPointGeometry(ctx, pg);
        }
コード例 #4
0
        /// <summary>
        /// Performs the data processing associated with this editing operation.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal override void CalculateGeometry(EditingContext ctx)
        {
            IPosition     p  = Calculate();
            PointGeometry pg = PointGeometry.Create(p);

            m_To.ApplyPointGeometry(ctx, pg);
        }
コード例 #5
0
        /// <summary>
        /// Performs the data processing associated with this face.
        /// </summary>
        /// <param name="parentLine">The line that is being subdivided</param>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal void CalculateGeometry(LineFeature parentLine, EditingContext ctx)
        {
            // Get adjusted lengths for each section
            double[] adjray = GetAdjustedLengths(parentLine, m_Distances);

            double       edist    = 0.0; // Distance to end of section.
            PointFeature start    = parentLine.StartPoint;
            LineGeometry lineGeom = parentLine.LineGeometry;

            for (int i = 0; i < adjray.Length; i++)
            {
                // Calculate the position at the end of the span
                edist += adjray[i];
                IPosition to;
                if (!lineGeom.GetPosition(new Length(edist), out to))
                {
                    throw new Exception("Cannot adjust line section");
                }

                // Get the point feature at the end of the span
                LineFeature  line = m_Sections[i];
                PointFeature end  = line.EndPoint;

                // Assign the calculated position so long as we're not at
                // the end of the line
                if (end != parentLine.EndPoint)
                {
                    end.ApplyPointGeometry(ctx, PointGeometry.Create(to));
                }

                // The end of the current span is the start of the next one
                start = end;
            }
        }
コード例 #6
0
ファイル: PathOperation.cs プロジェクト: 15831944/backsight
        /// <summary>
        /// Attaches geometry to the spans along a leg.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being defined.</param>
        /// <param name="spans">Information about each observed span</param>
        /// <param name="sections">The geometry that corresponds to each span</param>
        void AttachGeometry(EditingContext ctx, SpanInfo[] spans, ILineGeometry[] sections)
        {
            Debug.Assert(spans.Length == sections.Length);

            for (int i = 0; i < spans.Length; i++)
            {
                SpanInfo     data     = spans[i];
                Feature      feat     = data.CreatedFeature;
                PointFeature endPoint = null;

                if (feat is PointFeature)
                {
                    endPoint = (PointFeature)feat;
                }
                else if (feat is LineFeature)
                {
                    endPoint = (feat as LineFeature).EndPoint;
                }

                if (endPoint != null && endPoint.PointGeometry == null)
                {
                    PointGeometry pg = PointGeometry.Create(sections[i].End);
                    endPoint.ApplyPointGeometry(ctx, pg);
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Applies changes to this editing operation.
        /// </summary>
        /// <param name="ctx">The editing context (null if the model is being deserialized)</param>
        /// <param name="data">The changes to apply</param>
        void ApplyUpdateItems(EditingContext ctx, UpdateItemCollection data)
        {
            double        x  = data.ExchangeValue <double>(DataField.X, m_NewPoint.Easting.Meters);
            double        y  = data.ExchangeValue <double>(DataField.Y, m_NewPoint.Northing.Meters);
            PointGeometry pg = new PointGeometry(x, y);

            m_NewPoint.ApplyPointGeometry(ctx, pg);
        }
コード例 #8
0
        /// <summary>
        /// Performs the data processing associated with this editing operation.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal override void CalculateGeometry(EditingContext ctx)
        {
            IPosition     to = Calculate(m_Direction, m_Distance, m_From, m_Default);
            PointGeometry pg = PointGeometry.Create(to);

            m_To.ApplyPointGeometry(ctx, pg);

            // There's no need to calculate new geometry for the line segments
            // created by the edit, since their geometry is dependent on the
            // position of the end points - we calculated one end above, the
            // other end should have been calculated by a previous edit.
        }
コード例 #9
0
        /// <summary>
        /// Applies changes to this editing operation.
        /// </summary>
        /// <param name="ctx">The editing context (null if the model is being deserialized)</param>
        /// <param name="data">The changes to apply</param>
        void ApplyUpdateItems(EditingContext ctx, UpdateItemCollection data)
        {
            // Locate the specific point that was modified
            //string id = data.GetValue<string>(DataField.Id);
            //InternalIdValue iid = new InternalIdValue(id);
            //PointFeature p = this.MapModel.Find<PointFeature>(iid);
            PointFeature  p  = data.GetValue <PointFeature>(DataField.UpdatedPoint);
            double        x  = data.ExchangeValue <double>(DataField.X, p.Easting.Meters);
            double        y  = data.ExchangeValue <double>(DataField.Y, p.Northing.Meters);
            PointGeometry pg = new PointGeometry(x, y);

            p.ApplyPointGeometry(ctx, pg);
        }
コード例 #10
0
        /// <summary>
        /// Performs the data processing associated with this editing operation.
        /// </summary>
        /// <param name="ctx">The context in which the geometry is being calculated.</param>
        internal override void CalculateGeometry(EditingContext ctx)
        {
            IPosition p = Calculate();

            if (p == null)
            {
                p = CheckPosition;
            }

            PointGeometry pg = PointGeometry.Create(p);

            m_Intersection.ApplyPointGeometry(ctx, pg);
        }