Beispiel #1
0
        /// <summary>
        /// Returns the standard array grapher scaled by points array indices.
        /// </summary>
        /// <param name="minInd">The lower index of points array to copy to the new grapher.</param>
        /// <param name="maxInd">The upper index of points array to copy to the new grapher.</param>
        /// <returns></returns>
        public StandardGrapher newGrapherByIndexBounds(int minInd, int maxInd)
        {
            // проверяем корректность границ заданных индексов

            if (minInd >= maxInd)
            {
                throw new GrapherActionImpossibleException(String.Format("Неверно заданы границы отрезка масштабирования: индексы начала ({0}) больше или совпадает с индексом конца ({1}).", minInd, maxInd));
            }
            if (minInd < 0 || maxInd >= PointsArray.Count)
            {
                throw new GrapherActionImpossibleException("Неверно заданы границы отрезка масштабирования: индексы выходят за границы массива.");
            }

            // создаем копию объекта

            StandardGrapher temp = (StandardGrapher)this.MemberwiseClone();

            // temp.PointsArray = new Point<double>[maxInd - minInd + 1 + (minInd == 0 ? 0 : 1) + (maxInd == PointsArray.Count - 1 ? 0 : 1)];
            // ServiceMethods.Copy(this.PointsArray, minInd - (minInd == 0 ? 0 : 1), temp.PointsArray, 0, (maxInd == (PointsArray.Count - 1) ? maxInd : maxInd + 1) - (minInd == 0 ? minInd : (minInd - 1)) + 1);

            temp.PointsArray = new Point <double> [maxInd - minInd + 1];
            ServiceMethods.Copy(this.PointsArray, minInd, temp.PointsArray, 0, maxInd - minInd + 1);

            // находим новые минимальные и максимальные значения

            temp.FindMaximumsAndMinimums();

            if (Step1 != 0 && Step2 != 0)
            {
                temp.Step1 = this.Step1 * (temp.xMax - temp.xMin) / (this.xMax - this.xMin);
                temp.Step2 = this.Step2 * (temp.yMax - temp.yMin) / (this.yMax - this.yMin);
                if (this.yMax == this.yMin)
                {
                    temp.Step2 = this.Step2;
                }
            }

            return(temp);
        } // масштабированный по номеру измерения аргумента графер
Beispiel #2
0
        //  ------------- КОНСТРУКТОРЫ

        public GraphicDrawer(StandardGrapher obj):
            this(obj, obj.MinAxis1, obj.MaxAxis1, obj.MinAxis2, obj.MaxAxis2) {}
Beispiel #3
0
        //  ------------- КОНСТРУКТОРЫ

        public GraphicDrawer(StandardGrapher obj) :
            this(obj, obj.MinAxis1, obj.MaxAxis1, obj.MinAxis2, obj.MaxAxis2)
        {
        }