public void HighlightLineUsingValues(double xv1, double yv1, double xv2, double yv2) { // ------------------------------- // works-ish double xrange = Math.Abs(Config.XMin) + Config.XMax; double yrange = Math.Abs(Config.YMin) + Config.YMax; double xper = (Config.CanvasWidth - Config.XStart) / xrange; double yper = (Config.CanvasHeight - Config.YStart) / yrange; var cp_x1 = (Math.Abs(Config.XMin) + xv1) * xper + Config.XStart; var cp_y1 = (Math.Abs(Config.YMax) - yv1) * yper + Config.YStart; var cp_x2 = (Math.Abs(Config.XMin) + xv2) * xper + Config.XStart; var cp_y2 = (Math.Abs(Config.YMax) - yv2) * yper + Config.YStart; // ------------------------------- var line = new Line(); line.Stroke = new SolidColorBrush(Colors.Yellow); line.StrokeThickness = 6; line.Fill = new SolidColorBrush(Colors.Yellow); line.X1 = cp_x1; line.Y1 = cp_y1; line.X2 = cp_x2; line.Y2 = cp_y2; var cc = new CanvasComponent(); cc.AddUiElement(line); cc.SendToFarBack(); ActiveLayer.AddComponent(cc); }
public void HighlightPointUsingValues(double xv1, double yv1, int highlightLevel) { double xrange = Math.Abs(Config.XMin) + Config.XMax; double yrange = Math.Abs(Config.YMin) + Config.YMax; double xper = (Config.CanvasWidth - Config.XStart) / xrange; double yper = (Config.CanvasHeight - Config.YStart) / yrange; var cxp = (Math.Abs(Config.XMin) + xv1) * xper + Config.XStart; var cyp = (Math.Abs(Config.YMax) - yv1) * yper + Config.YStart; // ------------------------------- double size = 12; double offset = size / 2; var ellipse = CreateEllipse(size, cxp - offset, cyp - offset); ellipse.Stroke = new SolidColorBrush(Colors.Yellow); var cc = new CanvasComponent(); cc.AddUiElement(ellipse); cc.SendToFarBack(); ActiveLayer.AddComponent(cc); }
private void CreateDefaultShapes() { gridPointHighlight = new CanvasComponent(); double highlightPointSize = 9; highlightPointOffset = highlightPointSize / 2; Ellipse e = CreateEllipse(highlightPointSize, -10, -10); e.Stroke = new SolidColorBrush(Colors.Red); e.Visibility = Visibility.Collapsed; gridPointHighlight.AddUiElement(e); gridPointHighlight.SendToFarBack(); GetBaseLayer().AddComponent(gridPointHighlight); }