Пример #1
0
        //
        // Constructor - Internal prevents public creation
        // of instances. Returned by Telescope.AxisRates.
        //
        internal AxisRates(TelescopeAxes axis)
        {
            this.axis  = axis;
            this.rates = new List <Rate>();
            //
            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should
            // initialize the array for the rate for the selected axis.
            //
            switch (axis)
            {
            case TelescopeAxes.axisPrimary:
            case TelescopeAxes.axisSecondary:
            {
                HashSet <double> rates = new HashSet <double>();
                for (int index = 0; index <= 8; index++)
                {
                    double rate = Telescope.GuideRate(index);
                    if (!rates.Contains(rate))
                    {
                        rates.Add(rate);
                        this.rates.Add(new Rate(rate, rate));
                    }
                }
                break;
            }

            case TelescopeAxes.axisTertiary:
            {
                break;
            }
            }
        }