/// <summary>
        /// Overriden to create the family tree template
        /// </summary>
        /// <param name="document">document in which to create the template</param>
        protected override void CreateTemplate(NDrawingDocument document)
        {
            NPoint pt;
            NShape node;
            NShape edge = null;
            NPage  page = document.Content.ActivePage;

            // determine the elements dimensions
            double childrenWidth = m_nChildrenCount * m_VerticesSize.Width + (m_nChildrenCount - 1) * m_fHorizontalSpacing;
            double parentsWidth  = m_VerticesSize.Width * 2 + m_fHorizontalSpacing;

            // determine the template dimensions
            double     templateWidth  = Math.Max(childrenWidth, parentsWidth);
            NRectangle templateBounds = new NRectangle(m_Origin.X, m_Origin.Y, templateWidth, m_VerticesSize.Height * 2 + m_fVerticalSpacing);
            NPoint     center         = templateBounds.Center;

            // create the parent nodes
            NShape father = CreateVertex(m_VerticesShape);

            pt = new NPoint(center.X - (m_VerticesSize.Width + m_fHorizontalSpacing / 2), templateBounds.Y);
            father.SetBounds(new NRectangle(pt, m_VerticesSize));
            page.Items.AddChild(father);

            NShape mother = CreateVertex(m_VerticesShape);

            pt = new NPoint(center.X + m_fHorizontalSpacing / 2, templateBounds.Y);
            mother.SetBounds(new NRectangle(pt, m_VerticesSize));
            page.Items.AddChild(mother);

            // create the children
            if (m_nChildrenCount > 0)
            {
                double childrenY = templateBounds.Y + m_VerticesSize.Height + m_fVerticalSpacing;
                for (int i = 0; i < m_nChildrenCount; i++)
                {
                    // create the child
                    node = CreateVertex(m_VerticesShape);
                    pt   = new NPoint(i * (m_VerticesSize.Width + m_fHorizontalSpacing), childrenY);
                    node.SetBounds(new NRectangle(pt, m_VerticesSize));
                    page.Items.AddChild(node);

                    // attach it to the parents
                    edge = CreateEdge(ENConnectorShape.BottomToTop1);
                    page.Items.AddChild(edge);

                    edge.GlueBeginToGeometryIntersection(father);
                    edge.GlueEndToShape(node);

                    edge = CreateEdge(ENConnectorShape.BottomToTop1);
                    page.Items.AddChild(edge);

                    edge.GlueBeginToGeometryIntersection(mother);
                    edge.GlueEndToShape(node);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Overriden to create the rectangular grid template in the specified document
        /// </summary>
        /// <param name="document">document in which to create the template</param>
        protected override void CreateTemplate(NDrawingDocument document)
        {
            NPage  page = document.Content.ActivePage;
            NShape edge = null;
            NShape vertex;

            NShape[,] vertexGrid = new NShape[m_nRows, m_nColumns];

            for (int row = 0; row < m_nRows; row++)
            {
                for (int col = 0; col < m_nColumns; col++)
                {
                    // create the vertex
                    vertex = CreateVertex(m_VerticesShape);
                    vertex.SetBounds(new NRectangle(m_Origin.X + col * (m_VerticesSize.Width + m_fHorizontalSpacing),
                                                    m_Origin.Y + row * (m_VerticesSize.Height + m_fVerticalSpacing),
                                                    m_VerticesSize.Width, m_VerticesSize.Height));
                    page.Items.AddChild(vertex);

                    // connect it with its X and Y predecessors
                    if (m_bConnectGrid == false)
                    {
                        continue;
                    }

                    vertexGrid[row, col] = vertex;

                    // connect X
                    if (col > 0)
                    {
                        edge = CreateEdge(ENConnectorShape.Line);
                        page.Items.AddChild(edge);
                        edge.GlueBeginToGeometryIntersection(vertexGrid[row, col - 1]);
                        edge.GlueEndToShape(vertex);
                    }

                    // connect Y
                    if (row > 0)
                    {
                        edge = CreateEdge(ENConnectorShape.Line);
                        page.Items.AddChild(edge);
                        edge.GlueBeginToGeometryIntersection(vertexGrid[row - 1, col]);
                        edge.GlueEndToShape(vertex);
                    }
                }
            }
        }
示例#3
0
        private void ConnectNetworks(NGroup fromNetwork, NGroup toNetwork)
        {
            NConnectorShapeFactory connectorShapes = new NConnectorShapeFactory();
            NShape lineShape = connectorShapes.CreateShape((int)ENConnectorShape.Line);

            lineShape.GlueBeginToShape(fromNetwork);
            lineShape.GlueEndToShape(toNetwork);
            m_DrawingDocument.Content.ActivePage.Items.Add(lineShape);
        }
示例#4
0
        protected override void InitDiagram()
        {
            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            // 1. Create some shape factories
            NBasicShapeFactory     basicShapesFactory     = new NBasicShapeFactory();
            NConnectorShapeFactory connectorShapesFactory = new NConnectorShapeFactory();

            // 2. Create and add some shapes
            NShape shape1 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape1.SetBounds(new NRectangle(50, 50, 100, 100));
            activePage.Items.Add(shape1);

            NShape shape2 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape2.SetBounds(new NRectangle(400, 50, 100, 100));
            activePage.Items.Add(shape2);

            // 3. Connect the shapes
            NShape connector = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            activePage.Items.Add(connector);
            connector.GlueBeginToShape(shape1);
            connector.GlueEndToShape(shape2);

            // Add 2 outward ports to the connector
            NPort port1 = new NPort(0.3, 0.3, true);

            port1.GlueMode = ENPortGlueMode.Outward;
            connector.Ports.Add(port1);

            NPort port2 = new NPort(0.7, 0.7, true);

            port2.GlueMode = ENPortGlueMode.Outward;
            connector.Ports.Add(port2);

            // Attach label shapes to the outward ports of the connector
            NShape labelShape1 = CreateLabelShape("Label 1");

            activePage.Items.Add(labelShape1);
            labelShape1.GlueMasterPortToPort(labelShape1.Ports[0], port1);

            NShape labelShape2 = CreateLabelShape("Label 2");

            activePage.Items.Add(labelShape2);
            labelShape2.GlueMasterPortToPort(labelShape2.Ports[0], port2);
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            // plotter commands
            NBasicShapeFactory     basicShapes      = new NBasicShapeFactory();
            NConnectorShapeFactory connectorFactory = new NConnectorShapeFactory();

            // create a rounded rect
            NShape rectShape = basicShapes.CreateShape(ENBasicShape.Rectangle);

            rectShape.DefaultShapeGlue        = ENDefaultShapeGlue.GlueToGeometryIntersection;
            rectShape.Geometry.CornerRounding = 10;
            rectShape.SetBounds(50, 50, 100, 100);
            activePage.Items.Add(rectShape);

            // create a rounded pentagram
            NShape pentagramShape = basicShapes.CreateShape(ENBasicShape.Pentagram);

            pentagramShape.DefaultShapeGlue        = ENDefaultShapeGlue.GlueToGeometryIntersection;
            pentagramShape.Geometry.CornerRounding = 20;
            pentagramShape.SetBounds(310, 310, 100, 100);
            activePage.Items.Add(pentagramShape);

            // create a rounded routable connector
            NShape connector = connectorFactory.CreateShape(ENConnectorShape.RoutableConnector);

            connector.Geometry.CornerRounding = 30;
            connector.GlueBeginToShape(rectShape);
            connector.GlueEndToShape(pentagramShape);
            activePage.Items.Add(connector);
        }
        /// <summary>
        /// Overriden to create the triangular grid template in the specified document
        /// </summary>
        /// <param name="document">document in which to create the template</param>
        protected override void CreateTemplate(NDrawingDocument document)
        {
            NPage      page           = document.Content.ActivePage;
            NRectangle templateBounds = new NRectangle(m_Origin.X, m_Origin.Y,
                                                       m_nLevels * m_VerticesSize.Width + (m_nLevels - 1) * m_fHorizontalSpacing,
                                                       m_nLevels * m_VerticesSize.Height + (m_nLevels - 1) * m_fVerticalSpacing);
            NPoint location;
            NShape cur = null, prev = null;
            NShape edge = null;

            NList <NShape> curRowNodes  = null;
            NList <NShape> prevRowNodes = null;

            for (int level = 1; level <= m_nLevels; level++)
            {
                // determine the location of the first node in the level
                location = new NPoint(templateBounds.X + (templateBounds.Width - level * m_VerticesSize.Width - (level - 1) * m_fHorizontalSpacing) / 2,
                                      templateBounds.Y + (level - 1) * (m_VerticesSize.Height + m_fVerticalSpacing));

                curRowNodes = new NList <NShape>();
                for (int i = 0; i < level; i++)
                {
                    cur = CreateVertex(m_VerticesShape);
                    cur.SetBounds(new NRectangle(location, m_VerticesSize));
                    page.Items.AddChild(cur);

                    location.X += m_VerticesSize.Width + m_fHorizontalSpacing;

                    // connect the current node with its ancestors and prev node
                    if (m_bConnectGrid == false)
                    {
                        continue;
                    }

                    // connect with prev
                    if (i > 0)
                    {
                        edge = CreateEdge(ENConnectorShape.Line);
                        page.Items.AddChild(edge);

                        edge.GlueBeginToGeometryIntersection(prev);
                        edge.GlueEndToShape(cur);
                    }

                    // connect with ancestors
                    if (level > 1)
                    {
                        if (i < prevRowNodes.Count)
                        {
                            edge = CreateEdge(ENConnectorShape.Line);
                            page.Items.AddChild(edge);

                            edge.GlueBeginToGeometryIntersection((NShape)prevRowNodes[i]);
                            edge.GlueEndToShape(cur);
                        }

                        if (i > 0)
                        {
                            edge = CreateEdge(ENConnectorShape.Line);
                            page.Items.AddChild(edge);

                            edge.GlueBeginToGeometryIntersection((NShape)prevRowNodes[i - 1]);
                            edge.GlueEndToShape(cur);
                        }
                    }

                    curRowNodes.Add(cur);
                    prev = cur;
                }

                prevRowNodes = curRowNodes;
            }
        }
        /// <summary>
        /// Overriden to create a random graph template in the specified document.
        /// </summary>
        /// <param name="document">The document to create a graph in.</param>
        protected override void CreateTemplate(NDrawingDocument document)
        {
            if (m_nEdgeCount < m_nVertexCount - 1)
            {
                throw new Exception("##The number of edges must be greater than or equal to the (number of vertices - 1) in order to generate a connected graph");
            }

            if (m_nEdgeCount > MaxEdgeCount(m_nVertexCount))
            {
                throw new Exception("##Too many edges wanted for the graph");
            }

            int    i;
            Random random     = new Random();
            NPage  activePage = document.Content.ActivePage;

            NShape[]        vertices = new NShape[m_nVertexCount];
            NList <NPointI> edges    = GetRandomMST(m_nVertexCount);
            NPointI         edgeInfo;

            NSizeI minSize = m_MinVerticesSize.Round();
            NSizeI maxSize = m_MaxVerticesSize.Round();

            maxSize.Width++;
            maxSize.Height++;

            // Create the vertices
            for (i = 0; i < m_nVertexCount; i++)
            {
                vertices[i] = CreateVertex(m_VerticesShape);
                double width  = random.Next(minSize.Width, maxSize.Width);
                double height = random.Next(minSize.Height, maxSize.Height);
                vertices[i].SetBounds(new NRectangle(0, 0, width, height));
                activePage.Items.AddChild(vertices[i]);
            }

            // Generate the edges
            for (i = m_nVertexCount - 1; i < m_nEdgeCount; i++)
            {
                do
                {   // Generate a new edge
                    edgeInfo = new NPointI(random.Next(m_nVertexCount), random.Next(m_nVertexCount));
                }while (edgeInfo.X == edgeInfo.Y || edges.Contains(edgeInfo) || edges.Contains(new NPointI(edgeInfo.Y, edgeInfo.X)));
                edges.Add(edgeInfo);
            }

            // Create the edges
            for (i = 0; i < m_nEdgeCount; i++)
            {
                edgeInfo = edges[i];
                NShape edge = CreateEdge(ENConnectorShape.RoutableConnector);
                activePage.Items.AddChild(edge);
                edge.GlueBeginToGeometryIntersection(vertices[edgeInfo.X]);
                edge.GlueEndToShape(vertices[edgeInfo.Y]);
            }

            // Apply a table layout to the generated graph
            NTableFlowLayout tableLayout = new NTableFlowLayout();

            tableLayout.MaxOrdinal        = (int)Math.Sqrt(m_nVertexCount) + 1;
            tableLayout.HorizontalSpacing = m_VerticesSize.Width / 5;
            tableLayout.VerticalSpacing   = m_VerticesSize.Width / 5;

            NDrawingLayoutContext context = new NDrawingLayoutContext(document, activePage);

            tableLayout.Arrange(new NList <object>(NArrayHelpers <NShape> .CastAll <object>(vertices)), context);
        }
        /// <summary>
        /// Creates a tree in the specified document
        /// </summary>
        /// <param name="document">document in which to create a tree</param>
        /// <returns>tree elements</returns>
        protected virtual NList <NShape> CreateTree(NDrawingDocument document)
        {
            NPage          page     = document.Content.ActivePage;
            NList <NShape> elements = new NList <NShape>();

            NShape cur  = null;
            NShape edge = null;

            NList <NShape> curRowVertices  = null;
            NList <NShape> prevRowVertices = null;

            int    i, j, level;
            int    childrenCount, levelNodesCount;
            Random rnd = new Random();

            for (level = 1; level <= m_nLevels; level++)
            {
                curRowVertices = new NList <NShape>();

                if (m_bBalanced)
                {
                    //Create a balanced tree
                    levelNodesCount = (int)Math.Pow(m_nBranchNodes, level - 1);
                    for (i = 0; i < levelNodesCount; i++)
                    {
                        // create the cur node
                        cur = CreateVertex(m_VerticesShape);
                        cur.SetBounds(new NRectangle(m_Origin, GetSize(rnd)));

                        page.Items.AddChild(cur);
                        elements.Add(cur);

                        // connect with ancestor
                        if (level > 1)
                        {
                            edge = CreateEdge(m_ConnectorShape);
                            page.Items.AddChild(edge);

                            int parentIndex = (int)Math.Floor((double)(i / m_nBranchNodes));
                            edge.GlueBeginToGeometryIntersection(prevRowVertices[parentIndex]);
                            edge.GlueEndToShape(cur);
                        }

                        curRowVertices.Add(cur);
                    }
                }
                else
                {
                    //Create an unbalanced tree
                    if (level == 1)
                    {
                        // Create the current node
                        cur = CreateVertex(m_VerticesShape);
                        cur.SetBounds(new NRectangle(m_Origin, GetSize(rnd)));

                        page.Items.AddChild(cur);
                        elements.Add(cur);

                        curRowVertices.Add(cur);
                    }
                    else
                    {
                        levelNodesCount = prevRowVertices.Count;
                        do
                        {
                            // Ensure that the desired level depth is reached
                            for (i = 0; i < levelNodesCount; i++)
                            {
                                childrenCount = rnd.Next(0, m_nBranchNodes + 1);
                                for (j = 0; j < childrenCount; j++)
                                {
                                    // Create the current node
                                    cur = CreateVertex(m_VerticesShape);
                                    cur.SetBounds(new NRectangle(m_Origin, GetSize(rnd)));

                                    page.Items.AddChild(cur);
                                    elements.Add(cur);
                                    curRowVertices.Add(cur);

                                    // Connect with ancestor
                                    edge = CreateEdge(m_ConnectorShape);
                                    page.Items.AddChild(edge);

                                    edge.GlueBeginToGeometryIntersection(prevRowVertices[i]);
                                    edge.GlueEndToShape(cur);
                                }
                            }
                        }while (level < m_nLevels && curRowVertices.Count == 0);
                    }
                }

                prevRowVertices = curRowVertices;
            }

            return(elements);
        }
示例#9
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            NStyleSheet sheet = new NStyleSheet();

            m_DrawingDocument.StyleSheets.Add(sheet);

            // create a rule that applies to the TextBlocks of all shapes with user class Connectors
            string connectorClass = NDR.StyleSheetNameConnectors;
            {
                NRule rule2 = new NRule();
                sheet.Add(rule2);

                NSelectorBuilder sb = rule2.GetSelectorBuilder();
                sb.Start();
                sb.Type(NTextBlock.NTextBlockSchema); sb.ChildOf(); sb.UserClass(connectorClass);
                sb.End();

                rule2.Declarations.Add(new NValueDeclaration <NFill>(NTextBlock.BackgroundFillProperty, new NColorFill(NColor.White)));
            }

            // get drawing and active page
            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            // hide ports and grid
            drawing.ScreenVisibility.ShowGrid  = false;
            drawing.ScreenVisibility.ShowPorts = false;

            NBasicShapeFactory        basicShapesFactory        = new NBasicShapeFactory();
            NFlowchartingShapeFactory flowChartingShapesFactory = new NFlowchartingShapeFactory();
            NConnectorShapeFactory    connectorShapesFactory    = new NConnectorShapeFactory();

            // create title
            NShape titleShape = basicShapesFactory.CreateTextShape("Bubble Sort");

            titleShape.SetBounds(GetGridCell(0, 1, 2, 1));
            titleShape.TextBlock.FontName  = "Arial";
            titleShape.TextBlock.FontSize  = 40;
            titleShape.TextBlock.FontStyle = ENFontStyle.Bold;
            titleShape.TextBlock.Fill      = new NColorFill(new NColor(68, 90, 108));
            titleShape.TextBlock.Shadow    = new NShadow();
            activePage.Items.AddChild(titleShape);

            // begin shape
            NShape shapeBegin = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Termination);

            shapeBegin.SetBounds(GetGridCell(0, 0));
            shapeBegin.Text = "BEGIN";
            activePage.Items.Add(shapeBegin);

            // get array item shape
            NShape shapeGetItem = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Data);

            shapeGetItem.SetBounds(GetGridCell(1, 0));
            shapeGetItem.Text = "Get array item [1...n]";
            activePage.Items.Add(shapeGetItem);

            // i = 1 shape
            NShape shapeI1 = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Process);

            shapeI1.SetBounds(GetGridCell(2, 0));
            shapeI1.Text = "i = 1";
            activePage.Items.Add(shapeI1);

            // j = n shape
            NShape shapeJEN = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Process);

            shapeJEN.SetBounds(GetGridCell(3, 0));
            shapeJEN.Text = "j = n";
            activePage.Items.Add(shapeJEN);

            // less comparison shape
            NShape shapeLess = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Decision);

            shapeLess.SetBounds(GetGridCell(4, 0));
            shapeLess.Text = "item[i] < item[j - 1]?";
            activePage.Items.Add(shapeLess);

            // swap shape
            NShape shapeSwap = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Process);

            shapeSwap.SetBounds(GetGridCell(4, 1));
            shapeSwap.Text = "Swap item[i] and item[j-1]";
            activePage.Items.Add(shapeSwap);

            // j > i + 1? shape
            NShape shapeJQ = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Decision);

            shapeJQ.SetBounds(GetGridCell(5, 0));
            shapeJQ.Text = "j = (i + 1)?";
            activePage.Items.Add(shapeJQ);

            // dec j shape
            NShape shapeDecJ = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Process);

            shapeDecJ.SetBounds(GetGridCell(5, 1));
            shapeDecJ.Text = "j = j - 1";
            activePage.Items.Add(shapeDecJ);

            // i > n - 1? shape
            NShape shapeIQ = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Decision);

            shapeIQ.SetBounds(GetGridCell(6, 0));
            shapeIQ.Text = "i = (n - 1)?";
            activePage.Items.Add(shapeIQ);

            // inc i shape
            NShape shapeIncI = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Process);

            shapeIncI.SetBounds(GetGridCell(6, 1));
            shapeIncI.Text = "i = i + 1";
            activePage.Items.Add(shapeIncI);

            // end shape
            NShape shapeEnd = flowChartingShapesFactory.CreateShape(ENFlowchartingShape.Termination);

            shapeEnd.SetBounds(GetGridCell(7, 0));
            shapeEnd.Text = "END";
            activePage.Items.Add(shapeEnd);

            // connect begin with get array item
            NShape connector1 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector1.UserClass = connectorClass;
            activePage.Items.AddChild(connector1);
            connector1.GlueBeginToShape(shapeBegin);
            connector1.GlueEndToShape(shapeGetItem);

            // connect get array item with i = 1
            NShape connector2 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector2.UserClass = connectorClass;
            activePage.Items.AddChild(connector2);
            connector2.GlueBeginToShape(shapeGetItem);
            connector2.GlueEndToShape(shapeI1);

            // connect i = 1 and j = n
            NShape connector3 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector3.UserClass = connectorClass;
            activePage.Items.AddChild(connector3);
            connector3.GlueBeginToShape(shapeI1);
            connector3.GlueEndToShape(shapeJEN);

            // connect j = n and item[i] < item[j-1]?
            NShape connector4 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector4.UserClass = connectorClass;
            activePage.Items.AddChild(connector4);
            connector4.GlueBeginToShape(shapeJEN);
            connector4.GlueEndToShape(shapeLess);

            // connect item[i] < item[j-1]? and j = (i + 1)?
            NShape connector5 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector5.UserClass = connectorClass;
            connector5.Text      = "No";
            activePage.Items.AddChild(connector5);
            connector5.GlueBeginToShape(shapeLess);
            connector5.GlueEndToShape(shapeJQ);

            // connect j = (i + 1)? and i = (n - 1)?
            NShape connector6 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector6.UserClass = connectorClass;
            activePage.Items.AddChild(connector6);
            connector6.GlueBeginToShape(shapeJQ);
            connector6.GlueEndToShape(shapeIQ);

            // connect i = (n - 1) and END
            NShape connector7 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector7.UserClass = connectorClass;
            activePage.Items.AddChild(connector7);
            connector7.GlueBeginToShape(shapeIQ);
            connector7.GlueEndToShape(shapeEnd);

            // connect item[i] < item[j-1]? and Swap
            NShape connector8 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector8.UserClass = connectorClass;
            connector8.Text      = "Yes";
            activePage.Items.AddChild(connector8);
            connector8.GlueBeginToShape(shapeLess);
            connector8.GlueEndToShape(shapeSwap);

            // connect j = (i + 1)? and j = (j - 1)
            NShape connector9 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector9.UserClass = connectorClass;
            activePage.Items.AddChild(connector9);
            connector9.GlueBeginToShape(shapeJQ);
            connector9.GlueEndToShape(shapeDecJ);

            // connect i = (n - 1)? and i = (i + 1)
            NShape connector10 = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            connector10.UserClass = connectorClass;
            activePage.Items.AddChild(connector10);
            connector10.GlueBeginToShape(shapeIQ);
            connector10.GlueEndToShape(shapeIncI);

            // connect Swap to No connector
            NShape connector11 = connectorShapesFactory.CreateShape(ENConnectorShape.TopBottomToSide);

            connector11.UserClass = connectorClass;
            activePage.Items.AddChild(connector11);
            connector11.GlueBeginToShape(shapeSwap);
            connector11.GlueEndToShape(connector5);

            // connect i = i + 1 to connector3
            NShape connector12 = connectorShapesFactory.CreateSideToSide(m_GridSpacing.Width * 2);

            connector12.UserClass = connectorClass;
            activePage.Items.AddChild(connector12);
            connector12.GlueBeginToPort(shapeIncI.GetPortByName("Right"));
            connector12.GlueEndToGeometryContour(connector3, 0.5f);

            // connect j = j - 1 to connector4
            NShape connector13 = connectorShapesFactory.CreateSideToSide(m_GridSpacing.Width);

            connector13.UserClass = connectorClass;
            activePage.Items.AddChild(connector13);
            connector13.GlueBeginToPort(shapeDecJ.GetPortByName(("Right")));
            connector13.GlueEndToGeometryContour(connector4, 0.5f);
        }