コード例 #1
0
ファイル: DxfLayout.cs プロジェクト: 15831944/WW
        public Bounds2D GetPlotAreaBounds()
        {
            Bounds2D bounds2D = new Bounds2D();

            switch (this.PlotArea)
            {
            case PlotArea.LastScreenDisplay:
                if (this.LastActiveViewport is DxfVPort)
                {
                    bounds2D = DxfLayout.smethod_7(((DxfVPort)this.LastActiveViewport).ViewDescription);
                }
                if (this.LastActiveViewport is DxfViewport)
                {
                    bounds2D = DxfLayout.smethod_7(((DxfViewport)this.LastActiveViewport).ViewDescription);
                    break;
                }
                break;

            case PlotArea.DrawingExtents:
                bounds2D.Update(this.MinExtents.X, this.MinExtents.Y);
                bounds2D.Update(this.MaxExtents.X, this.MaxExtents.Y);
                break;

            case PlotArea.DrawingLimits:
                bounds2D.Update(this.Limits.Corner1);
                bounds2D.Update(this.Limits.Corner2);
                break;

            case PlotArea.SpecifiedByViewName:
                bounds2D = DxfLayout.smethod_7(this.Model.Views[this.PlotViewName].ViewDescription);
                break;

            case PlotArea.SpecifiedByPlotWindowArea:
                bounds2D.Update(this.PlotWindowArea.Corner1);
                bounds2D.Update(this.PlotWindowArea.Corner2);
                break;

            case PlotArea.LayoutInformation:
                if (this.PlotPaperSize == Size2D.Zero)
                {
                    return(bounds2D);
                }
                switch (this.PlotRotation)
                {
                case PlotRotation.None:
                    Vector2D vector2D1 = -new Vector2D(this.UnprintableMarginLeft, this.UnprintableMarginBottom) - (Vector2D)this.PaperImageOrigin;
                    bounds2D.Update(new WW.Math.Point2D(0.0, 0.0) + vector2D1);
                    bounds2D.Update(new WW.Math.Point2D(this.PlotPaperSize.X, this.PlotPaperSize.Y) + vector2D1);
                    break;

                case PlotRotation.QuarterCounterClockwise:
                    Vector2D vector2D2 = -new Vector2D(this.UnprintableMarginTop, this.UnprintableMarginLeft) - (Vector2D)this.PaperImageOrigin;
                    bounds2D.Update(new WW.Math.Point2D(0.0, 0.0) + vector2D2);
                    bounds2D.Update(new WW.Math.Point2D(this.PlotPaperSize.Y, this.PlotPaperSize.X) + vector2D2);
                    break;

                case PlotRotation.Half:
                    Vector2D vector2D3 = -new Vector2D(this.UnprintableMarginRight, this.UnprintableMarginTop) - (Vector2D)this.PaperImageOrigin;
                    bounds2D.Update(new WW.Math.Point2D(0.0, 0.0) + vector2D3);
                    bounds2D.Update(new WW.Math.Point2D(this.PlotPaperSize.X, this.PlotPaperSize.Y) + vector2D3);
                    break;

                case PlotRotation.QuarterClockwise:
                    Vector2D vector2D4 = -new Vector2D(this.UnprintableMarginBottom, this.UnprintableMarginRight) - (Vector2D)this.PaperImageOrigin;
                    bounds2D.Update(new WW.Math.Point2D(0.0, 0.0) + vector2D4);
                    bounds2D.Update(new WW.Math.Point2D(this.PlotPaperSize.Y, this.PlotPaperSize.X) + vector2D4);
                    break;
                }
                if (this.PlotPaperUnits == PlotPaperUnits.Inches)
                {
                    double num = 5.0 / (double)sbyte.MaxValue;
                    bounds2D = new Bounds2D((WW.Math.Point2D)(num * (Vector2D)bounds2D.Min), (WW.Math.Point2D)(num * (Vector2D)bounds2D.Max));
                    break;
                }
                break;
            }
            return(bounds2D);
        }