public Connector AddConnection(string id, Shape from, Shape to, string label,
            VA.Shapes.Connections.ConnectorType type, int beginArrow, int endArrow, string hyperlink)
        {
            var new_connector = new Connector(from, to);
            new_connector.ID = id;
            new_connector.Label = label;
            new_connector.ConnectorType = type;
            new_connector.Cells = new VA.DOM.ShapeCells();
            new_connector.Cells.BeginArrow = beginArrow;
            new_connector.Cells.BeginArrowSize = beginArrow;
            new_connector.Cells.EndArrow = endArrow;
            new_connector.Cells.EndArrowSize = endArrow;

            if (!string.IsNullOrEmpty(hyperlink))
            {

                //new_connector.VisioShape = IVisio.Shape; // IVisio.Shape();
                var h = new_connector.VisioShape.Hyperlinks.Add();

                h.Name = hyperlink; // Name of Hyperlink
                h.Address = hyperlink; // Address of Hyperlink
            }

            this.Connectors.Add(id, new_connector);
            return new_connector;
        }
        public Shape AddShape(string id, string label, string stencil_name, string master_name)
        {
            var s0 = new Shape(id);
            s0.Label = label;
            s0.StencilName = stencil_name;
            s0.MasterName = master_name;

            this.Shapes.Add(id, s0);
            return s0;
        }
        public Connector AddConnection(string id, Shape from, Shape to, string label, string stencil_name, string master_name)
        {
            var new_connector = new Connector(from, to);
               new_connector.ID = id;
               new_connector.Label = label;
               new_connector.StencilName = stencil_name;
               new_connector.MasterName = master_name;

               this.Connectors.Add(id, new_connector);
               return new_connector;
        }
        public Connector Connect(
            string id, 
            Shape from, 
            Shape to, 
            string label,
             ConnectorType type)
        {
            var new_connector = new Connector(from, to);
            new_connector.Label = label;
            new_connector.ConnectorType = type;

            this.Connectors.Add(id, new_connector);
            return new_connector;
        }
 public Connector(Shape from, Shape to)
 {
     this.ConnectorType = VACONNECT.ConnectorType.Curved;
     this.From = from;
     this.To = to;
 }
 public Connector Connect(string id, Shape from, Shape to)
 {
     return Connect(id, from, to, id, ConnectorType.RightAngle);
 }
 public Connector(Shape from, Shape to)
 {
     ConnectorType = ConnectorType.Curved;
     this.From = from;
     this.To = to;
 }
 public Connector AddConnection(string id, Shape from, Shape to)
 {
     return this.AddConnection(id, from, to, id, VA.Shapes.Connections.ConnectorType.Default);
 }
Beispiel #9
0
        private void format_shape(DGMODEL.Shape layout_shape, VA.DOM.BaseShape shape_node)
        {
            layout_shape.VisioShape = shape_node.VisioShape;

            // SET TEXT
            if (!string.IsNullOrEmpty(layout_shape.Label))
            {
                // if the shape contains vertical bars these are treated as line breaks
                if (layout_shape.Label.IndexOf('|') >= 0)
                {
                    // there is at least one line break so this means we have to
                    // construct multiple text regions

                    // create the root text element
                    shape_node.Text = new VA.Text.Markup.TextElement();

                    // Split apart the string
                    var tokens = layout_shape.Label.Split('|').Select(tok => tok.Trim()).ToArray();
                    // Add an text element for each piece
                    foreach (string token in tokens)
                    {
                        shape_node.Text.AddText(token);
                    }
                }
                else
                {
                    // No line braeaks. Just use a simple TextElement with the label string
                    shape_node.Text = new VA.Text.Markup.TextElement(layout_shape.Label);
                }
            }

            // SET SIZE
            if (layout_shape.Size.HasValue)
            {
                shape_node.Cells.Width  = layout_shape.Size.Value.Width;
                shape_node.Cells.Height = layout_shape.Size.Value.Height;
            }

            // ADD URL
            if (!string.IsNullOrEmpty(layout_shape.URL))
            {
                var hyperlink = new VA.DOM.Hyperlink("Row_1", layout_shape.URL);
                shape_node.Hyperlinks = new List <VA.DOM.Hyperlink> {
                    hyperlink
                };
            }

            // ADD CUSTOM PROPS
            if (layout_shape.CustomProperties != null)
            {
                shape_node.CustomProperties = new Dictionary <string, CustomPropertyCells>();
                foreach (var kv in layout_shape.CustomProperties)
                {
                    shape_node.CustomProperties[kv.Key] = kv.Value;
                }
            }

            if (layout_shape.Cells != null)
            {
                shape_node.Cells = layout_shape.Cells.ShallowCopy();
            }
        }