public void Show_CircleSearchingDefinitions(IEnumerable <CircleSearchingDefinition> circleSearchingDefinitions, Brush brush = null) { if (brush == null) { brush = Brushes.Green; } foreach (var circleSearchingDefinition in circleSearchingDefinitions) { var innerCircle = new CircleIndicatorViewModel() { CenterX = circleSearchingDefinition.CenterX, CenterY = circleSearchingDefinition.CenterY, Radius = circleSearchingDefinition.InnerRadius, Stroke = brush, StrokeThickness = 1, StrokeDashArray = new DoubleCollection() { 4, 4 }, }; CircleIndicators.Add(innerCircle); var outerCircle = new CircleIndicatorViewModel() { CenterX = circleSearchingDefinition.CenterX, CenterY = circleSearchingDefinition.CenterY, Radius = circleSearchingDefinition.OuterRadius, Stroke = brush, StrokeThickness = 1, StrokeDashArray = new DoubleCollection() { 4, 4 }, }; CircleIndicators.Add(outerCircle); } }
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); } } }