//sets the orientation of the indicator based on the scale and on the value private void SetIndicatorAngle(RadialScale scale, double value) { double angle = scale.GetAngleFromValue(Value); if (scale.SweepDirection == SweepDirection.Counterclockwise) { angle = -angle; } //rotate the needle TransformGroup tg = RenderTransform as TransformGroup; if (tg != null) { RotateTransform rt = tg.Children[1] as RotateTransform; if (rt != null) { rt.Angle = angle; // TODO : Commented to avoid a bug // Debug.WriteLine("angle changed to " + angle); } } }
//sets the indicator geometry based on the scale and the current value private void SetIndicatorGeometry(RadialScale scale, double value) { if (thePath != null) { double min = scale.MinAngle; double max = scale.GetAngleFromValue(Value); if (scale.SweepDirection == SweepDirection.Counterclockwise) { min = -min; max = -max; } double rad = scale.GetIndicatorRadius(); if (rad > BarThickness) { Geometry geom = RadialScaleHelper.CreateArcGeometry(min, max, rad, BarThickness, scale.SweepDirection); //stop the recursive loop. only set a new geometry if it is different from the current one if (thePath.Data == null || thePath.Data.Bounds != geom.Bounds) thePath.Data = geom; } } }