/// <summary> /// Receives a Hana result set (and its meta data) and builds a drawing result set, including the coloring of points /// </summary> internal void BuildDrawingResultSet(List<ResultSetHana> resultSetHanaList, ResultSetHanaMetadata meta) { _resultSetHanaMeta = meta; // Calculate the largest rectangle with aspect ratio of the result set, that can fit in the viewport float widthMandle = Math.Abs(_resultSetHanaMeta.Xmax - _resultSetHanaMeta.Xmin); float heightMandle = Math.Abs(_resultSetHanaMeta.Ymax - _resultSetHanaMeta.Ymin); float aspectRatioMandle = widthMandle / heightMandle; Rectangle viewportAtOrigin = new Rectangle(0, 0, _viewport.Width, _viewport.Height); Rectangle biggestRectangleThatCanFitInViewport = viewportAtOrigin.GetLargestRectangle(aspectRatioMandle, 1f); // The calculation above is just to give us the right scale and coordinates to fit in the viewport float scale = biggestRectangleThatCanFitInViewport.Width / widthMandle; float xStart = _viewport.X - (scale * _resultSetHanaMeta.Xmin); float yStart = _viewport.Y - (scale * _resultSetHanaMeta.Ymin); foreach (ResultSetHana rs in resultSetHanaList) { // Color int a = 0; int r = 0; int g = 0; int b = 0; ConvertEscapedToColor(this.ColorAlgorithm, rs.Escaped, out a, out r, out g, out b); ResultSetDraw rsd = new ResultSetDraw() { Id = rs.Id, XRaw = rs.X, YRaw = rs.Y, EscapedRaw = rs.Escaped, XDraw = xStart + (rs.X * scale), YDraw = yStart + (rs.Y * scale), Pen = new Pen(Color.FromArgb(a, r, g, b), BrushWidth), }; _resultSetDraw.Add(rsd); } }
internal void Reset() { _resultSetDraw.Clear(); _resultSetHanaMeta = new ResultSetHanaMetadata(); }