示例#1
0
        /// <summary>
        /// Does any command-specific drawing.
        /// </summary>
        /// <param name="point">The specific point (if any) that the parent window has drawn. Not used.</param>
        internal override void Paint(PointFeature point)
        {
            ISpatialDisplay display = ActiveDisplay;

            if (m_DialFrom != null)
            {
                m_DialFrom.Render(display);
            }

            if (m_DialTo != null)
            {
                m_DialTo.Render(display);
            }

            if (m_DialPath != null)
            {
                m_DialPath.Render(display); // was OnDraw(point)
            }
            if (m_DialUp != null)
            {
                m_DialUp.Render(display);
            }

            if (m_From != null)
            {
                m_From.Draw(display, Color.DarkBlue);
            }

            if (m_To != null)
            {
                m_To.Draw(display, Color.Cyan);
            }
        }
示例#2
0
        /// <summary>
        /// Draws the supplied point with a color that's consistent with the
        /// meaning of a control appearing on this dialog.
        /// </summary>
        /// <param name="point">The point to draw</param>
        /// <param name="field">The control the point relates to
        /// (default was the field that currently has the focus)
        /// </param>
        void SetColor(PointFeature point, Control field)
        {
            // Return if point not specified.
            if (point == null)
            {
                return;
            }

            // Determine the color.
            Color col;

            if (field == fromPointTextBox)
            {
                col = Color.Cyan;
            }
            else if (field == distanceTextBox)
            {
                col = Color.Yellow;
            }
            else
            {
                return;
            }

            // Draw the point in the proper color.
            point.Draw(ActiveDisplay, col);
        }
示例#3
0
        internal void Draw()
        {
            ISpatialDisplay display = m_Cmd.ActiveDisplay;

            // If we're doing an update, draw the original split point in grey.
            SimpleLineSubdivisionOperation pop = UpdateOp;

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

            // Ensure the line that's being subdivided is still highlighted
            IDrawStyle style = EditingController.Current.HighlightStyle;

            m_Line.Render(display, style);

            // Calculate the position of the split point.
            IPosition splitpos = SimpleLineSubdivisionOperation.Calculate(m_Line, m_Length, m_IsFromEnd);

            if (splitpos != null)
            {
                style = EditingController.Current.Style(Color.Magenta);
                style.Render(display, splitpos);
            }
        }
示例#4
0
        internal override void Draw()
        {
            ISpatialDisplay display = EditingController.Current.ActiveDisplay;

            // Redraw the arcs that are suitable for the next pointing operation.
            DrawCurves();

            // Draw a solid line to represent displayed distance (if any)
            if (m_CurrentDistanceArc != null)
            {
                DrawStyle style = new DrawStyle(Color.Magenta);
                style.Pen.Width = 3.0F;
                style.Render(display, m_CurrentDistanceArc);
            }

            // Draw the points.
            if (m_Point1 != null)
            {
                m_Point1.Draw(display, InverseColors[0]);
            }

            if (m_Point2 != null)
            {
                m_Point2.Draw(display, InverseColors[1]);
            }
        }
示例#5
0
 /// <summary>
 /// Sets the color for the currently selected point.
 /// </summary>
 void SetColor()
 {
     // Draw the point in the correct color.
     if (m_Point != null)
     {
         m_Point.Draw(m_Parent.ActiveDisplay, m_Color);
     }
 }
示例#6
0
 internal void Draw(PointFeature point)
 {
     if (point == null)
     {
         PaintAll();
     }
     else
     {
         if (Object.ReferenceEquals(point, m_Center))
         {
             point.Draw(ActiveDisplay, Color.Cyan);
         }
         else if (Object.ReferenceEquals(point, m_RadiusPoint))
         {
             point.Draw(ActiveDisplay, Color.Yellow);
         }
     }
 }
