Пример #1
0
        private void refreshGraph()
        {
            if (!bInitialized)
            {
                return;
            }

            //-- Now Add the Points
            m_Line.XValues.Clear();
            m_Line.Values.Clear();

            for (int i = 0; i < data.Stages.Count; i++)
            {
                FloatProgressionStage stage = data.Stages[i];

                //- First add the start point at the current location
                m_Line.AddXY(stage.Value, stage.Alpha);
            }

            if (chartControl1.Enabled)
            {
                m_Line.AreaFillEffect.BeginColor = ChartStartColor;
                m_Line.AreaFillEffect.EndColor   = ChartEndColor;
            }
            else
            {
                m_Line.AreaFillEffect.BeginColor = Color.DarkGray;
                m_Line.AreaFillEffect.EndColor   = Color.DarkGray;
            }

            chartControl1.Refresh();
        }
Пример #2
0
        public FloatProgressionStage clone()
        {
            FloatProgressionStage clone = new FloatProgressionStage();

            clone.Value         = Value;
            clone.Alpha         = Alpha;
            clone.ValueVariance = ValueVariance;
            return(clone);
        }
Пример #3
0
        private void chartControl1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (!bInitialized)
            {
                return;
            }

            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            //-- unselect
            m_SelectedPoint = -1;

            double fX = 0.0f;
            double fY = 0.0f;

            convertMouseXYtoClientXY(e.X, e.Y, ref fX, ref fY);

            double translatedX = fX;
            double translatedY = fY;

            for (int i = 0; i < data.Stages.Count; i++)
            {
                FloatProgressionStage stage = data.Stages[i];
                if (translatedX < stage.Alpha)
                {
                    //-- now clamp the x according to their neighbors
                    int leftNeighborIndex = i - 1;
                    if (leftNeighborIndex >= 0 && leftNeighborIndex < data.Stages.Count)
                    {
                        double neighborAlpha = data.Stages[leftNeighborIndex].Alpha;
                        translatedX = System.Math.Max(neighborAlpha, translatedX);
                    }

                    int rightNeighborIndex = i;
                    if (rightNeighborIndex >= 0 && rightNeighborIndex < data.Stages.Count)
                    {
                        double neighborAlpha = data.Stages[rightNeighborIndex].Alpha;
                        translatedX = System.Math.Min(neighborAlpha, translatedX);
                    }
                    //-- clamp Y
                    translatedY = System.Math.Min(System.Math.Max(mMinY, translatedY), mMaxY);

                    translatedX = System.Math.Round(translatedX, 2);
                    translatedY = System.Math.Round(translatedY, 2);

                    data.insertStage(i, translatedY, 0, translatedX);

                    refreshGraph();

                    break;
                }
            }
        }
Пример #4
0
        public void insertStage(int atIndex, double value, double valueVariance, double alpha)
        {
            FloatProgressionStage newStage = new FloatProgressionStage();

            newStage.Value         = value;
            newStage.ValueVariance = valueVariance;
            newStage.Alpha         = alpha;

            Stages.Insert(atIndex, newStage);
        }
Пример #5
0
        //-- interface
        public void addStage(double value, double valueVariance, double alpha)
        {
            FloatProgressionStage newStage = new FloatProgressionStage();

            newStage.Value         = value;
            newStage.Alpha         = alpha;
            newStage.ValueVariance = valueVariance;

            mStages.Add(newStage);
        }
Пример #6
0
        private void chartControl1_MouseMove(object sender, MouseEventArgs e)
        {
            if (!bInitialized)
            {
                return;
            }

            if (m_SelectedPoint >= 0 && m_SelectedPoint < data.Stages.Count)
            {
                Rectangle             clientRect = chartControl1.ClientRectangle;
                FloatProgressionStage stage      = data.Stages[m_SelectedPoint];

                double fX = 0;
                double fY = 0;
                convertMouseXYtoClientXY(e.X, e.Y, ref fX, ref fY);

                double translatedX = fX;
                double translatedY = fY;

                //-- Clamp the values within the range
                stage.Alpha = System.Math.Min(System.Math.Max(mMinX, translatedX), mMaxX);
                stage.Value = System.Math.Min(System.Math.Max(mMinY, translatedY), mMaxY);

                //-- now clamp the x according to their neighbors
                int leftNeighborIndex = m_SelectedPoint - 1;
                if (leftNeighborIndex >= 0 && leftNeighborIndex < data.Stages.Count)
                {
                    double neighborAlpha = data.Stages[leftNeighborIndex].Alpha;
                    stage.Alpha = System.Math.Max(neighborAlpha, stage.Alpha);
                }

                int rightNeighborIndex = m_SelectedPoint + 1;
                if (rightNeighborIndex >= 0 && rightNeighborIndex < data.Stages.Count)
                {
                    double neighborAlpha = data.Stages[rightNeighborIndex].Alpha;
                    stage.Alpha = System.Math.Min(neighborAlpha, stage.Alpha);
                }

                //-- clamp the end points -- they can only affect their Value but not their alpha
                if (m_SelectedPoint == 0)
                {
                    stage.Alpha = mMinX;
                }
                else if (m_SelectedPoint == data.Stages.Count - 1)
                {
                    stage.Alpha = mMaxX;
                }

                stage.Alpha = System.Math.Round(stage.Alpha, 2);
                stage.Value = System.Math.Round(stage.Value, 2);

                refreshGraph();
                refreshTextBoxes();
            }
        }
Пример #7
0
        private void refreshTextBoxes()
        {
            numericUpDown3.Value = (decimal)Math.Round((decimal)data.Cycles, 2, MidpointRounding.ToEven);

            int index = listBox1.SelectedIndex;

            if (index < 0 || index >= data.Stages.Count)
            {
                numericUpDown1.Value = 0;
                numericUpDown2.Value = 0;
                numericUpDown5.Value = 0;
                return;
            }

            FloatProgressionStage stage = data.Stages[index];

            numericUpDown1.Value = (decimal)Math.Round((decimal)stage.Value, 2, MidpointRounding.ToEven);
            numericUpDown2.Value = (decimal)Math.Round((decimal)stage.Alpha, 2, MidpointRounding.ToEven);
            numericUpDown5.Value = (decimal)Math.Round((decimal)stage.ValueVariance, 2, MidpointRounding.ToEven);
        }
Пример #8
0
        public void moveStageDown(int index)
        {
            //-- cannot move the endpoints
            if (index < 0 || index >= mStages.Count)
            {
                return;
            }

            int newIndex = index + 1;

            if (newIndex >= mStages.Count)
            {
                newIndex = mStages.Count - 1;
            }

            //swap members
            FloatProgressionStage tempStage = mStages[newIndex];

            mStages[newIndex] = mStages[index];
            mStages[index]    = tempStage;
        }