Beispiel #1
0
        private void SetMinMax(BandInfo bandInfo, bool custom)
        {
            if (bandInfo == null)
            {
                return;
            }

            var band = GetBand(bandInfo.Combo);

            if (band == null)
            {
                return;
            }

            if (custom)
            {
                var model = new RasterMinMaxModel(band);
                if (_context.Container.Run <RasterMinMaxPresenter, RasterMinMaxModel>(model, ParentForm))
                {
                    bandInfo.Min.DoubleValue = model.Min;
                    bandInfo.Max.DoubleValue = model.Max;
                }
            }
            else
            {
                ComputeBandMinMax(band, bandInfo);
            }
        }
Beispiel #2
0
        private bool GetCalculationType(out MinMaxCalculationType calculationType)
        {
            var model = new RasterMinMaxModel(null);

            if (_context.Container.Run <RasterMinMaxPresenter, RasterMinMaxModel>(model, ParentForm))
            {
                calculationType = model.CalculationType;
                return(true);
            }

            calculationType = MinMaxCalculationType.Precise;
            return(false);
        }
Beispiel #3
0
        private void SetAllCustomClick(object sender, EventArgs e)
        {
            MinMaxCalculationType calculationType;

            if (!GetCalculationType(out calculationType))
            {
                return;
            }

            foreach (var combo in BandCombos)
            {
                var band     = GetBand(combo);
                var bandInfo = GetBandInfo(combo);

                var model = new RasterMinMaxModel(band)
                {
                    CalculationType = calculationType
                };
                model.Calculate();

                bandInfo.Min.DoubleValue = model.Min;
                bandInfo.Max.DoubleValue = model.Max;
            }
        }