Пример #1
0
        void RenderSimpleGroup(SENodeGroup group,
                               float screenX,
                               float screenY,
                               List <EndPoint> endConnectors,
                               HashSet <String> cssClasses,
                               out float colWidth,
                               out float colHeight)
        {
            colWidth  = 0;
            colHeight = 0;

            SvgGroup childGroup = this.doc.AddGroup(null);

            childGroup.Class = group.Class;
            float col1ScreenX = screenX;
            float col1ScreenY = screenY;
            float col1Width   = 0;
            float col1Height  = 0;

            float topConnectorY    = float.MaxValue;
            float bottomConnectorY = float.MinValue;

            List <EndPoint> startConnectors = new List <EndPoint>();

            foreach (SENode node in group.Nodes)
            {
                this.Render(childGroup,
                            node,
                            screenX,
                            col1ScreenY,
                            cssClasses,
                            out float nodeWidth,
                            out float nodeHeight);
                if (col1Width < nodeWidth)
                {
                    col1Width = nodeWidth;
                }

                float connectorY = col1ScreenY + nodeHeight / 2;
                if (topConnectorY > connectorY)
                {
                    topConnectorY = connectorY;
                }
                if (bottomConnectorY < connectorY)
                {
                    bottomConnectorY = connectorY;
                }
                startConnectors.Add(new EndPoint
                {
                    Location   = new PointF(screenX + nodeWidth, col1ScreenY + nodeHeight / 2),
                    Annotation = node.RhsAnnotation
                });

                endConnectors.Add(new EndPoint
                {
                    Location   = new PointF(screenX, col1ScreenY + nodeHeight / 2),
                    Annotation = node.LhsAnnotation
                });
                col1Height  += nodeHeight + this.NodeGapY;
                col1ScreenY += nodeHeight + this.NodeGapY;
            }

            if (this.maxX < col1ScreenX + col1Width)
            {
                this.maxX = col1ScreenX + col1Width;
            }
            if (this.maxY < col1ScreenY)
            {
                this.maxY = col1ScreenY;
            }

            RenderGroupChildren(group,
                                childGroup,
                                screenX,
                                screenY,
                                col1Width,
                                topConnectorY,
                                bottomConnectorY,
                                startConnectors,
                                cssClasses,
                                out colWidth,
                                out colHeight);


            if (colHeight < col1Height)
            {
                colHeight = col1Height;
            }
        }