Exemplo n.º 1
0
 public ShapeWrapper(Shape shape, ShapeForm shapeForm, string shapeText, Point currentPos)
 {
     Shape      = shape;
     ShapeText  = shapeText;
     ShapeForm  = shapeForm;
     CurrentPos = currentPos;
 }
Exemplo n.º 2
0
        public ShapeWrapper DropSimpleShape(string text, Point point, ShapeForm shapeForm = ShapeForm.PROCESS)
        {
            var visioPage    = VisioApp.ActivePage;
            var shapeMaster  = GetShapeMasterByShapeForm(shapeForm);
            var droppedShape = visioPage.Drop(shapeMaster, point.X, point.Y);

            droppedShape.Text = text;
            return(new ShapeWrapper(droppedShape, shapeForm, text, point));
        }
        /// <summary>
        /// Connect two shapes
        /// </summary>
        /// <param name="shapeFrom">first shape to connect</param>
        /// <param name="shapeTo">sec shape to connect</param>
        /// <param name="connectorMaster">shape wich connect shapes</param>
        /// <param name="connectionType">shape connection type</param>
        public void connectShapes(Shape shapeFrom, Shape shapeTo, ShapeForm shapeForm, ShapeConnectionType connectionType, double x = 4.25, double y = 10)
        {
            Master         connectorMaster   = getShapeMasterByShapeType(shapeForm);
            VisCellIndices conectionToType   = VisCellIndices.visAlignTop;
            VisCellIndices conectionFromType = VisCellIndices.visAlignBottom;

            BuilderUtills.getCellsAlignsFromConnectionType(out conectionToType, out conectionFromType, connectionType);
            ConnectWithDynamicGlueAndConnector(shapeFrom, shapeTo, connectorMaster, conectionToType, conectionFromType, x, y);
        }
        /// <summary>
        /// Place common shape with text
        /// </summary>
        /// <param name="viosioShapeForm">visio shape form to place</param>
        /// <param name="text">shape text</param>
        /// <param name="x">shape x</param>
        /// <param name="y">shape y</param>
        /// <returns>placed shape</returns>
        public ShapeWrapper dropShape(ShapeForm viosioShapeForm, String text, double x, double y)
        {
            Master shapeMaster = getShapeMasterByShapeType(viosioShapeForm);
            Page   visioPage   = visioApp.ActivePage;
            Shape  shapeToDrop = visioPage.Drop(shapeMaster, x, y);

            shapeToDrop.Text = text;
            ShapeWrapper dropedShape = new ShapeWrapper(shapeToDrop, viosioShapeForm);

            return(dropedShape);
        }
