/// <summary> /// 產生合併用的參數 /// </summary> /// <param name="direction"></param> /// <param name="sWidth"></param> /// <param name="sHeight"></param> /// <param name="tWidth"></param> /// <param name="tHeight"></param> /// <returns></returns> private static MergeParamModel genMergeParams(MergeDirection direction, double sWidth, double sHeight, double tWidth, double tHeight) { HTuple row1 = new HTuple(new int[] { -1, -1 }); HTuple col1 = new HTuple(new int[] { -1, -1 }); HTuple row2 = new HTuple(new int[] { -1, -1 }); HTuple col2 = new HTuple(new int[] { -1, -1 }); double height = sHeight, width = sWidth; double[] offsetR = null, offsetC = null; MergeParamModel model = new MergeParamModel() { row1 = row1, col1 = col1, row2 = row2, col2 = col2, }; switch (direction) { case MergeDirection.Vertical: width = sWidth; height = sHeight + tHeight; offsetR = new double[] { 0, sHeight }; offsetC = new double[] { 0, 0 }; break; case MergeDirection.Horizontal: width = sWidth + tWidth; height = sHeight; offsetR = new double[] { 0, 0 }; offsetC = new double[] { 0, sWidth }; break; } model.height = new HTuple(height); model.width = new HTuple(width); model.offsetRow = new HTuple(offsetR); model.offsetCol = new HTuple(offsetC); return(model); }
/// <summary> /// 產生合併用的參數 /// </summary> /// <param name="direction"></param> /// <param name="sWidth"></param> /// <param name="sHeight"></param> /// <param name="tWidth"></param> /// <param name="tHeight"></param> /// <returns></returns> private static MergeParamModel genMergeParams(MergeDirection direction, double sWidth, double sHeight, double tWidth, double tHeight) { HTuple row1 = new HTuple(new int[] { -1, -1 }); HTuple col1 = new HTuple(new int[] { -1, -1 }); HTuple row2 = new HTuple(new int[] { -1, -1 }); HTuple col2 = new HTuple(new int[] { -1, -1 }); double height = sHeight, width = sWidth; double[] offsetR = null, offsetC = null; MergeParamModel model = new MergeParamModel() { row1 = row1, col1 = col1, row2 = row2, col2 = col2, }; switch (direction) { case MergeDirection.Vertical: width = sWidth; height = sHeight + tHeight; offsetR = new double[] { 0, sHeight }; offsetC = new double[] { 0, 0 }; break; case MergeDirection.Horizontal: width = sWidth + tWidth; height = sHeight; offsetR = new double[] { 0, 0 }; offsetC = new double[] { 0, sWidth }; break; } model.height = new HTuple(height); model.width = new HTuple(width); model.offsetRow = new HTuple(offsetR); model.offsetCol = new HTuple(offsetC); return model; }