NPlot.LogAxis.WorldTickPositions_SecondPass C# (CSharp) Method

WorldTickPositions_SecondPass() private method

Determines the positions, in world coordinates, of the small ticks if they have not already been generated.
private WorldTickPositions_SecondPass ( Point physicalMin, Point physicalMax, ArrayList largeTickPositions, ArrayList &smallTickPositions ) : void
physicalMin Point The physical position corresponding to the world minimum of the axis.
physicalMax Point The physical position corresponding to the world maximum of the axis.
largeTickPositions System.Collections.ArrayList The positions of the large ticks, unchanged
smallTickPositions System.Collections.ArrayList If null, small tick positions are returned via this parameter. Otherwise this function does nothing.
return void
        internal override void WorldTickPositions_SecondPass( 
            Point physicalMin,
            Point physicalMax,
            ArrayList largeTickPositions,
            ref ArrayList smallTickPositions)
        {
            if (smallTickPositions != null)
            {
                throw new NPlotException( "not expecting smallTickPositions to be set already." );
            }

            smallTickPositions = new ArrayList();

            // retrieve the spacing of the big ticks. Remember this is decades!
            double bigTickSpacing = this.DetermineTickSpacing();
            int nSmall = this.DetermineNumberSmallTicks( bigTickSpacing );

            // now we have to set the ticks
            // let us start with the easy case where the major tick distance
            // is larger than a decade
            if ( bigTickSpacing > 1.0f )
            {
                if (largeTickPositions.Count > 0)
                {
                    // deal with the smallticks preceding the
                    // first big tick
                    double pos1 = (double)largeTickPositions[0];
                    while (pos1 > this.WorldMin)
                    {
                        pos1 = pos1 / 10.0f;
                        smallTickPositions.Add( pos1 );
                    }
                    // now go on for all other Major ticks
                    for (int i=0; i<largeTickPositions.Count; ++i )
                    {
                        double pos = (double)largeTickPositions[i];
                        for (int j=1; j<=nSmall; ++j )
                        {
                            pos=pos*10.0F;
                            // check to see if we are still in the range
                            if (pos < WorldMax)
                            {
                                smallTickPositions.Add( pos );
                            }
                        }
                    }
                }
            }
            else
            {
                // guess what...
                double [] m = { 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f };
                // Then we deal with the other ticks
                if (largeTickPositions.Count > 0)
                {
                    // first deal with the smallticks preceding the first big tick
                    // positioning before the first tick
                    double pos1=(double)largeTickPositions[0]/10.0f;
                    for (int i=0; i<m.Length; i++)
                    {
                        double pos=pos1*m[i];
                        if (pos>this.WorldMin)
                        {
                            smallTickPositions.Add(pos);
                        }
                    }
                    // now go on for all other Major ticks
                    for (int i=0; i<largeTickPositions.Count; ++i )
                    {
                        pos1=(double)largeTickPositions[i];
                        for (int j=0; j<m.Length; ++j )
                        {
                            double pos=pos1*m[j];
                            // check to see if we are still in the range
                            if (pos < WorldMax)
                            {
                                smallTickPositions.Add( pos );
                            }
                        }
                    }
                }
                else
                {
                    // probably a minor tick would anyway fall in the range
                    // find the decade preceding the minimum
                    double dec=Math.Floor(Math.Log10(WorldMin));
                    double pos1=Math.Pow(10.0,dec);
                    for (int i=0; i<m.Length; i++)
                    {
                        double pos=pos1*m[i];
                        if (pos>this.WorldMin && pos< this.WorldMax )
                        {
                            smallTickPositions.Add(pos);
                        }
                    }
                }
            }
        }