コード例 #1
0
ファイル: DiagramLayer.cs プロジェクト: yycx0328/Dot.Utility
        public void Paint(Graphics g, DiagramView view, RectangleF clipRect)
        {
            bool flag1 = view.IsPrinting;

            if (!(flag1 ? !this.CanPrintObjects() : !this.CanViewObjects()))
            {
                RectangleF   ef1    = view.DocExtent;
                GoLayerCache cache1 = this.FindCache(view);
                if ((cache1 != null) && (cache1.Rect == ef1))
                {
                    foreach (Shapes.DiagramShape obj1 in cache1.Objects)
                    {
                        if (!(flag1 ? obj1.CanPrint() : obj1.CanView()))
                        {
                            continue;
                        }
                        RectangleF ef2 = obj1.Bounds;
                        ef2 = obj1.ExpandPaintBounds(ef2, view);
                        if (Shapes.DiagramShape.IntersectsRect(ef2, clipRect))
                        {
                            obj1.Paint(g, view);
                        }
                    }
                }
                else
                {
                    LayerEnumerator enumerator2;
                    if (this.CacheWanted(view))
                    {
                        if (cache1 == null)
                        {
                            cache1 = new GoLayerCache(view);
                            this.Caches.Add(cache1);
                        }
                        else
                        {
                            cache1.Reset();
                        }
                        cache1.Rect = ef1;
                        enumerator2 = this.GetEnumerator();
                        while (enumerator2.MoveNext())
                        {
                            Shapes.DiagramShape obj2 = enumerator2.Current;
                            RectangleF          ef3  = obj2.Bounds;
                            ef3 = obj2.ExpandPaintBounds(ef3, view);
                            if ((flag1 ? obj2.CanPrint() : obj2.CanView()) && Shapes.DiagramShape.IntersectsRect(ef3, clipRect))
                            {
                                obj2.Paint(g, view);
                            }
                            if (Shapes.DiagramShape.IntersectsRect(ef3, ef1))
                            {
                                cache1.Objects.Add(obj2);
                            }
                        }
                    }
                    else
                    {
                        enumerator2 = this.GetEnumerator();
                        while (enumerator2.MoveNext())
                        {
                            Shapes.DiagramShape obj3 = enumerator2.Current;
                            if (flag1 ? obj3.CanPrint() : obj3.CanView())
                            {
                                RectangleF ef4 = obj3.Bounds;
                                ef4 = obj3.ExpandPaintBounds(ef4, view);
                                if (Shapes.DiagramShape.IntersectsRect(ef4, clipRect))
                                {
                                    obj3.Paint(g, view);
                                }
                            }
                        }
                    }
                }
            }
        }