public void Paint(Graphics g, IPlotArea layer, Altaxo.Graph.Gdi.Plot.Data.Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData) { if (_fillToPrevPlotItem && null != prevItemData) { PaintFillToPrevPlotItem(g, layer, pdata, prevItemData); } if (_fillToNextPlotItem && null != nextItemData) { // ensure that brush and pen are cached if (null != _fillBrush) { _fillBrush.SetEnvironment(new RectangleD2D(PointD2D.Empty, layer.Size), BrushX.GetEffectiveMaximumResolution(g, 1)); } PlotRangeList rangeList = pdata.RangeList; int rangelistlen = rangeList.Count; if (rangelistlen > 0) { // we have to ignore the missing points here, thus all ranges can be plotted // as one range, i.e. continuously // for this, we create the totalRange, which contains all ranges var totalRange = new PlotRange(rangeList[0].LowerBound, rangeList[rangelistlen - 1].UpperBound); _cachedPaintOneRange(g, pdata, totalRange, layer, nextItemData); } } }
public void Paint(System.Drawing.Graphics g, IPlotArea layer, Altaxo.Graph.Gdi.Plot.Data.Processed2DPlotData pdata) { if (_isHorizontalStyle) { PaintXErrorBars(g, layer, pdata); } else { PaintYErrorBars(g, layer, pdata); } }
public void PrepareGroupStyles(Altaxo.Graph.Gdi.Plot.Groups.PlotGroupStyleCollection externalGroups, Altaxo.Graph.Gdi.Plot.Groups.PlotGroupStyleCollection localGroups, IPlotArea layer, Altaxo.Graph.Gdi.Plot.Data.Processed2DPlotData pdata) { // nothing to collect here }
protected void PaintXErrorBars(System.Drawing.Graphics g, IPlotArea layer, Altaxo.Graph.Gdi.Plot.Data.Processed2DPlotData pdata) { // Plot error bars for the independent variable (x) PlotRangeList rangeList = pdata.RangeList; PointF[] ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates; INumericColumn posErrCol = _positiveErrorColumn.Document; INumericColumn negErrCol = _negativeErrorColumn.Document; if (posErrCol == null && negErrCol == null) { return; // nothing to do if both error columns are null } System.Drawing.Drawing2D.GraphicsPath errorBarPath = new System.Drawing.Drawing2D.GraphicsPath(); Region oldClippingRegion = g.Clip; Region newClip = (Region)oldClippingRegion.Clone(); foreach (PlotRange r in rangeList) { int lower = r.LowerBound; int upper = r.UpperBound; int offset = r.OffsetToOriginal; for (int j = lower; j < upper; j++) { AltaxoVariant x = pdata.GetXPhysical(j + offset); Logical3D lm = layer.GetLogical3D(pdata, j + offset); lm.RX += _cachedLogicalShiftOfIndependent; if (lm.IsNaN) { continue; } Logical3D lh = lm; Logical3D ll = lm; bool lhvalid = false; bool llvalid = false; if (posErrCol != null) { lh.RX = layer.XAxis.PhysicalVariantToNormal(x + Math.Abs(posErrCol[j + offset])); lhvalid = !lh.IsNaN; } if (negErrCol != null) { ll.RX = layer.XAxis.PhysicalVariantToNormal(x - Math.Abs(negErrCol[j + offset])); llvalid = !ll.IsNaN; } if (!(lhvalid || llvalid)) { continue; // nothing to do for this point if both pos and neg logical point are invalid. } // now paint the error bar if (_symbolGap) // if symbol gap, then clip the painting, exclude a rectangle of size symbolSize x symbolSize { double xlm, ylm; layer.CoordinateSystem.LogicalToLayerCoordinates(lm, out xlm, out ylm); newClip.Union(oldClippingRegion); newClip.Exclude(new RectangleF((float)(xlm - _symbolSize / 2), (float)(ylm - _symbolSize / 2), _symbolSize, _symbolSize)); g.Clip = newClip; } if (lhvalid && llvalid) { errorBarPath.Reset(); layer.CoordinateSystem.GetIsoline(errorBarPath, ll, lm); layer.CoordinateSystem.GetIsoline(errorBarPath, lm, lh); g.DrawPath(_strokePen, errorBarPath); } else if (llvalid) { layer.CoordinateSystem.DrawIsoline(g, _strokePen, ll, lm); } else if (lhvalid) { layer.CoordinateSystem.DrawIsoline(g, _strokePen, lm, lh); } // now the end bars if (_showEndBars) { if (lhvalid) { PointF outDir; layer.CoordinateSystem.GetNormalizedDirection(lm, lh, 1, new Logical3D(0, 1), out outDir); outDir.X *= _symbolSize / 2; outDir.Y *= _symbolSize / 2; double xlay, ylay; layer.CoordinateSystem.LogicalToLayerCoordinates(lh, out xlay, out ylay); // Draw a line from x,y to g.DrawLine(_strokePen, (float)(xlay - outDir.X), (float)(ylay - outDir.Y), (float)(xlay + outDir.X), (float)(ylay + outDir.Y)); } if (llvalid) { PointF outDir; layer.CoordinateSystem.GetNormalizedDirection(lm, ll, 1, new Logical3D(0, 1), out outDir); outDir.X *= _symbolSize / 2; outDir.Y *= _symbolSize / 2; double xlay, ylay; layer.CoordinateSystem.LogicalToLayerCoordinates(ll, out xlay, out ylay); // Draw a line from x,y to g.DrawLine(_strokePen, (float)(xlay - outDir.X), (float)(ylay - outDir.Y), (float)(xlay + outDir.X), (float)(ylay + outDir.Y)); } } } } g.Clip = oldClippingRegion; }
public void PrepareGroupStyles(Altaxo.Graph.Gdi.Plot.Groups.PlotGroupStyleCollection externalGroups, Altaxo.Graph.Gdi.Plot.Groups.PlotGroupStyleCollection localGroups, IPlotArea layer, Altaxo.Graph.Gdi.Plot.Data.Processed2DPlotData pdata) { if (!_independentColor) { Graph.Plot.Groups.ColorGroupStyle.PrepareStyle(externalGroups, localGroups, delegate() { return(PlotColors.Colors.GetPlotColor(this._strokePen.Color)); }); } // SkipFrequency should be the same for all sub plot styles, so there is no "private" property SkipFrequencyGroupStyle.PrepareStyle(externalGroups, localGroups, delegate() { return(SkipFrequency); }); // note: symbol size and barposition are only applied, but not prepared // this item can not be used as provider of a symbol size }