Exemplo n.º 1
0
        protected void Initialize(bool newColourBar)
        {
            colourMapUpdateTimer          = new DispatcherTimer();
            colourMapUpdateTimer.Interval = TimeSpan.FromSeconds(0.2);
            colourMap      = new ColourMap(ColourMapType.Jet, 256);
            imageRectangle = new Path();
            Geometry geometry = new RectangleGeometry(bounds);

            imageRectangle.Data = geometry;
            RenderOptions.SetBitmapScalingMode(imageRectangle, BitmapScalingMode.NearestNeighbor);
#if ILNumerics
            if (useILArray)
            {
                indices = UnderlyingILArrayToIndexArray(colourMap.Length);
            }
#endif
            if (!useILArray)
            {
                indices = UnderlyingToIndexArray(colourMap.Length);
            }
            writeableBitmap     = new WriteableBitmap(IndexArrayToBitmapSource());
            imageBrush          = new ImageBrush(writeableBitmap);
            imageRectangle.Fill = imageBrush;
            Bounds = new Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight);
            if (newColourBar)
            {
                colourBar = new ColourBar(ColourMap);
#if ILNumerics
                if (useILArray)
                {
                    colourBar.Min = underlyingILArrayData.MinValue;
                    colourBar.Max = underlyingILArrayData.MaxValue;
                }
#endif
                if (!useILArray)
                {
                    colourBar.Min = underlyingData.Min();
                    colourBar.Max = underlyingData.Max();
                }
            }
        }
Exemplo n.º 2
0
        protected void Initialize(bool newColourBar)
        {
            colourMapUpdateTimer = new DispatcherTimer();
            colourMapUpdateTimer.Interval = TimeSpan.FromSeconds(0.2);
            colourMap = new ColourMap(ColourMapType.Jet, 256);
            imageRectangle = new Path();
            Geometry geometry = new RectangleGeometry(Bounds);
            imageRectangle.Data = geometry;
            RenderOptions.SetBitmapScalingMode(imageRectangle, BitmapScalingMode.NearestNeighbor);
#if ILNumerics
            if (useILArray)
            {
                indices = UnderlyingILArrayToIndexArray(colourMap.Length);
            }
#endif
            if (!useILArray) indices = UnderlyingToIndexArray(colourMap.Length);
            writeableBitmap = new WriteableBitmap(IndexArrayToBitmapSource());
            imageBrush = new ImageBrush(writeableBitmap);
            imageRectangle.Fill = imageBrush;
            Bounds = new Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight);
            if (newColourBar)
            {
                colourBar = new ColourBar(ColourMap);
#if ILNumerics
                if (useILArray)
                {
                    colourBar.Min = underlyingILArrayData.MinValue;
                    colourBar.Max = underlyingILArrayData.MaxValue;
                }
#endif
                if (!useILArray)
                {
                    colourBar.Min = underlyingData.Min();
                    colourBar.Max = underlyingData.Max();
                }
            }
        }