示例#7
0
        /// <summary>
        /// Sets color for a point.
        /// </summary>
        /// <param name="point">The point to draw.</param>
        /// <param name="c">The field that the point relates to. The default is
        /// the field that currently has the focus.</param>
        void SetColor(PointFeature point, Control c)
        {
            // Return if point not specified.
            if (point == null)
            {
                return;
            }

            ISpatialDisplay display = m_Command.ActiveDisplay;
            Control         field   = (c == null ? m_Focus : c);

            if (Object.ReferenceEquals(field, fromTextBox))
            {
                point.Draw(display, Color.DarkBlue);
            }
            else if (Object.ReferenceEquals(field, toTextBox))
            {
                point.Draw(display, Color.Cyan);
            }
        }
示例#8
0
        /// <summary>
        /// Reacts to selection of a point on the map.
        /// </summary>
        /// <param name="point"></param>
        internal void OnSelectPoint(PointFeature point)
        {
            // Return if point is not defined.
            if (point == null)
            {
                return;
            }

            // Handle the pointing, depending on what field we were last in.
            if (m_Focus == centerTextBox)
            {
                // Draw any previously selected center point normally.
                SetNormalColor(m_Center);

                // Grab the new centre point.
                m_Center = point;

                // Draw the point in appropriate color.
                m_Center.Draw(ActiveDisplay, Color.Cyan);

                // Display its key (causes a call to OnChangeCentre).
                centerTextBox.Text = String.Format("+{0}", m_Center.FormattedKey);

                // Move focus to the radius field.
                radiusTextBox.Focus();
            }
            else if (m_Focus == radiusTextBox)
            {
                // The radius must be getting specified by pointing at an offset point.

                // Ensure that any previously selected offset point is
                // drawn in its normal colout.
                SetNormalColor(m_RadiusPoint);

                // Grab the new offset point.
                m_RadiusPoint = point;

                // Draw the point in appropriate colour.
                m_RadiusPoint.Draw(ActiveDisplay, Color.Yellow);

                // Display the point number.
                radiusTextBox.Text = String.Format("+{0}", m_RadiusPoint.FormattedKey);

                // Ensure any radius circle has been refreshed.
                OnChange();

                // Move focus to the OK button.
                okButton.Focus();
            }
        }
示例#9
0
        internal override void Draw()
        {
            ISpatialDisplay display = EditingController.Current.ActiveDisplay;

            if (m_Point1 != null)
            {
                m_Point1.Draw(display, InverseColors[0]);
            }

            if (m_Point2 != null)
            {
                m_Point2.Draw(display, InverseColors[1]);
            }
        }
示例#10
0
        internal void Draw() // was Paint
        {
            // Nothing to do if parallel points undefined.
            if (m_South == null || m_North == null)
            {
                return;
            }

            Debug.Assert(m_Line != null);
            ISpatialDisplay draw        = m_Cmd.ActiveDisplay;
            IDrawStyle      solidStyle  = EditingController.Current.Style(Color.Magenta);
            IDrawStyle      dottedStyle = new DottedStyle();

            ArcFeature arc = m_Line.GetArcBase();

            if (arc != null)
            {
                // The parallel portion is solid, while the remaining portion of the circle is dotted.
                CircularArcGeometry cg = new CircularArcGeometry(arc.Circle.Center, m_South, m_North, arc.IsClockwise);
                solidStyle.Render(draw, cg);
                cg.IsClockwise = !cg.IsClockwise;
                dottedStyle.Render(draw, cg);
            }
            else
            {
                // What's the bearing from the start to the end of the parallel?
                double bearing = Geom.BearingInRadians(m_South, m_North);

                // What's the max length of a diagonal crossing the entire screen?
                double maxdiag = m_Cmd.MaxDiagonal;

                // Project to a point below the southern end of the parallel, as
                // well as a point above the northern end.
                IPosition below = Geom.Polar(m_South, bearing + Constants.PI, maxdiag);
                IPosition above = Geom.Polar(m_North, bearing, maxdiag);

                LineSegmentGeometry.Render(below, m_South, draw, dottedStyle);
                LineSegmentGeometry.Render(m_South, m_North, draw, solidStyle);
                LineSegmentGeometry.Render(m_North, above, draw, dottedStyle);

                // If we have an offset point, draw it in green.
                if (m_Point != null)
                {
                    m_Point.Draw(draw, Color.Green);
                }
            }
        }
