Exemplo n.º 1
0
 private static double GetPositionOnShape(VA.Shapes.XFormCells xform, PositionOnShape pos)
 {
     if (pos == PositionOnShape.PinY)
     {
         return(xform.PinY.Result);
     }
     else if (pos == PositionOnShape.PinX)
     {
         return(xform.PinX.Result);
     }
     else
     {
         var r = GetRectangle(xform);
         if (pos == PositionOnShape.Left)
         {
             return(r.Left);
         }
         else if (pos == PositionOnShape.Right)
         {
             return(r.Right);
         }
         else if (pos == PositionOnShape.Top)
         {
             return(r.Top);
         }
         else if (pos == PositionOnShape.Right)
         {
             return(r.Bottom);
         }
         else
         {
             throw new System.ArgumentOutOfRangeException("pos");
         }
     }
 }
Exemplo n.º 2
0
 private static double GetPositionOnShape(VA.Shapes.XFormCells xform, PositionOnShape pos)
 {
     if (pos == PositionOnShape.PinY)
     {
         return xform.PinY.Result;
     }
     else if (pos == PositionOnShape.PinX)
     {
         return xform.PinX.Result;
     }
     else
     {
         var r = GetRectangle(xform);
         if (pos == PositionOnShape.Left)
         {
             return r.Left;
         }
         else if (pos == PositionOnShape.Right)
         {
             return r.Right;
         }
         else if (pos == PositionOnShape.Top)
         {
             return r.Top;
         }
         else if (pos == PositionOnShape.Right)
         {
             return r.Bottom;
         }
         else
         {
             throw new System.ArgumentOutOfRangeException("pos");
         }
     }
 }
Exemplo n.º 3
0
        public static IList<int> SortShapesByPosition(IVisio.Page page, IList<int> shapeids, PositionOnShape pos)
        {
            if (page == null)
            {
                throw new System.ArgumentNullException("page");
            }

            if (shapeids == null)
            {
                throw new System.ArgumentNullException("shapeids");
            }

            // First get the transforms of the shapes on the given axis
            var xforms = ArrangeHelper.GetXForm(page, shapeids);

            // Then, sort the shapeids pased on the corresponding value in the results

            var sorted_shape_ids = Enumerable.Range(0, shapeids.Count)
                .Select(i => new {index = i, shapeid = shapeids[i], pos = GetPositionOnShape(xforms[i], pos)})
                .OrderBy(i => i.pos)
                .Select(i=>i.shapeid)
                .ToList();

            return sorted_shape_ids;
        }
Exemplo n.º 4
0
        public static IList <int> SortShapesByPosition(IVisio.Page page, IList <int> shapeids, PositionOnShape pos)
        {
            if (page == null)
            {
                throw new System.ArgumentNullException("page");
            }

            if (shapeids == null)
            {
                throw new System.ArgumentNullException("shapeids");
            }

            // First get the transforms of the shapes on the given axis
            var xforms = ArrangeHelper.GetXForm(page, shapeids);

            // Then, sort the shapeids pased on the corresponding value in the results


            var sorted_shape_ids = Enumerable.Range(0, shapeids.Count)
                                   .Select(i => new { index = i, shapeid = shapeids[i], pos = GetPositionOnShape(xforms[i], pos) })
                                   .OrderBy(i => i.pos)
                                   .Select(i => i.shapeid)
                                   .ToList();

            return(sorted_shape_ids);
        }