コード例 #1
0
ファイル: ArcGeometry.cs プロジェクト: 15831944/backsight
        internal override void Render(ISpatialDisplay display, IDrawStyle style)
        {
            // At scales larger than 1:1000, it may be advisable to draw an approximation (since
            // the drawing methods tend to reveal small non-existent glitches at larger scales)...

            // Draw an approximation of the curve (such that the chord-to-circumference
            // distance does not exceed 0.2mm at draw scale).

            /*
             * ILength tol = new Length(display.MapScale * 0.0002);
             * IPointGeometry[] pts = CircularArcGeometry.GetApproximation(this, tol);
             * new LineStringGeometry(pts).Render(display, style);
             */
            CircularArcGeometry.Render(this, display, style);
        }
コード例 #2
0
        internal void Draw()
        {
            ISpatialDisplay display = m_Cmd.ActiveDisplay;

            // Draw the line we're extending in a special colour (any highlighting it
            // originally had should have been removed during LineExtensionControl_Load)
            if (m_ExtendLine != null)
            {
                m_ExtendLine.Draw(display, Color.DarkBlue);
            }

            // If we're doing an update, draw the original extension in grey.
            LineExtensionOperation pop = UpdateOp;

            if (pop != null)
            {
                LineFeature origLine = pop.NewLine;
                if (origLine != null)
                {
                    origLine.Draw(display, Color.Gray);
                }

                PointFeature origPoint = pop.NewPoint;
                if (origPoint != null)
                {
                    origPoint.Draw(display, Color.Gray);
                }
            }

            // Calculate the start and end points of the extension, initially
            // assuming that it's a straight line extension.
            IPosition start, end;

            if (LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end))
            {
                // Draw the straight extension line
                IDrawStyle          style = (m_WantLine ? new DrawStyle(Color.Magenta) : new DottedStyle(Color.Magenta));
                LineSegmentGeometry seg   = new LineSegmentGeometry(start, end);
                seg.Render(display, style);
            }
            else
            {
                // Perhaps it's a circular arc ...

                IPosition center;
                bool      iscw;

                if (LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length,
                                              out start, out end, out center, out iscw))
                {
                    // And draw the curve.
                    IDrawStyle          style = (m_WantLine ? new DrawStyle(Color.Magenta) : new DottedStyle(Color.Magenta));
                    IPointGeometry      c     = PointGeometry.Create(center);
                    CircularArcGeometry arc   = new CircularArcGeometry(c, start, end, iscw);
                    arc.Render(display, style);
                }
                else if (m_ExtendLine != null)
                {
                    // Get the position we're extending from.
                    end = (m_IsExtendFromEnd ? m_ExtendLine.EndPoint : m_ExtendLine.StartPoint);
                }
            }

            // If we actually got something, draw the end point.
            if (end != null)
            {
                IDrawStyle style = m_Cmd.Controller.DrawStyle;
                style.FillColor = Color.Magenta;
                style.Render(display, end);
            }
        }