Beispiel #1
0
        public static void TreeWithTwoPassLayoutAndFormatting()
        {
            var doc   = SampleEnvironment.Application.ActiveDocument;
            var page1 = doc.Pages.Add();

            var t = new TREEMODEL.Drawing();

            t.Root = new TREEMODEL.Node("Root");

            var na = new TREEMODEL.Node("A");
            var nb = new TREEMODEL.Node("B");

            var na1 = new TREEMODEL.Node("A1");
            var na2 = new TREEMODEL.Node("A2");

            var nb1 = new TREEMODEL.Node("B1");
            var nb2 = new TREEMODEL.Node("B2");

            t.Root.Children.Add(na);
            t.Root.Children.Add(nb);

            na.Children.Add(na1);
            na.Children.Add(na2);

            nb.Children.Add(nb1);
            nb1.Children.Add(nb2);

            var fontname = "Segoe UI";
            var font     = doc.Fonts[fontname];

            foreach (var tn in t.Nodes)
            {
                var cells = new VADOM.ShapeCells();
                tn.Cells = cells;

                cells.ParaHorizontalAlign = 0; // align text to left
                cells.VerticalAlign       = 0; // align text block to top
                cells.CharFont            = font.ID;
                cells.CharSize            = "10pt";
                cells.FillForegnd         = "rgb(255,250,200)";
                cells.CharColor           = "rgb(255,0,0)";
            }

            t.Render(page1);
        }
