src/Foundation/Presentation/Gimela.Presentation.Controls/Controls/Sprocket/SprocketControl.cs
/// <summary>
/// Calculate the Spoke Points and store them
/// </summary>
Calculate the Spoke Points and store them
Calculate the Spoke Points and store them
private void CalculateSpokesPoints()
    {
      spokes = new List<Spoke>();
      angleIncrement = (360 / (double)TickCount);
      alphaChange = (int)((255 - ALPHA_LOWER_LIMIT) / (double)TickCount);
      renderStartAngle = StartAngle;
      double width = (this.Width < this.Height) ? this.Width : this.Height;
      centerPoint = new Point(this.Width / 2, this.Height / 2);
      innerRadius = (int)(width * INNER_RADIUS_FACTOR);
      if (innerRadius < MINIMUM_INNER_RADIUS)
        innerRadius = MINIMUM_INNER_RADIUS;
      outerRadius = (int)(width * OUTER_RADIUS_FACTOR);
      if (outerRadius < MINIMUM_OUTER_RADIUS)
        outerRadius = MINIMUM_OUTER_RADIUS;
      double angle = 0;
      for (int i = 0; i < TickCount; i++)
      {
        Point pt1 = new Point(
            innerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)),
            innerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle)));
        Point pt2 = new Point(
            outerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)),
            outerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle)));
        Spoke spoke = new Spoke(pt1, pt2);
        spokes.Add(spoke);
        if (!IsIndeterminate)
        {
          angle += angleIncrement;
        }
        else
        {
          if (Rotation == Direction.CLOCKWISE)
          {
            angle -= angleIncrement;
          }
          else if (Rotation == Direction.ANTICLOCKWISE)
          {
            angle += angleIncrement;
          }
        }
      }
    }
private void CalculateSpokesPoints ( ) { spokes = new List < Spoke > ( ) ; angleIncrement = ( 360 / ( double ) TickCount ) ; alphaChange = ( int ) ( ( 255 - ALPHA_LOWER_LIMIT ) / ( double ) TickCount ) ; renderStartAngle = StartAngle ; double width = ( this . Width < this . Height ) ? this . Width : this . Height ; centerPoint = new Point ( this . Width / 2 , this . Height / 2 ) ; innerRadius = ( int ) ( width * INNER_RADIUS_FACTOR ) ; if ( innerRadius < MINIMUM_INNER_RADIUS ) innerRadius = MINIMUM_INNER_RADIUS ; outerRadius = ( int ) ( width * OUTER_RADIUS_FACTOR ) ; if ( outerRadius < MINIMUM_OUTER_RADIUS ) outerRadius = MINIMUM_OUTER_RADIUS ; double angle = 0 ; for ( int i = 0 ; i < TickCount ; i ++ ) { Point pt1 = new Point ( innerRadius * ( float ) Math . Cos ( ConvertDegreesToRadians ( angle ) ) , innerRadius * ( float ) Math . Sin ( ConvertDegreesToRadians ( angle ) ) ) ; Point pt2 = new Point ( outerRadius * ( float ) Math . Cos ( ConvertDegreesToRadians ( angle ) ) , outerRadius * ( float ) Math . Sin ( ConvertDegreesToRadians ( angle ) ) ) ; Spoke spoke = new Spoke ( pt1 , pt2 ) ; spokes . Add ( spoke ) ; if ( ! IsIndeterminate ) { angle += angleIncrement ; } else { if ( Rotation == Direction . CLOCKWISE ) { angle -= angleIncrement ; } else if ( Rotation == Direction . ANTICLOCKWISE ) { angle += angleIncrement ; } } } }
Calculate the Spoke Points and store them
Calculate the Spoke Points and store them
// Calculate the angle between adjacent spokes // Calculate the change in alpha between adjacent spokes // Set the startTime angle for rendering // Calculate the location around which the spokes will be drawn // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values // Create a spoke based on the points generated // Add the spoke to the List // If it is not it Indeterminate state,  // ensure that the spokes are drawn in clockwise manner