예제 #1
0
        /// <summary>
        /// Converts a Transform-Center Diagram to an Architectural Chart.
        /// </summary>
        private void transformToArchChart(Visio.Page inputPage, Visio.Page outputPage, Visio.Shape root)
        {
            // Separates a Transform-Center into its different components
            // ie. a Process tree, an Input tree, and an Output tree. To get all these
            // components, start at the Root and retrieve all Shapes connected to Root.

            // Gets all shapes that are connected to the root shape through a connector
            // (such as through a 1-D Dynamic Connector)
            List <int> shapeIDs = new List <int>(
                (int[])root.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesAllNodes, ""));

            // Gets all shapes that are glued to the root shape (as in, it is connected
            // directly to the root shape.
            shapeIDs.AddRange(
                (int[])root.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesAll1D, ""));

            List <Visio.Shape> inputs  = new List <Visio.Shape>();
            List <Visio.Shape> process = new List <Visio.Shape>();
            List <Visio.Shape> outputs = new List <Visio.Shape>();

            Visio.Shapes allShapes = inputPage.Shapes;

            foreach (int id in shapeIDs)
            {
                Visio.Shape toShape = allShapes.get_ItemFromID(id);

                if (toShape.Master.Name == CaseTypes.TRANSFORM_PROCESS_MASTER)
                {
                    process.Add(toShape);
                }
                else if (toShape.Master.Name == CaseTypes.TRANSFORM_INPUT_MASTER)
                {
                    inputs.Add(toShape);
                }
                else if (toShape.Master.Name == CaseTypes.TRANSFORM_OUTPUT_MASTER)
                {
                    outputs.Add(toShape);
                }
            }

            // Draws the Architecture Chart on the Architecture Chart Page.
            outputChart(outputPage, root, inputs, process, outputs);
        }
예제 #2
0
        private void erToObjHierBtn_Click(object sender, RibbonControlEventArgs e)
        {
            Visio.Shape sh = app.ActivePage.Shapes[1];
            //foreach (Visio.Shape sh in app.ActivePage.Shapes)
            {
                Array con = sh.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesIncoming1D, "", null);
                foreach (int cn in con)
                {
                    Visio.Shape ts = app.ActivePage.Shapes.get_ItemFromID(cn);
                    MessageBox.Show(ts.Name);
                }

                Array s = sh.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesIncomingNodes, "");
                foreach (int id in s)
                {
                    MessageBox.Show(app.ActivePage.Shapes.get_ItemFromID(id).Name);
                }
            }
        }
예제 #3
0
        public static string GetDependsOn(Visio.Shape shape)
        {
            System.Text.StringBuilder sb = new StringBuilder();
            var   connects    = shape.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesIncomingNodes, null);
            short customProps = (short)Visio.VisSectionIndices.visSectionProp;

            Visio.Shape connectedShape;
            if (connects.Length > 0)
            {
                sb.Append("            DependsOn = \"");
            }
            foreach (int shapeId in connects)
            {
                connectedShape = shape.ContainingPage.Shapes[shapeId];
                for (short i = 0; i < connectedShape.RowCount[customProps]; i++)
                {
                    if (connectedShape.CellsSRC[customProps, i, (short)Visio.VisCellIndices.visCustPropsLabel].FormulaU.Replace("\"", "").ToLower() == "name")
                    {
                        sb.Append("[" + connectedShape.Master.Name + "]" + connectedShape.CellsSRC[customProps, i, (short)Visio.VisCellIndices.visCustPropsValue].FormulaU.Replace("\"", "") + ";");
                    }
                }
            }
            return(sb.ToString() + "\"");
        }