using Microsoft.VisualBasic.CompilerServices; using MuchInfo.Chart.Data.EnumTypes; using MuchInfo.Chart.Infrastructure.Helpers; using MuchInfo.Chart.WPF.Controls.Drawing; using MuchInfo.Chart.WPF.Helpers; using MuchInfo.Chart.WPF.Primitives.Interfaces; using System; using System.Collections.Generic; using System.Windows; using System.Windows.Media; using System.Windows.Shapes; namespace MuchInfo.Chart.WPF.Primitives.Drawing { public class DrawingSpeedLines : Drawing2PointBase { private ExtendableLine drawingSpeedLines_1084; private List drawingSpeedLines_1085; public DrawingSpeedLines() { this.drawingSpeedLines_1085 = new List(); } public override DrawingToolType ToolType() { return DrawingToolType.SpeedLines; } public override IDrawingTool Clone() { return new DrawingSpeedLines { mColor = Colors.Cyan }; } protected override List GetDrawingPlots(Chart owner, ScaleLayer aScale, Rect aRect) { List list = new List(); bool flag = this.drawingSpeedLines_1084 == null; if (flag) { this.drawingSpeedLines_1084 = new ExtendableLine(this, owner); this.drawingSpeedLines_1084.Stroke = new SolidColorBrush(this.mColor); this.drawingSpeedLines_1084.StrokeThickness = 1.4; DoubleCollection doubleCollection = new DoubleCollection(); doubleCollection.Add(10.0); doubleCollection.Add(10.0); this.drawingSpeedLines_1084.SetMainStrokeDash(doubleCollection); this.drawingSpeedLines_1084.ExtensionStroke = this.drawingSpeedLines_1084.Stroke; } this.drawingSpeedLines_1085.Clear(); int num = 0; checked { int arg_111_0; int num2; do { Line line = new Line(); line.Stroke = (new SolidColorBrush(this.mColor)); line.StrokeThickness = (1.4); this.drawingSpeedLines_1085.Add(line); list.Add(line); num++; arg_111_0 = num; num2 = 2; } while (arg_111_0 <= num2); this.MoveDrawingToNewLocations(aRect); list.Add(this.drawingSpeedLines_1084); return list; } } public override string RootName { get { return "drawSPL"; } } public override string MenuDescription() { return LanguageManager.FindResource(LanguageConst.DrawingTool_Abbreviation_SpeedLine); } public override string Description() { return MenuDescription(); } public override string Abbreviation() { return "Speed"; } protected override void ColorChanged() { bool flag = this.drawingSpeedLines_1084 != null; if (flag) { this.drawingSpeedLines_1084.Stroke = new SolidColorBrush(this.mColor); this.drawingSpeedLines_1084.ExtensionStroke = this.drawingSpeedLines_1084.Stroke; } try { List.Enumerator enumerator = this.drawingSpeedLines_1085.GetEnumerator(); while (enumerator.MoveNext()) { Line current = enumerator.Current; current.Stroke = (new SolidColorBrush(this.mColor)); } } finally { //List.Enumerator enumerator; //enumerator.Dispose(); } } protected override void MoveDrawingToNewLocations(Rect aRect) { bool flag = this.drawingSpeedLines_1084 != null; if (flag) { this.drawingSpeedLines_1084.SetPosition(this.mDrawP1, this.mDrawP2, this.mDrawP1.X > this.mDrawP2.X, this.mDrawP1.X < this.mDrawP2.X, aRect); } Point point; Point point2; Point pointA = new Point(); Point pointB = new Point(); checked { point = new Point((double)((int)Math.Round(this.mDrawP1.X)), (double)((int)Math.Round(this.mDrawP1.Y))); point2 = new Point((double)((int)Math.Round(this.mDrawP2.X)), (double)((int)Math.Round(this.mDrawP2.Y))); Point point3 = new Point((double)((int)Math.Round(unchecked(this.mDrawP2.X / 2.0 + this.mDrawP1.X / 2.0))), (double)((int)Math.Round(unchecked(this.mDrawP2.Y / 2.0 + this.mDrawP1.Y / 2.0)))); Size size = new Size(12.0, 12.0); flag = (point.X != point2.X); } if (flag) { float num = (float)(point2.Y - point.Y); int num2 = 0; int arg_2DD_0; int num7; do { float num3 = 1f; flag = (num2 == 1); if (flag) { num3 = 0.6666667f; } flag = (num2 == 2); if (flag) { num3 = 0.333333343f; } float num4 = (float)((double)(num * num3) + point.Y); float num5 = (float)(((double)num4 - point.Y) / (point2.X - point.X)); flag = (point2.X > point.X); float num6; if (flag) { num6 = (float)aRect.Right; } else { num6 = (float)aRect.Left; } Point point4 = new Point(Math.Round(num6), point.Y + Math.Round((num6 - point.X) * num5)); double slope = GeometryHelper.LineSlope(ref point, ref point4); flag = (point4.Y < aRect.Top); if (flag) { point4 = new Point(GeometryHelper.XFromLine(point, slope, aRect.Top), aRect.Top); } flag = (point4.Y > aRect.Bottom); if (flag) { point4 = new Point(GeometryHelper.XFromLine(point, slope, aRect.Bottom), aRect.Bottom); } try { PointOfLineAtRectangleCalculator(ref pointA, ref pointB, point, point4, aRect); this.drawingSpeedLines_1085[num2].X1 = double.IsNaN(pointA.X) ? 0 : pointA.X; this.drawingSpeedLines_1085[num2].Y1 = double.IsNaN(pointA.Y) ? 0 : pointA.Y; this.drawingSpeedLines_1085[num2].X2 = double.IsNaN(pointB.X) ? 0 : pointB.X; this.drawingSpeedLines_1085[num2].Y2 = double.IsNaN(pointB.Y) ? 0 : pointB.Y; this.drawingSpeedLines_1085[num2].Visibility = (Visibility)(0); } catch { ; } checked { num2++; arg_2DD_0 = num2; num7 = 2; } } while (arg_2DD_0 <= num7); } else { try { PointOfLineAtRectangleCalculator(ref pointA, ref pointB, point, point2, aRect); this.drawingSpeedLines_1085[0].X1 = pointA.X; this.drawingSpeedLines_1085[0].Y1 = pointA.Y; this.drawingSpeedLines_1085[0].X2 = pointB.X; this.drawingSpeedLines_1085[0].Y2 = pointB.Y; this.drawingSpeedLines_1085[1].Visibility = (Visibility)(1); this.drawingSpeedLines_1085[2].Visibility = (Visibility)(1); } catch { ; } } this.drawingSpeedLines_1085[0].Visibility = (Visibility)(1); } public override ImageSource Icon() { ImageSource result; try { result = ImageHelper.GetImage("FibFan.png"); } catch (Exception expr_3A) { ProjectData.SetProjectError(expr_3A); result = null; ProjectData.ClearProjectError(); } return result; } protected override bool CanExtendLeft() { return false; } protected override bool CanExtendRight() { return false; } } }