private ArbitraryCompoundShape GetCustomTeeShape()
        {

            List<CompoundShapePart> rectX = new List<CompoundShapePart>()
            {
                new CompoundShapePart(0.5,6, new Point2D(0,3)),
                new CompoundShapePart(5,1, new Point2D(0,6.5)),
            };
            ArbitraryCompoundShape shape = new ArbitraryCompoundShape(rectX, null);

            return shape;
        }
예제 #2
0
        /// <summary>
        /// Calculates a section based on slicing criteria
        /// </summary>
        /// <param name="YCoordinate">Plane Y coordinate in local coordinate system</param>
        /// <param name="sliceType">Indicates whether top or bottom slice is returned</param>
        /// <returns></returns>
        private IMoveableSection getSliceAtCoordinate(double YCoordinate, SliceType sliceType)
        {
            ArbitraryCompoundShape newShape = new ArbitraryCompoundShape(null, null);

            if (sliceType == SliceType.Top)
            {
                var sortedRectanglesX = RectanglesXAxis.OrderByDescending(r => r.InsertionPoint.Y).ToList();
                foreach (var r in sortedRectanglesX)
                {
                    if (r.Ymax > YCoordinate && r.Ymin >= YCoordinate)
                    {
                        newShape.rectanglesXAxis.Add(r);
                    }
                    else if (r.Ymax >= YCoordinate && r.Ymin <= YCoordinate)
                    {
                        double thisRectHeight = r.Ymax - YCoordinate;
                        newShape.rectanglesXAxis.Add(new CompoundShapePart(r.b, thisRectHeight, new Point2D(0, r.Ymax - thisRectHeight / 2)));
                    }
                    else
                    {
                        //do nothing since this rectangle does not belong here
                    }
                }
            }
            else
            {
                var sortedRectanglesX = RectanglesXAxis.OrderBy(r => r.InsertionPoint.Y).ToList();
                foreach (var r in sortedRectanglesX)
                {
                    if (r.Ymax <= YCoordinate && r.Ymin < YCoordinate)
                    {
                        newShape.rectanglesXAxis.Add(r);
                    }
                    else if (r.Ymax > YCoordinate && r.Ymin <= YCoordinate)
                    {
                        double thisRectHeight = YCoordinate - r.Ymin;
                        newShape.rectanglesXAxis.Add(new CompoundShapePart(r.b, thisRectHeight, new Point2D(0, r.Ymin + thisRectHeight / 2)));
                    }
                    else
                    {
                        //do nothing since this rectangle does not belong here
                    }
                }
            }

            return(newShape);
        }
예제 #3
0
        /// <summary>
        /// Calculates a section based on slicing criteria
        /// </summary>
        /// <param name="YCoordinate">Plane Y coordinate in local coordinate system</param>
        /// <param name="sliceType">Indicates whether top or bottom slice is returned</param>
        /// <returns></returns>
        private IMoveableSection getSliceAtCoordinate(double YCoordinate, SliceType sliceType)
        {


            ArbitraryCompoundShape newShape = new ArbitraryCompoundShape(null, null);
            if (sliceType == SliceType.Top)
            {
                var sortedRectanglesX = RectanglesXAxis.OrderByDescending(r => r.InsertionPoint.Y).ToList();
                foreach (var r in sortedRectanglesX)
                {
                    if (r.Ymax > YCoordinate && r.Ymin >= YCoordinate)
                    {
                        newShape.rectanglesXAxis.Add(r);
                    }
                    else if (r.Ymax >= YCoordinate && r.Ymin <= YCoordinate)
                    {
                        double thisRectHeight = r.Ymax - YCoordinate;
                        newShape.rectanglesXAxis.Add(new CompoundShapePart(r.b, thisRectHeight, new Point2D(0, r.Ymax - thisRectHeight / 2)));
                    }
                    else
                    {
                        //do nothing since this rectangle does not belong here
                    }

                }
            }
            else
            {
                var sortedRectanglesX = RectanglesXAxis.OrderBy(r => r.InsertionPoint.Y).ToList();
                foreach (var r in sortedRectanglesX)
                {
                    if (r.Ymax <= YCoordinate && r.Ymin < YCoordinate)
                    {
                        newShape.rectanglesXAxis.Add(r);
                    }
                    else if (r.Ymax > YCoordinate && r.Ymin <= YCoordinate)
                    {
                        double thisRectHeight =  YCoordinate - r.Ymin;
                        newShape.rectanglesXAxis.Add(new CompoundShapePart(r.b, thisRectHeight, new Point2D(0, r.Ymin + thisRectHeight / 2)));
                    }
                    else
                    {
                        //do nothing since this rectangle does not belong here
                    }

                }
            }

            return newShape;

            
        }