NPlot.PhysicalAxis.SetWorldLimitsFromPhysical C# (CSharp) Метод

SetWorldLimitsFromPhysical() публичный Метод

This sets new world limits for the axis from two physical points selected within the plot area.
public SetWorldLimitsFromPhysical ( Point min, Point max ) : void
min Point The upper left point of the selection.
max Point The lower right point of the selection.
Результат void
        public void SetWorldLimitsFromPhysical(Point min, Point max)
        {
            double minc;
            double maxc;
            if (Axis != null)
            {
                minc = Axis.WorldMin;
                maxc = Axis.WorldMax;
                double tmp = PhysicalToWorld(min, true);
                Axis.WorldMax = PhysicalToWorld(max, true);
                Axis.WorldMin = tmp;
                // need to trap somehow if the user selects an 
                // arbitrarily small range. Otherwise the GDI+ 
                // drawing routines lead to an overflow in painting 
                // the picture. This may be not the optimal solution,
                // but if the GDI+ draw leads to an overflow the
                // graphic surface becomes unusable anymore and I
                // had difficulty to trap the error.
                double half = (Axis.WorldMin + Axis.WorldMax) / 2;
                double width = Axis.WorldMax - Axis.WorldMin;
                if (Math.Abs(half / width) > 1.0e12)
                {
                    Axis.WorldMin = minc;
                    Axis.WorldMax = maxc;
                }
            }
        }