public static int Add(
            IVisio.Shape shape,
            ConnectionPointCells cp)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            if (!cp.X.Formula.HasValue)
            {
                throw new System.ArgumentException("Must provide an X Formula");
            }

            if (!cp.Y.Formula.HasValue)
            {
                throw new System.ArgumentException("Must provide an Y Formula");
            }

            var n = shape.AddRow((short)IVisio.VisSectionIndices.visSectionConnectionPts,
                                 (short)IVisio.VisRowIndices.visRowLast,
                                 (short)IVisio.VisRowTags.visTagCnnctPt);

            var update = new ShapeSheet.Update();
            update.SetFormulas(cp,n);
            update.Execute(shape);

            return n;
        }
        public void ConnectionPoints_DeleteAll()
        {
            var page1 = this.GetNewPage();

            var s1 = page1.DrawRectangle(0, 0, 4, 1);

            Assert.AreEqual(0, VACONNECT.ConnectionPointHelper.GetCount(s1));

            var cp_type = VACONNECT.ConnectionPointType.Inward;

            var xpositions = new[] { "Width*0.25", "Width*0.30", "Width*0.75", "Width*0.90" };
            var ypos       = "Height*0";

            foreach (var xpos in xpositions)
            {
                var cp = new VACONNECT.ConnectionPointCells();
                cp.X    = xpos;
                cp.Y    = ypos;
                cp.DirX = 0;
                cp.DirY = 0;
                cp.Type = (int)cp_type;

                VACONNECT.ConnectionPointHelper.Add(s1, cp);
            }

            Assert.AreEqual(4, VACONNECT.ConnectionPointHelper.GetCount(s1));

            int num_deleted = VACONNECT.ConnectionPointHelper.Delete(s1);

            Assert.AreEqual(4, num_deleted);
            Assert.AreEqual(0, VACONNECT.ConnectionPointHelper.GetCount(s1));

            page1.Delete(0);
        }
Beispiel #3
0
        public static int Add(
            IVisio.Shape shape,
            ConnectionPointCells connection_point_cells)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            if (!connection_point_cells.X.Formula.HasValue)
            {
                string msg = "Must provide an X Formula";
                throw new System.ArgumentException(msg, nameof(connection_point_cells));
            }

            if (!connection_point_cells.Y.Formula.HasValue)
            {
                string msg = "Must provide an Y Formula";
                throw new System.ArgumentException(msg, nameof(connection_point_cells));
            }

            var n = shape.AddRow((short)IVisio.VisSectionIndices.visSectionConnectionPts,
                                 (short)IVisio.VisRowIndices.visRowLast,
                                 (short)IVisio.VisRowTags.visTagCnnctPt);

            var update = new ShapeSheet.Update();

            update.SetFormulas(connection_point_cells, n);
            update.Execute(shape);

            return(n);
        }
Beispiel #4
0
        public static int Add(
            IVisio.Shape shape,
            ConnectionPointCells cp)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException("shape");
            }

            if (!cp.X.Formula.HasValue)
            {
                throw new System.ArgumentException("Must provide an X Formula");
            }

            if (!cp.Y.Formula.HasValue)
            {
                throw new System.ArgumentException("Must provide an Y Formula");
            }

            var n = shape.AddRow((short)IVisio.VisSectionIndices.visSectionConnectionPts,
                                 (short)IVisio.VisRowIndices.visRowLast,
                                 (short)IVisio.VisRowTags.visTagCnnctPt);

            var update = new VA.ShapeSheet.Update();

            update.SetFormulas(cp, n);
            update.Execute(shape);

            return(n);
        }
        public void ConnectionPoints_DeleteAll()
        {
            var page1 = GetNewPage();

            var s1 = page1.DrawRectangle(0, 0, 4, 1);
            Assert.AreEqual(0, VACXN.ConnectionPointHelper.GetCount(s1));

            var cp_type = VACXN.ConnectionPointType.Inward;

            var xpositions = new[] {"Width*0.25", "Width*0.30", "Width*0.75", "Width*0.90"};
            var ypos = "Height*0";

            foreach (var xpos in xpositions)
            {
                var cp = new VACXN.ConnectionPointCells();
                cp.X = xpos;
                cp.Y = ypos;
                cp.DirX = 0;
                cp.DirY = 0;
                cp.Type = (int) cp_type;

                VACXN.ConnectionPointHelper.Add(s1, cp);
            }

            Assert.AreEqual(4, VACXN.ConnectionPointHelper.GetCount(s1));

            int num_deleted = VACXN.ConnectionPointHelper.Delete(s1);
            Assert.AreEqual(4, num_deleted);
            Assert.AreEqual(0, VACXN.ConnectionPointHelper.GetCount(s1));

            page1.Delete(0);
        }
