public void ResizeBuffer(int width, int height) { _Width = width; _Height = height; var numBuffers = AllBuffers.Count; foreach (var buf in AllBuffers) { buf.Dispose(); } Buffers.Clear(); AllBuffers.Clear(); for (var i = 0; i < numBuffers; i++) { Buffers.Add( PPXDepthEngine.CreateRenderTarget(base.GraphicsDevice, 1, 0, SurfaceFormat.Color, Width, Height, DepthFormat.None) ); } AllBuffers = new List <RenderTarget2D>(Buffers); }
public Mq4Double this[int index] { get { var indexToGetFrom = CurrentIndex - index + Shift; if (indexToGetFrom < 0 || indexToGetFrom > CurrentIndex) { return(0); } if (indexToGetFrom >= _originalValues.Count) { return(MQ4Const.EMPTY_VALUE); } return(_originalValues[indexToGetFrom]); } set { var indexToSet = CurrentIndex - index + Shift; if (indexToSet < 0) { return; } _originalValues[indexToSet] = value; var valueToSet = value; if (valueToSet == MQ4Const.EMPTY_VALUE) { valueToSet = double.NaN; } if (indexToSet < 0) { return; } OutputDataSeries[indexToSet] = valueToSet; switch (_style) { case MQ4Const.DRAW_ARROW: var arrowName = GetArrowName(indexToSet); if (double.IsNaN(valueToSet)) { _chartObjects.RemoveObject(arrowName); } else { var color = Color.HasValue ? Color.Value : Colors.Red; _chartObjects.DrawText(arrowName, ArrowByIndex[_bufferIndex], indexToSet, valueToSet, VerticalAlignment.Center, HorizontalAlignment.Center, color); } break; case MQ4Const.DRAW_HISTOGRAM: //if (false) { var anotherLine = AllBuffers.FirstOrDefault(b => b.LineWidth == LineWidth && b != this); if (anotherLine != null) { var name = GetNameOfHistogramLineOnChartWindow(indexToSet); Colors color; if (this[index] > anotherLine[index]) { color = Color ?? Colors.Green; } else { color = anotherLine.Color ?? Colors.Green; } var lineWidth = LineWidth; if (lineWidth != 1 && lineWidth < 5) { lineWidth = 5; } _chartObjects.DrawLine(name, indexToSet, this[index], indexToSet, anotherLine[index], color, lineWidth); } } break; } } }