Example #1
0
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            PicFactory fTemp = new PicFactory();
            // free variables
            double a0            = stack.GetDoubleParameterValue("a0");
            double a1            = stack.GetDoubleParameterValue("a1");
            bool   bbox          = stack.GetBoolParameterValue("bbox");
            bool   arcDefault    = stack.GetBoolParameterValue("Arc default");
            bool   arcReflX      = stack.GetBoolParameterValue("Arc Refl X");
            bool   arcReflY      = stack.GetBoolParameterValue("Arc Refl Y");
            bool   arcReflXY     = stack.GetBoolParameterValue("Arc Refl XY");
            bool   arcComplement = stack.GetBoolParameterValue("Complement");

            if (arcDefault)
            {
                PicArc arc0 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc0.Transform(Transform2D.Identity);

                if (bbox)
                {
                    Box2D box = arc0.Box;
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                                     , box.PtMin.X // x0
                                     , box.PtMin.Y // y0
                                     , box.PtMax.X // x1
                                     , box.PtMin.Y // y1
                                     );
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                                     , box.PtMax.X // x0
                                     , box.PtMin.Y // y0
                                     , box.PtMax.X // x1
                                     , box.PtMax.Y // y1
                                     );
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                                     , box.PtMin.X // x0
                                     , box.PtMax.Y // y0
                                     , box.PtMax.X // x1
                                     , box.PtMax.Y // y1
                                     );
                    fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0
                                     , box.PtMin.X // x0
                                     , box.PtMin.Y // y0
                                     , box.PtMin.X // x1
                                     , box.PtMax.Y // y1
                                     );
                }
            }
            if (arcReflY)
            {
                PicArc arc1 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc1.Transform(Transform2D.ReflectionY);
            }
            if (arcReflX)
            {
                PicArc arc2 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc2.Transform(Transform2D.ReflectionX);
            }
            if (arcReflXY)
            {
                PicArc arc3 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc3.Transform(Transform2D.ReflectionX * Transform2D.ReflectionY);
            }
            if (arcComplement)
            {
                PicArc arc4 = fTemp.AddArc(PicGraphics.LT.LT_COTATION, new Vector2D(0.0, 0.0), 100.0, a0, a1);
                arc4.Complement();
            }

            // end
            factory.AddEntities(fTemp, transform);
        }