示例#11
0
        /// <summary>
        /// Handles any redrawing. This just ensures that points are drawn in the right
        /// color, and that any distance circle shown is still there.
        /// </summary>
        void PaintAll()
        {
            ISpatialDisplay display = ActiveDisplay;

            if (m_Circle != null)
            {
                m_Circle.Render(display, new DottedStyle());
            }

            if (m_Center != null)
            {
                m_Center.Draw(display, Color.Cyan);
            }

            if (m_RadiusPoint != null)
            {
                m_RadiusPoint.Draw(display, Color.Yellow);
            }
        }
示例#12
0
        /// <summary>
        /// Draws the current state of the edit
        /// </summary>
        internal void Draw()
        {
            Debug.Assert(m_Line != null);
            ISpatialDisplay view = ActiveDisplay;

            // Figure out the positions for the ends of the parallel line (if any) ...

            // Assume we already know both terminals.
            IPosition start = m_Term1;
            IPosition end   = m_Term2;

            // If either one is undefined, but a dialog for it is active,
            // try to get the terminal from there instead.
            if (m_TermDial1 != null && start == null)
            {
                start = m_TermDial1.TerminalPosition;
            }

            if (m_TermDial2 != null && end == null)
            {
                end = m_TermDial2.TerminalPosition;
            }

            // If they weren't actually defined, use the parallel points instead.
            if (start == null)
            {
                start = m_Par1;
            }

            if (end == null)
            {
                end = m_Par2;
            }

            // If those weren't defined either, try to calculate them now.
            if (end == null && Calculate())
            {
                start = m_Par1;
                end   = m_Par2;
            }

            // Any offset point
            if (m_OffsetPoint != null)
            {
                m_OffsetPoint.Draw(view, Color.Green);
            }

            // Everything else should draw in usual command-style colour.
            IDrawStyle style       = EditingController.Current.Style(Color.Magenta);
            IDrawStyle dottedStyle = new DottedStyle();

            // If the reference line is a curve, get the curve info.
            ArcFeature arc = m_Line.GetArcBase();

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

                // Reverse the direction if necessary.
                if (m_IsReversed)
                {
                    iscw = !iscw;
                }

                // Draw the parallel line (the rest of the circle being dotted).
                if (start != null)
                {
                    CircularArcGeometry parArc = new CircularArcGeometry(arc.Circle, start, end, iscw);
                    style.Render(view, parArc);

                    parArc.IsClockwise = !parArc.IsClockwise;
                    dottedStyle.Render(view, parArc);
                }
            }
            else
            {
                // PARALLEL IS STRAIGHT

                // If we've got something, figure out positions for dotted portion.
                if (start != null)
                {
                    // What's the max length of a diagonal crossing the entire screen?
                    double maxdiag = this.MaxDiagonal;

                    // What's the bearing from the start to the end of the parallel?
                    double bearing = Geom.BearingInRadians(start, end);

                    // Project to a point before the start end of the parallel, as
                    // well as a point after the end.
                    IPosition before = Geom.Polar(start, bearing + Constants.PI, maxdiag);
                    IPosition after  = Geom.Polar(end, bearing, maxdiag);

                    LineSegmentGeometry.Render(before, start, view, dottedStyle);
                    LineSegmentGeometry.Render(start, end, view, style);
                    LineSegmentGeometry.Render(end, after, view, dottedStyle);
                }
            }

            // Draw terminal positions (if defined).

            if (m_Term1 != null)
            {
                style.Render(view, m_Term1);
            }

            if (m_Term2 != null)
            {
                style.Render(view, m_Term2);
            }

            // The terminal lines.

            if (m_TermLine1 != null)
            {
                m_TermLine1.Render(view, style);
            }

            if (m_TermLine2 != null)
            {
                m_TermLine2.Render(view, style);
            }

            // Do the active dialog last so their stuff draws on top.
            if (m_ParDial != null)
            {
                m_ParDial.Draw();
            }

            if (m_TermDial1 != null)
            {
                m_TermDial1.Draw();
            }

            if (m_TermDial2 != null)
            {
                m_TermDial2.Draw();
            }
        }
