Beispiel #1
0
        public override bool WorldDraw(Drawable drawable, WorldDraw wd)
        {
            if (drawable is Entity ent)
            {
                var id = GrasshopperData.GetGrasshopperData(ent);
                if (!id.IsNull)
                {
                    var database   = id.Database;
                    var docExt     = GhBcConnection.GrasshopperDataExtension.GrasshopperDataManager(database);
                    var ghDrawable = docExt?.Drawable(id);
                    if (ghDrawable == null)
                    {
                        return(base.WorldDraw(drawable, wd));
                    }

                    bool needToDraw = false;
                    using (var transaction = database.TransactionManager.StartTransaction())
                    {
                        var ghData = transaction.GetObject(id, OpenMode.ForRead) as GrasshopperData;
                        needToDraw = ghData.IsVisible;
                        transaction.Commit();
                    }
                    if (needToDraw)
                    {
                        using (var trSt = new TraitsState(wd.SubEntityTraits))
                        {
                            wd.Geometry.Draw(ghDrawable);
                        }
                        wd.SubEntityTraits.Transparency = new Transparency((byte)GhDataSettings.HostTransparency);
                    }
                }
            }
            return(base.WorldDraw(drawable, wd));
        }
Beispiel #2
0
 protected override void SubViewportDraw(ViewportDraw vd)
 {
     using (var trSt = new TraitsState(vd.SubEntityTraits))
     {
         SetColor(vd.SubEntityTraits, Color);
         _drawables.ForEach(drawable => drawable.VieportDraw(vd));
         SetColor(vd.SubEntityTraits, ColorSelected);
         _selectedDrawables.ForEach(drawable => drawable.VieportDraw(vd));
     }
 }
Beispiel #3
0
        protected override bool SubWorldDraw(WorldDraw wd)
        {
            int drawablesForViewport = 0;

            using (var trSt = new TraitsState(wd.SubEntityTraits))
            {
                SetColor(wd.SubEntityTraits, Color);
                drawablesForViewport = _drawables.Count(drawable => !drawable.WorldDraw(wd));
                SetColor(wd.SubEntityTraits, ColorSelected);
                drawablesForViewport += _selectedDrawables.Count(drawable => !drawable.WorldDraw(wd));
            }
            return(drawablesForViewport == 0);
        }