public override Visual CreateVisual(IRenderContext context) { VisualGroup container = new VisualGroup(); var bounds = Bounds; var width = bounds.Width; var height = bounds.Height; var path = new GeneralPath(); path.MoveTo(0, TopLeftRadius); path.QuadTo(0, 0, TopLeftRadius, 0); path.LineTo(width - TopRightRadius, 0); path.QuadTo(width, 0, width, TopRightRadius); path.LineTo(width, height - BottomRightRadius); path.QuadTo(width, height, width - BottomRightRadius, height); path.LineTo(BottomLeftRadius, height); path.QuadTo(0, height, 0, height - BottomRightRadius); path.Close(); var pathVisual = path.CreatePath(Brush, Pen, new Matrix2D(), FillMode.Always); container.Add(pathVisual); container.SetRenderDataCache(new PathIconState(width, height, Pen, Brush)); container.SetCanvasArrangeRect(bounds.ToRectD()); return(container); }
protected override Visual CreateVisual(IRenderContext context, INode node) { UpdateIcon(node); if (Icon == null) { return(null); } var bounds = node.Layout.ToRectD(); Icon.SetBounds(new RectD(PointD.Origin, bounds.ToSizeD())); var visual = Icon.CreateVisual(context); var container = new VisualGroup(); if (visual != null) { container.Add(visual); } container.SetCanvasArrangeRect(new Rect(bounds.TopLeft, bounds.BottomRight)); container.SetRenderDataCache(new IconData { ModCount = ModCount, Bounds = bounds }); return(container); }
public override Visual CreateVisual(IRenderContext context) { VisualGroup container = new VisualGroup(); var bounds = Bounds; var width = bounds.Width; var height = bounds.Height; var cornerSize = Math.Min(width, height) * 0.4; var path = new GeneralPath(); path.MoveTo(0, 0); path.LineTo(width - cornerSize, 0); path.LineTo(width, cornerSize); path.LineTo(width, height); path.LineTo(0, height); path.Close(); container.Add(path.CreatePath(Brush, Pen, new Matrix2D(), FillMode.Always)); path = new GeneralPath(); path.MoveTo(width - cornerSize, 0); path.LineTo(width - cornerSize, cornerSize); path.LineTo(width, cornerSize); container.Add(path.CreatePath(null, Pen, new Matrix2D(), FillMode.Never)); container.SetRenderDataCache(new PathIconState(width, height, Pen, Brush)); container.SetCanvasArrangeRect(bounds.ToRectD()); return(container); }
public override Visual UpdateVisual(IRenderContext context, Visual oldVisual) { VisualGroup container = oldVisual as VisualGroup; if (container == null || container.Children.Count != 1) { return(CreateVisual(context)); } var rectangle = container.Children.ElementAt(0) as Rectangle; var lastState = container.GetRenderDataCache <PathIconState>(); if (rectangle == null || lastState == null) { container.Children.Clear(); return(CreateVisual(context)); } if (!lastState.Equals(Bounds.Width, Bounds.Height, Pen, Brush)) { UpdateRectangle(rectangle); container.SetRenderDataCache(new PathIconState(Bounds.Width, Bounds.Height, Pen, Brush)); } // arrange container.SetCanvasArrangeRect(Bounds.ToRectD()); return(container); }
/// <inheritdoc/> public Visual CreateVisual(IRenderContext context) { var container = new VisualGroup(); var delegateStyle = GetCurrentStyle(label, labelStyle); container.Add(delegateStyle.Renderer.GetVisualCreator(label, delegateStyle).CreateVisual(context)); container.SetRenderDataCache(CreateRenderData()); return(container); }
public override Visual CreateVisual(IRenderContext context) { VisualGroup container = new VisualGroup(); var rectangle = new Rectangle { RadiusX = CornerRadius, RadiusY = CornerRadius }; UpdateRectangle(rectangle); container.Add(rectangle); container.SetRenderDataCache(new PathIconState(Bounds.Width, Bounds.Height, Pen, Brush)); container.SetCanvasArrangeRect(Bounds.ToRectD()); return(container); }
public override Visual CreateVisual(IRenderContext context) { VisualGroup container = new VisualGroup(); var matrix2D = new Matrix2D(); matrix2D.Scale(Math.Max(0, Bounds.Width), Math.Max(0, Bounds.Height)); Path visual = Path.CreatePath(Brush, Pen, matrix2D, FillMode.FillClosedFigures); container.Add(visual); container.SetRenderDataCache(new PathIconState(Bounds.Width, Bounds.Height, Pen, Brush)); container.SetCanvasArrangeRect(Bounds.ToRectD()); return(container); }
/// <inheritdoc/> public virtual Visual CreateVisual(IRenderContext context) { var container = new VisualGroup(); if (style.Type != EdgeType.Conversation) { container.Add(delegateRenderer.GetVisualCreator(this.edge, this.style.delegateStyle).CreateVisual(context)); } else { container.Add(delegateRenderer.GetVisualCreator(this.edge, this.style.delegateStyle).CreateVisual(context)); var oldPen = style.delegateStyle.Pen; style.delegateStyle.Pen = style.innerPen; container.Add(delegateRenderer.GetVisualCreator(this.edge, this.style.delegateStyle).CreateVisual(context)); style.delegateStyle.Pen = oldPen; } container.SetRenderDataCache(style.Type); return(container); }
public override Visual CreateVisual(IRenderContext context) { if (Bounds == null) { return(null); } var container = new VisualGroup(); var iconBounds = new RectD(PointD.Origin, Bounds.ToSizeD()); foreach (var icon in icons) { icon.SetBounds(iconBounds); container.Add(icon.CreateVisual(context)); } container.SetCanvasArrangeRect(Bounds.ToRectD()); container.SetRenderDataCache(Bounds.ToRectD()); return(container); }
public override Visual CreateVisual(IRenderContext context) { if (Bounds == null) { return(null); } var container = new VisualGroup(); double offset = 0; foreach (var pathIcon in icons) { pathIcon.SetBounds(new RectD(offset, 0, innerIconSize.Width, innerIconSize.Height)); container.Add(pathIcon.CreateVisual(context)); offset += innerIconSize.Width + gap; } container.SetCanvasArrangeRect(Bounds.ToRectD()); container.SetRenderDataCache(Bounds.GetTopLeft()); return(container); }
protected override Visual CreateVisual(IRenderContext context, INode node) { var bounds = node.Layout.ToRectD(); var container = new VisualGroup(); // task band var taskBandContainer = new VisualGroup(); var bandIcon = CreateTaskBandIcon(node); bandIcon.SetBounds(GetRelativeTaskNameBandBounds(node)); taskBandContainer.Add(bandIcon.CreateVisual(context)); taskBandContainer.SetRenderDataCache(bandIcon); container.Children.Add(taskBandContainer); var tpi = new List <IIcon>(); // top participants double topOffset = 0; bool first = true; foreach (Participant participant in topParticipants) { var participantIcon = CreateParticipantIcon(participant, true, first); tpi.Add(participantIcon); var height = participant.GetSize(); participantIcon.SetBounds(new RectD(0, topOffset, bounds.Width, height)); container.Add(participantIcon.CreateVisual(context)); topOffset += height; first = false; } var bpi = new List <IIcon>(); // bottom participants double bottomOffset = bounds.Height; first = true; foreach (Participant participant in bottomParticipants) { var participantIcon = CreateParticipantIcon(participant, false, first); bpi.Add(participantIcon); var height = participant.GetSize(); bottomOffset -= height; participantIcon.SetBounds(new RectD(0, bottomOffset, bounds.Width, height)); container.Add(participantIcon.CreateVisual(context)); first = false; } // outline outlineIcon.SetBounds(new RectD(PointD.Origin, bounds.Size)); container.Add(outlineIcon.CreateVisual(context)); // messages if (InitiatingMessage) { UpdateInitiatingMessageIcon(); var initiatingMessageIcon = InitiatingAtTop ? topInitiatingMessageIcon : bottomInitiatingMessageIcon; initiatingMessageIcon.SetBounds(new RectD(0, 0, bounds.Width, bounds.Height)); container.Add(initiatingMessageIcon.CreateVisual(context)); } if (ResponseMessage) { UpdateResponseMessageIcon(); var responseMessageIcon = InitiatingAtTop ? bottomResponseMessageIcon : topResponseMessageIcon; responseMessageIcon.SetBounds(new RectD(0, 0, bounds.Width, bounds.Height)); container.Add(responseMessageIcon.CreateVisual(context)); } container.SetCanvasArrangeRect(new Rect(bounds.TopLeft, bounds.Size)); container.SetRenderDataCache(new ChoreographyRenderData(bounds, ModCount + topParticipants.ModCount + bottomParticipants.ModCount) { TopParticipantIcons = tpi, BottomParticipantIcons = bpi }); return(container); }