Exemplo n.º 5
0
        [Test, Category("IgnoreOnJenkins"), Category("SkipMono")] //ExSkip
        public void RenderShapesOnForm()
        {
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            ShapeForm shapeForm = new ShapeForm(new Size(1017, 840));

            // Below are two ways to use the "ShapeRenderer" class to render a shape to a Graphics object.
            // 1 -  Create a shape with a chart, and render it to a specific scale.
            Chart chart = builder.InsertChart(ChartType.Pie, 500, 400).Chart;

            chart.Series.Clear();
            chart.Series.Add("Desktop Browser Market Share (Oct. 2020)",
                             new[] { "Google Chrome", "Apple Safari", "Mozilla Firefox", "Microsoft Edge", "Other" },
                             new[] { 70.33, 8.87, 7.69, 5.83, 7.28 });

            Shape chartShape = (Shape)doc.GetChild(NodeType.Shape, 0, true);

            shapeForm.AddShapeToRenderToScale(chartShape, 0, 0, 1.5f);

            // 2 -  Create a shape group, and render it to a specific size.
            GroupShape group = new GroupShape(doc);

            group.Bounds    = new RectangleF(0, 0, 100, 100);
            group.CoordSize = new Size(500, 500);

            Shape subShape = new Shape(doc, ShapeType.Rectangle);

            subShape.Width     = 500;
            subShape.Height    = 500;
            subShape.Left      = 0;
            subShape.Top       = 0;
            subShape.FillColor = Color.RoyalBlue;
            group.AppendChild(subShape);

            subShape        = new Shape(doc, ShapeType.Image);
            subShape.Width  = 450;
            subShape.Height = 450;
            subShape.Left   = 25;
            subShape.Top    = 25;
            subShape.ImageData.SetImage(ImageDir + "Logo.jpg");
            group.AppendChild(subShape);

            builder.InsertNode(group);

            GroupShape groupShape = (GroupShape)doc.GetChild(NodeType.GroupShape, 0, true);

            shapeForm.AddShapeToRenderToSize(groupShape, 880, 680, 100, 100);

            shapeForm.ShowDialog();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Gets operator text from code line
 /// </summary>
 /// <param name="nodeCode">operator code to extract text</param>
 /// <param name="nodeType">operator type to extract</param>
 /// <returns>extracted operator text</returns>
 String extractTextFromOperator(string nodeCode, ShapeForm nodeType)
 {
     if (nodeType == ShapeForm.IF)
     {
         nodeCode = this.languageConfig.formatIf(nodeCode);
     }
     else if (nodeType == ShapeForm.FOR)
     {
         nodeCode = this.languageConfig.formatFor(nodeCode);
     }
     else if (nodeType == ShapeForm.WHILE)
     {
         nodeCode = this.languageConfig.formatWhile(nodeCode);
     }
     else if (nodeType == ShapeForm.IN_OUT_PUT)
     {
         nodeCode = this.languageConfig.formatInOutPut(nodeCode);
     }
     return(nodeCode);
 }
        /// <summary>
        /// Place shape based on node
        /// </summary>
        /// <param name="shapeMaster">shape master to place</param>
        /// <param name="node">shape node</param>
        /// <param name="x">shape x</param>
        /// <param name="y">shape x</param>
        /// <returns>placed shape</returns>
        public ShapeWrapper dropShape(Node node, double x, double y)
        {
            Master    shapeMaster  = begin;
            Page      visioPage    = visioApp.ActivePage;
            ShapeForm newShapeType = ShapeForm.BEGIN;

            if (node != null)
            {
                shapeMaster = getShapeMasterByShapeType(node.shapeForm);
            }
            Shape shapeToDrop = visioPage.Drop(shapeMaster, x, y);

            if (node != null)
            {
                newShapeType     = node.shapeForm;
                shapeToDrop.Text = node.nodeText;
            }
            ShapeWrapper dropedShape = new ShapeWrapper(shapeToDrop, newShapeType);

            return(dropedShape);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Get figure master from visio shape form
        /// </summary>
        /// <param name="shapeForm">form to get master</param>
        /// <returns>Shape master</returns>
        protected Master GetShapeMasterByShapeForm(ShapeForm shapeForm)
        {
            Master resultFigure = Begin;

            switch (shapeForm)
            {
            case ShapeForm.BEGIN_END:
                resultFigure = Begin;
                break;

            case ShapeForm.FOR:
                resultFigure = ForState;
                break;

            case ShapeForm.LOOP_START:
                resultFigure = LoopStart;
                break;

            case ShapeForm.LOOP_END:
                resultFigure = LoopEnd;
                break;

            case ShapeForm.IF:
                resultFigure = IfState;
                break;

            case ShapeForm.PROCESS:
                resultFigure = Process;
                break;

            case ShapeForm.PROGRAM:
                resultFigure = Program;
                break;

            case ShapeForm.ARROW:
                resultFigure = Arrow;
                break;

            case ShapeForm.LINE:
                resultFigure = Line;
                break;

            case ShapeForm.IN_OUT_PUT:
                resultFigure = InOutPut;
                break;

            case ShapeForm.CONNECTOR:
                resultFigure = Connector;
                break;

            case ShapeForm.PAGE_CONNECTOR:
                resultFigure = PageConnector;
                break;

            case ShapeForm.TEXT_FIELD:
                resultFigure = TextField;
                break;

            case ShapeForm.SMALL_TEXT_FIELD:
                resultFigure = SmallTextField;
                break;

            case ShapeForm.INVISIBLE_BLOCK:
            case ShapeForm.INIT_SHAPE:
                resultFigure = LittleInvisibleBlock;
                break;
            }

            return(resultFigure);
        }
Exemplo n.º 9
0
 public void DropTextField(string text, Point point, ShapeForm textFieldType = ShapeForm.TEXT_FIELD)
 {
     DropSimpleShape(text, point, textFieldType);
 }
Exemplo n.º 10
0
 private void DropTextField(string text, Point point, ShapeForm textFieldType)
 {
     DropSimpleShape(text, point, textFieldType);
 }
Exemplo n.º 11
0
 private HexShape(ShapeForm _shapeFormingFunc)
 {
     shapeFormingFunc = _shapeFormingFunc;
 }
Exemplo n.º 12
0
 public ShapeWrapper(Shape shape, ShapeForm shapeType)
 {
     this.shape     = shape;
     this.shapeType = shapeType;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Get figure master from visio shape form
        /// </summary>
        /// <param name="shapeForm">form to get master</param>
        /// <returns>Shape master</returns>
        public Master getShapeMasterByShapeType(ShapeForm shapeForm)
        {
            Master resultFigure = begin;

            switch (shapeForm)
            {
            case ShapeForm.BEGIN:
                resultFigure = begin;
                break;

            case ShapeForm.FOR:
                resultFigure = forState;
                break;

            case ShapeForm.WHILE:
            case ShapeForm.IF:
                resultFigure = ifState;
                break;

            case ShapeForm.PROCESS:
                resultFigure = process;
                break;

            case ShapeForm.PROGRAM:
                resultFigure = program;
                break;

            case ShapeForm.ARROW_LEFT:
                resultFigure = arrowLeft;
                break;

            case ShapeForm.ARROW_RIGHT:
                resultFigure = arrowRight;
                break;

            case ShapeForm.LINE:
                resultFigure = line;
                break;

            case ShapeForm.IN_OUT_PUT:
                resultFigure = inoutPut;
                break;

            case ShapeForm.CONNECTOR:
                resultFigure = connector;
                break;

            case ShapeForm.PAGE_CONNECTOR:
                resultFigure = pageConnector;
                break;

            case ShapeForm.TEXT_FIELD:
                resultFigure = textField;
                break;

            case ShapeForm.SMALL_TEXT_FIELD:
                resultFigure = smallTextField;
                break;

            case ShapeForm.INVISIBLE_BLOCK:
            case ShapeForm.DO:
                resultFigure = littleInvisibleBlock;
                break;
            }
            return(resultFigure);
        }
Exemplo n.º 14
0
 public Node(String nodeText, ShapeForm shapeForm)
 {
     this.nodeText  = nodeText;
     this.shapeForm = shapeForm;
 }