Exemplo n.º 1
0
        private NCompositeShape CreateVerticalPipe()
        {
            NDynamicPort    port;
            NCompositeShape shape = new NCompositeShape();
            NRectanglePath  rect  = new NRectanglePath(SIZE, 0, SIZE, 3 * SIZE);

            NStyle.SetStrokeStyle(rect, new NStrokeStyle(0, Color.White));

            shape.Primitives.AddChild(rect);
            shape.Primitives.AddChild(new NLinePath(SIZE, 0, SIZE, 3 * SIZE));
            shape.Primitives.AddChild(new NLinePath(2 * SIZE, 0, 2 * SIZE, 3 * SIZE));
            shape.UpdateModelBounds();

            if (shape.Ports == null)
            {
                shape.CreateShapeElements(ShapeElementsMask.Ports);
            }

            port      = new NDynamicPort(shape.UniqueId, TOP, DynamicPortGlueMode.GlueToContour);
            port.Type = PortType.InwardAndOutward;
            shape.Ports.AddChild(port);

            port      = new NDynamicPort(shape.UniqueId, BOTTOM, DynamicPortGlueMode.GlueToContour);
            port.Type = PortType.InwardAndOutward;
            shape.Ports.AddChild(port);

            SetProtections(shape);
            return(shape);
        }
Exemplo n.º 2
0
        private void CreateArchitecturalDocument()
        {
            // set global document styles
            document.Style.TextStyle = new NTextStyle(new Font("Arial", 8.25f));
            document.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center;
            document.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Center;

            // create the rim rect
            NRectangleShape rimRect = new NRectangleShape(new NRectangleF(0, 0, 5, 7));

            rimRect.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White));
            document.ActiveLayer.AddChild(rimRect);

            // create the room rects
            NRectangleShape roomRect1 = new NRectangleShape(new NRectangleF(0, 0, 2, 3));

            roomRect1.Text = "Room 1";
            document.ActiveLayer.AddChild(roomRect1);

            NRectangleShape roomRect2 = new NRectangleShape(new NRectangleF(3, 0, 2, 3));

            roomRect2.Text = "Room 2";
            document.ActiveLayer.AddChild(roomRect2);

            NRectangleShape roomRect3 = new NRectangleShape(new NRectangleF(0, 4, 2, 3));

            roomRect3.Text = "Room 3";
            document.ActiveLayer.AddChild(roomRect3);

            // create the stairs case
            NCompositeShape stairCase = new NCompositeShape();

            float stepXSize = 0.7f;
            float stepYSize = 0.25f;

            for (int i = 0; i < 9; i++)
            {
                NRectanglePath step = new NRectanglePath(0, stepYSize * i, stepXSize, stepYSize);
                stairCase.Primitives.AddChild(step);
            }

            stairCase.UpdateModelBounds();
            stairCase.Bounds = new NRectangleF(4, 4, 1, 3);

            stairCase.Text = "Stairs";
            NTextStyle textStyle = (document.Style.TextStyle.Clone() as NTextStyle);

            textStyle.Orientation     = 90;
            stairCase.Style.TextStyle = textStyle;

            document.ActiveLayer.AddChild(stairCase);

            // update the drawing bounds to size to content with some margins
            document.AutoBoundsMinSize = new NSizeF(1, 1);
            document.AutoBoundsPadding = new Nevron.Diagram.NMargins(0.5f);
            document.AutoBoundsMode    = AutoBoundsMode.AutoSizeToContent;
        }
