//Implement a base rendering of an element selection public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { Table table = element as Table; if (render.ActionStyle == ActionStyle.Default) { RenderTable(table, graphics, render); //Render the ports if (table.Ports != null) { foreach (Port port in table.Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-port.Bounds.X + port.Bounds.X, -port.Bounds.Y + port.Bounds.Y); port.SuspendValidation(); IFormsRenderer renderer = render.GetRenderer(port); renderer.RenderElement(port, graphics, render); port.ResumeValidation(); graphics.TranslateTransform(port.Bounds.X - port.Bounds.X, port.Bounds.Y - port.Bounds.Y); } } } } else { base.RenderAction(element, graphics, render); } }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { ComplexShape complex = element as ComplexShape; base.RenderAction(element, graphics, render); Region current = null; //Set up clipping if required if (complex.Clip) { Region region = new Region(complex.GetPath()); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render the children if (complex.Children != null) { foreach (Solid solid in complex.RenderList) { graphics.TranslateTransform(solid.Bounds.X, solid.Bounds.Y); IFormsRenderer renderer = render.GetRenderer(solid); renderer.RenderAction(solid, graphics, render); graphics.TranslateTransform(-solid.Bounds.X, -solid.Bounds.Y); } } if (complex.Clip) { graphics.Clip = current; } }
public override void RenderAction(IRenderable renderable, Graphics graphics, ControlRender render) { Solid solid = renderable as Solid; GraphicsPath path = solid.GetPath(); if (solid.DrawBackground) { if (render.ActionStyle == ActionStyle.Default) { RenderSolid(solid, graphics, render); //Add local clipping Region current = null; if (solid.Clip) { Region region = new Region(path); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render annotation and image if (solid.Label != null) { LabelRender renderer = render.GetRenderer(solid.Label) as LabelRender; renderer.RenderAction(solid.Label, graphics, render, solid.InternalRectangle); } //Restore clipping if (solid.Clip) { graphics.Clip = current; } } else { if (path == null) { return; } graphics.FillPath(Singleton.Instance.ActionBrush, path); } } if (solid.DrawBorder) { base.RenderAction(renderable, graphics, render); } }
//Renders a graphics marker protected virtual void RenderMarkerAction(MarkerBase marker, PointF markerPoint, PointF referencePoint, Graphics graphics, ControlRender render) { if (marker == null) { return; } //Save the graphics state Matrix gstate = graphics.Transform; //Apply the marker transform and render the marker graphics.Transform = Link.GetMarkerTransform(marker, markerPoint, referencePoint, graphics.Transform); IFormsRenderer renderer = render.GetRenderer(marker); renderer.RenderAction(marker, graphics, render); //Restore the graphics state graphics.Transform = gstate; }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { Link link = element as Link; if (link.Points == null || link.Points.Count < 2) { return; } PointF startLocation = (PointF)link.Points[0]; PointF startReference = (PointF)link.Points[1]; PointF endLocation = (PointF)link.Points[link.Points.Count - 1]; PointF endReference = (PointF)link.Points[link.Points.Count - 2]; startLocation = Geometry.OffsetPoint(startLocation, link.Bounds.Location); startReference = Geometry.OffsetPoint(startReference, link.Bounds.Location); endLocation = Geometry.OffsetPoint(endLocation, link.Bounds.Location); endReference = Geometry.OffsetPoint(endReference, link.Bounds.Location); //Save the current region Region current = graphics.Clip; //Mask out the start marker if (link.Start.Marker != null) { Region region = new Region(link.Start.Marker.GetPath()); region.Transform(Link.GetMarkerTransform(link.Start.Marker, startLocation, startReference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Mask out the end marker if (link.End.Marker != null) { Region region = new Region(link.End.Marker.GetPath()); region.Transform(Link.GetMarkerTransform(link.End.Marker, endLocation, endReference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Render element action base.RenderAction(element, graphics, render); //Render markers if (link.Start.Marker != null || link.End.Marker != null) { graphics.Clip = current; if (link.Start.Marker != null) { RenderMarkerAction(link.Start.Marker, startLocation, startReference, graphics, render); } if (link.End.Marker != null) { RenderMarkerAction(link.End.Marker, endLocation, endReference, graphics, render); } } //Render any ports if (link.Ports != null) { foreach (Port port in link.Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-link.Bounds.X + port.Bounds.X, -link.Bounds.Y + port.Bounds.Y); port.SuspendValidation(); IFormsRenderer renderer = render.GetRenderer(port); renderer.RenderElement(port, graphics, render); port.ResumeValidation(); graphics.TranslateTransform(link.Bounds.X - port.Bounds.X, link.Bounds.Y - port.Bounds.Y); } } } }