Beispiel #6
0
 internal ConnectionPointValues(int shapeid, VACONNECT.ConnectionPointCells point)
 {
     this.ShapeID = shapeid;
     this.Type    = point.Type.Formula.Value;
     this.X       = point.X.Formula.Value;
     this.Y       = point.Y.Formula.Value;
     this.DirX    = point.DirX.Formula.Value;
     this.DirY    = point.DirY.Formula.Value;
 }
        public void ConnectionPoints_AddRemove()
        {
            var page1 = this.GetNewPage();

            var s1 = page1.DrawRectangle(0, 0, 4, 1);

            Assert.AreEqual(0, VACONNECT.ConnectionPointHelper.GetCount(s1));

            var cp_type = VACONNECT.ConnectionPointType.Inward;

            var cpd1 = new VACONNECT.ConnectionPointCells();

            cpd1.X    = "Width*0.25";
            cpd1.Y    = "Height*0";
            cpd1.Type = (int)cp_type;

            var cpd2 = new VACONNECT.ConnectionPointCells();

            cpd2.X    = "Width*0.75";
            cpd2.Y    = "Height*0";
            cpd2.Type = (int)cp_type;

            VACONNECT.ConnectionPointHelper.Add(s1, cpd1);
            Assert.AreEqual(1, VACONNECT.ConnectionPointHelper.GetCount(s1));

            VACONNECT.ConnectionPointHelper.Add(s1, cpd2);
            Assert.AreEqual(2, VACONNECT.ConnectionPointHelper.GetCount(s1));

            var controlpoints = VACONNECT.ConnectionPointCells.GetCells(s1);

            Assert.AreEqual(2, controlpoints.Count);
            var cp_0 = controlpoints[0];

            AssertVA.AreEqual("0 in", 0, cp_0.DirX);
            AssertVA.AreEqual("0 in", 0, cp_0.DirY);
            AssertVA.AreEqual("0", 0, cp_0.Type);
            AssertVA.AreEqual("Width*0.25", 1, cp_0.X);
            AssertVA.AreEqual("Height*0", 0, cp_0.Y);

            var cp_1 = controlpoints[1];

            AssertVA.AreEqual("0 in", 0, cp_1.DirX);
            AssertVA.AreEqual("0 in", 0, cp_1.DirY);
            AssertVA.AreEqual("0", 0, cp_1.Type);
            AssertVA.AreEqual("Width*0.75", 3, cp_1.X);
            AssertVA.AreEqual("Height*0", 0, cp_1.Y);

            VACONNECT.ConnectionPointHelper.Delete(s1, 1);
            Assert.AreEqual(1, VACONNECT.ConnectionPointHelper.GetCount(s1));
            VACONNECT.ConnectionPointHelper.Delete(s1, 0);
            Assert.AreEqual(0, VACONNECT.ConnectionPointHelper.GetCount(s1));

            page1.Delete(0);
        }
