private UpdateArcContext CreateUpdateArcContext(double angle, ArcSegment arc) { UpdateArcContext result = new UpdateArcContext(); result.angle = angle; result.arc = arc; result.center = this.center; result.minAngle = this.minAngle; result.radius = this.radius * this.radiusScale; return(result); }
private UpdateArcContext CreateUpdateArcContext(double angle, double startAngle) { UpdateArcContext arcContext = new UpdateArcContext(); arcContext.angle = angle; arcContext.center = this.Center; arcContext.radius = this.Radius * this.RadiusScale; arcContext.arc = this.arc; arcContext.minAngle = startAngle; return(arcContext); }
/// <summary> /// Updates an arc segment with the provided data. /// </summary> /// <param name="context">A context for the arc to be updated. the arc to update is a part of the context.</param> internal static void UpdateArc(UpdateArcContext context) { context.angle = context.arc.SweepDirection == SweepDirection.Clockwise ? context.angle : -context.angle; var arcWidth = Math.Abs(context.angle - RadialGaugePanel.ConvertDegreesToRadians(context.minAngle)); // Ensure that start and endpoint will not match, so that arc is displayed. if (arcWidth >= 2 * Math.PI) { context.angle -= Math.Sign(context.angle - context.minAngle) * 0.01; } Point arcEndPoint = RadialGaugePanel.CreateRotatedPoint(context.angle, context.radius, context.center, 1); context.arc.IsLargeArc = arcWidth > Math.PI; context.arc.Size = new Size(context.radius, context.radius); context.arc.Point = arcEndPoint; }