AcTools.Render.Kn5SpecificSpecial.TrackMapRenderer.Prepare C# (CSharp) Метод

Prepare() защищенный Метод

protected Prepare ( ) : void
Результат void
        protected void Prepare() {
            UpdateFiltered();
            if (!FilteredNode.BoundingBox.HasValue) {
                throw new Exception("Can’t find a bounding box for provided filter");
            }

            var box = FilteredNode.BoundingBox.Value;
            var size = box.GetSize();

            {
                var limit = Math.Min(Device.FeatureLevel == FeatureLevel.Level_11_0 ? 16384 : 8192, MaxSize) - Margin * 2;
                var width = size.X * Scale;
                var height = size.Z * Scale;

                if (MinSize > 0) {
                    var min = MinSize / Math.Min(width, height);
                    if (min > 1f) {
                        width *= min;
                        height *= min;
                        Scale *= min;
                    }
                }

                if (limit < int.MaxValue) {
                    var max = limit / Math.Max(width, height);
                    if (max < 1f) {
                        width *= max;
                        height *= max;
                        Scale *= max;
                    }
                }

                Width = (int)(width + Margin * 2);
                Height = (int)(height + Margin * 2);
            }

            _information = new TrackMapInformation {
                Width = Width - Margin * 2,
                Height = Height - Margin * 2,
                Margin = Margin,
                XOffset = box.Maximum.X + Margin / Scale,
                ZOffset = -box.Minimum.Z + Margin / Scale,
                ScaleFactor = 1 / Scale
            };
        }