示例#1
0
        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);
        }
示例#2
0
        public void DrawLineUsingIndexes(int xi1, int yi1, int xi2, int yi2)
        {
            double xp1 = xi1 * Config.XIncrement + Config.XStart;
            double yp1 = yi1 * Config.YIncrement + Config.YStart;

            double xp2 = xi2 * Config.XIncrement + Config.XStart;
            double yp2 = yi2 * Config.YIncrement + Config.YStart;

            var line = new Line();

            line.Stroke          = new SolidColorBrush(Colors.Red);
            line.StrokeThickness = 1;
            line.Fill            = new SolidColorBrush(Colors.Red);

            line.X1  = xp1;
            line.Y1  = yp1;
            line.X2  = xp2;
            line.Y2  = yp2;
            line.Tag = new LineModel
            {
                StartPoint = new Vector(xp1, yp1, xi1, yi1),
                EndPoint   = new Vector(xp2, yp2, xi2, yi2)
            };

            var cc = new CanvasComponent();

            cc.AddUiElement(line);

            ActiveLayer.AddComponent(cc);
        }
示例#3
0
        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);
        }