コード例 #1
0
        private void RenderMeasurings(RenderArea arg1, DrawingVisual arg2, System.Windows.Media.DrawingContext arg3)
        {
            const double TH_DEFAULT = 1; const double RADIUS_ELLIPSE_DEFAULT = 3;
            double       stroke         = TH_DEFAULT;
            double       radius_ellipse = RADIUS_ELLIPSE_DEFAULT;

            var d = context;

            if (arg1 == renderAreaMagnifier)
            {
                if (!GetIsZoomEnabled())
                {
                    return;
                }

                arg3.PushTransform(GetMagnfierRenderAreaTransform());

                stroke         = TH_DEFAULT / MagnifierZoom;
                radius_ellipse = RADIUS_ELLIPSE_DEFAULT / MagnifierZoom;
            }



            foreach (var l in d.Lines)
            {
                arg3.DrawLine(new Pen(new SolidColorBrush(l.Color), stroke), l.P0, l.P1);
            }
            if (d.LinesUnderMouse.Length > 0)
            {
                var nl = d.LinesUnderMouse[0].Line;

                drawPointHighlighted(nl.P0, nl.Color, arg3, radius_ellipse, stroke);
                drawPointHighlighted(nl.P1, nl.Color, arg3, radius_ellipse, stroke);

                mouseOverLine_info.LineInfo   = nl;
                mouseOverLine_info.Foreground = new SolidColorBrush(nl.Color);
                mouseOverLine_info.Visibility = Visibility.Visible;
            }
            else
            {
                mouseOverLine_info.Visibility = Visibility.Hidden;
            }

            if (d.MousePosition.HasValue && d.TempPoint.HasValue)
            {
                var tempLine = new MeasureLine(d.MousePosition.Value, d.TempPoint.Value, d.CurrentColor);
                //drawLineText(1, tempLine, arg3);

                arg3.DrawLine(new Pen(new SolidColorBrush(tempLine.Color), stroke), tempLine.P0, tempLine.P1);
                currentLine_info.LineInfo   = tempLine;
                currentLine_info.Foreground = new SolidColorBrush(tempLine.Color);
                currentLine_info.Visibility = Visibility.Visible;
            }
            else
            {
                currentLine_info.Visibility = Visibility.Hidden;
            }

            if (d.MousePosition.HasValue)
            {
                drawPointHighlighted(d.MousePosition.Value, d.CurrentColor, arg3, radius_ellipse, stroke);
            }

            if (d.TempPoint.HasValue)
            {
                drawPointHighlighted(d.TempPoint.Value, d.CurrentColor, arg3, radius_ellipse, stroke);
            }
        }
コード例 #2
0
ファイル: Types.cs プロジェクト: burfab/ScreenRuler
 public PointLineIntersection(MeasureLine l, Point p, double d)
 {
     Distance = d;
     P        = p;
     Line     = l;
 }