Example #1
0
            public BasicLayoutRenderInfo(IViewDescription viewDescription)
            {
                double val1 = viewDescription.ViewportWidth / viewDescription.ViewWidth;
                double val2 = viewDescription.ViewportHeight / viewDescription.ViewHeight;

                if (DxfUtil.IsSaneNotZero(val1) && DxfUtil.IsSaneNotZero(val2))
                {
                    this.ModelToLayoutScaling = System.Math.Min(val1, val2);
                    Vector2D        vector2D       = val1 > val2 ? new Vector2D(0.5 * val2 / val1 * viewDescription.ViewportWidth, 0.5 * viewDescription.ViewportHeight) : new Vector2D(0.5 * viewDescription.ViewportWidth, 0.5 * val1 / val2 * viewDescription.ViewportHeight);
                    WW.Math.Point2D viewportCenter = (WW.Math.Point2D)viewDescription.ViewportCenter;
                    this.LayoutViewport         = new Bounds2D(viewportCenter - vector2D, viewportCenter + vector2D);
                    this.ModelToLayoutTransform = Transformation4D.Translation((WW.Math.Vector3D)viewDescription.ViewportCenter) * Transformation4D.Scaling(this.ModelToLayoutScaling) * ViewUtil.GetBasicModelToViewportTransform(viewDescription) * Transformation4D.Translation(-(WW.Math.Vector3D)viewDescription.ViewportCenter);
                }
                else
                {
                    this.LayoutViewport         = new Bounds2D();
                    this.ModelToLayoutTransform = Matrix4D.Identity;
                    this.ModelToLayoutScaling   = 0.0;
                }
            }