Пример #1
0
        public void Show_RegionTargetResults(IEnumerable <RegionTargetResult> results)
        {
            foreach (var result in results)
            {
                if (result.HasError)
                {
                    continue;
                }

                var rect2   = result.TargetRegion.GetSmallestHRectangle2();
                var roiRect = rect2.GetRoiRectangle();

                if (result.Definition.Rect2Len1Line_DisplayEnabled)
                {
                    var line = roiRect.GetWidthLine();

                    var lineIndicator = new LineIndicatorViewModel
                    {
                        StartPointX     = line.X1,
                        StartPointY     = line.Y1,
                        EndPointX       = line.X2,
                        EndPointY       = line.Y2,
                        Stroke          = Brushes.DeepPink,
                        StrokeThickness = 2,
                    };
                    LineIndicators.Add(lineIndicator);
                }

                if (result.Definition.Rect2Len2Line_DisplayEnabled)
                {
                    var line = roiRect.GetLine();

                    var lineIndicator = new LineIndicatorViewModel
                    {
                        StartPointX     = line.X1,
                        StartPointY     = line.Y1,
                        EndPointX       = line.X2,
                        EndPointY       = line.Y2,
                        Stroke          = Brushes.DeepPink,
                        StrokeThickness = 2,
                    };
                    LineIndicators.Add(lineIndicator);
                }

                var regionIndicator2 = new RegionIndicatorViewModel
                {
                    StartPointX     = roiRect.StartX,
                    StartPointY     = roiRect.StartY,
                    EndPointX       = roiRect.EndX,
                    EndPointY       = roiRect.EndY,
                    RegionWidth     = roiRect.ROIWidth,
                    Stroke          = Brushes.Lime,
                    StrokeThickness = 2,
                    IsHidden        = false,
                };
                RegionIndicators.Add(regionIndicator2);
            }
        }
Пример #2
0
        public void Show_EdgeSearchingResults(IEnumerable <EdgeSearchingResult> edgeSearchingResults)
        {
            foreach (var edgeSearchingResult in edgeSearchingResults)
            {
                if (edgeSearchingResult.HasError)
                {
                    continue;
                }

                var lineIndicator = new LineIndicatorViewModel
                {
                    StartPointX     = edgeSearchingResult.EdgeLine.X1,
                    StartPointY     = edgeSearchingResult.EdgeLine.Y1,
                    EndPointX       = edgeSearchingResult.EdgeLine.X2,
                    EndPointY       = edgeSearchingResult.EdgeLine.Y2,
                    Stroke          = Brushes.Lime,
                    StrokeThickness = 2,
                };
                LineIndicators.Add(lineIndicator);
            }
        }
Пример #3
0
 public void Show_DistanceBetweenPointsResults(
     DistanceBetweenPointsResultCollection pointsResultCollection)
 {
     foreach (var result in pointsResultCollection)
     {
         var distanceLineIndicator = new LineIndicatorViewModel
         {
             StartPointX     = result.Point1.X,
             StartPointY     = result.Point1.Y,
             EndPointX       = result.Point2.X,
             EndPointY       = result.Point2.Y,
             Stroke          = Brushes.Lime,
             StrokeThickness = 2,
             StrokeDashArray = new DoubleCollection()
             {
                 2, 2
             },
         };
         LineIndicators.Add(distanceLineIndicator);
     }
 }
Пример #4
0
        public void Show_CircleSearchingResults(IList <CircleSearchingResult> CircleSearchingResults, Brush brush = null)
        {
            if (brush == null)
            {
                brush = Brushes.Lime;
            }

            foreach (var result in CircleSearchingResults)
            {
                var ci = new CircleIndicatorViewModel()
                {
                    CenterX         = result.Circle.CenterX,
                    CenterY         = result.Circle.CenterY,
                    Radius          = result.Circle.Radius,
                    Stroke          = brush,
                    StrokeThickness = 2,
                    StrokeDashArray = null,
                };
                if (result.IsNotFound)
                {
                    ci.Stroke = Brushes.Red;
                }

                CircleIndicators.Add(ci);



                if (result.Definition.Diameter_DisplayEnabled)
                {
                    var line = result.Circle.GetLine(45);

                    var lineIndicator = new LineIndicatorViewModel
                    {
                        StartPointX     = line.X1,
                        StartPointY     = line.Y1,
                        EndPointX       = line.X2,
                        EndPointY       = line.Y2,
                        Stroke          = Brushes.DeepPink,
                        StrokeThickness = 2,
                    };
                    LineIndicators.Add(lineIndicator);
                }
            }

            if (CircleSearchingResults.Count >= 2)
            {
                var Circle1CenterX = CircleSearchingResults[0].Circle.CenterX;
                var Circle1CenterY = CircleSearchingResults[0].Circle.CenterY;
                var vector1        = new Vector(Circle1CenterX, Circle1CenterY);


                for (int i = 1; i < CircleSearchingResults.Count; i++)
                {
                    var Circle2CenterX = CircleSearchingResults[i].Circle.CenterX;
                    var Circle2CenterY = CircleSearchingResults[i].Circle.CenterY;

                    var vector2 = new Vector(Circle2CenterX, Circle2CenterY);

                    var diff                = vector1 - vector2;
                    var distance            = diff.Length;
                    var DistanceBetweenC1C2 = distance;


                    var distanceLineIndicator = new LineIndicatorViewModel
                    {
                        StartPointX     = Circle1CenterX,
                        StartPointY     = Circle1CenterY,
                        EndPointX       = Circle2CenterX,
                        EndPointY       = Circle2CenterY,
                        Stroke          = brush,
                        StrokeThickness = 2,
                        StrokeDashArray = new DoubleCollection()
                        {
                            4, 4
                        },
                    };
                    LineIndicators.Add(distanceLineIndicator);
                }
            }
        }