Ejemplo n.º 1
0
        private void DrawScope(Point windowPoint, Point picturePoint)
        {
            int    SCOPE_RADIUS          = 10;
            int    size                  = 300;
            int    maxT                  = curSolver.TSize;
            int    maxX                  = curSolver.XSize;
            double widthRatio            = maxT / graphImage.ActualWidth;
            double heightRatio           = maxX / graphImage.ActualHeight;
            int    kRadius               = (int)(SCOPE_RADIUS * widthRatio);
            int    jRadius               = (int)(SCOPE_RADIUS * heightRatio);
            int    kCursor               = (int)(picturePoint.X * widthRatio);
            int    jCursor               = (int)(picturePoint.Y * heightRatio);
            WriteableBitmapData image    = vis.DrawScope(kCursor, jCursor, kRadius, jRadius);
            WriteableBitmap     scopeBmp = new WriteableBitmap(image.Width, image.Height, 96, 96, PixelFormats.Bgr32, null);

            scopeBmp.WritePixels(image.Dimentions, image.Pixels, image.NStride, 0, 0);
            scopeImage.Source = scopeBmp;
            scopeImage.Width  = size;
            scopeImage.Height = size;

            scopeCanvas.Margin = new Thickness(windowPoint.X - size / 2, windowPoint.Y - size - 5, 0, 0);
            scopeCanvas.Width  = size;
            scopeCanvas.Height = size;
            if (scopeCanvas.Visibility != Visibility.Visible)
            {
                scopeCanvas.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 2
0
        private void UpdateVisualization(double[,] solution, string name)
        {
            vis = new Visualization(solution, VISUALIZATION_WIDTH, VISUALIZATION_HEIGHT);

            WriteableBitmapData image = vis.Draw();

            WriteableBitmap bmp = new WriteableBitmap(image.Width, image.Height, 96, 96, PixelFormats.Bgr32, null);

            bmp.WritePixels(image.Dimentions, image.Pixels, image.NStride, 0, 0);
            graphImage.Source = bmp;

            image = vis.DrawProfile(200, 500);
            WriteableBitmap profileBmp = new WriteableBitmap(image.Width, image.Height, 96, 96, PixelFormats.Bgr32, null);

            profileBmp.WritePixels(image.Dimentions, image.Pixels, image.NStride, 0, 0);
            profileImage.Source = profileBmp;

            UpdateVisSizes();
            visContainer.Visibility = Visibility.Visible;

            RunPlotWindow(GetLastLayer(solution), name);
        }