//-------------------------------------------------------------------------------------------------- public override bool Render(IDrawingRenderer renderer) { var shapes = _Source?.GetBreps(); if (shapes == null) { return(true); // nothing to do } if (renderer.RenderElement(this)) { return(true); } renderer.SetStyle(_Stroke, _Fill, null); renderer.BeginGroup(Name); bool res = true; foreach (var shape in shapes) { res &= BrepRenderHelper.RenderShape(renderer, shape); } renderer.EndGroup(); return(res); }
//-------------------------------------------------------------------------------------------------- public override bool Render(IDrawingRenderer renderer) { if (!ComputeParameters(out var p)) { return(false); } if (renderer.RenderElement(this)) { return(true); } // Render each element separately renderer.SetStyle(new StrokeStyle(Color.Black, 0.1f, LineStyle.Solid), null, null); renderer.BeginGroup("Dimension"); if (_Debug_DrawPoints) { DrawingRenderHelper.RenderCross(renderer, _FirstPoint); DrawingRenderHelper.RenderCross(renderer, _SecondPoint); DrawingRenderHelper.RenderCross(renderer, _CenterPoint); DrawingRenderHelper.RenderCross(renderer, Position); } // Extension lines renderer.Line(_FirstPoint, _FirstPoint.Translated(p.FirstExtensionVector)); renderer.Line(_SecondPoint, _SecondPoint.Translated(p.SecondExtensionVector)); // Dimension line BrepRenderHelper.RenderCircle(renderer, new Geom2d_Circle(new Ax2d(_CenterPoint, Dir2d.DX), p.Radius), p.StartAngle, p.EndAngle, false); DrawingRenderHelper.RenderArrow(renderer, new Ax2d(p.FirstArrowPoint, p.FirstArrowTangent), p.Scale); DrawingRenderHelper.RenderArrow(renderer, new Ax2d(p.SecondArrowPoint, p.SecondArrowTangent), p.Scale); // Dimension text if (!Text.IsNullOrWhiteSpace()) { var fontStyle = DrawingRenderHelper.GetDefaultFontStyle(); renderer.SetStyle(null, new FillStyle(Color.Black), new FontStyle(fontStyle.Family, (float)(fontStyle.Size * p.TextScale))); renderer.Text(Text, p.TextOrigin, p.TextRotation); if (_IsNotToScale) { var start = p.TextOrigin.Translated(Dir2d.DX.Rotated(-p.TextRotation + Maths.HalfPI).ToVec(-0.5)); renderer.Line(start, start.Translated(Dir2d.DX.Rotated(-p.TextRotation).ToVec(p.TextWidth))); } } renderer.EndGroup(); return(true); }