Exemple #1
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);
            }
        }
Exemple #2
0
 /// <summary>
 /// Highlights the specified line on the command's active display.
 /// </summary>
 /// <param name="line">The line to highlight (ignored if null)</param>
 protected void Highlight(LineFeature line)
 {
     if (line != null)
     {
         IDrawStyle      style   = Controller.HighlightStyle;
         ISpatialDisplay display = ActiveDisplay;
         line.Render(display, style);
     }
 }
        internal void Draw() // was Paint
        {
            // Ensure nothing else is currently selected/highlighted.
            ISpatialDisplay view = m_Cmd.ActiveDisplay;

            //m_Cmd.ErasePainting();

            // If we've got a terminal line, highlight it.
            if (m_Line != null)
            {
                m_Line.Render(view, new HighlightStyle());
            }

            // And draw the terminal position on top of it.
            if (m_Terminal != null)
            {
                EditingController.Current.Style(Color.Yellow).Render(view, m_Terminal);
            }
        }
Exemple #4
0
        /// <summary>
        /// Sees whether the orientation of the new text should be altered. This
        /// occurs if the auto-angle capability is enabled, and the specified
        /// position is close to any visible line.
        /// </summary>
        /// <param name="refpos">The current mouse position (reference position
        /// for the new label)</param>
        /// <returns>True if the orientation angle got changed.</returns>
        bool CheckOrientation(IPointGeometry refpos)
        {
            // Return if the auto-angle function is disabled.
            if (!m_IsAutoAngle)
            {
                return(false);
            }

            // Return if the auto-position function is enabled
            if (m_IsAutoPos)
            {
                return(false);
            }

            // Try to get an orientation line
            LineFeature orient = GetOrientation(refpos);

            if (!Object.ReferenceEquals(orient, m_Orient))
            {
                ErasePainting();
            }

            m_Orient = null;
            if (orient == null)
            {
                return(false);
            }

            // Locate the closest point on the line (we SHOULD find it,
            // but if we don't, just bail out)
            ISpatialDisplay display = ActiveDisplay;
            ILength         tol     = new Length(0.002 * display.MapScale);
            IPosition       closest = orient.LineGeometry.GetClosest(refpos, tol);

            if (closest == null)
            {
                return(false);
            }

            m_Orient = orient;
            if (m_Orient == null)
            {
                return(false);
            }

            // Highlight the new orientation line
            m_Orient.Render(display, new HighlightStyle());

            // Get the rotation angle
            IPointGeometry cg  = PointGeometry.Create(closest);
            double         rot = m_Orient.LineGeometry.GetRotation(cg);

            SetRotation(rot);
            return(true);
        }
Exemple #5
0
        /// <summary>
        /// Draws (or erases) the polygon that the mouse currently sits in.
        /// </summary>
        /// <param name="draw">Draw the polygon? [Default was true]</param>
        /// <returns>True if a polygon was drawn or erased.</returns>
        bool DrawPolygon(bool draw)
        {
            // Return if there is no valid polygon.
            if (!IsValidPolygon())
            {
                return(false);
            }

            if (draw)
            {
                m_Polygon.Render(ActiveDisplay, new DrawStyle());
                if (m_Orient != null)
                {
                    m_Orient.Render(ActiveDisplay, new HighlightStyle());
                }
            }
            else
            {
                ErasePainting();
            }

            return(true);
        }
Exemple #6
0
        /// <summary>
        /// Highlights a line.
        /// </summary>
        /// <param name="line">The line to highlight</param>
        void Highlight(LineFeature line)
        {
            ISpatialDisplay display = ActiveDisplay;

            // Create thick pen (we want a line that is 1mm wide, corresponding
            // to the pick aperture).
            DrawStyle style = new HighlightStyle();

            style.LineColor = m_LineColor;
            double scale = display.MapScale;
            float  pxwid = display.LengthToDisplay(scale * 0.001);

            style.Pen.Width = pxwid;

            // Do the draw
            line.Render(display, style);
        }
