public override void Render(AnnContainerMapper mapper, AnnObject annObject) { if (mapper == null) { ExceptionHelper.ArgumentNullException("mapper"); } if (annObject == null) { ExceptionHelper.ArgumentNullException("annObject"); } AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine; if (engine != null && engine.Context != null) { base.Render(mapper, annObject); AnnMidlineObject annMidlineObject = annObject as AnnMidlineObject; if (annMidlineObject != null) { LeadPointD[] leadPoints = annMidlineObject.Points.ToArray(); int linesCount = leadPoints.Length / 2; if (linesCount > 0) { PointF[] linesCenters = new PointF[linesCount]; leadPoints = mapper.PointsFromContainerCoordinates(leadPoints, annMidlineObject.FixedStateOperations); PointF[] points = AnnWinFormsRenderingEngine.ToPoints(leadPoints); if (annMidlineObject.SupportsStroke && annMidlineObject.Stroke != null) { double radius = mapper.LengthFromContainerCoordinates(annMidlineObject.CenterPointRadius, annMidlineObject.FixedStateOperations); using (Pen pen = AnnWinFormsRenderingEngine.ToPen(mapper.StrokeFromContainerCoordinates(annMidlineObject.Stroke, annMidlineObject.FixedStateOperations), annMidlineObject.Opacity)) { for (int i = 0; i < linesCount; ++i) { PointF firstPoint = points[2 * i]; PointF secondPoint = points[2 * i + 1]; PointF center = new PointF((firstPoint.X + secondPoint.X) / 2, (firstPoint.Y + secondPoint.Y) / 2); DrawPoint(annMidlineObject, engine.Context, center, radius); linesCenters[i] = center; } if (linesCount > 1) { int count = linesCount - 1; for (int i = 0; i < count; ++i) { engine.Context.DrawLine(pen, linesCenters[i], linesCenters[i + 1]); // draw midline } } } } } } } }
public override void Render(AnnContainerMapper mapper, AnnObject annObject) { if (mapper == null) { ExceptionHelper.ArgumentNullException("mapper"); } if (annObject == null) { ExceptionHelper.ArgumentNullException("annObject"); } IAnnDrawEngine engine = RenderingEngine as IAnnDrawEngine; if (engine != null) { base.Render(mapper, annObject); AnnIntersectionPointObject annIntersectionPointObject = annObject as AnnIntersectionPointObject; if (annIntersectionPointObject != null) { int count = annIntersectionPointObject.Points.Count; if (count < 2) { return; } LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annIntersectionPointObject.Points.ToArray(), annIntersectionPointObject.FixedStateOperations); if (annIntersectionPointObject.SupportsStroke && annIntersectionPointObject.Stroke != null) { AnnStroke stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), annIntersectionPointObject.Stroke.StrokeThickness); stroke.StrokeDashArray = new double[] { 3, 1, 1, 1, 1, 1 }; // DashDotDot IAnnDrawPen pen = engine.ToPen(mapper.StrokeFromContainerCoordinates(stroke, annIntersectionPointObject.FixedStateOperations), annIntersectionPointObject.Opacity); try { if (leadPoints.Length > 2) { LeadPointD intersectionPoint = annIntersectionPointObject.IntersectionPoint; intersectionPoint = mapper.PointFromContainerCoordinates(intersectionPoint, annIntersectionPointObject.FixedStateOperations); double radius = mapper.LengthFromContainerCoordinates(annIntersectionPointObject.IntersectionPointRadius, annIntersectionPointObject.FixedStateOperations); DrawPoint(annIntersectionPointObject, engine, intersectionPoint, radius); if (leadPoints.Length < 5 && annIntersectionPointObject.IntersectionInsideContainer) { engine.DrawLine(pen, leadPoints[3], intersectionPoint); } } } finally { engine.Destroy(pen); } } } } }
public override void Render(AnnContainerMapper mapper, AnnObject annObject) { if (mapper == null) { ExceptionHelper.ArgumentNullException("mapper"); } if (annObject == null) { ExceptionHelper.ArgumentNullException("annObject"); } AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine; if (engine != null && engine.Context != null) { base.Render(mapper, annObject); AnnIntersectionPointObject annIntersectionPointObject = annObject as AnnIntersectionPointObject; if (annIntersectionPointObject != null) { int count = annIntersectionPointObject.Points.Count; if (count < 2) { return; } LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annIntersectionPointObject.Points.ToArray(), annIntersectionPointObject.FixedStateOperations); PointF[] points = AnnWinFormsRenderingEngine.ToPoints(leadPoints); if (annIntersectionPointObject.SupportsStroke && annIntersectionPointObject.Stroke != null) { using (Pen pen = AnnWinFormsRenderingEngine.ToPen(mapper.StrokeFromContainerCoordinates(annIntersectionPointObject.Stroke, annIntersectionPointObject.FixedStateOperations), annIntersectionPointObject.Opacity)) { if (points.Length > 2) { LeadPointD LeadIntersectionPoint = annIntersectionPointObject.IntersectionPoint; LeadIntersectionPoint = mapper.PointFromContainerCoordinates(LeadIntersectionPoint, annIntersectionPointObject.FixedStateOperations); PointF intersectionPoint = new PointF((float)LeadIntersectionPoint.X, (float)LeadIntersectionPoint.Y); double radius = mapper.LengthFromContainerCoordinates(annIntersectionPointObject.IntersectionPointRadius, annIntersectionPointObject.FixedStateOperations); DrawPoint(annIntersectionPointObject, engine.Context, intersectionPoint, radius); if (points.Length < 5 && annIntersectionPointObject.IntersectionInsideContainer) { pen.Brush = Brushes.Blue; pen.DashStyle = DashStyle.DashDotDot; engine.Context.DrawLine(pen, points[3], intersectionPoint); } } } } } } }