NPlot.LabelAxis.DrawTicks C# (CSharp) Method

DrawTicks() protected method

Given Graphics surface, and physical extents of axis, draw ticks and associated labels.
protected DrawTicks ( Graphics g, Point physicalMin, Point physicalMax, object &labelOffset, object &boundingBox ) : void
g System.Drawing.Graphics The GDI+ Graphics surface on which to draw.
physicalMin Point The physical location of the world min point
physicalMax Point The physical location of the world max point
labelOffset object out: a suitable offset from the axis to draw the axis label.
boundingBox object out: smallest box that completely encompasses all of the ticks and tick labels.
return void
        protected override void DrawTicks( 
            Graphics g,
            Point physicalMin,
            Point physicalMax,
            out object labelOffset,
            out object boundingBox)
        {
            Point tLabelOffset;
            Rectangle tBoundingBox;

            labelOffset = this.getDefaultLabelOffset( physicalMin, physicalMax );
            boundingBox = null;

            // draw the tick labels (but not the ticks).
            PointF lastPos = WorldToPhysical( (double)numbers_[0], physicalMin, physicalMax, true );
            for (int i=0; i<labels_.Count; ++i)
            {

                if ((double)numbers_[i] > WorldMin && (double)numbers_[i] < WorldMax)
                {

                    // check to make sure labels are far enough appart.
                    PointF thisPos = WorldToPhysical( (double)numbers_[i], physicalMin, physicalMax, true );
                    float dist = Utils.Distance( thisPos, lastPos );

                    if ( i==0 || (dist > this.PhysicalSpacingMin) )
                    {
                        lastPos = thisPos;

                        this.DrawTick( g, (double)numbers_[i], 0,
                            (string)labels_[i],
                            new Point(0,0),
                            physicalMin, physicalMax,
                            out tLabelOffset, out tBoundingBox );

                        Axis.UpdateOffsetAndBounds(
                            ref labelOffset, ref boundingBox,
                            tLabelOffset, tBoundingBox );
                    }
                }
            }

            // now draw the ticks (which might not be aligned with the tick text).
            ArrayList largeTickPositions;
            ArrayList smallTickPositions;
            WorldTickPositions_FirstPass( physicalMin, physicalMax, out largeTickPositions, out smallTickPositions );
            lastPos = WorldToPhysical( (double)largeTickPositions[0], physicalMin, physicalMax, true );
            for (int i=0; i<largeTickPositions.Count; ++i)
            {
                double tickPos = (double)largeTickPositions[i];

                // check to see that labels are far enough appart.
                PointF thisPos = WorldToPhysical( tickPos, physicalMin, physicalMax, true );
                float dist = Utils.Distance( thisPos, lastPos );
                if ( (i==0) || (dist> this.PhysicalSpacingMin) )
                {
                    lastPos = thisPos;

                    this.DrawTick( g, tickPos, LargeTickSize,
                        "",
                        new Point(0,0),
                        physicalMin, physicalMax,
                        out tLabelOffset, out tBoundingBox );

                    Axis.UpdateOffsetAndBounds(
                        ref labelOffset, ref boundingBox,
                        tLabelOffset, tBoundingBox );
                }
            }
        }