Beispiel #2
0
        private static VABOX.BoxLayout CreateTwoLevelLayout(List <string[]> data)
        {
            double itemsep = 0.0;
            var    major_group_direction = VABOX.Direction.LeftToRight;
            var    minor_group_direction = VABOX.Direction.TopToBottom;

            var name_to_major_group = new Dictionary <string, VABOX.Container>();
            var name_to_minor_group = new Dictionary <string, VABOX.Container>();

            var layout1 = new VABOX.BoxLayout();

            layout1.Root = new VABOX.Container(major_group_direction);

            var major_cells = new VADOM.ShapeCells();

            major_cells.FillForeground         = "rgb(245,245,245)";
            major_cells.CharFont               = 0;
            major_cells.CharSize               = "12pt";
            major_cells.ParaHorizontalAlign    = "0";
            major_cells.TextBlockVerticalAlign = "0";
            major_cells.LineWeight             = "0";
            major_cells.LinePattern            = "0";

            var minor_cells = new VADOM.ShapeCells();

            minor_cells.FillForeground         = "rgb(230,230,230)";
            minor_cells.CharFont               = 0;
            minor_cells.CharSize               = "10pt";
            minor_cells.ParaHorizontalAlign    = "0";
            minor_cells.TextBlockVerticalAlign = "0";
            minor_cells.LineWeight             = "0";
            minor_cells.LinePattern            = "0";

            var item_cells = new VADOM.ShapeCells();

            item_cells.CharFont               = 0;
            item_cells.FillPattern            = "0";
            item_cells.CharSize               = "8pt";
            item_cells.ParaHorizontalAlign    = "0";
            item_cells.TextBlockVerticalAlign = "0";
            item_cells.LineWeight             = "0";
            item_cells.LinePattern            = "0";


            foreach (var row in data)
            {
                var majorname = row[0];
                var minorname = row[1];
                var itemname  = row[2];

                VABOX.Container majorcnt;
                if (name_to_major_group.ContainsKey(majorname))
                {
                    majorcnt = name_to_major_group[majorname];
                }
                else
                {
                    majorcnt = layout1.Root.AddContainer(minor_group_direction, 1, 1);

                    var major_info = new TwoLevelInfo();
                    major_info.Text       = majorname;
                    major_info.Render     = true;
                    major_info.ShapeCells = major_cells;
                    majorcnt.Data         = major_info;


                    name_to_major_group[majorname] = majorcnt;

                    VABOX.Box headerbox = majorcnt.AddBox(2, 0.25);
                }

                VABOX.Container minorcnt;
                var             minorkey = majorname + "___" + minorname;
                if (name_to_minor_group.ContainsKey(minorkey))
                {
                    minorcnt = name_to_minor_group[minorkey];
                }
                else
                {
                    minorcnt = majorcnt.AddContainer(minor_group_direction);
                    minorcnt.ChildSpacing = itemsep;
                    var minor_info = new TwoLevelInfo();
                    minor_info.Text               = minorname;
                    minor_info.Render             = true;
                    minor_info.ShapeCells         = minor_cells;
                    minorcnt.Data                 = minor_info;
                    name_to_minor_group[minorkey] = minorcnt;

                    VABOX.Box headerbox = minorcnt.AddBox(2, 0.25);
                }

                VABOX.Box itembox = minorcnt.AddBox(2, 0.25);

                var item_info = new TwoLevelInfo();
                item_info.Text   = itemname;
                item_info.Render = true;


                item_info.ShapeCells = item_cells;

                itembox.Data = item_info;
            }
            return(layout1);
        }
 public void ApplyFormulasTo(ShapeCells target)
 {
     if (this.XFormWidth.HasValue)
     {
         target.XFormWidth = this.XFormWidth;
     }
     if (this.XFormHeight.HasValue)
     {
         target.XFormHeight = this.XFormHeight;
     }
     if (this.XFormAngle.HasValue)
     {
         target.XFormAngle = this.XFormAngle;
     }
     if (this.XFormPinX.HasValue)
     {
         target.XFormPinX = this.XFormPinX;
     }
     if (this.XFormPinY.HasValue)
     {
         target.XFormPinY = this.XFormPinY;
     }
     if (this.XFormLocPinX.HasValue)
     {
         target.XFormLocPinX = this.XFormLocPinX;
     }
     if (this.XFormLocPinY.HasValue)
     {
         target.XFormLocPinY = this.XFormLocPinY;
     }
     if (this.FillBackground.HasValue)
     {
         target.FillBackground = this.FillBackground;
     }
     if (this.FillBackgroundTransparency.HasValue)
     {
         target.FillBackgroundTransparency = this.FillBackgroundTransparency;
     }
     if (this.FillForeground.HasValue)
     {
         target.FillForeground = this.FillForeground;
     }
     if (this.FillForegroundTransparency.HasValue)
     {
         target.FillForegroundTransparency = this.FillForegroundTransparency;
     }
     if (this.FillPattern.HasValue)
     {
         target.FillPattern = this.FillPattern;
     }
     if (this.FillShadowObliqueAngle.HasValue)
     {
         target.FillShadowObliqueAngle = this.FillShadowObliqueAngle;
     }
     if (this.FillShadowOffsetX.HasValue)
     {
         target.FillShadowOffsetX = this.FillShadowOffsetX;
     }
     if (this.FillShadowOffsetY.HasValue)
     {
         target.FillShadowOffsetY = this.FillShadowOffsetY;
     }
     if (this.FillShadowScaleFactor.HasValue)
     {
         target.FillShadowScaleFactor = this.FillShadowScaleFactor;
     }
     if (this.FillShadowType.HasValue)
     {
         target.FillShadowType = this.FillShadowType;
     }
     if (this.FillShadowBackground.HasValue)
     {
         target.FillShadowBackground = this.FillShadowBackground;
     }
     if (this.FillShadowBackgroundTransparency.HasValue)
     {
         target.FillShadowBackgroundTransparency = this.FillShadowBackgroundTransparency;
     }
     if (this.FillShadowForeground.HasValue)
     {
         target.FillShadowForeground = this.FillShadowForeground;
     }
     if (this.FillShadowForegroundTransparency.HasValue)
     {
         target.FillShadowForegroundTransparency = this.FillShadowForegroundTransparency;
     }
     if (this.FillShadowPattern.HasValue)
     {
         target.FillShadowPattern = this.FillShadowPattern;
     }
     if (this.LineBeginArrow.HasValue)
     {
         target.LineBeginArrow = this.LineBeginArrow;
     }
     if (this.LineBeginArrowSize.HasValue)
     {
         target.LineBeginArrowSize = this.LineBeginArrowSize;
     }
     if (this.LineEndArrow.HasValue)
     {
         target.LineEndArrow = this.LineEndArrow;
     }
     if (this.LineEndArrowSize.HasValue)
     {
         target.LineEndArrowSize = this.LineEndArrowSize;
     }
     if (this.LineCap.HasValue)
     {
         target.LineCap = this.LineCap;
     }
     if (this.LineColor.HasValue)
     {
         target.LineColor = this.LineColor;
     }
     if (this.LineColorTransparency.HasValue)
     {
         target.LineColorTransparency = this.LineColorTransparency;
     }
     if (this.LinePattern.HasValue)
     {
         target.LinePattern = this.LinePattern;
     }
     if (this.LineWeight.HasValue)
     {
         target.LineWeight = this.LineWeight;
     }
     if (this.Rounding.HasValue)
     {
         target.Rounding = this.Rounding;
     }
     if (this.CharAsianFont.HasValue)
     {
         target.CharAsianFont = this.CharAsianFont;
     }
     if (this.CharCase.HasValue)
     {
         target.CharCase = this.CharCase;
     }
     if (this.CharColor.HasValue)
     {
         target.CharColor = this.CharColor;
     }
     if (this.CharComplexScriptFont.HasValue)
     {
         target.CharComplexScriptFont = this.CharComplexScriptFont;
     }
     if (this.CharComplexScriptSize.HasValue)
     {
         target.CharComplexScriptSize = this.CharComplexScriptSize;
     }
     if (this.CharDoubleStrikeThrough.HasValue)
     {
         target.CharDoubleStrikeThrough = this.CharDoubleStrikeThrough;
     }
     if (this.CharDoubleUnderline.HasValue)
     {
         target.CharDoubleUnderline = this.CharDoubleUnderline;
     }
     if (this.CharFont.HasValue)
     {
         target.CharFont = this.CharFont;
     }
     if (this.CharLangID.HasValue)
     {
         target.CharLangID = this.CharLangID;
     }
     if (this.CharLocale.HasValue)
     {
         target.CharLocale = this.CharLocale;
     }
     if (this.CharLocalizeFont.HasValue)
     {
         target.CharLocalizeFont = this.CharLocalizeFont;
     }
     if (this.CharOverline.HasValue)
     {
         target.CharOverline = this.CharOverline;
     }
     if (this.CharPerpendicular.HasValue)
     {
         target.CharPerpendicular = this.CharPerpendicular;
     }
     if (this.CharPos.HasValue)
     {
         target.CharPos = this.CharPos;
     }
     if (this.CharRTLText.HasValue)
     {
         target.CharRTLText = this.CharRTLText;
     }
     if (this.CharFontScale.HasValue)
     {
         target.CharFontScale = this.CharFontScale;
     }
     if (this.CharSize.HasValue)
     {
         target.CharSize = this.CharSize;
     }
     if (this.CharLetterspace.HasValue)
     {
         target.CharLetterspace = this.CharLetterspace;
     }
     if (this.CharStrikethru.HasValue)
     {
         target.CharStrikethru = this.CharStrikethru;
     }
     if (this.CharStyle.HasValue)
     {
         target.CharStyle = this.CharStyle;
     }
     if (this.CharTransparency.HasValue)
     {
         target.CharTransparency = this.CharTransparency;
     }
     if (this.CharUseVertical.HasValue)
     {
         target.CharUseVertical = this.CharUseVertical;
     }
     if (this.TextBlockBottomMargin.HasValue)
     {
         target.TextBlockBottomMargin = this.TextBlockBottomMargin;
     }
     if (this.TextBlockDefaultTabStop.HasValue)
     {
         target.TextBlockDefaultTabStop = this.TextBlockDefaultTabStop;
     }
     if (this.TextBlockLeftMargin.HasValue)
     {
         target.TextBlockLeftMargin = this.TextBlockLeftMargin;
     }
     if (this.TextBlockRightMargin.HasValue)
     {
         target.TextBlockRightMargin = this.TextBlockRightMargin;
     }
     if (this.TextBlockBackground.HasValue)
     {
         target.TextBlockBackground = this.TextBlockBackground;
     }
     if (this.TextBlockBackgroundTransparency.HasValue)
     {
         target.TextBlockBackgroundTransparency = this.TextBlockBackgroundTransparency;
     }
     if (this.TextBlockDirection.HasValue)
     {
         target.TextBlockDirection = this.TextBlockDirection;
     }
     if (this.TextBlockTopMargin.HasValue)
     {
         target.TextBlockTopMargin = this.TextBlockTopMargin;
     }
     if (this.TextBlockVerticalAlign.HasValue)
     {
         target.TextBlockVerticalAlign = this.TextBlockVerticalAlign;
     }
     if (this.ParaBullet.HasValue)
     {
         target.ParaBullet = this.ParaBullet;
     }
     if (this.ParaBulletFont.HasValue)
     {
         target.ParaBulletFont = this.ParaBulletFont;
     }
     if (this.ParaBulletFontSize.HasValue)
     {
         target.ParaBulletFontSize = this.ParaBulletFontSize;
     }
     if (this.ParaBulletString.HasValue)
     {
         target.ParaBulletString = this.ParaBulletString;
     }
     if (this.ParaFlags.HasValue)
     {
         target.ParaFlags = this.ParaFlags;
     }
     if (this.ParaHorizontalAlign.HasValue)
     {
         target.ParaHorizontalAlign = this.ParaHorizontalAlign;
     }
     if (this.ParaIndentFirst.HasValue)
     {
         target.ParaIndentFirst = this.ParaIndentFirst;
     }
     if (this.ParaIndentLeft.HasValue)
     {
         target.ParaIndentLeft = this.ParaIndentLeft;
     }
     if (this.ParaIndentRight.HasValue)
     {
         target.ParaIndentRight = this.ParaIndentRight;
     }
     if (this.ParaLocBulletFont.HasValue)
     {
         target.ParaLocBulletFont = this.ParaLocBulletFont;
     }
     if (this.ParaSpacingAfter.HasValue)
     {
         target.ParaSpacingAfter = this.ParaSpacingAfter;
     }
     if (this.ParaSpacingBefore.HasValue)
     {
         target.ParaSpacingBefore = this.ParaSpacingBefore;
     }
     if (this.ParaSpacingLine.HasValue)
     {
         target.ParaSpacingLine = this.ParaSpacingLine;
     }
     if (this.ParaTextPosAfterBullet.HasValue)
     {
         target.ParaTextPosAfterBullet = this.ParaTextPosAfterBullet;
     }
     if (this.TextXFormAngle.HasValue)
     {
         target.TextXFormAngle = this.TextXFormAngle;
     }
     if (this.TextXFormHeight.HasValue)
     {
         target.TextXFormHeight = this.TextXFormHeight;
     }
     if (this.TextXFormLocPinX.HasValue)
     {
         target.TextXFormLocPinX = this.TextXFormLocPinX;
     }
     if (this.TextXFormLocPinY.HasValue)
     {
         target.TextXFormLocPinY = this.TextXFormLocPinY;
     }
     if (this.TextXFormPinX.HasValue)
     {
         target.TextXFormPinX = this.TextXFormPinX;
     }
     if (this.TextXFormPinY.HasValue)
     {
         target.TextXFormPinY = this.TextXFormPinY;
     }
     if (this.TextXFormWidth.HasValue)
     {
         target.TextXFormWidth = this.TextXFormWidth;
     }
     if (this.ShapeLayoutConFixedCode.HasValue)
     {
         target.ShapeLayoutConFixedCode = this.ShapeLayoutConFixedCode;
     }
     if (this.ShapeLayoutConLineJumpCode.HasValue)
     {
         target.ShapeLayoutConLineJumpCode = this.ShapeLayoutConLineJumpCode;
     }
     if (this.ShapeLayoutConLineJumpDirX.HasValue)
     {
         target.ShapeLayoutConLineJumpDirX = this.ShapeLayoutConLineJumpDirX;
     }
     if (this.ShapeLayoutConLineJumpDirY.HasValue)
     {
         target.ShapeLayoutConLineJumpDirY = this.ShapeLayoutConLineJumpDirY;
     }
     if (this.ShapeLayoutConLineJumpStyle.HasValue)
     {
         target.ShapeLayoutConLineJumpStyle = this.ShapeLayoutConLineJumpStyle;
     }
     if (this.ShapeLayoutConLineRouteExt.HasValue)
     {
         target.ShapeLayoutConLineRouteExt = this.ShapeLayoutConLineRouteExt;
     }
     if (this.ShapeLayoutFixedCode.HasValue)
     {
         target.ShapeLayoutFixedCode = this.ShapeLayoutFixedCode;
     }
     if (this.ShapeLayoutPermeablePlace.HasValue)
     {
         target.ShapeLayoutPermeablePlace = this.ShapeLayoutPermeablePlace;
     }
     if (this.ShapeLayoutPermeableX.HasValue)
     {
         target.ShapeLayoutPermeableX = this.ShapeLayoutPermeableX;
     }
     if (this.ShapeLayoutPermeableY.HasValue)
     {
         target.ShapeLayoutPermeableY = this.ShapeLayoutPermeableY;
     }
     if (this.ShapeLayoutPlaceFlip.HasValue)
     {
         target.ShapeLayoutPlaceFlip = this.ShapeLayoutPlaceFlip;
     }
     if (this.ShapeLayoutPlaceStyle.HasValue)
     {
         target.ShapeLayoutPlaceStyle = this.ShapeLayoutPlaceStyle;
     }
     if (this.ShapeLayoutPlowCode.HasValue)
     {
         target.ShapeLayoutPlowCode = this.ShapeLayoutPlowCode;
     }
     if (this.ShapeLayoutRouteStyle.HasValue)
     {
         target.ShapeLayoutRouteStyle = this.ShapeLayoutRouteStyle;
     }
     if (this.ShapeLayoutSplit.HasValue)
     {
         target.ShapeLayoutSplit = this.ShapeLayoutSplit;
     }
     if (this.ShapeLayoutSplittable.HasValue)
     {
         target.ShapeLayoutSplittable = this.ShapeLayoutSplittable;
     }
 }
        public IVisio.Document DrawNamespacesAndClasses(IList <Type> types_)
        {
            var cmdtarget = this._client.GetCommandTarget(CommandTargetFlags.RequireApplication);


            string segoeui_fontname      = "Segoe UI";
            string segoeuilight_fontname = "Segoe UI Light";
            string def_linecolor         = "rgb(180,180,180)";
            string def_shape_fill        = "rgb(245,245,245)";
            string template = null;

            var page_size         = new VisioAutomation.Geometry.Size(8.5, 11);
            var doc               = this._client.Document.NewDocumentFromTemplate(page_size, template);
            var fonts             = doc.Fonts;
            var font_segoe        = fonts[segoeui_fontname];
            var font_segoelight   = fonts[segoeuilight_fontname];
            int fontid_segoe      = font_segoe.ID16;
            int fontid_segoelight = font_segoelight.ID16;

            var types = types_.Select(t => new TypeInfo(t));

            var pathbuilder = new PathTreeBuilder();

            foreach (var type in types)
            {
                pathbuilder.Add(type.Type.Namespace);
            }

            var namespaces = pathbuilder.GetPaths();

            var tree_layout = new VATREE.Drawing();

            tree_layout.LayoutOptions.Direction     = VATREE.LayoutDirection.Down;
            tree_layout.LayoutOptions.ConnectorType = VATREE.ConnectorType.PolyLine;
            var ns_node_map     = new Dictionary <string, VATREE.Node>(namespaces.Count);
            var node_to_nslabel = new Dictionary <VATREE.Node, string>(namespaces.Count);

            // create nodes for every namespace
            foreach (string ns in namespaces)
            {
                string label             = ns;
                int    index_of_last_sep = ns.LastIndexOf(pathbuilder.Separator, StringComparison.Ordinal);
                if (index_of_last_sep > 0)
                {
                    label = ns.Substring(index_of_last_sep + 1);
                }

                string ns1 = ns;
                var    types_in_namespace = types.Where(t => t.Type.Namespace == ns1)
                                            .OrderBy(t => t.Type.Name)
                                            .Select(t => t.Label);
                var node = new VATREE.Node(ns);
                node.Size = new VisioAutomation.Geometry.Size(2.0, (0.15) * (1 + 2 + types_in_namespace.Count()));


                var markup = new VisioAutomation.Models.Text.Element();
                var m1     = markup.AddElement(label + "\n");
                m1.CharacterFormatting.Font  = fontid_segoe;
                m1.CharacterFormatting.Size  = "12.0pt";
                m1.CharacterFormatting.Style = "1"; // Bold
                var m2 = markup.AddElement();
                m2.CharacterFormatting.Font = fontid_segoe;
                m2.CharacterFormatting.Size = "8.0pt";
                m2.AddText(string.Join("\n", types_in_namespace));

                node.Text = markup;

                ns_node_map[ns]       = node;
                node_to_nslabel[node] = label;
            }

            // add children to nodes
            foreach (string ns in namespaces)
            {
                var parent_ns = pathbuilder.PathToParentPath[ns];

                if (parent_ns != null)
                {
                    // the current namespace has a parent
                    var parent_node = ns_node_map[parent_ns];
                    var child_node  = ns_node_map[ns];
                    parent_node.Children.Add(child_node);
                }
                else
                {
                    // that means this namespace is a root, forget about it
                }
            }

            if (pathbuilder.Roots.Count == 0)
            {
            }
            else if (pathbuilder.Roots.Count == 1)
            {
                // when there is exactly one root namespace, then that node will be the tree's root node
                var first_root = pathbuilder.Roots[0];
                var root_n     = ns_node_map[first_root];
                tree_layout.Root = root_n;
            }
            else
            {
                // if there are multiple root namespaces, inject an empty placeholder root
                var root_n = new VATREE.Node();
                tree_layout.Root = root_n;

                foreach (var root_ns in pathbuilder.Roots)
                {
                    var node = ns_node_map[root_ns];
                    tree_layout.Root.Children.Add(node);
                }
            }

            // format the shapes
            foreach (var node in tree_layout.Nodes)
            {
                if (node.Cells == null)
                {
                    node.Cells = new VADOM.ShapeCells();
                }
                node.Cells.FillForeground = def_shape_fill;
                //node.ShapeCells.LineWeight = "0";
                //node.ShapeCells.LinePattern = "0";
                node.Cells.LineColor              = def_linecolor;
                node.Cells.ParaHorizontalAlign    = "0";
                node.Cells.TextBlockVerticalAlign = "0";
            }

            var cxn_cells = new VADOM.ShapeCells();

            cxn_cells.LineColor = def_linecolor;
            tree_layout.LayoutOptions.ConnectorCells = cxn_cells;
            tree_layout.Render(doc.Application.ActivePage);

            DeveloperCommands.hide_ui_stuff(doc);

            return(doc);
        }
        public IVisio.Document DrawNamespaces(IList <Type> types)
        {
            var cmdtarget = this._client.GetCommandTarget(CommandTargetFlags.RequireApplication);

            string template      = null;
            string def_linecolor = "rgb(140,140,140)";
            string def_fillcolor = "rgb(240,240,240)";
            string def_font      = "Segoe UI";

            var page_size = new VisioAutomation.Geometry.Size(8.5, 11);
            var doc       = this._client.Document.NewDocumentFromTemplate(page_size, template);
            var fonts     = doc.Fonts;
            var font      = fonts[def_font];
            int fontid    = font.ID16;

            var pathbuilder = new PathTreeBuilder();

            foreach (var type in types)
            {
                pathbuilder.Add(type.Namespace);
            }

            var namespaces = pathbuilder.GetPaths();

            var tree_layout = new VATREE.Drawing();

            tree_layout.LayoutOptions.Direction     = VATREE.LayoutDirection.Right;
            tree_layout.LayoutOptions.ConnectorType = VATREE.ConnectorType.CurvedBezier;
            var ns_node_map = new Dictionary <string, VATREE.Node>(namespaces.Count);

            // create nodes for every namespace
            foreach (string ns in namespaces)
            {
                string label             = ns;
                int    index_of_last_sep = ns.LastIndexOf(pathbuilder.Separator, StringComparison.Ordinal);
                if (index_of_last_sep > 0)
                {
                    label = ns.Substring(index_of_last_sep + 1);
                }

                var node = new VATREE.Node(ns);
                node.Text       = new VisioAutomation.Models.Text.Element(label);
                node.Size       = new VisioAutomation.Geometry.Size(2.0, 0.25);
                ns_node_map[ns] = node;
            }

            // add children to nodes
            foreach (string ns in namespaces)
            {
                var parent_ns = pathbuilder.PathToParentPath[ns];

                if (parent_ns != null)
                {
                    // the current namespace has a parent
                    var parent_node = ns_node_map[parent_ns];
                    var child_node  = ns_node_map[ns];
                    parent_node.Children.Add(child_node);
                }
                else
                {
                    // that means this namespace is a root, forget about it
                }
            }

            if (pathbuilder.Roots.Count == 0)
            {
            }
            else if (pathbuilder.Roots.Count == 1)
            {
                // when there is exactly one root namespace, then that node will be the tree's root node
                var first_root = pathbuilder.Roots[0];
                var root_n     = ns_node_map[first_root];
                tree_layout.Root = root_n;
            }
            else
            {
                // if there are multiple root namespaces, inject an empty placeholder root
                var root_n = new VATREE.Node();
                tree_layout.Root = root_n;

                foreach (var root_ns in pathbuilder.Roots)
                {
                    var node = ns_node_map[root_ns];
                    tree_layout.Root.Children.Add(node);
                }
            }

            // format the shapes
            foreach (var node in tree_layout.Nodes)
            {
                if (node.Cells == null)
                {
                    node.Cells = new VADOM.ShapeCells();
                }
                node.Cells.FillForeground      = def_fillcolor;
                node.Cells.CharFont            = fontid;
                node.Cells.LineColor           = def_linecolor;
                node.Cells.ParaHorizontalAlign = "0";
            }

            var cxn_cells = new VADOM.ShapeCells();

            cxn_cells.LineColor = def_linecolor;
            tree_layout.LayoutOptions.ConnectorCells = cxn_cells;


            tree_layout.Render(doc.Application.ActivePage);

            DeveloperCommands.hide_ui_stuff(doc);
            return(doc);
        }