示例#1
0
 /// <summary>
 /// Creates a new instance of EditorSettings
 /// </summary>
 public EditorSettings()
 {
     _hsl = true;
     _useColor = true;
     _startColor = SymbologyGlobal.ColorFromHsl(5, .7, .7);
     _endColor = SymbologyGlobal.ColorFromHsl(345, .8, .8);
     _maxSampleCount = 10000;
     _intervalMethod = IntervalMethod.EqualInterval;
     _rampColors = true;
     _intervalSnapMethod = IntervalSnapMethod.Rounding;
     _intervalRoundingDigits = 0;
     _numBreaks = 5;
 }
示例#2
0
 /// <summary>
 /// Applies the snapping rule directly to the categories, instead of the breaks.
 /// </summary>
 public void ApplySnapping(IntervalSnapMethod method, int numDigits, List<double> values)
 {
     switch (method)
     {
         case IntervalSnapMethod.None:
             break;
         case IntervalSnapMethod.SignificantFigures:
             if (Maximum != null)
             {
                 int digits = numDigits;
                 double max = (double)Maximum;
                 int md = (int)Math.Ceiling(Math.Log10(max));
                 md -= digits;
                 double norm = Math.Pow(10, md);
                 double val = (double)Maximum;
                 Maximum = norm * Math.Round(val / norm);
             }
             if (Minimum != null)
             {
                 int digits = numDigits;
                 double min = (double)Minimum;
                 int md = (int)Math.Ceiling(Math.Log10(min));
                 md -= digits;
                 double norm = Math.Pow(10, md);
                 double val = (double)Minimum;
                 Minimum = norm * Math.Round(val / norm);
             }
             break;
         case IntervalSnapMethod.Rounding:
             if (Maximum != null)
             {
                 Maximum = Math.Round((double)Maximum, numDigits);
             }
             if (Minimum != null)
             {
                 Minimum = Math.Round((double)Minimum, numDigits);
             }
             break;
         case IntervalSnapMethod.DataValue:
             if (Maximum != null)
             {
                 Maximum = NearestValue((double)Maximum, values);
             }
             if (Minimum != null)
             {
                 Minimum = NearestValue((double)Minimum, values);
             }
             break;
     }
 }
示例#3
0
        /// <summary>
        /// This is a slightly more complex specification where the numeric formatting
        /// controls how the generated string will appear.
        /// </summary>
        /// <param name="method">The interval snap method</param>
        /// <param name="digits">This is only used for rounding or significant figures, but controls those options</param>
        /// <returns>A string equivalent of this range, but using a number format.</returns>
        public string ToString(IntervalSnapMethod method, int digits)
        {
            if (Minimum == null && Maximum == null)
            {
                return("[All Values]");
            }

            if (Minimum == null)
            {
                string max = Format(Maximum.Value, method, digits);
                return(MaxIsInclusive ? "<= " + max : "< " + max);
            }

            if (Maximum == null)
            {
                string min = Format(Minimum.Value, method, digits);
                return(MinIsInclusive ? ">= " + min : "> " + min);
            }

            return(Format(Minimum.Value, method, digits) + " - " + Format(Maximum.Value, method, digits));
        }
示例#4
0
        /// <summary>
        /// Applies the minimum and maximum in order to create the filter expression. This will also
        /// count the members that match the specified criteria.
        /// </summary>
        /// <param name="settings">Settings that are used to apply the minimum and maximum.</param>
        public override void ApplyMinMax(EditorSettings settings)
        {
            base.ApplyMinMax(settings);
            FeatureEditorSettings fs = settings as FeatureEditorSettings;

            if (fs == null)
            {
                return;
            }
            string field = "[" + fs.FieldName.ToUpper() + "]";

            if (!string.IsNullOrEmpty(fs.NormField))
            {
                field += "/[" + fs.NormField.ToUpper() + "]";
            }
            IntervalSnapMethod method = settings.IntervalSnapMethod;
            int digits = settings.IntervalRoundingDigits;

            LegendText        = Range.ToString(method, digits);
            _filterExpression = Range.ToExpression(field);
        }
示例#5
0
        private void CmbIntervalSnappingSelectedIndexChanged(object sender, EventArgs e)
        {
            if (_newScheme == null)
            {
                return;
            }
            IntervalSnapMethod method = (IntervalSnapMethod)cmbIntervalSnapping.SelectedItem;

            _newScheme.EditorSettings.IntervalSnapMethod = method;
            switch (method)
            {
            case IntervalSnapMethod.SignificantFigures:
                lblSigFig.Visible = true;
                nudSigFig.Visible = true;
                nudSigFig.Minimum = 1;
                lblSigFig.Text    = SymbologyFormsMessageStrings.RasterCategoryControl_SignificantFigures;
                break;

            case IntervalSnapMethod.Rounding:
                nudSigFig.Visible = true;
                lblSigFig.Visible = true;
                nudSigFig.Minimum = 0;
                lblSigFig.Text    = SymbologyFormsMessageStrings.RasterCategoryControl_RoundingDigits;
                break;

            case IntervalSnapMethod.None:
                lblSigFig.Visible = false;
                nudSigFig.Visible = false;
                break;

            case IntervalSnapMethod.DataValue:
                lblSigFig.Visible = false;
                nudSigFig.Visible = false;
                break;
            }

            RefreshValues();
        }
