/// <summary> /// Creates a new instance for the given model graph and the given <see cref="MultiPageLayout"/>. /// </summary> /// <param name="result">The <see cref="MultiPageLayout"/>: a holder for the pages created by the <see cref="MultiPageLayout"/>.</param> public MultiPageIGraphBuilder(MultiPageLayoutResult result) { // initialize the graph item defaults with the null styles NormalEdgeDefaults = new EdgeDefaults { Style = NullEdgeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; ConnectorEdgeDefaults = new EdgeDefaults { Style = NullEdgeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; ProxyEdgeDefaults = new EdgeDefaults { Style = NullEdgeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; ProxyReferenceEdgeDefaults = new EdgeDefaults { Style = NullEdgeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; NormalNodeDefaults = new NodeDefaults { Style = NullNodeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; GroupNodeDefaults = new NodeDefaults { Style = NullNodeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; ConnectorNodeDefaults = new NodeDefaults { Style = NullNodeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; ProxyNodeDefaults = new NodeDefaults { Style = NullNodeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; ProxyReferenceNodeDefaults = new NodeDefaults { Style = NullNodeStyle, Labels = { Style = NullLabelStyle, LayoutParameter = NullLabelModelParameter } }; this.result = result; }
/// <summary> /// Applies the result of the multipage layout using a <see cref="MultiPageIGraphBuilder"/>. /// </summary> private void ApplyLayoutResult(MultiPageLayoutResult multiPageLayout, double pageWidth, double pageHeight) { // decorations for underlined labels var decorations = new TextDecorationCollection { new TextDecoration(TextDecorationLocation.Underline, Pens.Black, 0, TextDecorationUnit.FontRecommended, TextDecorationUnit.FontRecommended) }; // use the MultiPageGraphBuilder to create a list of IGraph instances that represent the single pages MultiPageIGraphBuilder builder = new MultiPageIGraphBuilder(multiPageLayout) { // assign custom template node styles for the auxiliary nodes introduced by the multipage layout. // also set the label style and model parameter. // if nothing is specified, the values of the original graph are copied. NormalNodeDefaults = { Style = new NodeControlNodeStyle("NormalNodeTemplate"), Labels = { Style = new DefaultLabelStyle(), LayoutParameter= InteriorLabelModel.Center } }, ConnectorNodeDefaults = { Style = new NodeControlNodeStyle("ConnectorNodeTemplate"), Labels = { Style = new DefaultLabelStyle { TextDecorations = decorations }, LayoutParameter = InteriorLabelModel.Center } }, ProxyNodeDefaults = { Style = new NodeControlNodeStyle("ProxyNodeTemplate"), Labels = { Style = new DefaultLabelStyle { TextDecorations = decorations }, LayoutParameter = InteriorLabelModel.Center } }, ProxyReferenceNodeDefaults = { Style = new NodeControlNodeStyle("ProxyReferenceNodeTemplate"), Labels = { Style = new DefaultLabelStyle { TextDecorations = decorations }, LayoutParameter = InteriorLabelModel.Center } } }; // create the graphs viewGraphs = builder.CreateViewGraphs(); SetPageNumber(0, null); // set the new page bounds pageBoundsVisualCreator.PageWidth = pageWidth; pageBoundsVisualCreator.PageHeight = pageHeight; ShowLoadingIndicator(false); }
public void LayoutDone(MultiPageLayoutResult result) { layoutDelegate(result); }
/// <summary> /// Applies the result of the multipage layout using a <see cref="MultiPageIGraphBuilder"/>. /// </summary> private void ApplyLayoutResult(MultiPageLayoutResult multiPageLayout, double pageWidth, double pageHeight) { // typeface format for underlined labels Font normalFont = new Font(SystemFonts.DefaultFont.FontFamily, 9.0f, GraphicsUnit.Pixel); Font font = new Font(SystemFonts.DefaultFont.FontFamily, 9.0f, FontStyle.Underline, GraphicsUnit.Pixel); // use the MultiPageGraphBuilder to create a list of IGraph instances that represent the single pages MultiPageIGraphBuilder builder = new MultiPageIGraphBuilder(multiPageLayout) { // assign custom template node styles for the auxiliary nodes introduced by the multipage layout. // also set the label style and model parameter. // if nothing is specified, the values of the original graph are copied. NormalNodeDefaults = { Style = new ShapeNodeStyle { Shape = ShapeNodeShape.RoundRectangle, Pen = new Pen(Color.FromArgb(0xFF, 0x99, 0xCC, 0xFF)), Brush = new LinearGradientBrush(new Point(0, 0), new Point(0, 1), Color.FromArgb(0xFF, 0xCC, 0xFF, 0xFF), Color.FromArgb(0xFF, 0x99, 0xCC, 0xFF)) }, Labels = { Style = new DefaultLabelStyle { Font = normalFont }, LayoutParameter = InteriorLabelModel.Center } }, ConnectorNodeDefaults = { Style = new ShapeNodeStyle { Shape = ShapeNodeShape.RoundRectangle, Pen = new Pen(Color.FromArgb(0xFF, 0xFF, 0x99, 0x00)), Brush = new LinearGradientBrush(new Point(0, 0), new Point(0, 1), Color.FromArgb(0xFF, 0xFF, 0xCC, 0x00), Color.FromArgb(0xFF, 0xFF, 0x99, 0x00)) }, Labels = { Style = new DefaultLabelStyle { Font = font }, LayoutParameter = InteriorLabelModel.Center } }, ProxyNodeDefaults = { Style = new ShapeNodeStyle { Shape = ShapeNodeShape.RoundRectangle, Pen = new Pen(Color.FromArgb(0xFF, 0x99, 0xCC, 0x33)), Brush = new LinearGradientBrush(new Point(0, 0), new Point(0, 1), Color.FromArgb(0xFF, 0xCC, 0xFF, 0x99), Color.FromArgb(0xFF, 0x99, 0xCC, 0x33)) }, Labels = { Style = new DefaultLabelStyle { Font = font }, LayoutParameter = InteriorLabelModel.Center } }, ProxyReferenceNodeDefaults = { Style = new ShapeNodeStyle { Shape = ShapeNodeShape.RoundRectangle, Pen = new Pen(Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF)), Brush = new LinearGradientBrush(new Point(0, 0), new Point(0, 1), Color.FromArgb(0xFF, 0xFF, 0xA6, 0xFF), Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF)) }, Labels = { Style = new DefaultLabelStyle { Font = font }, LayoutParameter = InteriorLabelModel.Center } } }; // create the graphs viewGraphs = builder.CreateViewGraphs(); SetPageNumber(0, null); // set the new page bounds pageBoundsVisualCreator.PageWidth = pageWidth; pageBoundsVisualCreator.PageHeight = pageHeight; ShowLoadingIndicator(false); graphControl.Focus(); }