protected virtual void UpdateOverride(bool updateData)
        {
            // Update data of the curve
            if (updateData)
            {
                SelectedCurve?.UpdateData();
            }

            // Update the max and min of the axes
            UpdateMaxMin(updateData);
        }
Ejemplo n.º 2
0
        public void DeleteSelectedKey()
        {
            LinkedListNode <CurvePoint> point = SelectedCurve.CurvePoints.Find(SelectedPoint);

            if (point != null)
            {
                if (point.Previous != null)
                {
                    SelectedPoint = point.Previous.Value;
                }
                else if (point.Next != null)
                {
                    SelectedPoint = point.Next.Value;
                }
                SelectedCurve.RemovePoint(point);
                Paint();
            }
        }
Ejemplo n.º 3
0
        private void AddKey_Click(object sender, RoutedEventArgs e)
        {
            Point  pos   = (Point)(sender as MenuItem).Tag;
            double inVal = unrealX(pos.X);
            LinkedListNode <CurvePoint> node;

            try
            {
                node = SelectedCurve.CurvePoints.Find(SelectedCurve.CurvePoints.First(x => x.InVal > inVal));
                SelectedCurve.AddPoint(new CurvePoint((float)inVal, (float)unrealY(ActualHeight - pos.Y), 0, 0, node.Value.InterpMode), node);
            }
            catch (Exception)
            {
                node = SelectedCurve.CurvePoints.Last;
                SelectedCurve.AddPoint(new CurvePoint((float)inVal, (float)unrealY(ActualHeight - pos.Y), 0, 0, node?.Value.InterpMode ?? CurveMode.CIM_CurveUser), node, false);
            }
            Paint(true);
        }
        /// <summary>
        /// Updates maximum and minimum values of the axes from values of all data series.
        /// </summary>
        /// <param name="isDataUpdated">if set to <c>true</c>, the data has been updated.</param>
        private void UpdateMaxMin(bool isDataUpdated)
        {
            if (isDataUpdated)
            {
                foreach (var axis in Axes)
                {
                    axis.ResetDataMaxMin();
                }

                // data has been updated, so we need to calculate the max/min of the curves again
                SelectedCurve?.UpdateMaxMin();
            }

            SelectedCurve?.UpdateAxisMaxMin();

            foreach (var axis in Axes)
            {
                axis.UpdateActualMaxMin();
            }
        }
 /// <summary>
 /// Render the curves.
 /// </summary>
 /// <param name="drawingContext"></param>
 private void RenderCurves(IDrawingContext drawingContext)
 {
     // Only renders the selected curve
     SelectedCurve?.Render(drawingContext, true);
 }