示例#6
0
        private void cmbIntervalSnapping_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_newScheme == null)
            {
                return;
            }
            IntervalSnapMethod method = (IntervalSnapMethod)cmbIntervalSnapping.SelectedItem;

            _newScheme.EditorSettings.IntervalSnapMethod = method;
            switch (method)
            {
            case IntervalSnapMethod.SignificantFigures:
                lblSigFig.Visible = true;
                nudSigFig.Visible = true;
                nudSigFig.Minimum = 1;
                lblSigFig.Text    = "Significant Figures:";
                break;

            case IntervalSnapMethod.Rounding:
                nudSigFig.Visible = true;
                lblSigFig.Visible = true;
                nudSigFig.Minimum = 0;
                lblSigFig.Text    = "Rounding Digits:";
                break;

            case IntervalSnapMethod.None:
                lblSigFig.Visible = false;
                nudSigFig.Visible = false;
                break;

            case IntervalSnapMethod.DataValue:
                lblSigFig.Visible = false;
                nudSigFig.Visible = false;
                break;
            }

            RefreshValues();
        }
示例#7
0
 /// <summary>
 /// Applies the snapping rule directly to the categories, instead of the breaks.
 /// </summary>
 public void ApplySnapping(IntervalSnapMethod method, int numDigits, List<double> values)
 {
     switch (method)
     {
         case IntervalSnapMethod.None:
             break;
         case IntervalSnapMethod.SignificantFigures:
             if (Maximum != null)
             {
                 Maximum = SigFig(Maximum.Value, numDigits);
             }
             if (Minimum != null)
             {
                 Minimum = SigFig(Minimum.Value, numDigits);
             }
             break;
         case IntervalSnapMethod.Rounding:
             if (Maximum != null)
             {
                 Maximum = Math.Round((double)Maximum, numDigits);
             }
             if (Minimum != null)
             {
                 Minimum = Math.Round((double)Minimum, numDigits);
             }
             break;
         case IntervalSnapMethod.DataValue:
             if (Maximum != null)
             {
                 Maximum = NearestValue((double)Maximum, values);
             }
             if (Minimum != null)
             {
                 Minimum = NearestValue((double)Minimum, values);
             }
             break;
     }
 }
示例#8
0
 /// <summary>
 ///  Returns this Number as a string.
 /// </summary>
 /// <param name="method">Specifies how the numbers are modified so that the numeric text can be cleaned up.</param>
 /// <param name="digits">An integer clarifying digits for rounding or significant figure situations.</param>
 /// <returns>A string with the formatted number.</returns>
 public virtual string ToString(IntervalSnapMethod method, int digits)
 {
     return(_range.ToString(method, digits));
 }
示例#9
0
 private static string Format(double value, IntervalSnapMethod method, int digits)
 {
     if (method == IntervalSnapMethod.None)
     {
         return value.ToString();
     }
     if (method == IntervalSnapMethod.DataValue)
     {
         return value.ToString();
     }
     if (method == IntervalSnapMethod.Rounding)
     {
         return value.ToString("N" + digits);
     }
     if (method == IntervalSnapMethod.SignificantFigures)
     {
         int dig = (int)Math.Ceiling(Math.Log10(value));
         dig = digits - dig;
         if (dig < 0) dig = 0;
         if (dig > 10)
         {
             return value.ToString("E" + digits);
         }
         return value.ToString("N" + dig);
     }
     return value.ToString("N");
 }
示例#10
0
 /// <summary>
 /// This is a slightly more complex specification where the numeric formatting
 /// controls how the generated string will appear.
 /// </summary>
 /// <param name="method">The interval snap method</param>
 /// <param name="digits">This is only used for rounding or significant figures, but controls those options</param>
 /// <returns>A string equivalent of this range, but using a number format.</returns>
 public string ToString(IntervalSnapMethod method, int digits)
 {
     if (_minimum == null && _maximum == null)
     {
         return "[All Values]";
     }
     if (_minimum == null)
     {
         string max = Format(_maximum.Value, method, digits);
         return _maxIsInclusive ? "<= " + max : "< " + max;
     }
     if (_maximum == null)
     {
         string min = Format(_minimum.Value, method, digits);
         return _minIsInclusive ? ">= " + min : "> " + min;
     }
     return Format(_minimum.Value, method, digits) + " - " + Format(_maximum.Value, method, digits);
 }
示例#11
0
 /// <summary>
 ///  Returns this Number as a string.
 /// </summary>
 /// <param name="method">Specifies how the numbers are modified so that the numeric text can be cleaned up.</param>
 /// <param name="digits">An integer clarifying digits for rounding or significant figure situations.</param>
 /// <returns>A string with the formatted number.</returns>
 public virtual string ToString(IntervalSnapMethod method, int digits)
 {
     return _range.ToString(method, digits);
 }