示例#1
0
 public void Convert()
 {
     if (_root.Shape != null)
     {
         _converter.outputToConsole("Converting to tables...");
         recursiveLeavesToTables(_root.Shape);
     }
 }
        private void insertShapes(string[] path, SDON.Model.Shape rootShape, Uri url)
        {
            int i = ((path.Length > 0) && (path[0] == "/")) ? 1 : 0;

            SDON.Model.Shape parent = rootShape;
            SDON.Model.Shape child  = null;
            string           currentStep;

            for (; (i < path.Length) && (i < _maxDepth); i++)
            {
                if ((path[i].Length > 0) && (path[i][path[i].Length - 1] == '/'))
                {
                    if (path[i].Length == 1)
                    {
                        break;
                    }

                    currentStep = path[i].Substring(0, path[i].Length - 1);
                }
                else
                {
                    currentStep = path[i];
                }

                child = FilterUtility.SearchConnectedShapesForLabel(parent, currentStep);

                if (child == null)
                {
                    child          = new SDON.Model.Shape();
                    child.TextGrow = SDON.Model.TextGrow.Horizontal;
                    child.Truncate = 72;
                    child.Label    = currentStep;

                    if (((i + 1) == path.Length) || (((i + 2) == path.Length) && (path[path.Length - 1] == "/")))
                    {
                        child.ShapeType = LeafShape;

                        if (_converter.GenerateHyperlinks)
                        {
                            child.Hyperlink     = new SDON.Model.Hyperlink();
                            child.Hyperlink.url = url.OriginalString;
                        }
                    }
                    else
                    {
                        child.ShapeType = FolderShape;
                    }

                    FilterUtility.InsertConnectedShape(parent, child);
                    _numShapes++;

                    if (parent.ShapeType == LeafShape)
                    {
                        parent.ShapeType = NormalShape;
                    }

                    if (_numShapes >= _maxShapes)
                    {
                        _converter.outputToConsole("Reached maximum number of shapes");
                        break;
                    }
                }
                else if ((child.ShapeType == FolderShape) && (((i + 1) == path.Length) || (((i + 2) == path.Length) && (path[path.Length - 1] == "/"))))
                {
                    child.ShapeType = NormalShape;

                    if (_converter.GenerateHyperlinks)
                    {
                        child.Hyperlink     = new SDON.Model.Hyperlink();
                        child.Hyperlink.url = url.OriginalString;
                    }
                }

                parent = child;
                child  = null;
            }
        }