Exemplo n.º 1
0
        private void UpdateCore()
        {
            var    startAngle = RadialGaugePanel.ConvertDegreesToRadians(this.MinAngle);
            double angle      = RadialGaugePanel.CalculateAngle(this.CreateCalculateAngleContext(this.ActualValue));

            if (startAngle > angle)
            {
                var tmp = startAngle;
                startAngle = angle;
                angle      = tmp;
            }

            this.figure.StartPoint = RadialGaugePanel.CreateRotatedPoint(startAngle, this.Radius, this.Center, this.RadiusScale);
            RadialBarGaugeIndicator.UpdateArc(this.CreateUpdateArcContext(angle, startAngle / Math.PI * 180));
        }
        /// <summary>
        /// This method is called so that a segmented indicator can synchronize
        /// its visual state with its current value.
        /// </summary>
        /// <param name="value">The value to synchronize with.</param>
        internal override void SyncWithValue(double value)
        {
            double currentAngle = RadialGaugePanel.CalculateAngle(this.CreateCalculateAngleContext(value));

            foreach (SegmentInfo info in this.SegmentInfos)
            {
                ArcSegment arc = (ArcSegment)info.PathSegment;
                if (currentAngle >= info.Start && currentAngle <= info.End)
                {
                    RadialBarGaugeIndicator.UpdateArc(this.CreateUpdateArcContext(currentAngle, arc));
                    arc.IsLargeArc = Math.Abs(currentAngle - info.Start) > Math.PI;
                }
                else if (currentAngle > info.End)
                {
                    RadialBarGaugeIndicator.UpdateArc(this.CreateUpdateArcContext(info.End, arc));
                    arc.IsLargeArc = Math.Abs(info.End - info.Start) > Math.PI;
                }
                else if (currentAngle <= info.Start)
                {
                    RadialBarGaugeIndicator.UpdateArc(this.CreateUpdateArcContext(info.Start, arc));
                    arc.IsLargeArc = false;
                }
            }
        }