示例#1
0
        /// <summary>
        /// Sets the <see cref="D2DBrush" /> instance that defines the fill for each shape falling within the range.
        /// </summary>
        /// <param name="range"></param>
        protected override void SetFillForRange(ColorRange range)
        {
            if (range == null)
            {
                throw new ArgumentNullException(nameof(range));
            }

            if (range.Index < 0 || this.brushes.Count == 0)
            {
                return;
            }

            range.Fill = this.brushes[range.Index % this.brushes.Count];
        }
示例#2
0
        /// <summary>
        /// Sets the <see cref="D2DBrush" /> instance that defines the fill for each shape falling within the range.
        /// </summary>
        protected override void SetFillForRange(ColorRange range)
        {
            if (range == null)
            {
                throw new ArgumentNullException(nameof(range));
            }

            double ratio      = 1d / (this.rangeCountCache - 1) * range.Index;
            double colorRatio = this.to + (ratio * (this.from - this.to));

            var hsl = this.hslColor;

            hsl.S *= colorRatio;
            hsl.L  = 1 - ((1 - hsl.L) * colorRatio);

            range.Fill = new D2DSolidColorBrush()
            {
                Color = hsl.ToColor()
            };
        }
示例#3
0
        internal static IEnumerable <ColorRange> BuildLinearRanges(ValueRange <double> actualRange, int count, double step)
        {
            double startValue = actualRange.minimum;

            for (int i = 0; i < count; i++)
            {
                var range = new ColorRange()
                {
                    Min   = startValue,
                    Max   = startValue + step,
                    Index = i
                };

                if (i == count - 1)
                {
                    range.Max = actualRange.maximum;
                }

                startValue += step;

                yield return(range);
            }
        }
示例#4
0
 /// <summary>
 /// Provides an extension point for inheritors to perform additional logic when a <see cref="IMapShape"/> is associated with a valid <see cref="ColorRange"/>.
 /// </summary>
 protected virtual void OnShapeAssociated(IMapShape shape, ColorRange range)
 {
 }
示例#5
0
 /// <summary>
 /// Sets the <see cref="D2DBrush"/> instance that defines the fill for each shape falling within the range.
 /// </summary>
 protected virtual void SetFillForRange(ColorRange range)
 {
 }