public void PaintLine(IGraphicsContext3D g, IPlotArea layer) { if (IsAxisLineEnabled) { _axisLineStyle.Paint(g, layer, _cachedAxisInfo, _customTickSpacing); } }
/// <summary> /// Draws the specified background /// </summary> /// <param name="g">The drawing context.</param> /// <param name="itemRectangle">Position and size of the item for which this background is intended. For text, this is the position and size of the text rectangle, already with a margin around. /// This parameter should have the same size as was used in the previous call to <see cref="Measure(RectangleD3D)" /></param> /// <param name="material">The material to use for this background.</param> /// <exception cref="NotImplementedException"></exception> public void Draw(IGraphicsContext3D g, RectangleD3D itemRectangle, IMaterial material) { var rectangleToDraw = GetRectangleToDraw(itemRectangle); var buffers = g.GetPositionNormalIndexedTriangleBuffer(material); if (null != buffers.PositionNormalColorIndexedTriangleBuffer) { var c = material.Color.Color; var voffs = buffers.PositionNormalColorIndexedTriangleBuffer.VertexCount; Altaxo.Drawing.D3D.SolidCube.Add( rectangleToDraw.X, rectangleToDraw.Y, rectangleToDraw.Z, rectangleToDraw.SizeX, rectangleToDraw.SizeY, rectangleToDraw.SizeZ, (point, normal) => buffers.PositionNormalColorIndexedTriangleBuffer.AddTriangleVertex(point.X, point.Y, point.Z, normal.X, normal.Y, normal.Z, c.ScR, c.ScG, c.ScB, c.ScA), (i1, i2, i3) => buffers.IndexedTriangleBuffer.AddTriangleIndices(i1 + voffs, i2 + voffs, i3 + voffs), ref voffs); } else if (null != buffers.PositionNormalIndexedTriangleBuffer) { var voffs = buffers.PositionNormalIndexedTriangleBuffer.VertexCount; Altaxo.Drawing.D3D.SolidCube.Add( rectangleToDraw.X, rectangleToDraw.Y, rectangleToDraw.Z, rectangleToDraw.SizeX, rectangleToDraw.SizeY, rectangleToDraw.SizeZ, (point, normal) => buffers.PositionNormalIndexedTriangleBuffer.AddTriangleVertex(point.X, point.Y, point.Z, normal.X, normal.Y, normal.Z), (i1, i2, i3) => buffers.IndexedTriangleBuffer.AddTriangleIndices(i1 + voffs, i2 + voffs, i3 + voffs), ref voffs); } else { throw new NotImplementedException(); } }
public override void Draw(IGraphicsContext3D g, DrawContext dc, double xbase, double ybase, double zbase) { var mylayer = (HostLayer)dc.LinkedObject; var layer = mylayer as XYZPlotLayer; if (_layerNumber >= 0 && mylayer.SiblingLayers != null && _layerNumber < mylayer.SiblingLayers.Count) { layer = mylayer.SiblingLayers[_layerNumber] as XYZPlotLayer; } if (null == layer) { return; } if (_plotNumber < layer.PlotItems.Flattened.Length) { var fontInfo = dc.FontCache.GetFontInfo(Style.FontId); IGPlotItem pa = layer.PlotItems.Flattened[_plotNumber]; var symbolpos = new PointD3D(xbase, (ybase + 0.5 * fontInfo.cyDescent - 0.5 * fontInfo.cyAscent), 0); var symbolRect = new RectangleD3D(symbolpos, new VectorD3D(SizeX, 0, 0)); symbolRect = symbolRect.WithPadding(0, fontInfo.Size, 0); pa.PaintSymbol(g, symbolRect); if (!dc.bForPreview) { var volume = new RectangleTransformedD3D( new RectangleD3D(symbolpos.X, symbolpos.Y - 0.5 * fontInfo.cyLineSpace, 0, SizeX, fontInfo.cyLineSpace, 0), dc.transformMatrix); dc._cachedSymbolPositions.Add(volume, pa); } } }
public static void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { for (int i = coll.Count - 1; i >= 0; --i) { coll[i].Paint(g, paintContext, layer, i == coll.Count - 1 ? null : coll[i + 1], i == 0 ? null : coll[i - 1]); } }
public virtual void PaintLine(IGraphicsContext3D g, PointD3D beg, PointD3D end) { if (null != _linePen) { g.DrawLine(_linePen, beg, end); } }
public override void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext context, IPlotArea layer, IGPlotItem previousPlotItem, IGPlotItem nextPlotItem) { if (null != _plotStyle) { _plotStyle.Paint(g, layer, _plotData); } }
/// <summary> /// Paint the density image in the layer. /// </summary> /// <param name="gfrx">The graphics context painting in.</param> /// <param name="gl">The layer painting in.</param> /// <param name="plotObject">The data to plot.</param> public void Paint(IGraphicsContext3D gfrx, IPlotArea gl, object plotObject) // plots the curve with the choosen style { if (!(plotObject is XYZMeshedColumnPlotData)) { return; // we cannot plot any other than a TwoDimMeshDataAssociation now } var myPlotAssociation = (XYZMeshedColumnPlotData)plotObject; myPlotAssociation.DataTableMatrix.GetWrappers( gl.XAxis.PhysicalVariantToNormal, // transformation function for row header values Altaxo.Calc.RMath.IsFinite, // selection functiton for row header values gl.YAxis.PhysicalVariantToNormal, // transformation function for column header values Altaxo.Calc.RMath.IsFinite, // selection functiton for column header values out var matrix, out var logicalRowHeaderValues, out var logicalColumnHeaderValues ); int cols = matrix.ColumnCount; int rows = matrix.RowCount; if (cols <= 1 || rows <= 1) { return; // we cannot plot anything if one length is zero or one } BuildImage(gfrx, gl, myPlotAssociation, matrix, logicalRowHeaderValues, logicalColumnHeaderValues); }
public void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, bool bForPreview) { //_isStructureInSync = false; _isMeasureInSync = false; // Change: interpret text every time in order to update plot items and \ID if (!_isStructureInSync) { // this.Interpret(g); InterpretText(); _isStructureInSync = true; _isMeasureInSync = false; } using (var fontCache = new FontCache()) { if (!_isMeasureInSync) { // this.MeasureStructure(g, obj); MeasureGlyphs(g, fontCache, paintContext); MeasureBackground(g, _rootNode.SizeX, _rootNode.SizeY, _rootNode.SizeZ); _isMeasureInSync = true; } _cachedSymbolPositions.Clear(); var gs = g.SaveGraphicsState(); var bounds = Bounds; var transformmatrix = Matrix4x3.NewScalingShearingRotationDegreesTranslation( ScaleX, ScaleY, ScaleZ, ShearX, ShearY, ShearZ, RotationX, RotationY, RotationZ, _location.AbsolutePivotPositionX, _location.AbsolutePivotPositionY, _location.AbsolutePivotPositionZ); transformmatrix.TranslatePrepend(bounds.X, bounds.Y, bounds.Z); if (!bForPreview) { TransformGraphics(g); g.TranslateTransform(bounds.X, bounds.Y, bounds.Z); } // first of all paint the background PaintBackground(g); var dc = new DrawContext { FontCache = fontCache, bForPreview = bForPreview, LinkedObject = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing <HostLayer>(this), transformMatrix = transformmatrix, _cachedSymbolPositions = _cachedSymbolPositions }; DrawGlyphs(g, dc, _cachedTextOffset.X, _cachedTextOffset.Y, _cachedTextOffset.Z); g.RestoreGraphicsState(gs); } }
/// <summary> /// Paints the grid of all planes, but not the background. /// </summary> /// <param name="g">The g.</param> /// <param name="layer">The layer.</param> public void PaintGrid(IGraphicsContext3D g, IPlotArea layer) { for (int i = 0; i < _innerList.Count; ++i) { _innerList[i].PaintGrid(g, layer); } }
public void PaintTitle(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer) { if (IsTitleEnabled) { _axisTitle.Paint(g, paintContext); } }
public void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer) { for (int i = 0; i < _axisStyles.Count; ++i) { _axisStyles[i].Paint(g, paintContext, layer); } }
public void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer, Func <CSLineID, CSAxisInformation> GetAxisStyleInformation) { PaintLine(g, layer); PaintMajorLabels(g, layer); PaintMinorLabels(g, layer); PaintTitle(g, paintContext, layer); }
public void PaintChild(IGraphicsContext3D g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll, int indexOfChild) { var plotDataDict = paintContext.GetValueOrDefault <Dictionary <G3DPlotItem, Processed3DPlotData> >(this); if (null == plotDataDict) // if initializing this dict was not successfull, then make a normal plot { coll[indexOfChild].Paint(g, paintContext, layer, indexOfChild == coll.Count - 1 ? null : coll[indexOfChild + 1], indexOfChild == 0 ? null : coll[indexOfChild - 1]); return; } Processed3DPlotData prevPlotData = null; Processed3DPlotData nextPlotData = null; if ((indexOfChild + 1) < coll.Count && (coll[indexOfChild + 1] is G3DPlotItem)) { prevPlotData = plotDataDict[coll[indexOfChild + 1] as G3DPlotItem]; } if (indexOfChild > 0 && (coll[indexOfChild - 1] is G3DPlotItem)) { nextPlotData = plotDataDict[coll[indexOfChild - 1] as G3DPlotItem]; } if (coll[indexOfChild] is G3DPlotItem) { var gpi = coll[indexOfChild] as G3DPlotItem; gpi.Paint(g, layer, plotDataDict[gpi], prevPlotData, nextPlotData); } else { coll[indexOfChild].Paint(g, paintContext, layer, null, null); } }
public void Paint(IGraphicsContext3D g, IPlotArea layer, CSPlaneID plane, int axisnumber) { if (!_showGrid) { return; } Scale axis = layer.Scales[axisnumber]; TickSpacing ticking = layer.Scales[axisnumber].TickSpacing; var layerRect = new RectangleD3D(PointD3D.Empty, layer.Size); if (_showZeroOnly) { var var = new Altaxo.Data.AltaxoVariant(0.0); double rel = axis.PhysicalVariantToNormal(var); //_majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); if (rel >= 0 && rel <= 1) { var logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, rel); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MajorPen, line); } } else { double[] ticks; if (_showMinor) { //_minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMinorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { var logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, ticks[i]); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MinorPen, line); } } //MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1)); ticks = ticking.GetMajorTicksNormal(axis); for (int i = 0; i < ticks.Length; ++i) { var logV = new Logical3D(); logV.SetR(plane.PerpendicularAxisNumber, plane.LogicalValue); logV.SetR(axisnumber, ticks[i]); var thirdAxisNumber = Logical3D.GetPerpendicularAxisNumber(plane.PerpendicularAxisNumber, axisnumber); var line = layer.CoordinateSystem.GetIsoline(logV.WithR(thirdAxisNumber, 0), logV.WithR(thirdAxisNumber, 1)); g.DrawLine(MajorPen, line); } } }
public override void Draw(IGraphicsContext3D g, DrawContext dc, double xbase, double ybase, double zbase) { if (_child != null) { var fontInfo = dc.FontCache.GetFontInfo(Style.FontId); _child.Draw(g, dc, xbase, ybase + 0.35 * fontInfo.cyAscent, zbase); } }
public override void Paint(IGraphicsContext3D g, IPaintContext context) { var gs = g.SaveGraphicsState(); g.PrependTransform(_transformation); g.DrawLine(_linePen, Bounds.Location, Bounds.LocationPlusSize); g.RestoreGraphicsState(gs); }
/// <summary> /// Template to make a line draw. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="pdata">The plot data. Don't use the Range property of the pdata, since it is overriden by the next argument.</param> /// <param name="range">The plot range to use.</param> /// <param name="layer">Graphics layer.</param> /// <param name="pen">The pen to draw the line.</param> /// <param name="symbolGap">The size of the symbol gap. Argument is the original index of the data. The return value is the absolute symbol gap at this index. /// This function is null if no symbol gap is required.</param> /// <param name="skipFrequency">Skip frequency. Normally 1, thus all gaps are taken into account. If 2, only every 2nd gap is taken into account, and so on.</param> /// <param name="connectCircular">If true, the end of the line is connected with the start of the line.</param> public abstract void Paint( IGraphicsContext3D g, Processed3DPlotData pdata, PlotRange range, IPlotArea layer, PenX3D pen, Func<int, double> symbolGap, int skipFrequency, bool connectCircular);
public void SetDrawing(IGraphicsContext3D drawing) { if (null == drawing) { throw new ArgumentNullException(); } _scene.SetDrawing((D3D10GraphicsContext)drawing); }
/// <summary> /// Needed for coordinate transforming styles to plot the data. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="layer">The plot layer.</param> /// <param name="plotdata">The plot data. Since the data are transformed, you should not rely that the physical values in this item correspond to the area coordinates.</param> /// <param name="prevPlotData">Plot data of the previous plot item.</param> /// <param name="nextPlotData">Plot data of the next plot item.</param> public virtual void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData plotdata, Processed3DPlotData prevPlotData, Processed3DPlotData nextPlotData) { _cachedPlotDataUsedForPainting = plotdata ?? throw new ArgumentNullException(nameof(plotdata)); if (null != _plotStyles) { _plotStyles.Paint(g, layer, plotdata, prevPlotData, nextPlotData); } }
/// <summary> /// Template to make a line draw. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="pdata">The plot data. Don't use the Range property of the pdata, since it is overriden by the next argument.</param> /// <param name="range">The plot range to use.</param> /// <param name="layer">Graphics layer.</param> /// <param name="pen">The pen to draw the line.</param> /// <param name="symbolGap">The size of the symbol gap. Argument is the original index of the data. The return value is the absolute symbol gap at this index. /// This function is null if no symbol gap is required.</param> /// <param name="skipFrequency">Skip frequency. Normally 1, thus all gaps are taken into account. If 2, only every 2nd gap is taken into account, and so on.</param> /// <param name="connectCircular">If true, the end of the line is connected with the start of the line.</param> public abstract void Paint( IGraphicsContext3D g, Processed3DPlotData pdata, PlotRange range, IPlotArea layer, PenX3D pen, Func <int, double> symbolGap, int skipFrequency, bool connectCircular);
public RectangleD3D PaintSymbol(IGraphicsContext3D g, RectangleD3D bounds) { for (int i = _innerList.Count - 1; i >= 0; i--) { bounds = this[i].PaintSymbol(g, bounds); } return(bounds); }
public RectangleD3D PaintSymbol(IGraphicsContext3D g, RectangleD3D bounds) { bounds = bounds.WithPadding(0, 0, -bounds.SizeZ / 4); var heightBy2 = new VectorD3D(0, 0, bounds.SizeZ / 4); g.DrawLine(_pen, bounds.Center - heightBy2, bounds.Center + heightBy2); return(bounds); }
public override void Draw(IGraphicsContext3D g, DrawContext dc, double xbase, double ybase, double zbase) { if (_child != null) { _child.Draw(g, dc, xbase, ybase, zbase); FontInfo fontInfo = dc.FontCache.GetFontInfo(Style.FontId); g.DrawString("_", Style.FontId, Style.brush, new PointD3D((xbase), (ybase - _child.ExtendAboveBaseline - fontInfo.cyAscent), zbase)); } }
public void PaintMinorLabels(IGraphicsContext3D g, IPlotArea layer) { if (AreMinorLabelsEnabled) { var labelSide = _minorLabelStyle.PredictLabelSide(_cachedAxisInfo); var outerDistance = null == _axisLineStyle ? 0 : _axisLineStyle.GetOuterDistance(labelSide); var scaleWithTicks = layer.Scales[_cachedAxisInfo.Identifier.ParallelAxisNumber]; _minorLabelStyle.Paint(g, layer.CoordinateSystem, scaleWithTicks, _customTickSpacing ?? scaleWithTicks.TickSpacing, _cachedAxisInfo, outerDistance, true); } }
public override void Draw(IGraphicsContext3D g, DrawContext dc, double xbase, double ybase, double zbase) { if (_child != null) { _child.Draw(g, dc, xbase, ybase, zbase); FontInfo fontInfo = dc.FontCache.GetFontInfo(Style.FontId); double psize = FontManager3D.Instance.MeasureString(".", Style.FontId).X; g.DrawString(".", Style.FontId, Style.brush, new PointD3D((xbase + _child.SizeX / 2 - psize / 2), (ybase - _child.ExtendAboveBaseline - fontInfo.cyAscent), zbase)); } }
public override void Draw(IGraphicsContext3D g, DrawContext dc, double xbase, double ybase, double zbase) { double x = xbase; foreach (var ch in _childs) { ch.Draw(g, dc, x, ybase, zbase); x += ch.SizeX; } }
public RectangleD3D PaintSymbol(IGraphicsContext3D g, RectangleD3D bounds) { if (!ScatterSymbols.NoSymbol.Instance.Equals(_symbolShape)) { _symbolShape.Paint(g, _material, bounds.Center, _symbolSize); bounds = bounds.WithPadding(0, Math.Max(0, SymbolSize - bounds.SizeY), Math.Max(0, SymbolSize - bounds.SizeZ)); } return(bounds); }
public override VectorD3D MeasureItem(IGraphicsContext3D g, FontX3D font, Altaxo.Data.AltaxoVariant mtick, PointD3D morg) { SplitInFirstPartAndExponent(mtick, out var firstpart, out var mant, out var middelpart, out var exponent); var size1 = g.MeasureString(_prefix + firstpart + middelpart, font, PointD3D.Empty); var size2 = g.MeasureString(exponent, font, PointD3D.Empty); var size3 = g.MeasureString(_suffix, font, PointD3D.Empty); return(new VectorD3D(size1.X + size2.X + size3.X, size1.Y, font.Depth)); }
public void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData pdata, Processed3DPlotData prevItemData, Processed3DPlotData nextItemData) { PlotRangeList rangeList = pdata.RangeList; var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates; // adjust the skip frequency if it was not set appropriate if (_skipFreq <= 0) { _skipFreq = 1; } // paint the scatter style if (!ScatterSymbols.NoSymbol.Instance.Equals(_symbolShape)) { PointD3D pos = PointD3D.Empty; if (null == _cachedSymbolSizeForIndexFunction && null == _cachedColorForIndexFunction) // using a constant symbol size { for (int r = 0; r < rangeList.Count; r++) { var range = rangeList[r]; int lower = range.LowerBound; int upper = range.UpperBound; for (int j = lower; j < upper; j += _skipFreq) { _symbolShape.Paint(g, _material, ptArray[j], _symbolSize); } // end for all points in range } // end for all ranges } else // using a variable symbol size or variable symbol color { for (int r = 0; r < rangeList.Count; r++) { int lower = rangeList[r].LowerBound; int upper = rangeList[r].UpperBound; int offset = rangeList[r].OffsetToOriginal; for (int j = lower; j < upper; j += _skipFreq) { if (null == _cachedColorForIndexFunction) { double customSymbolSize = _cachedSymbolSizeForIndexFunction(j + offset); _symbolShape.Paint(g, _material, ptArray[j], customSymbolSize); } else { double customSymbolSize = null == _cachedSymbolSizeForIndexFunction ? _symbolSize : _cachedSymbolSizeForIndexFunction(j + offset); var customSymbolColor = _cachedColorForIndexFunction(j + offset); _symbolShape.Paint(g, _material.WithColor(NamedColor.FromArgb(customSymbolColor.A, customSymbolColor.R, customSymbolColor.G, customSymbolColor.B)), ptArray[j], customSymbolSize); } } } } } }
public void PaintGrid(IGraphicsContext3D g, IPlotArea layer) { if (null != _grid1) { _grid1.Paint(g, layer, _planeID, _planeID.InPlaneAxisNumber1); } if (null != _grid2) { _grid2.Paint(g, layer, _planeID, _planeID.InPlaneAxisNumber2); } }
public void PaintBackground(IGraphicsContext3D g, IPlotArea layer) { if (null == _background) { return; } var cs = layer.CoordinateSystem; if (layer.CoordinateSystem is CS.G3DCartesicCoordinateSystem) { var p = new PointD3D[4]; p[0] = cs.GetPointOnPlane(_planeID, 0, 0); p[1] = cs.GetPointOnPlane(_planeID, 0, 1); p[2] = cs.GetPointOnPlane(_planeID, 1, 0); p[3] = cs.GetPointOnPlane(_planeID, 1, 1); var normal = VectorD3D.CrossProduct(p[1] - p[0], p[2] - p[0]).Normalized; var buffer = g.GetPositionNormalIndexedTriangleBuffer(_background); if (null != buffer.PositionNormalIndexedTriangleBuffer) { // front faces var offs = buffer.IndexedTriangleBuffer.VertexCount; for (int i = 0; i < 4; ++i) { buffer.PositionNormalIndexedTriangleBuffer.AddTriangleVertex(p[i].X, p[i].Y, p[i].Z, normal.X, normal.Y, normal.Z); } buffer.IndexedTriangleBuffer.AddTriangleIndices(0 + offs, 1 + offs, 3 + offs); buffer.IndexedTriangleBuffer.AddTriangleIndices(2 + offs, 0 + offs, 3 + offs); // back faces offs = buffer.IndexedTriangleBuffer.VertexCount; for (int i = 0; i < 4; ++i) { buffer.PositionNormalIndexedTriangleBuffer.AddTriangleVertex(p[i].X, p[i].Y, p[i].Z, -normal.X, -normal.Y, -normal.Z); } buffer.IndexedTriangleBuffer.AddTriangleIndices(0 + offs, 3 + offs, 1 + offs); buffer.IndexedTriangleBuffer.AddTriangleIndices(2 + offs, 3 + offs, 0 + offs); } else { throw new NotImplementedException(); } } else { throw new NotImplementedException(); } }
public override void Paint(IGraphicsContext3D g, IMaterial material, PointD3D centerLocation, double symbolSize) { // Note: the symbolSize provided in the argument is the diameter of an imaginary sphere in which the cube has to fit in // thus the cube's diagonal should be equal to the sphere's diameter var size = symbolSize * Sqrt1By3; // size of the cube var sizeBy2 = size * 0.5; var buffers = g.GetPositionNormalIndexedTriangleBuffer(material); if (null != buffers.PositionNormalIndexedTriangleBuffer) { var buf = buffers.PositionNormalIndexedTriangleBuffer; var voffs = buffers.PositionNormalIndexedTriangleBuffer.VertexCount; SolidCube.Add( centerLocation.X - sizeBy2, centerLocation.Y - sizeBy2, centerLocation.Z - sizeBy2, size, size, size, (point, normal) => buf.AddTriangleVertex(point.X, point.Y, point.Z, normal.X, normal.Y, normal.Z), (i1, i2, i3) => buf.AddTriangleIndices(i1 + voffs, i2 + voffs, i3 + voffs), ref voffs); } }
public override void Paint(IGraphicsContext3D g, IMaterial material, PointD3D centerLocation, double symbolSize) { var radius = symbolSize / 2; var buffers = g.GetPositionNormalIndexedTriangleBuffer(material); if (null != buffers.PositionNormalIndexedTriangleBuffer) { var buffer = buffers.PositionNormalIndexedTriangleBuffer; var offs = buffer.VertexCount; foreach (var entry in GetVerticesAndNormals()) { var pt = centerLocation + radius * entry.Item1; var nm = entry.Item2; buffer.AddTriangleVertex(pt.X, pt.Y, pt.Z, nm.X, nm.Y, nm.Z); } foreach (var idx in GetTriangleIndices()) { buffer.AddTriangleIndices(idx.Item1 + offs, idx.Item2 + offs, idx.Item3 + offs); } } }
protected virtual void PaintBackground(IGraphicsContext3D g) { // Assumptions: // 1. the overall size of the structure must be measured before, i.e. bMeasureInSync is true // 2. the graphics object was translated and rotated before, so that the paining starts at (0,0) if (!this._isMeasureInSync) return; if (_background != null) { var textSizeWithPadding = CachedTextSizeWithoutPadding + new VectorD3D(_cachedTextPadding.Left + _cachedTextPadding.Right, _cachedTextPadding.Top + _cachedTextPadding.Bottom, 0); _background.Draw(g, new RectangleD3D(PointD3D.Empty, textSizeWithPadding)); } }
private void DrawGlyphs(IGraphicsContext3D g, DrawContext dc, double x, double y, double z) { _rootNode.Draw(g, dc, x, y + _rootNode.ExtendBelowBaseline, z); }
private void MeasureGlyphs(IGraphicsContext3D g, FontCache cache, Altaxo.Graph.IPaintContext paintContext) { MeasureContext mc = new MeasureContext(); mc.FontCache = cache; mc.LinkedObject = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing<HostLayer>(this); mc.TabStop = Glyph.MeasureString("MMMM", _font).X; if (null != _rootNode) _rootNode.Measure(mc, 0); }
public RectangleD3D PaintSymbol(IGraphicsContext3D g, RectangleD3D bounds) { return RectangleD3D.Empty; }
public void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData pdata, Processed3DPlotData prevItemData, Processed3DPlotData nextItemData) { PlotRangeList rangeList = pdata.RangeList; var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates; // paint the style PointD3D leftFrontBotton, rightBackTop; layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(0, 0, 0), out leftFrontBotton); layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(1, 1, 1), out rightBackTop); double globalBaseValue; if (_usePhysicalBaseValue) { globalBaseValue = layer.ZAxis.PhysicalVariantToNormal(_baseValue); if (double.IsNaN(globalBaseValue)) globalBaseValue = 0; } else { globalBaseValue = _baseValue.ToDouble(); } bool useVariableColor = null != _cachedColorForIndexFunction && !_independentColor; var pen = _pen; int j = -1; foreach (int originalRowIndex in pdata.RangeList.OriginalRowIndices()) { j++; double xCenterLogical = layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalRowIndex)); double xLowerLogical = xCenterLogical + _xOffsetLogical; double xUpperLogical = xLowerLogical + _xSizeLogical; double yCenterLogical = layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalRowIndex)); double yLowerLogical = yCenterLogical + _yOffsetLogical; double yUpperLogical = yLowerLogical + _ySizeLogical; double zCenterLogical = layer.ZAxis.PhysicalVariantToNormal(pdata.GetZPhysical(originalRowIndex)); double zBaseLogical = globalBaseValue; if (_startAtPreviousItem && pdata.PreviousItemData != null) { double prevstart = layer.ZAxis.PhysicalVariantToNormal(pdata.PreviousItemData.GetZPhysical(originalRowIndex)); if (!double.IsNaN(prevstart)) { zBaseLogical = prevstart; zBaseLogical += Math.Sign(zBaseLogical - globalBaseValue) * _previousItemZGap; } } // calculate the size at the base PointD3D lcp, ucp, clp, cup; layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xLowerLogical, yCenterLogical, zBaseLogical), out lcp); layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xUpperLogical, yCenterLogical, zBaseLogical), out ucp); layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xCenterLogical, yLowerLogical, zBaseLogical), out clp); layer.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xCenterLogical, yUpperLogical, zBaseLogical), out cup); double penWidth1 = (lcp - ucp).Length; double penWidth2 = (clp - cup).Length; if (_useUniformCrossSectionThickness) { pen = pen.WithUniformThickness(Math.Min(penWidth1, penWidth2)); } else { pen = pen.WithThickness1(penWidth1); pen = pen.WithThickness2(penWidth2); } if (useVariableColor) pen = pen.WithColor(GdiColorHelper.ToNamedColor(_cachedColorForIndexFunction(originalRowIndex), "VariableColor")); var isoLine = layer.CoordinateSystem.GetIsoline(new Logical3D(xLowerLogical, yLowerLogical, zBaseLogical), new Logical3D(xLowerLogical, yLowerLogical, zCenterLogical)); g.DrawLine(pen, isoLine); } }
public override void PaintSymbol(IGraphicsContext3D g, RectangleD3D location) { _plotStyles.PaintSymbol(g, location); }
public RectangleD3D PaintSymbol(IGraphicsContext3D g, RectangleD3D bounds) { bounds = bounds.WithPadding(0, 0, -bounds.SizeZ / 4); var heightBy2 = new VectorD3D(0, 0, bounds.SizeZ / 4); g.DrawLine(_pen, bounds.Center - heightBy2, bounds.Center + heightBy2); return bounds; }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public override IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) titems[i] = _prefix + titems[i] + _suffix; } MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; FontX3D localfont = font; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, titems[i], _relativeLineSpacing, Alignment.Near, Alignment.Near, _textBlockAlignment); } return litems; }
public void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer) { Paint(g, paintContext, layer, layer.CoordinateSystem.GetAxisStyleInformation); }
/// <summary> /// Needed for coordinate transforming styles to plot the data. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="layer">The plot layer.</param> /// <param name="plotdata">The plot data. Since the data are transformed, you should not rely that the physical values in this item correspond to the area coordinates.</param> /// <param name="prevPlotData">Plot data of the previous plot item.</param> /// <param name="nextPlotData">Plot data of the next plot item.</param> public virtual void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData plotdata, Processed3DPlotData prevPlotData, Processed3DPlotData nextPlotData) { _cachedPlotDataUsedForPainting = plotdata; if (null != this._plotStyles) { _plotStyles.Paint(g, layer, plotdata, prevPlotData, nextPlotData); } }
public override void Paint(IGraphicsContext3D g, IPaintContext context, IPlotArea layer, IGPlotItem prevPlotItem, IGPlotItem nextPlotItem) { Processed3DPlotData pdata = GetRangesAndPoints(layer); if (pdata != null) Paint(g, layer, pdata, (prevPlotItem is G3DPlotItem) ? ((G3DPlotItem)prevPlotItem).GetPlotData(layer) : null, (nextPlotItem is G3DPlotItem) ? ((G3DPlotItem)nextPlotItem).GetPlotData(layer) : null ); }
/// <summary> /// Template to make a line draw. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="pdata">The plot data. Don't use the Range property of the pdata, since it is overriden by the next argument.</param> /// <param name="range">The plot range to use.</param> /// <param name="layer">Graphics layer.</param> /// <param name="pen">The pen to draw the line.</param> /// <param name="symbolGap">The size of the symbol gap. Argument is the original index of the data. The return value is the absolute symbol gap at this index. This function is null if no symbol gap is required.</param> /// <param name="skipFrequency">Skip frequency. Normally 1, thus all gaps are taken into account. If 2, only every 2nd gap is taken into account, and so on.</param> /// <param name="connectCircular">If true, the end of the line is connected with the start of the line.</param> public override void Paint( IGraphicsContext3D g, Processed3DPlotData pdata, PlotRange range, IPlotArea layer, PenX3D pen, Func<int, double> symbolGap, int skipFrequency, bool connectCircular) { var linePoints = pdata.PlotPointsInAbsoluteLayerCoordinates; var linepts = new PointD3D[range.Length + (connectCircular ? 1 : 0)]; Array.Copy(linePoints, range.LowerBound, linepts, 0, range.Length); // Extract if (connectCircular) linepts[linepts.Length - 1] = linepts[0]; int lastIdx = range.Length - 1 + (connectCircular ? 1 : 0); var layerSize = layer.Size; if (symbolGap != null) { if (skipFrequency <= 1) // skip all scatter symbol gaps -> thus skipOffset can be ignored { for (int i = 0; i < lastIdx; i++) { int originalIndex = range.OffsetToOriginal + i; var diff = linepts[i + 1] - linepts[i]; double gapAtStart = symbolGap(originalIndex); double gapAtEnd = i != (range.Length-1) ? symbolGap(originalIndex + 1) : symbolGap(range.OffsetToOriginal); var relAtStart = 0.5 * gapAtStart / diff.Length; // 0.5 because symbolGap is the full gap between two lines, thus between the symbol center and the beginning of the line it is only 1/2 var relAtEnd = 0.5 * gapAtEnd / diff.Length; // 0.5 because symbolGap is the full gap between two lines, thus between the symbol center and the beginning of the line it is only 1/2 if ((relAtStart + relAtEnd) < 1) // a line only appears if sum of the gaps is smaller than 1 { var start = linepts[i] + relAtStart * diff; var stop = linepts[i + 1] - relAtEnd * diff; g.DrawLine(pen, start, stop); } } // end for } // skipFrequency was 1 else // skipFrequency is > 1 { for (int i = 0; i < lastIdx; i += skipFrequency) { int originalRowIndex = range.OriginalFirstPoint + i; double gapAtStart = symbolGap(originalRowIndex); double gapAtEnd = i != range.Length ? symbolGap(originalRowIndex + skipFrequency) : symbolGap(range.OffsetToOriginal); IPolylineD3D polyline = SharpPolylineD3D.FromPointsWithPossibleDublettes(linepts.Skip(i).Take(1 + skipFrequency)); polyline = polyline.ShortenedBy(RADouble.NewAbs(gapAtStart / 2), RADouble.NewAbs(gapAtEnd / 2)); if (null != polyline) g.DrawLine(pen, polyline); } // end for. } } else // no line symbol gap required, so we can use DrawLines to draw the lines { if (linepts.Length > 1) // we don't want to have a drawing exception if number of points is only one { g.DrawLine(pen, SharpPolylineD3D.FromPointsWithPossibleDublettes(linepts)); } } }
public void Paint(IGraphicsContext3D g, Graph3D.IPlotArea layer, Graph3D.Plot.Data.Processed3DPlotData pdata, Graph3D.Plot.Data.Processed3DPlotData prevItemData, Graph3D.Plot.Data.Processed3DPlotData nextItemData) { // this is not a visible style, thus doing nothing }
public MeasuredLabelItem(IGraphicsContext3D g, FontX3D font, string itemtext, double lineSpacing, Alignment horizontalAlignment, Alignment verticalAlignment, Alignment textBlockAligment) { _text = itemtext.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); _stringSize = new VectorD3D[_text.Length]; _font = font; _horizontalAlignment = horizontalAlignment; _verticalAlignment = verticalAlignment; _textBlockAligment = textBlockAligment; _lineSpacing = lineSpacing; _size = VectorD3D.Empty; var bounds = RectangleD3D.Empty; var position = PointD3D.Empty; for (int i = 0; i < _text.Length; ++i) { _stringSize[i] = g.MeasureString(_text[i], _font, PointD3D.Empty); bounds = bounds.WithRectangleIncluded(new RectangleD3D(position, _stringSize[i])); position = position.WithYPlus(-_stringSize[i].Y * _lineSpacing); } _size = bounds.Size; }
public void SetDrawing(IGraphicsContext3D drawing) { if (null == drawing) throw new ArgumentNullException(); _scene.SetDrawing((D3D10GraphicsContext)drawing); }
public void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer, Func<CSLineID, CSAxisInformation> GetAxisStyleInformation) { PaintLine(g, layer); PaintMajorLabels(g, layer); PaintMinorLabels(g, layer); PaintTitle(g, paintContext, layer); }
public virtual void Draw(IGraphicsContext3D g, IMaterial brush, PointD3D point) { var positionX = point.X + GetHorizontalOffset(); var positionY = point.Y + GetVerticalOffset(); for (int i = 0; i < _text.Length; ++i) { var posX = positionX; switch (_textBlockAligment) { case Alignment.Center: posX += (_size.X - _stringSize[i].X) * 0.5; break; case Alignment.Far: posX += (_size.X - _stringSize[i].X); break; } g.DrawString(_text[i], _font, brush, new PointD3D(posX, positionY, 0)); positionY -= _stringSize[i].Y * _lineSpacing; } }
public void PaintMinorLabels(IGraphicsContext3D g, IPlotArea layer) { if (AreMinorLabelsEnabled) { var labelSide = _minorLabelStyle.PredictLabelSide(_cachedAxisInfo); var outerDistance = null == _axisLineStyle ? 0 : _axisLineStyle.GetOuterDistance(labelSide); var scaleWithTicks = layer.Scales[_cachedAxisInfo.Identifier.ParallelAxisNumber]; this._minorLabelStyle.Paint(g, layer.CoordinateSystem, scaleWithTicks, _customTickSpacing ?? scaleWithTicks.TickSpacing, _cachedAxisInfo, outerDistance, true); } }
public void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, bool bForPreview) { //_isStructureInSync = false; _isMeasureInSync = false; // Change: interpret text every time in order to update plot items and \ID if (!this._isStructureInSync) { // this.Interpret(g); this.InterpretText(); _isStructureInSync = true; _isMeasureInSync = false; } using (FontCache fontCache = new FontCache()) { if (!this._isMeasureInSync) { // this.MeasureStructure(g, obj); this.MeasureGlyphs(g, fontCache, paintContext); MeasureBackground(g, _rootNode.SizeX, _rootNode.SizeY, _rootNode.SizeZ); _isMeasureInSync = true; } _cachedSymbolPositions.Clear(); var gs = g.SaveGraphicsState(); var bounds = Bounds; var transformmatrix = Matrix4x3.NewScalingShearingRotationDegreesTranslation( ScaleX, ScaleY, ScaleZ, ShearX, ShearY, ShearZ, RotationX, RotationY, RotationZ, _location.AbsolutePivotPositionX, _location.AbsolutePivotPositionY, _location.AbsolutePivotPositionZ); transformmatrix.TranslatePrepend(bounds.X, bounds.Y, bounds.Z); if (!bForPreview) { TransformGraphics(g); g.TranslateTransform(bounds.X, bounds.Y, bounds.Z); } // first of all paint the background PaintBackground(g); DrawContext dc = new DrawContext(); dc.FontCache = fontCache; dc.bForPreview = bForPreview; dc.LinkedObject = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing<HostLayer>(this); dc.transformMatrix = transformmatrix; dc._cachedSymbolPositions = _cachedSymbolPositions; DrawGlyphs(g, dc, _cachedTextOffset.X, _cachedTextOffset.Y, _cachedTextOffset.Z); g.RestoreGraphicsState(gs); } }
public void PaintChild(IGraphicsContext3D g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll, int indexOfChild) { var plotDataDict = paintContext.GetValueOrDefault<Dictionary<G3DPlotItem, Processed3DPlotData>>(this); if (null == plotDataDict) // if initializing this dict was not successfull, then make a normal plot { coll[indexOfChild].Paint(g, paintContext, layer, indexOfChild == coll.Count - 1 ? null : coll[indexOfChild + 1], indexOfChild == 0 ? null : coll[indexOfChild - 1]); return; } Processed3DPlotData prevPlotData = null; Processed3DPlotData nextPlotData = null; if ((indexOfChild + 1) < coll.Count && (coll[indexOfChild + 1] is G3DPlotItem)) prevPlotData = plotDataDict[coll[indexOfChild + 1] as G3DPlotItem]; if (indexOfChild > 0 && (coll[indexOfChild - 1] is G3DPlotItem)) nextPlotData = plotDataDict[coll[indexOfChild - 1] as G3DPlotItem]; if (coll[indexOfChild] is G3DPlotItem) { var gpi = coll[indexOfChild] as G3DPlotItem; gpi.Paint(g, layer, plotDataDict[gpi], prevPlotData, nextPlotData); } else { coll[indexOfChild].Paint(g, paintContext, layer, null, null); } }
public override void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext) { Paint(g, paintContext, false); }
public void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData pdata, Processed3DPlotData prevItemData, Processed3DPlotData nextItemData) { PlotRangeList rangeList = pdata.RangeList; var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates; // adjust the skip frequency if it was not set appropriate if (_skipFreq <= 0) _skipFreq = 1; var dropTargets = new List<CSPlaneID>(_dropTargets.Select(id => layer.UpdateCSPlaneID(id))); if (_additionalDropTargetIsEnabled) { CSPlaneID userPlane; if (_additionalDropTargetUsePhysicalBaseValue) { userPlane = new CSPlaneID(_additionalDropTargetPerpendicularAxis, layer.Scales[_additionalDropTargetPerpendicularAxis].PhysicalVariantToNormal(_additionalDropTargetBaseValue)); } else { userPlane = new CSPlaneID(_additionalDropTargetPerpendicularAxis, _additionalDropTargetBaseValue); } dropTargets.Add(userPlane); } // paint the scatter style PointD3D pos = PointD3D.Empty; if (null == _cachedSymbolSizeForIndexFunction && null == _cachedColorForIndexFunction) // using a constant symbol size and constant color { var pen = _pen; // update pen widths double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize; double w2 = _lineWidth2Offset + _lineWidth2Factor * _cachedSymbolSize; pen = pen.WithThickness1(w1).WithThickness2(w2); var gapStart = 0.5 * (_gapAtStartOffset + _gapAtStartFactor * _cachedSymbolSize); var gapEnd = 0.5 * (_gapAtEndOffset + _gapAtEndFactor * _cachedSymbolSize); for (int r = 0; r < rangeList.Count; r++) { var range = rangeList[r]; int lower = range.LowerBound; int upper = range.UpperBound; for (int j = lower; j < upper; j += _skipFreq) { Logical3D r3d = layer.GetLogical3D(pdata, j + range.OffsetToOriginal); foreach (CSPlaneID id in dropTargets) { IPolylineD3D isoLine; layer.CoordinateSystem.GetIsolineFromPointToPlane(r3d, id, out isoLine); if (gapStart != 0 || gapEnd != 0) isoLine = isoLine.ShortenedBy(RADouble.NewAbs(gapStart), RADouble.NewAbs(gapEnd)); if (null != isoLine) g.DrawLine(pen, isoLine); } } } // for each range } else // using a variable symbol size or variable symbol color { for (int r = 0; r < rangeList.Count; r++) { var range = rangeList[r]; int lower = range.LowerBound; int upper = range.UpperBound; int offset = range.OffsetToOriginal; for (int j = lower; j < upper; j += _skipFreq) { var pen = _pen; if (null == _cachedColorForIndexFunction) { _cachedSymbolSize = _cachedSymbolSizeForIndexFunction(j + offset); double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize; double w2 = _lineWidth2Offset + _lineWidth2Factor * _cachedSymbolSize; pen = _pen.WithThickness1(w1).WithThickness2(w2); } else { _cachedSymbolSize = null == _cachedSymbolSizeForIndexFunction ? _cachedSymbolSize : _cachedSymbolSizeForIndexFunction(j + offset); double w1 = _lineWidth1Offset + _lineWidth1Factor * _cachedSymbolSize; double w2 = _lineWidth2Offset + _lineWidth2Factor * _cachedSymbolSize; var customSymbolColor = _cachedColorForIndexFunction(j + offset); pen = _pen.WithThickness1(w1).WithThickness2(w2).WithColor(NamedColor.FromArgb(customSymbolColor.A, customSymbolColor.R, customSymbolColor.G, customSymbolColor.B)); } var gapStart = 0.5 * (_gapAtStartOffset + _gapAtStartFactor * _cachedSymbolSize); var gapEnd = 0.5 * (_gapAtEndOffset + _gapAtEndFactor * _cachedSymbolSize); Logical3D r3d = layer.GetLogical3D(pdata, j + rangeList[r].OffsetToOriginal); foreach (CSPlaneID id in _dropTargets) { IPolylineD3D isoLine; layer.CoordinateSystem.GetIsolineFromPointToPlane(r3d, id, out isoLine); if (gapStart != 0 || gapEnd != 0) isoLine = isoLine.ShortenedBy(RADouble.NewAbs(gapStart), RADouble.NewAbs(gapEnd)); if (null != isoLine) g.DrawLine(pen, isoLine); } } } } }
public void Paint(IGraphicsContext3D g, IPlotArea layer, Processed3DPlotData pdata, Processed3DPlotData prevItemData, Processed3DPlotData nextItemData) { const double logicalClampMinimum = -10; const double logicalClampMaximum = 11; // Plot error bars for the dependent variable (y) PlotRangeList rangeList = pdata.RangeList; var ptArray = pdata.PlotPointsInAbsoluteLayerCoordinates; var columnX = ColumnX; var columnY = ColumnY; var columnZ = ColumnZ; if (columnX == null || columnY == null || columnZ == null) return; // nothing to do if both error columns are null if (!typeof(double).IsAssignableFrom(columnX.ItemType) || !typeof(double).IsAssignableFrom(columnY.ItemType) || !typeof(double).IsAssignableFrom(columnZ.ItemType)) return; // TODO make this an runtime paint error to be reported var strokePen = _strokePen; foreach (PlotRange r in rangeList) { int lower = r.LowerBound; int upper = r.UpperBound; int offset = r.OffsetToOriginal; for (int j = lower; j < upper; j += _skipFrequency) { int originalRow = j + offset; double symbolSize = null == _cachedSymbolSizeForIndexFunction ? _symbolSize : _cachedSymbolSizeForIndexFunction(originalRow); strokePen = strokePen.WithThickness1(_lineWidth1Offset + _lineWidth1Factor * symbolSize); strokePen = strokePen.WithThickness2(_lineWidth2Offset + _lineWidth2Factor * symbolSize); if (null != _cachedColorForIndexFunction) strokePen = strokePen.WithColor(GdiColorHelper.ToNamedColor(_cachedColorForIndexFunction(originalRow), "VariableColor")); if (null != strokePen.LineEndCap) strokePen = strokePen.WithLineEndCap(strokePen.LineEndCap.WithMinimumAbsoluteAndRelativeSize(symbolSize * _endCapSizeFactor + _endCapSizeOffset, 1 + 1E-6)); // Calculate target AltaxoVariant targetX, targetY, targetZ; switch (_meaningOfValues) { case ValueInterpretation.AbsoluteDifference: { targetX = pdata.GetXPhysical(originalRow) + columnX[originalRow]; targetY = pdata.GetYPhysical(originalRow) + columnY[originalRow]; targetZ = pdata.GetZPhysical(originalRow) + columnZ[originalRow]; } break; case ValueInterpretation.AbsoluteValue: { targetX = columnX[originalRow]; targetY = columnY[originalRow]; targetZ = columnZ[originalRow]; } break; default: throw new NotImplementedException(nameof(_meaningOfValues)); } var logicalTarget = layer.GetLogical3D(targetX, targetY, targetZ); var logicalOrigin = layer.GetLogical3D(pdata, originalRow); if (!_independentOnShiftingGroupStyles && (0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY || 0 != _cachedLogicalShiftZ)) { logicalOrigin.RX += _cachedLogicalShiftX; logicalOrigin.RY += _cachedLogicalShiftY; logicalOrigin.RZ += _cachedLogicalShiftZ; logicalTarget.RX += _cachedLogicalShiftX; logicalTarget.RY += _cachedLogicalShiftY; logicalTarget.RZ += _cachedLogicalShiftZ; } if (!Calc.RMath.IsInIntervalCC(logicalOrigin.RX, logicalClampMinimum, logicalClampMaximum)) continue; if (!Calc.RMath.IsInIntervalCC(logicalOrigin.RY, logicalClampMinimum, logicalClampMaximum)) continue; if (!Calc.RMath.IsInIntervalCC(logicalOrigin.RZ, logicalClampMinimum, logicalClampMaximum)) continue; if (!Calc.RMath.IsInIntervalCC(logicalTarget.RX, logicalClampMinimum, logicalClampMaximum)) continue; if (!Calc.RMath.IsInIntervalCC(logicalTarget.RY, logicalClampMinimum, logicalClampMaximum)) continue; if (!Calc.RMath.IsInIntervalCC(logicalTarget.RZ, logicalClampMinimum, logicalClampMaximum)) continue; var isoLine = layer.CoordinateSystem.GetIsoline(logicalOrigin, logicalTarget); if (null == isoLine) continue; if (_useManualVectorLength) { double length = _vectorLengthOffset + _vectorLengthFactor * symbolSize; double isoLineLength = isoLine.TotalLineLength; isoLine = isoLine.ShortenedBy(RADouble.NewAbs(0), RADouble.NewAbs(isoLineLength - length)); if (null == isoLine) continue; } if (_useSymbolGap) { double gap = _symbolGapOffset + _symbolGapFactor * symbolSize; if (gap != 0) { isoLine = isoLine.ShortenedBy(RADouble.NewAbs(gap / 2), RADouble.NewAbs(0)); if (null == isoLine) continue; } } g.DrawLine(strokePen, isoLine); } } }