Esempio n. 1
0
        protected void MovePointerNextDataPoint(int Offset)
        {
            PlotChannelConsecutive plotChannelConsecutive = base.Channel as PlotChannelConsecutive;

            if (plotChannelConsecutive != null && plotChannelConsecutive.Count != 0 && base.XAxis != null && base.YAxis != null && (base.Style != PlotDataCursorMultipleStyle.ValueY || base.YIsInterpolated) && base.Style != PlotDataCursorMultipleStyle.DeltaY && base.Style != PlotDataCursorMultipleStyle.InverseDeltaY)
            {
                bool flag  = false;
                bool flag2 = false;
                bool flag3 = (Control.ModifierKeys & Keys.Control) == Keys.Control;
                if (base.Style == PlotDataCursorMultipleStyle.ValueXY)
                {
                    flag  = true;
                    flag2 = false;
                }
                if (base.Style == PlotDataCursorMultipleStyle.ValueX)
                {
                    flag  = true;
                    flag2 = false;
                }
                if (base.Style == PlotDataCursorMultipleStyle.ValueY)
                {
                    flag  = true;
                    flag2 = false;
                }
                if (base.Style == PlotDataCursorMultipleStyle.DeltaX)
                {
                    if (flag3)
                    {
                        flag  = false;
                        flag2 = true;
                    }
                    else
                    {
                        flag  = true;
                        flag2 = false;
                    }
                }
                if (base.Style == PlotDataCursorMultipleStyle.InverseDeltaX)
                {
                    if (flag3)
                    {
                        flag  = false;
                        flag2 = true;
                    }
                    else
                    {
                        flag  = true;
                        flag2 = false;
                    }
                }
                if (plotChannelConsecutive != null)
                {
                    if (flag)
                    {
                        double num = base.XAxis.PercentToValue(base.Pointer1.Position);
                        if (num > plotChannelConsecutive.XLast)
                        {
                            base.SnapPointer1To(plotChannelConsecutive.XLast);
                            return;
                        }
                        if (num < plotChannelConsecutive.XFirst)
                        {
                            base.SnapPointer1To(plotChannelConsecutive.XMin);
                            return;
                        }
                        int num2 = plotChannelConsecutive.CalculateXValueNearestIndex(num) + Offset;
                        if (num2 != -1)
                        {
                            base.SnapPointer1To(plotChannelConsecutive.GetX(num2));
                        }
                    }
                    if (flag2)
                    {
                        double num = base.XAxis.PercentToValue(base.Pointer2.Position);
                        if (num > plotChannelConsecutive.XLast)
                        {
                            base.SnapPointer2To(plotChannelConsecutive.XLast);
                        }
                        else if (num < plotChannelConsecutive.XFirst)
                        {
                            base.SnapPointer2To(plotChannelConsecutive.XMin);
                        }
                        else
                        {
                            int num2 = plotChannelConsecutive.CalculateXValueNearestIndex(num) + Offset;
                            if (num2 != -1)
                            {
                                base.SnapPointer2To(plotChannelConsecutive.GetX(num2));
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public override void DoSnapToPoint()
        {
            PlotChannelConsecutive plotChannelConsecutive = base.Channel as PlotChannelConsecutive;

            if (plotChannelConsecutive != null && base.XAxis != null && base.YAxis != null && (base.Style != PlotDataCursorMultipleStyle.ValueY || base.YIsInterpolated) && base.Style != PlotDataCursorMultipleStyle.DeltaY && base.Style != PlotDataCursorMultipleStyle.InverseDeltaY && plotChannelConsecutive.Count != 0)
            {
                bool flag  = false;
                bool flag2 = false;
                if (base.Style == PlotDataCursorMultipleStyle.ValueXY)
                {
                    flag  = true;
                    flag2 = false;
                }
                if (base.Style == PlotDataCursorMultipleStyle.ValueX)
                {
                    flag  = true;
                    flag2 = false;
                }
                if (base.Style == PlotDataCursorMultipleStyle.ValueY)
                {
                    flag  = true;
                    flag2 = false;
                }
                if (base.Style == PlotDataCursorMultipleStyle.DeltaX)
                {
                    flag  = true;
                    flag2 = true;
                }
                if (base.Style == PlotDataCursorMultipleStyle.InverseDeltaX)
                {
                    flag  = true;
                    flag2 = true;
                }
                if (plotChannelConsecutive != null)
                {
                    if (flag)
                    {
                        double num = base.XAxis.PercentToValue(base.Pointer1.Position);
                        if (num > plotChannelConsecutive.XLast)
                        {
                            base.SnapPointer1To(plotChannelConsecutive.XLast);
                            return;
                        }
                        if (num < plotChannelConsecutive.XFirst)
                        {
                            base.SnapPointer1To(plotChannelConsecutive.XMin);
                            return;
                        }
                        int num2 = plotChannelConsecutive.CalculateXValueNearestIndex(num);
                        if (num2 != -1)
                        {
                            base.SnapPointer1To(plotChannelConsecutive.GetX(num2));
                        }
                    }
                    if (flag2)
                    {
                        double num = base.XAxis.PercentToValue(base.Pointer2.Position);
                        if (num > plotChannelConsecutive.XLast)
                        {
                            base.SnapPointer2To(plotChannelConsecutive.XLast);
                        }
                        else if (num < plotChannelConsecutive.XFirst)
                        {
                            base.SnapPointer2To(plotChannelConsecutive.XMin);
                        }
                        else
                        {
                            int num2 = plotChannelConsecutive.CalculateXValueNearestIndex(num);
                            if (num2 != -1)
                            {
                                base.SnapPointer2To(plotChannelConsecutive.GetX(num2));
                            }
                        }
                    }
                }
            }
        }