Exemplo n.º 3
0
        private void CreateRectangleArrowShape()
        {
            /// create a simple rect and name it
            NRectangleF    modelBounds = new NRectangleF(0, -1, 2, 2);
            NRectanglePath rect        = new NRectanglePath(modelBounds);

            rect.Name = "Rectangle";

            // add it to the arrowhead shape stencil
            document.ArrowheadShapeStencil.AddChild(rect);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the zoom rect
        /// </summary>
        /// <remarks>
        /// This implementation will currently create a zoom rectangle and add it to the preview layer
        /// </remarks>
        protected virtual void CreateZoomRect()
        {
            // create the zoom rect
            m_ZoomRect = new NRectanglePath();
            NStyle.SetFillStyle(m_ZoomRect, new NColorFillStyle(Color.FromArgb(0, 0, 0, 0)));
            NStyle.SetStrokeStyle(m_ZoomRect, new NStrokeStyle(1, Color.Black, LinePattern.Dash));
            View.PreviewLayer.AddChild(m_ZoomRect);

            // start dragging
            View.OnDraggingStarted();
        }
Exemplo n.º 5
0
        protected NCompositeShape CreateLegendItem(NRectangleF bounds, string str, NFillStyle fillStyle)
        {
            NCompositeShape item = new NCompositeShape();

            NRectanglePath rect = new NRectanglePath(0, 0, 2, 2);

            NStyle.SetFillStyle(rect, (fillStyle.Clone() as NFillStyle));
            item.Primitives.AddChild(rect);

            NTextPrimitive text = new NTextPrimitive(str, new NRectangleF(2, 0, 4, 2));

            item.Primitives.AddChild(text);

            item.UpdateModelBounds();
            item.Bounds = bounds;
            return(item);
        }
Exemplo n.º 6
0
        private void CreateMechanicalEngineeringDocument()
        {
            // create the key shape
            NCompositeShape key = new NCompositeShape();

            NRectanglePath keyRect = new NRectanglePath(new NRectangleF(12.5f, 30, 5f, 50));

            key.Primitives.AddChild(keyRect);

            NEllipsePath keyCircle = new NEllipsePath(new NRectangleF(0, 0, 30, 30));

            key.Primitives.AddChild(keyCircle);

            NEllipsePath keyHole = new NEllipsePath(new NRectangleF(13f, 2f, 4f, 4f));

            NStyle.SetFillStyle(keyHole, new NColorFillStyle(Color.White));
            NStyle.SetStrokeStyle(keyHole, new NStrokeStyle(0, Color.Black));
            key.Primitives.AddChild(keyHole);

            key.UpdateModelBounds();
            key.Style.FillStyle   = new NColorFillStyle(Color.DarkGray);
            key.Style.StrokeStyle = new NStrokeStyle(0, Color.Black);

            document.ActiveLayer.AddChild(key);

            // create the octagram
            NBasicShapesFactory factory = new NBasicShapesFactory(document);
            NShape octagram             = factory.CreateShape((int)BasicShapes.Octagram);

            octagram.Bounds            = new NRectangleF(40, 0, 40, 40);
            octagram.Style.FillStyle   = new NColorFillStyle(Color.DarkGray);
            octagram.Style.StrokeStyle = new NStrokeStyle(0, Color.Black);

            document.ActiveLayer.AddChild(octagram);

            // update the drawing bounds to size to content with some margins
            document.AutoBoundsMinSize = new NSizeF(1, 1);
            document.AutoBoundsPadding = new Nevron.Diagram.NMargins(5f);
            document.AutoBoundsMode    = AutoBoundsMode.AutoSizeToContent;
        }
        protected NCompositeShape CreateOrgChartShape(NPersonalInfo info)
        {
            NRectangleF bounds = info.Bounds;
            float       bottomPortAlignment = info.BottomPortAlignment;
            Bitmap      photo = new Bitmap(this.MapPathSecure(info.Picture));

            // compose a new graph vertex from a frame and an image
            NRectanglePath  frame           = new NRectanglePath(bounds);
            NRectanglePath  image           = new NRectanglePath(new NPointF(bounds.X + 5, bounds.Y + 5), new NSizeF(photo.Size));
            NImageFillStyle imgageFillStyle = new NImageFillStyle(photo, 0xff);

            NStyle.SetFillStyle(image, imgageFillStyle);

            NCompositeShape shape = new NCompositeShape();

            shape.Primitives.AddChild(frame);
            shape.Primitives.AddChild(image);
            shape.UpdateModelBounds();
            Document.ActiveLayer.AddChild(shape);

            // set the vertex fill style
            NColorFillStyle fillStyle = null;

            switch (info.Level)
            {
            case 0:
                fillStyle = new NColorFillStyle(Color.FromArgb(241, 100, 34));
                break;

            case 1:
                fillStyle = new NColorFillStyle(Color.FromArgb(249, 167, 26));
                break;

            case 2:
                fillStyle = new NColorFillStyle(Color.FromArgb(255, 247, 151));
                break;
            }

            fillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter());
            shape.Style.FillStyle = fillStyle;

            NInteractivityStyle interactivityStyle = new NInteractivityStyle();

            interactivityStyle.Tooltip.Text = "Click to show " + info.Name + " personal information";
            interactivityStyle.UrlLink.Url  = "../Examples/WebControl/GettingStarted/NPersonalInfoPage.aspx?" + info.Id.ToString();
            shape.Style.InteractivityStyle  = interactivityStyle;

            // add a new label for the person name
            NRotatedBoundsLabel nameLabel = new NRotatedBoundsLabel(info.Name, shape.UniqueId, new Nevron.Diagram.NMargins(40, 1, 50, 1));

            shape.Labels.AddChild(nameLabel);
            NStyle.SetTextStyle(nameLabel, nameLabel.ComposeTextStyle().Clone() as NTextStyle);
            nameLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            nameLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Top;

            // configure default label (used for the person position)
            NRotatedBoundsLabel positionLabel = shape.Labels.DefaultLabel as NRotatedBoundsLabel;

            NStyle.SetTextStyle(positionLabel, positionLabel.ComposeTextStyle().Clone() as NTextStyle);
            positionLabel.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold));
            positionLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            positionLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Bottom;
            positionLabel.Margins = new Nevron.Diagram.NMargins(40, 5, 1, 50);
            positionLabel.Text    = info.Position;

            // create the optional ports of the shape
            shape.CreateShapeElements(ShapeElementsMask.Ports);

            // add rotated bounds ports
            NPort leftPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleLeft));

            leftPort.Name = "Left";
            shape.Ports.AddChild(leftPort);

            NPort rightPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleRight));

            rightPort.Name = "Right";
            shape.Ports.AddChild(rightPort);

            NPort topPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.TopCenter));

            topPort.Name = "Top";
            shape.Ports.AddChild(topPort);

            NRotatedBoundsPort bottomPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(bottomPortAlignment, 50));

            bottomPort.Name = "Bottom";
            shape.Ports.AddChild(bottomPort);

            return(shape);
        }
        void InitToolbar()
        {
            if (nDrawingViewToolbar.RequiresInitialization)
            {
                ActiveCommand = toolbarButtons[0].CommandName;

                // begin view init
                nDrawingViewToolbar.ViewLayout      = CanvasLayout.Normal;
                nDrawingViewToolbar.DocumentPadding = new Nevron.Diagram.NMargins(0);

                // init document
                nDrawingViewToolbar.Document.BeginInit();

                nDrawingViewToolbar.Document.AutoBoundsPadding = new Nevron.Diagram.NMargins(4);

                nDrawingViewToolbar.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                nDrawingViewToolbar.Document.GraphicsSettings.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                nDrawingViewToolbar.Document.GraphicsSettings.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

                // set up visual formatting
                nDrawingViewToolbar.Document.Style.FillStyle = new NColorFillStyle(Color.White);
                nDrawingViewToolbar.Document.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial Narrow", 8));

                nDrawingViewToolbar.Document.BackgroundStyle.FrameStyle.Visible = false;

                //	set up the shape factories
                NBasicShapesFactory buttonFactory = new NBasicShapesFactory(nDrawingViewToolbar.Document);
                buttonFactory.DefaultSize = new NSizeF(24, 24);

                NBrainstormingShapesFactory iconFactory = new NBrainstormingShapesFactory(nDrawingViewToolbar.Document);
                iconFactory.DefaultSize = new NSizeF(16, 16);

                //	create a batch layout, which will align shapes
                NBatchLayout batchLayout = new NBatchLayout(nDrawingViewToolbar.Document);

                //	create buttons
                int count = toolbarButtons.Length;
                for (int i = 0; i < count; i++)
                {
                    ToolbarButton btn         = toolbarButtons[i];
                    bool          isActive    = (this.ActiveCommand == btn.CommandName);
                    NShape        buttonShape = buttonFactory.CreateShape(BasicShapes.RoundedRectangle);

                    //	create the button shape group
                    NGroup      g      = new NGroup();
                    NBatchGroup bgroup = new NBatchGroup(nDrawingViewToolbar.Document);
                    NNodeList   shapes = new NNodeList();
                    if (btn.IsSeparator)
                    {
                        buttonShape.Width            /= 2;
                        buttonShape.Style.StrokeStyle = new NStrokeStyle(Color.White);
                        shapes.Add(buttonShape);
                    }
                    else if (!btn.IsColorSelector)
                    {
                        shapes.Add(buttonShape);
                    }
                    else
                    {
                        buttonShape.Style.FillStyle = new NColorFillStyle(btn.Color);
                        shapes.Add(buttonShape);
                    }

                    NRectanglePath  imagePath = new NRectanglePath(0f, 0f, btn.IconSize.Width, btn.IconSize.Height);
                    NImageFillStyle fs1       = new NImageFillStyle(this.MapPathSecure(@"..\..\..\Images\FlowChartBuilder\" + btn.IconFile));
                    NStyle.SetFillStyle(imagePath, fs1);
                    NStyle.SetStrokeStyle(imagePath, new NStrokeStyle(0, Color.White));
                    NCompositeShape imageShape = new NCompositeShape();
                    imageShape.Primitives.AddChild(imagePath);
                    imageShape.UpdateModelBounds();
                    shapes.Add(imageShape);

                    NShape coverShape = buttonFactory.CreateShape(BasicShapes.RoundedRectangle);
                    coverShape.Width = buttonShape.Width;
                    coverShape.Name  = "coverShape";
                    shapes.Add(coverShape);

                    if (!isActive && !btn.IsClientSide && !btn.IsSeparator)
                    {
                        if (btn.IsColorSelector)
                        {
                            coverShape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(180, Color.White));
                        }
                        else
                        {
                            coverShape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(160, Color.White));
                        }
                        coverShape.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(160, Color.White));
                    }
                    else
                    {
                        coverShape.Style.FillStyle   = new NColorFillStyle(Color.FromArgb(0, Color.White));
                        coverShape.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.White));
                        if (!btn.IsSeparator)
                        {
                            coverShape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(70, Color.Black), new NPointL(1, 0));
                        }
                    }

                    // perform layout
                    batchLayout.Build(shapes);
                    batchLayout.AlignVertically(buttonShape, VertAlign.Center, false);
                    batchLayout.AlignHorizontally(buttonShape, HorzAlign.Center, false);

                    // group shapes
                    bgroup.Build(shapes);
                    bgroup.Group(null, false, out g);

                    // enable interactivity
                    if (!btn.IsSeparator)
                    {
                        g.Style.InteractivityStyle = new NInteractivityStyle(true, btn.CommandName, btn.Title, CursorType.Hand);
                    }

                    // set the command of the button
                    g.Tag = btn.CommandName;

                    nDrawingViewToolbar.Document.ActiveLayer.AddChild(g);
                }

                // layout the shapes in the active layer using a table layout
                NTableLayout layout = new NTableLayout();

                // setup the table layout
                layout.Direction         = LayoutDirection.LeftToRight;
                layout.ConstrainMode     = CellConstrainMode.Ordinal;
                layout.MaxOrdinal        = toolbarButtons.Length;
                layout.HorizontalSpacing = 7;

                // create a layout context
                NLayoutContext layoutContext = new NLayoutContext();
                layoutContext.GraphAdapter         = new NShapeGraphAdapter();
                layoutContext.BodyAdapter          = new NShapeBodyAdapter(nDrawingViewToolbar.Document);
                layoutContext.BodyContainerAdapter = new NDrawingBodyContainerAdapter(nDrawingViewToolbar.Document);

                // layout the shapes
                layout.Layout(nDrawingViewToolbar.Document.ActiveLayer.Children(null), layoutContext);

                nDrawingViewToolbar.Document.EndInit();
            }
        }
        private void InitDocument()
        {
            // modify the connectors style sheet
            NStyleSheet styleSheet = (document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.Shape     = ArrowheadShape.None;
            styleSheet.Style.EndArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black);

            // create a stylesheet for the CPA shapes
            styleSheet = new NStyleSheet("CPA");
            styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(68, 90, 108), Color.FromArgb(162, 173, 182));
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the CLIENT shapes
            styleSheet = new NStyleSheet("CLIENT");
            styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(247, 150, 56), Color.FromArgb(251, 203, 156));
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the stripes
            styleSheet = new NStyleSheet("STRIPE");
            styleSheet.Style.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.FromArgb(221, 221, 221));
            styleSheet.Style.StrokeStyle = new NStrokeStyle(0, Color.White);
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the ABC texts
            styleSheet = new NStyleSheet("ABC");
            styleSheet.Style.TextStyle = new NTextStyle(new Font("Ariel", 12), Color.FromArgb(150, 150, 150));
            document.StyleSheets.AddChild(styleSheet);

            float abcWidth = 150;

            // configure the document
            base.DefaultGridCellSize = new NSizeF(100, 70);
            base.DefaultGridSpacing  = new NSizeF(30, 30);
            base.DefaultGridOrigin   = new NPointF(60, 30);

            document.Bounds        = new NRectangleF(0, 0, 1000, (6 * base.DefaultGridCellSize.Height) + (7 * base.DefaultGridSpacing.Height));
            document.ShadowsZOrder = ShadowsZOrder.BehindLayer;

            // create the stripes
            NRectanglePath rect = new NRectanglePath(0, 0, document.Width, document.Height / 3);

            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            rect = new NRectanglePath(0, document.Height / 3, document.Width, document.Height / 3);
            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            rect = new NRectanglePath(0, 2 * document.Height / 3, document.Width, document.Height / 3);
            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            // create A,B,C texts
            NTextPrimitive text = new NTextPrimitive("A", document.Width - abcWidth, 0, abcWidth, document.Height / 3);

            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            text                = new NTextPrimitive("B", document.Width - abcWidth, document.Height / 3, abcWidth, document.Height / 3);
            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            text                = new NTextPrimitive("C", document.Width - abcWidth, 2 * document.Height / 3, abcWidth, document.Height / 3);
            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            // add stripe texts
            text = new NTextPrimitive("Sing up client", document.Width - abcWidth, document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextPrimitive("Monthly Accounting Services", document.Width - abcWidth, 2 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextPrimitive("Additional Services", document.Width - abcWidth, 3 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            // create a layer for the foreground shapes
            NLayer layer = new NLayer();

            document.Layers.AddChild(layer);
            document.ActiveLayerUniqueId = layer.UniqueId;

            // all shapes in the foreground layer have a shadow
            layer.Style.ShadowStyle = new NShadowStyle(
                ShadowType.GaussianBlur,
                Color.Gray,
                new NPointL(5, 5),
                1,
                new NLength(10));

            // shapes in row 1
            NShape newClient                  = base.CreateFlowChartingShape(FlowChartingShapes.Decision, base.GetGridCell(0, 0), "New Client", "CPA");
            NShape register                   = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(0, 1), "Register", "CPA");
            NShape clientAccountInfo          = base.CreateFlowChartingShape(FlowChartingShapes.Data, base.GetGridCell(0, 2), "Client account info", "CPA");
            NShape explainDataEntryProcedures = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(0, 3), "Explain data entry procedures", "CPA");

            // shapes in row 2
            NShape dataEntry         = base.CreateFlowChartingShape(FlowChartingShapes.ManualInput, base.GetGridCell(2, 0), "Data Entry", "CLIENT");
            NShape emailCompleted    = base.CreateFlowChartingShape(FlowChartingShapes.Document, base.GetGridCell(2, 1), "E-mail Completed", "CLIENT");
            NShape review            = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(2, 2), "Review", "CPA");
            NShape needsRevising     = base.CreateFlowChartingShape(FlowChartingShapes.Decision, base.GetGridCell(2, 3), "Needs revising", "CPA");
            NShape emailRevisions    = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(2, 4), "E-mail revisions", "CPA");
            NShape evaluateRevisions = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(2, 5), "Evaluate revisions", "CLIENT");

            // shapes in row 3
            NShape emailApprovedRevisions = base.CreateFlowChartingShape(FlowChartingShapes.Document, base.GetGridCell(3, 2), "E-mail Approved Revisions", "CLIENT");
            NShape evaluateRevisions2     = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(3, 4), "Evaluate Revisions", "CLIENT");
            NShape answerClientEmail      = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(3, 5), "Answer Client E-mail", "CPA");

            // shapes in row 4
            NShape paywoll    = base.CreateFlowChartingShape(FlowChartingShapes.Document, base.GetGridCell(5, 2), "Payroll", "CLIENT");
            NShape taxes      = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(5, 3), "Taxes", "CLIENT");
            NShape controller = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(5, 4), "Controller", "CPA");

            // some shapes need to have extra ports
            NRotatedBoundsPort port = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(-25, 50));

            port.Name = "BottomLeft";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(+25, 50));
            port.Name = "BottomRight";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(-25, -50));
            port.Name = "TopLeft";
            answerClientEmail.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(+25, -50));
            port.Name = "TopRight";
            answerClientEmail.Ports.AddChild(port);

            // connect shapes in levels
            base.CreateConnector(newClient, "Center", register, "Center", ConnectorType.Line, "YES");
            base.CreateConnector(register, "Center", clientAccountInfo, "Center", ConnectorType.Line, "");
            base.CreateConnector(clientAccountInfo, "Center", explainDataEntryProcedures, "Center", ConnectorType.Line, "");

            base.CreateConnector(dataEntry, "Center", emailCompleted, "Center", ConnectorType.Line, "");
            base.CreateConnector(emailCompleted, "Center", review, "Center", ConnectorType.Line, "");
            base.CreateConnector(review, "Center", needsRevising, "Center", ConnectorType.Line, "");
            base.CreateConnector(needsRevising, "Center", emailRevisions, "Center", ConnectorType.Line, "YES");
            base.CreateConnector(emailRevisions, "Center", evaluateRevisions, "Center", ConnectorType.Line, "");

            base.CreateConnector(evaluateRevisions2, "Center", emailApprovedRevisions, "Center", ConnectorType.Line, "");

            // connect accross levels
            NStep3Connector connector = (base.CreateConnector(newClient, "Center", dataEntry, "Center", ConnectorType.SideToSide, "NO") as NStep3Connector);

            connector.UseMiddleControlPointPercent = false;
            connector.MiddleControlPointOffset     = -55;

            base.CreateConnector(explainDataEntryProcedures, "Center", dataEntry, "Center", ConnectorType.TopToBottom, "");

            base.CreateConnector(emailApprovedRevisions, "Center", review, "Center", ConnectorType.Line, "");
            base.CreateConnector(emailRevisions, "Center", evaluateRevisions2, "Center", ConnectorType.Line, "");
            base.CreateConnector(evaluateRevisions, "BottomLeft", answerClientEmail, "TopLeft", ConnectorType.Line, "");
            base.CreateConnector(answerClientEmail, "TopRight", evaluateRevisions, "BottomRight", ConnectorType.Line, "");

            connector = (base.CreateConnector(needsRevising, "Center", paywoll, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            connector = (base.CreateConnector(needsRevising, "Center", taxes, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            connector = (base.CreateConnector(needsRevising, "Center", controller, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            // create the legend as a group
            NGroup legend = new NGroup();

            NRectangleShape legendBackground = new NRectangleShape(0, 0, 1, 3);

            legendBackground.Style.FillStyle = new NColorFillStyle(Color.White);
            legend.Shapes.AddChild(legendBackground);

            NRectangleF bounds = new NRectangleF(0, 1, 1, 1);

            bounds.Inflate(-0.2f, -0.2f);

            NRectangleShape cpaItem = new NRectangleShape(bounds);

            cpaItem.Text           = "CPA";
            cpaItem.StyleSheetName = "CPA";
            legend.Shapes.AddChild(cpaItem);

            bounds = new NRectangleF(0, 2, 1, 1);
            bounds.Inflate(-0.2f, -0.2f);

            NRectangleShape clientItem = new NRectangleShape(bounds);

            clientItem.Text           = "Client";
            clientItem.StyleSheetName = "CLIENT";
            legend.Shapes.AddChild(clientItem);

            legend.UpdateModelBounds();
            legend.Bounds = base.GetGridCell(4, 0, 1, 1);

            document.ActiveLayer.AddChild(legend);
        }