Esempio n. 1
0
 private void txtMax_Leave(object sender, EventArgs e)
 {
     if (StringToNumberHelper.isFloatPointNumber(txtMax.Text))
     {
         _intervalType = IntervalType.FloatType;
     }
 }
Esempio n. 2
0
        private void CalcMinMax()
        {
            double pdfMin = 0;
            double pdfMax = 0;

            try
            {
                _progress.Reset("正在统计端值...", 100);
                _progress.Start(false);
                IRasterBand band = _drawing.DataProviderCopy.GetRasterBand(_selectBand);
                band.ComputeMinMax(out pdfMin, out pdfMax, false,
                                   (idx, tip) => { _progress.Boost(idx); });
            }
            finally
            {
                _progress.Finish();
            }
            this.txtMin.Text = Math.Round(pdfMin, 2).ToString();
            this.txtMax.Text = Math.Round(pdfMax, 2).ToString();
            if (StringToNumberHelper.isFloatPointNumber(txtMin.Text) || StringToNumberHelper.isFloatPointNumber(txtMax.Text))
            {
                _intervalType = IntervalType.FloatType;
            }
            else
            {
                _intervalType = IntervalType.IntType;
            }
            _min_value = (int)pdfMin;
            _max_value = (int)pdfMax;
            _minValue  = (float)Math.Round(pdfMin, 2);
            _maxValue  = (float)Math.Round(pdfMax, 2);
        }
Esempio n. 3
0
        //private void txtInterval_TextChanged(object sender, EventArgs e)
        //{
        //    //if (!_isOpenXML)
        //    //    CalcSliceRange();
        //}

        private void CalcSliceRange()
        {
            if (_isInit)
            {
                return;
            }
            if (!CheckMaxMinValue())
            {
                return;
            }
            if (!CheckInterval())
            {
                return;
            }
            if (StringToNumberHelper.isFloatPointNumber(txtInterval.Text))
            {
                IntervalType = IntervalType.FloatType;
            }
            else
            {
                IntervalType = IntervalType.IntType;
            }
            float numValue = (float)(_maxValue - _minValue) / _interval;

            numSliceRange.Value = (decimal)Math.Ceiling(numValue <= 0 ? 1 :
                                                        numValue > (float)numSliceRange.Maximum ? numSliceRange.Maximum : (decimal)numValue);
        }
Esempio n. 4
0
        private List <DensityRange> InitRange(int range)
        {
            ConstructColorList();
            if (ckInterval.Checked)
            {
                if (StringToNumberHelper.isFloatPointNumber(txtInterval.Text))
                {
                    _intervalType = IntervalType.FloatType;
                }
                else
                {
                    _intervalType = IntervalType.IntType;
                }
            }
            else
            {
                _interval = (float)Math.Round((_maxValue - _minValue) / (float)numSliceRange.Value, 2);
            }
            if (_intervalType == IntervalType.IntType)
            {
                _interval = (int)Math.Ceiling(_interval);
            }
            List <DensityRange> m_RangeList = new List <DensityRange>();

            for (int i = 0; i < range; i++)
            {
                int          color_idx  = i > colorList.Length - 1 ? i % (colorList.Length - 1) : i;
                Color        rangeColor = colorList[color_idx];
                DensityRange r          = (i == 0) ?
                                          new DensityRange(_minValue + (i * _interval), _minValue + ((i + 1) * _interval), rangeColor.R, rangeColor.G, rangeColor.B) :
                                          new DensityRange(_minValue + (i * _interval), _minValue + ((i + 1) * _interval), rangeColor.R, rangeColor.G, rangeColor.B);
                m_RangeList.Add(r);
            }
            return(m_RangeList);
        }