示例#13
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);
            }
        }
示例#14
0
 internal void Draw(PointFeature point)
 {
     if (point==null)
         PaintAll();
     else
     {
         if (Object.ReferenceEquals(point, m_Center))
             point.Draw(ActiveDisplay, Color.Cyan);
         else if (Object.ReferenceEquals(point, m_RadiusPoint))
             point.Draw(ActiveDisplay, Color.Yellow);
     }
 }
        /// <summary>
        /// Draws the supplied point with a color that's consistent with the
        /// meaning of a control appearing on this dialog.
        /// </summary>
        /// <param name="point">The point to draw</param>
        /// <param name="field">The control the point relates to
        /// (default was the field that currently has the focus)
        /// </param>
        void SetColor(PointFeature point, Control field)
        {
            // Return if point not specified.
            if (point==null)
                return;

            // Determine the color.
            Color col;

            if (field == backsightTextBox)
                col = Color.DarkBlue;
            else if (field == fromPointTextBox)
                col = Color.Cyan;
            else if (field == directionTextBox)
                col = Color.Yellow;
            else if (field == offsetTextBox)
                col = Color.LightGreen;
            else
                return;

            // Draw the point in the proper color.
            point.Draw(ActiveDisplay, col);
        }
示例#16
0
        /// <summary>
        /// Reacts to selection of a point on the map.
        /// </summary>
        /// <param name="point"></param>
        internal void OnSelectPoint(PointFeature point)
        {
            // Return if point is not defined.
            if (point==null)
                return;

            // Handle the pointing, depending on what field we were last in.
            if (m_Focus == centerTextBox)
            {
                // Draw any previously selected center point normally.
                SetNormalColor(m_Center);

                // Grab the new centre point.
                m_Center = point;

                // Draw the point in appropriate color.
                m_Center.Draw(ActiveDisplay, Color.Cyan);

                // Display its key (causes a call to OnChangeCentre).
                centerTextBox.Text = String.Format("+{0}", m_Center.FormattedKey);

                // Move focus to the radius field.
                radiusTextBox.Focus();
            }
            else if (m_Focus == radiusTextBox)
            {
                // The radius must be getting specified by pointing at an offset point.

                // Ensure that any previously selected offset point is
                // drawn in its normal colout.
                SetNormalColor(m_RadiusPoint);

                // Grab the new offset point.
                m_RadiusPoint = point;

                // Draw the point in appropriate colour.
                m_RadiusPoint.Draw(ActiveDisplay, Color.Yellow);

                // Display the point number.
                radiusTextBox.Text = String.Format("+{0}", m_RadiusPoint.FormattedKey);

                // Ensure any radius circle has been refreshed.
                OnChange();

                // Move focus to the OK button.
                okButton.Focus();
            }
        }
        /// <summary>
        /// Draws the supplied point with a color that's consistent with the
        /// meaning of a control appearing on this dialog.
        /// </summary>
        /// <param name="point">The point to draw</param>
        /// <param name="field">The control the point relates to
        /// (default was the field that currently has the focus)
        /// </param>
        void SetColor(PointFeature point, Control field)
        {
            // Return if point not specified.
            if (point==null)
                return;

            // Determine the color.
            Color col;

            if (field == fromPointTextBox)
                col = Color.Cyan;
            else if (field == distanceTextBox)
                col = Color.Yellow;
            else
                return;

            // Draw the point in the proper color.
            point.Draw(ActiveDisplay, col);
        }