/// <summary>
 /// Connect last if/else branch shape with invisibe shape (connect both branches in one place)
 /// </summary>
 /// <param name="invisibleBlock">invisible block shape wrapper</param>
 /// <param name="lastBranchShape">last branch shape wrapper</param>
 public void connectLastShapeToInvisibleBlock(ShapeWrapper invisibleBlock, ShapeWrapper lastBranchShape, double x = 4.25, double y = 10)
 {
     if (lastBranchShape.isCommonShape())
     {
         connectShapes(invisibleBlock.shape, lastBranchShape.shape, ShapeForm.LINE, ShapeConnectionType.FROM_BOT_TO_CENTER, x, y);
     }
     else
     {
         connectShapes(invisibleBlock.shape, lastBranchShape.shape, ShapeForm.LINE, ShapeConnectionType.FROM_RIGHT_TO_CENTER, x, y);
     }
 }
예제 #2
0
        /// <summary>
        /// Define connection type between two shapes (none of the shapes is parent shape)
        /// </summary>
        /// <param name="firstShape">up shape</param>
        /// <param name="secShape">down shape</param>
        /// <returns>connection type</returns>
        public static ShapeConnectionType defineConnectionType(ShapeWrapper firstShape, ShapeWrapper secShape, bool isSameBranch)
        {
            bool firstShapeIsCommon = firstShape.isCommonShape();
            bool secShapeIsCommon   = secShape.isCommonShape();
            ShapeConnectionType shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_RIGHT;

            if (!firstShapeIsCommon && secShapeIsCommon)
            {
                if (isSameBranch)
                {
                    shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_BOT;
                }
                else
                {
                    shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_RIGHT;
                }
            }
            else if (firstShapeIsCommon && !secShapeIsCommon)
            {
                shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_BOT;
            }
            else if (!firstShapeIsCommon && !secShapeIsCommon)
            {
                if (isSameBranch)
                {
                    shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_BOT;
                }
                else
                {
                    shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_RIGHT;
                }
            }
            else if (firstShapeIsCommon && secShapeIsCommon)
            {
                shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_BOT;
            }
            return(shapeConnectionType);
        }
예제 #3
0
        /// <summary>
        /// Define connection type between two shapes (first shape is parent shape)
        /// </summary>
        /// <param name="chainParentShape">parent shape</param>
        /// <param name="lastBranchShape">child shape</param>
        /// <returns>connection type</returns>
        public static ShapeConnectionType defineConnectionTypeWithBranchParent(ShapeWrapper chainParentShape, ShapeWrapper lastBranchShape)
        {
            bool lastBranchShapeIsCommon            = lastBranchShape.isCommonShape();
            ShapeConnectionType shapeConnectionType = ShapeConnectionType.FROM_TOP_TO_RIGHT;

            if (chainParentShape.shapeType == ShapeForm.FOR && lastBranchShapeIsCommon)
            {
                shapeConnectionType = ShapeConnectionType.FROM_BOT_TO_LEFT;
            }
            else if (chainParentShape.shapeType == ShapeForm.FOR && !lastBranchShapeIsCommon)
            {
                shapeConnectionType = ShapeConnectionType.FROM_RIGHT_TO_LEFT;
            }
            else if (chainParentShape.shapeType == ShapeForm.WHILE && lastBranchShapeIsCommon)
            {
                shapeConnectionType = ShapeConnectionType.FROM_BOT_TO_CENTER;
            }
            else if (chainParentShape.shapeType == ShapeForm.WHILE && !lastBranchShapeIsCommon)
            {
                shapeConnectionType = ShapeConnectionType.FROM_LEFT_TO_CENTER;
            }
            return(shapeConnectionType);
        }