コード例 #1
0
        public override void Render(double time, double timestretch, XElement channel)
        {
            int channelNum    = 0;
            int numOfChannels = 0;

            // prüfen, ob eine bestimmte RenderSlice oder alle RenderSlice gerendert werden.
            if (channel != null)
            {
                // wenn nur eine bestimmte RS gerendert werden soll, werden die For-Schleife nur einmal ausgeführt.
                channelNum    = MeasurementEntry.GetChannelNum(channel);
                numOfChannels = channelNum + 1;
            }
            else
            {
                // Sonst werden alle Kanäle (alle RenderSlice) durch die Schleife neu gerendert.
                channelNum    = 0;
                numOfChannels = this.channels;
            }

            for (int c = channelNum; c < numOfChannels; ++c)
            {
                if (RenderSlices[c] != null)
                {
                    ((RasterRenderSlice)RenderSlices[c]).WBmp.Lock();
                }
            }

            double samplesperpixel = this.samplespersec * timestretch / this.imageheight;
            // (kontinuierliche) nummer des samples
            double s       = time * this.samplespersec;
            double peakend = s + samplesperpixel;

            if (RendererManager.SampleAndHold)
            {
                this.RenderSampleAndHold(this.imageheight, samplesperpixel, s, peakend, channelNum, numOfChannels);
            }
            if (RendererManager.Point)
            {
                this.RenderPoint(this.imageheight, samplesperpixel, s, peakend, channelNum, numOfChannels);
            }
            if (RendererManager.Linear)
            {
                this.RenderLinear(this.imageheight, samplesperpixel, s, peakend, channelNum, numOfChannels);
            }

            for (int c = channelNum; c < numOfChannels; ++c)
            {
                if (RenderSlices[c] != null)
                {
                    if (((RasterRenderSlice)RenderSlices[c]).WBmp.PixelWidth != this.dirtyrect.Width)
                    {
                        this.dirtyrect.Width = ((RasterRenderSlice)RenderSlices[c]).WBmp.PixelWidth;
                    }
                    ((RasterRenderSlice)RenderSlices[c]).WBmp.AddDirtyRect(this.dirtyrect);
                    ((RasterRenderSlice)RenderSlices[c]).WBmp.Unlock();
                }
            }
        }
コード例 #2
0
        private void DropChannel(XElement channel, ObservableCollection <RenderSlice> rslist)
        {
            Renderer r = RendererManager.GetRenderer(channel.Parent);

            if (r != null)
            {
                List <RenderSlice> renderSliceList = new List <RenderSlice>();

                int channelNum = MeasurementEntry.GetChannelNum(channel);

                if (channelNum != -1)
                {
                    RenderSlice renderSlice = r.GetRenderSlice(channelNum);

                    this.AttachKillHandler(renderSlice);
                    this.MoveRenderSlice(renderSlice, rslist);

                    renderSliceList.Add(renderSlice);
                }

                RendererManager.AutoZoomIndividual(renderSliceList);
            }
        }
コード例 #3
0
        /// <summary>
        /// This function renders a single Renderer Object with all render slices (when channel is null) or only a specific render slice or a renderer (when channel is not null).
        /// </summary>
        /// <param name="time">time in seconds at the beginning of the signal pane</param>
        /// <param name="timestretch">length of the signal pane</param>
        /// <param name="channel">specific channel</param>
        public override void Render(double time, double timestretch, XElement channel)
        {
            int channelNum    = 0;
            int numOfChannels = 0;

            // prüfen, ob eine bestimmte RenderSlice oder alle RenderSlice gerendert werden.
            if (channel != null)
            {
                // wenn nur eine bestimmte RS gerendert werden soll, werden die For-Schleife nur einmal ausgeführt.
                channelNum    = MeasurementEntry.GetChannelNum(channel);
                numOfChannels = channelNum + 1;
            }
            else
            {
                // Sonst werden alle Kanäle (alle RenderSlice) durch die Schleife neu gerendert.
                channelNum    = 0;
                numOfChannels = this.channels;
            }

            // Locks all RenderSlice's bitmaps
            for (int a = channelNum; a < numOfChannels; ++a)
            {
                if (this.RenderSlices[a] != null)
                {
                    ((RasterRenderSlice)this.RenderSlices[a]).WBmp.Lock();
                }
            }

            double samplesperpixel = this.samplespersec * timestretch / this.imageheight;

            // Perform signal interpolation, compression or just render the signal.
            if (samplesperpixel < 1)
            {
                if (RendererManager.SincInterpolation)
                {
                    this.RenderSinc(0, this.imageheight, time * this.samplespersec, samplesperpixel, channelNum, numOfChannels);
                }
                else
                {
                    this.RenderSampleAndHold(0, this.imageheight, time * this.samplespersec, samplesperpixel, channelNum, numOfChannels);
                }
            }
            else
            {
                if (RendererManager.PeakSamples)
                {
                    this.RenderPeak(0, this.imageheight, time * this.samplespersec, samplesperpixel, channelNum, numOfChannels);
                }
                else
                {
                    this.RenderSkip(0, this.imageheight, time * this.samplespersec, samplesperpixel, channelNum, numOfChannels);
                }
            }

            // Change parts of the old bitmap with the new rendered bitmap.
            for (int a = channelNum; a < numOfChannels; ++a)
            {
                if (RenderSlices[a] != null)
                {
                    if (((RasterRenderSlice)this.RenderSlices[a]).WBmp.PixelWidth != this.dirtyrect.Width)
                    {
                        this.dirtyrect.Width = ((RasterRenderSlice)this.RenderSlices[a]).WBmp.PixelWidth;
                    }
                    ((RasterRenderSlice)this.RenderSlices[a]).WBmp.AddDirtyRect(this.dirtyrect);
                    ((RasterRenderSlice)this.RenderSlices[a]).WBmp.Unlock();
                }
            }
        }