Beispiel #8
0
            public ConnectionPointCells GetCells(VA.ShapeSheet.CellData <double>[] row)
            {
                var cells = new ConnectionPointCells();

                cells.X    = row[this.X.Ordinal];
                cells.Y    = row[this.Y.Ordinal];
                cells.DirX = row[this.DirX.Ordinal].ToInt();
                cells.DirY = row[this.DirY.Ordinal].ToInt();
                cells.Type = row[this.Type.Ordinal].ToInt();

                return(cells);
            }
        public void ConnectionPoints_AddRemove()
        {
            var page1 = GetNewPage();

            var s1 = page1.DrawRectangle(0, 0, 4, 1);
            Assert.AreEqual(0, VACXN.ConnectionPointHelper.GetCount(s1));

            var cp_type = VACXN.ConnectionPointType.Inward;

            var cpd1 = new VACXN.ConnectionPointCells();
            cpd1.X = "Width*0.25";
            cpd1.Y = "Height*0";
            cpd1.Type = (int) cp_type;

            var cpd2 = new VACXN.ConnectionPointCells();
            cpd2.X = "Width*0.75";
            cpd2.Y = "Height*0";
            cpd2.Type = (int) cp_type;

            VACXN.ConnectionPointHelper.Add(s1, cpd1);
            Assert.AreEqual(1, VACXN.ConnectionPointHelper.GetCount(s1));

            VACXN.ConnectionPointHelper.Add(s1, cpd2);
            Assert.AreEqual(2, VACXN.ConnectionPointHelper.GetCount(s1));

            var controlpoints = VACXN.ConnectionPointCells.GetCells(s1);
            Assert.AreEqual(2, controlpoints.Count);
            var cp_0 = controlpoints[0];
            AssertVA.AreEqual("0 in", 0, cp_0.DirX);
            AssertVA.AreEqual("0 in", 0, cp_0.DirY);
            AssertVA.AreEqual("0", 0, cp_0.Type);
            AssertVA.AreEqual("Width*0.25", 1, cp_0.X);
            AssertVA.AreEqual("Height*0", 0, cp_0.Y);

            var cp_1 = controlpoints[1];
            AssertVA.AreEqual("0 in", 0, cp_1.DirX);
            AssertVA.AreEqual("0 in", 0, cp_1.DirY);
            AssertVA.AreEqual("0", 0, cp_1.Type);
            AssertVA.AreEqual("Width*0.75", 3, cp_1.X);
            AssertVA.AreEqual("Height*0", 0, cp_1.Y);

            VACXN.ConnectionPointHelper.Delete(s1, 1);
            Assert.AreEqual(1, VACXN.ConnectionPointHelper.GetCount(s1));
            VACXN.ConnectionPointHelper.Delete(s1, 0);
            Assert.AreEqual(0, VACXN.ConnectionPointHelper.GetCount(s1));

            page1.Delete(0);
        }
        public IList <int> Add(IList <IVisio.Shape> target_shapes,
                               string fx,
                               string fy,
                               CONS.ConnectionPointType type)
        {
            this.Client.Application.AssertApplicationAvailable();
            this.Client.Document.AssertDocumentAvailable();

            var shapes = this.GetTargetShapes(target_shapes);

            if (shapes.Count < 1)
            {
                return(new List <int>(0));
            }

            int dirx = 0;
            int diry = 0;

            var indices = new List <int>(shapes.Count);

            var app = this.Client.Application.Get();

            using (var undoscope = this.Client.Application.NewUndoScope("Add Connection Point"))
            {
                var cp = new CONS.ConnectionPointCells();
                cp.X    = fx;
                cp.Y    = fy;
                cp.DirX = dirx;
                cp.DirY = diry;
                cp.Type = (int)type;

                foreach (var shape in shapes)
                {
                    int index = CONS.ConnectionPointHelper.Add(shape, cp);
                    indices.Add(index);
                }
            }

            return(indices);
        }
        public IList<int> Add( IList<IVisio.Shape> target_shapes, 
            string fx,
            string fy,
            CONS.ConnectionPointType type)
        {
            this.Client.Application.AssertApplicationAvailable();
            this.Client.Document.AssertDocumentAvailable();

            var shapes = this.GetTargetShapes(target_shapes);
            if (shapes.Count < 1)
            {
                return new List<int>(0);
            }

            int dirx = 0;
            int diry = 0;

            var indices = new List<int>(shapes.Count);

            var app = this.Client.Application.Get();
            using (var undoscope = this.Client.Application.NewUndoScope("Add Connection Point"))
            {
                var cp = new CONS.ConnectionPointCells();
                cp.X = fx;
                cp.Y = fy;
                cp.DirX = dirx;
                cp.DirY = diry;
                cp.Type = (int)type;

                foreach (var shape in shapes)
                {
                    int index = CONS.ConnectionPointHelper.Add(shape, cp);
                    indices.Add(index);
                }
            }

            return indices;
        }
            public ConnectionPointCells GetCells(VA.ShapeSheet.CellData<double>[] row)
            {
                var cells = new ConnectionPointCells();
                cells.X = row[this.X.Ordinal];
                cells.Y = row[this.Y.Ordinal];
                cells.DirX = row[this.DirX.Ordinal].ToInt();
                cells.DirY = row[this.DirY.Ordinal].ToInt();
                cells.Type = row[this.Type.Ordinal].ToInt();

                return cells;
            }