예제 #1
0
        private static void AddHatch(VectorImage vectorImage, Hatch hatch, DistanceUnit currentUnit)
        {
            HatchShape hatchShape = new HatchShape();

            List <HatchPattern> hatchPatternList = new List <HatchPattern>();

            foreach (HatchPattern hatchPattern in hatch.HatchPatternList)
            {
                hatchShape.AddHatchPattern(hatchPattern);
            }

            foreach (ShapeBase boundryShape in hatch.BoundaryShapeList)
            {
                AddToHatchBoundaries(boundryShape, hatchShape);
            }
            vectorImage.AddHatchShape(hatchShape, 0);
        }
예제 #2
0
        static void AddToHatchBoundaries(ShapeBase shape, HatchShape hatchShape)
        {
            switch (shape.ShapeType)
            {
            case ShapeType.Arc:
                Arc arcShape = shape as Arc;
                hatchShape.AddArc2D(arcShape.CenterPoint.X, arcShape.CenterPoint.Y, arcShape.Radius, arcShape.StartAngle, arcShape.SweepAngle);
                break;

            case ShapeType.Circle:
                Circle circleShape = shape as Circle;
                hatchShape.AddCircle2D(circleShape.CenterPoint.X, circleShape.CenterPoint.Y, circleShape.Radius);
                break;

            case ShapeType.Group:
                Group groupShape = shape as Group;
                foreach (ShapeBase groupSubShape in groupShape.ShapeList)
                {
                    AddToHatchBoundaries(groupSubShape, hatchShape);
                }
                break;

            case ShapeType.Line:
                Line lineShape = shape as Line;
                hatchShape.AddLine2D(lineShape.StartPoint.X, lineShape.StartPoint.Y, lineShape.EndPoint.X, lineShape.EndPoint.Y);
                break;

            case ShapeType.Polyline:
                Polyline polylineShape = shape as Polyline;
                if (polylineShape.Closed)
                {
                    hatchShape.AddPolygon(polylineShape.Vertices);
                }
                else
                {
                    hatchShape.AddPolyline(polylineShape.Vertices);
                }
                break;

            default:
                break;
            }
        }