Exemple #7
0
        /// <summary>
        /// Called before icon render.  If the user has clicked on one of the GoTos head there now.
        /// Renders 3-D model and history trails.  If you want to only show models or trails on
        /// mouseover set the TrailShowDistance or ModelShowDistance to 0.
        /// </summary>
        /// <param name="drawArgs"></param>
        /// <param name="isMouseOver">Whether or not the mouse is over the icon</param>
        public override void PreRender(DrawArgs drawArgs, bool isMouseOver)
        {
            base.PreRender(drawArgs, isMouseOver);

            if (RenderTrail && ((DistanceToIcon < TrailShowDistance) || isMouseOver || IsHooked))
            {
                if (RenderTrail && m_lineFeature != null)
                {
                    if (!m_lineFeature.Initialized || m_lineFeature.NeedsUpdate)
                    {
                        m_lineFeature.Update(drawArgs);
                    }

                    m_lineFeature.Render(drawArgs);
                }
            }

            if (RenderModel && ((DistanceToIcon < ModelShowDistance) || isMouseOver || IsHooked))
            {
                if (m_modelFeature == null)
                {
                    updateModel(isMouseOver);
                }

                if (!m_modelFeature.Initialized)
                {
                    m_modelFeature.Update(drawArgs);
                }

                m_modelFeature.Render(drawArgs);
            }

            if (m_gotoMe)
            {
                GoTo(drawArgs);
            }
        }
        /// <summary>
        /// Dialog-specific painting.
        /// </summary>
        internal void Draw()
        {
            // Draw the features originally created by the op in gray.
            ISpatialDisplay display = m_UpdCmd.ActiveDisplay;
            IDrawStyle      style   = m_UpdCmd.Controller.Style(Color.Gray);

            style.IsFixed = true;
            m_pop.Render(display, style, true);

            // Ensure the current face has up-to-date geometry and draw that using magenta draw style
            m_CurrentFace.CalculateGeometry(m_pop.Parent, null);
            style         = m_UpdCmd.Controller.Style(Color.Magenta);
            style.IsFixed = true;
            foreach (LineFeature line in m_CurrentFace.Sections)
            {
                line.Render(display, style);
            }

            // Highlight the currently selected section (if any).
            if (m_SelectedLine != null)
            {
                m_SelectedLine.Render(display, new HighlightStyle());
            }
        }
Exemple #9
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();
            }
        }
Exemple #10
0
        /// <summary>
        /// Sees whether the orientation of the new text should be altered. This
        /// occurs if the auto-angle capability is enabled, and the specified
        /// position is close to any visible line.
        /// </summary>
        /// <param name="refpos">The current mouse position (reference position
        /// for the new label)</param>
        /// <returns>True if the orientation angle got changed.</returns>
        bool CheckOrientation(IPointGeometry refpos)
        {
            // Return if the auto-angle function is disabled.
            if (!m_IsAutoAngle)
                return false;

            // Return if the auto-position function is enabled
            if (m_IsAutoPos)
                return false;

            // Try to get an orientation line
            LineFeature orient = GetOrientation(refpos);
            if (!Object.ReferenceEquals(orient, m_Orient))
                ErasePainting();

            m_Orient = null;
            if (orient == null)
                return false;

            // Locate the closest point on the line (we SHOULD find it,
            // but if we don't, just bail out)
            ISpatialDisplay display = ActiveDisplay;
            ILength tol = new Length(0.002 * display.MapScale);
            IPosition closest = orient.LineGeometry.GetClosest(refpos, tol);
            if (closest == null)
                return false;

            m_Orient = orient;
            if (m_Orient==null)
                return false;

            // Highlight the new orientation line
            m_Orient.Render(display, new HighlightStyle());

            // Get the rotation angle
            IPointGeometry cg = PointGeometry.Create(closest);
            double rot = m_Orient.LineGeometry.GetRotation(cg);
            SetRotation(rot);
            return true;
        }
        /// <summary>
        /// Highlights a line.
        /// </summary>
        /// <param name="line">The line to highlight</param>
        void Highlight(LineFeature line)
        {
            ISpatialDisplay display = ActiveDisplay;

            // Create thick pen (we want a line that is 1mm wide, corresponding
            // to the pick aperture).
            DrawStyle style = new HighlightStyle();
            style.LineColor = m_LineColor;
            double scale = display.MapScale;
            float pxwid = display.LengthToDisplay(scale*0.001);
            style.Pen.Width = pxwid;

            // Do the draw
            line.Render(display, style);
        }