示例#1
0
        public override bool WorldDraw(Drawable d, WorldDraw wd)
        {
            double radius = 0.0;

            if (d is DBObject)
            {
                radius = PipeRadiusForObject((DBObject)d);
            }

            if (radius > 0.0)
            {
                Circle circle = d as Circle;

                if (circle != null)
                {
                    // Draw the circle as is, with overruled attributes

                    base.WorldDraw(circle, wd);

                    // Needed to avoid ill-formed swept surface

                    if (circle.Radius > radius)
                    {
                        // Draw a pipe around the cirle

                        EntityColor c = wd.SubEntityTraits.TrueColor;
                        wd.SubEntityTraits.TrueColor =
                            new EntityColor(0x3fffe0e0);
                        wd.SubEntityTraits.LineWeight =
                            LineWeight.LineWeight000;
                        Vector3d normal =
                            (circle.Center - circle.StartPoint).
                            CrossProduct(circle.Normal);
                        Circle clr =
                            new Circle(
                                circle.StartPoint, normal, radius
                                );
                        SweptSurface pipe = new SweptSurface();
                        pipe.CreateSweptSurface(clr, circle, sweepOpts);
                        clr.Dispose();
                        pipe.WorldDraw(wd);
                        pipe.Dispose();
                        wd.SubEntityTraits.TrueColor = c;
                    }
                    return(true);
                }
            }
            return(base.WorldDraw(d, wd));
        }
示例#2
0
        public override void Explode(Entity e, DBObjectCollection objs)
        {
            double radius = 0.0;

            if (e is DBObject)
            {
                radius = PipeDrawOverrule.PipeRadiusForObject(e);
            }

            if (radius > 0.0)
            {
                Circle circle = e as Circle;

                if (circle != null)
                {
                    // Needed to avoid ill-formed swept surface

                    if (circle.Radius > radius)
                    {
                        // Draw a pipe around the cirle

                        Vector3d normal =
                            (circle.Center - circle.StartPoint).
                            CrossProduct(circle.Normal);
                        Circle clr =
                            new Circle(
                                circle.StartPoint, normal, radius
                                );
                        SweptSurface pipe = new SweptSurface();
                        pipe.CreateSweptSurface(clr, circle, sweepOpts);
                        clr.Dispose();
                        objs.Add(pipe);
                    }
                    return;
                }
            }
            base.Explode(e, objs);
        }