예제 #1
0
파일: Cursor.cs 프로젝트: rbua/JILK
 public void ForcedMoveDown(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X,
         CursorPosition.Y + 9,
         0);
 }
예제 #2
0
        public override void OnCursorClick(object sender, CursorEventArgs eventArgs)
        {
            var relativePosition = new Point(
                eventArgs.CursorOnScreenPosition.X - RelatedWindow.Position.X,
                eventArgs.CursorOnScreenPosition.Y - RelatedWindow.Position.Y,
                0);

            if (relativePosition.Y == 1)
            {
                if (relativePosition.X == 2)
                {
                    RelatedWindow.OnClose();
                    // After OnClose invocation related window shall be closed, so user will see the following text
                    // only in case when window is not closed
                    RelatedWindow.Title += " At least one window should be on the surface";
                }
                if (relativePosition.X == 5)
                {
                    // TODO: Minimizing
                    RelatedWindow.Title += " Maximizing is unavailable at this moment.";
                }
                if (relativePosition.X == 8)
                {
                    // TODO: Maximizing
                    RelatedWindow.Title += " Minimizing is unavailable at this moment.";
                }
            }
        }
예제 #3
0
        private void chartZ_SelectionRangeChanged(object sender, CursorEventArgs e)
        {
            var xRangeStart = e.Axis.ScaleView.ViewMinimum;
            var xRangeEnd   = e.Axis.ScaleView.ViewMaximum;

            AutoScaleYAxisWhenXAxisZoomed(chartZ, xRangeStart, xRangeEnd);
        }
예제 #4
0
        private void SelectionChange(object sender, CursorEventArgs e)
        {
            SelectionStart = e.NewSelectionStart;
            SelectionEnd   = e.NewSelectionEnd;

            lblSelection.Text = $"Selection: {SelectionStart} - {SelectionEnd} ({FormatTime(SelectionStart, SelectionEnd)})";
        }
예제 #5
0
 private void Cursor_CursorDeactivated(object sender, CursorEventArgs e)
 {
     cursor.CursorDeactivated -= Cursor_CursorDeactivated;
     isGrabbing = false;
     transform.SetParent(originalParent);
     originalParent = null;
 }
예제 #6
0
        private void chart1_CursorPositionChanging(object sender, CursorEventArgs e)
        {
            int N = chart1.Series[0].Points.Count;

            if (N == 0)
            {
                return;
            }
            if (e.Axis.AxisName == AxisName.X)
            {
                int xindex = GetPointIndex(e.NewPosition);
                e.NewPosition = chart1.Series[0].Points[xindex].XValue;
                lX.Text       = e.NewPosition.ToString("f01");
            }
            if (e.Axis.AxisName == AxisName.Y)
            {
                double x = e.ChartArea.CursorX.Position;
                for (int i = 0; i < N; i++)
                {
                    if (x == chart1.Series[0].Points[i].XValue)
                    {
                        e.NewPosition = chart1.Series[0].Points[i].YValues[0];
                        lY.Text       = e.NewPosition.ToString();
                        return;
                    }
                }
            }
        }
예제 #7
0
        /// <summary>
        /// keeps track of the latest frequency bins that
        /// have been selected. flips the selection to the
        /// corresponding bin if they select past the
        /// nyquist limit (midway point of the bar chart).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilterSelected(object sender, CursorEventArgs e)
        {
            if (frequencies == null)
            {
                return;
            }
            filterStart = (int)e.NewSelectionStart;
            filterEnd   = (int)e.NewSelectionEnd;

            if (filterEnd > frequencies.Length / 2)
            {
                filterEnd = frequencies.Length / 2;
            }
            if (filterStart > frequencies.Length / 2)
            {
                filterStart = filterStart - frequencies.Length / 2;
            }

            if (filterDiff < 0)
            {
                int temp = filterEnd;
                filterEnd   = filterStart;
                filterStart = temp;
            }
            filterDiff = filterEnd - filterStart;

            if (filterStart == 0)
            {
                filterStart++;
            }
            if (filterEnd < filterStart)
            {
                filterEnd = filterStart;
            }
        }
예제 #8
0
파일: Cursor.cs 프로젝트: rbua/JILK
 public void MoveLeft(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X - 1,
         CursorPosition.Y,
         CursorPosition.Z);
 }
예제 #9
0
파일: Cursor.cs 프로젝트: rbua/JILK
 public void MoveUp(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X,
         CursorPosition.Y - 1,
         0);
 }
예제 #10
0
        /**
         * Selection dragging on the X axis will update the summary to be current selection.
         */
        private void NetworkChart_SelectionRangeChanged(object sender, CursorEventArgs e)
        {
            if ((CurrentNetworkStream == null) || (CurrentNetworkStream.Frames.Count == 0))
            {
                return;
            }

            if (e.NewSelectionEnd - e.NewSelectionStart < 1)
            {
                return;                 // Single click, ignore, handled above
            }

            if (e.Axis.AxisName == AxisName.X)
            {
                ActorPerfPropsDetailsListView.Items.Clear();

                RangeSelectStart = Math.Max(0, ( int )NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMinimum);
                RangeSelectEnd   = Math.Min(CurrentNetworkStream.Frames.Count, ( int )NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMaximum);

                CancelSelectRangeThread();

                SelectRangeThread = new Thread(() => SelectRangeWorker(RangeSelectStart, RangeSelectEnd));
                SelectRangeThread.Start();
            }
        }
예제 #11
0
파일: Cursor.cs 프로젝트: rbua/JILK
 public void ForcedMoveRight(object sender, CursorEventArgs e)
 {
     CursorPosition = new Point(
         CursorPosition.X + 18,
         CursorPosition.Y,
         0);
 }
예제 #12
0
        private void chart1_SelectionRangeChanging(object sender, CursorEventArgs e)
        {
            double SelectionSize_new = e.NewSelectionEnd - e.NewSelectionStart;

            if (SelectionSize_new != 0 || SelectionSize != 0 && SelectionSize_new == 0)
            {
                mouse_click_block = true;
            }
            SelectionSize = SelectionSize_new;
            pr("SelectionRangeChanging: " + SelectionSize.ToString());
            if (SelectionSize == 0)
            {
                prs("");
            }
            else
            {
                string msg = string.Format("Смещение: {0}", ((int)SelectionSize).ToString());
                int    pos = (int)e.NewSelectionEnd;
                if (pos >= 0 && pos < miu.Length)
                {
                    msg += string.Format(" I={0} {1}={2}",
                                         miu[pos].I.ToString(),
                                         DescValIU,
                                         miu[pos].Val(ValIU).ToString()
                                         );
                }
                prs(msg);
            }
        }
예제 #13
0
 private void Cursor_CursorActivated(object sender, CursorEventArgs e)
 {
     cursor.CursorDeactivated += Cursor_CursorDeactivated;
     isGrabbing     = true;
     originalParent = transform.parent;
     transform.SetParent(cursor.transform);
 }
예제 #14
0
 private void chartMain_SelectionRangeChanged(object sender, CursorEventArgs e)
 {
     if ((e.NewSelectionStart > 0 && Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) > MinimumZoom) ||
         (e.NewSelectionStart == 0 && e.NewSelectionEnd == 0))
     {
         ShowDataRange((int)e.NewSelectionStart, (int)e.NewSelectionEnd);
     }
 }
예제 #15
0
 private void Cursor_CursorDeactivated(object sender, CursorEventArgs e)
 {
     if (spawnedItem != null)
     {
         Destroy(spawnedItem.GetComponent <OnePointMove>());
     }
     cursor = null;
 }
예제 #16
0
 public override void OnPressedCursorMoveUp(object sender, CursorEventArgs eventArgs)
 {
     RelatedWindow.Position = new Point(
         RelatedWindow.Position.X,
         RelatedWindow.Position.Y - 1,
         RelatedWindow.Position.Z);
     base.OnPressedCursorMoveUp(sender, eventArgs);
 }
예제 #17
0
 private void nodesChart_SelectionRangeChanged(object sender, CursorEventArgs e)
 {
     this.viewModel.NodeReportPane.Selection = new DateSelection()
     {
         StartDate = DateTime.FromOADate(Math.Min(e.NewSelectionStart, e.NewSelectionEnd)),
         EndDate   = DateTime.FromOADate(Math.Max(e.NewSelectionStart, e.NewSelectionEnd))
     };
 }
예제 #18
0
        //用来设置切换视图时的视角

        private void chart_SelectionRangeChanged(object sender, CursorEventArgs e)

        {
            //无数据时返回

            if (chart.Series[0].Points.Count == 0)
            {
                return;
            }

            double start_position = 0.0;

            double end_position = 0.0;

            double myInterval = 0.0;

            start_position = e.NewSelectionStart;

            end_position = e.NewSelectionEnd;

            myInterval = Math.Abs(start_position - end_position);

            if (myInterval == 0.0)
            {
                return;
            }

            //X轴视图起点

            chart.ChartAreas[0].AxisX.ScaleView.Position = Math.Min(start_position, end_position);

            //X轴视图长度

            chart.ChartAreas[0].AxisX.ScaleView.Size = myInterval;

            //X轴间隔

            if (myInterval < 11.0)

            {
                chart.ChartAreas[0].AxisX.Interval = 1;
            }
            else

            {
                chart.ChartAreas[0].AxisX.Interval = Math.Floor(myInterval / 10);
            }

            flag = true;

            if (!comboBox1.Items.Contains("Zoom"))

            {
                comboBox1.Items.Add("Zoom");

                comboBox1.SelectedItem = "Zoom";
            }
        }
        //private void comboBox1_CursorChanged(object sender, EventArgs e)
        //{


        //}

        private void Chart1OnCursorPositionChanged(object sender, CursorEventArgs cursorEventArgs)
        {
            if (double.IsNaN(cursorEventArgs.NewPosition))
            {
                Debug.WriteLine("nan");
                return;
            }

            Debug.WriteLine(DateTime.FromOADate(cursorEventArgs.NewPosition));
        }
예제 #20
0
 private void Chart_CursorPositionChanged(object sender, CursorEventArgs e)
 {
     if (LoadingLog || PlottingLog)
     {
         return;
     }
     if (LogEntries != null && e.Axis == this.chart.ChartAreas[0].AxisX)
     {
         SetCursorPosition(e.NewPosition);
     }
 }
예제 #21
0
        private void diagChart_CursorPositionChanging(object sender, CursorEventArgs e)
        {
            if (double.IsNaN(e.NewPosition))
            {
                return;
            }

            var index = (int)e.NewPosition;

            UpdateCursorValue(index - 1);
        }
예제 #22
0
 private void onCursorEvent(CursorCommandCodes CursorCommand, int Row, int Col)
 {
     if (CursorEvent != null)
     {
         CursorEventArgs e = new CursorEventArgs();
         e.CursorCommand = CursorCommand;
         e.Row           = Row;
         e.Col           = Col;
         CursorEvent(this, e);
     }
 }
예제 #23
0
        void chart1_SelectionRangeChanged(object sender, CursorEventArgs e)
        {
            var axisY = this.chart1.ChartAreas["ChartArea1"].AxisY;

            var xRangeStart = e.Axis.ScaleView.ViewMinimum;
            var xRangeEnd   = e.Axis.ScaleView.ViewMaximum;

            // compute the Y values for the points crossing the range edges
            double?yRangeStart           = null;
            var    pointBeforeRangeStart = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue <= xRangeStart);
            var    pointAfterRangeStart  = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue > xRangeStart);

            if (pointBeforeRangeStart != null && pointAfterRangeStart != null)
            {
                yRangeStart = Interpolate2Points(pointBeforeRangeStart, pointAfterRangeStart, xRangeStart);
            }

            double?yRangeEnd           = null;
            var    pointBeforeRangeEnd = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue <= xRangeEnd);
            var    pointAfterRangeEnd  = this.chart1.Series[0].Points.FirstOrDefault(x => x.XValue > xRangeEnd);

            if (pointBeforeRangeEnd != null && pointAfterRangeEnd != null)
            {
                yRangeEnd = Interpolate2Points(pointBeforeRangeEnd, pointAfterRangeEnd, xRangeEnd);
            }

            var edgeValues = new[] { yRangeStart, yRangeEnd }.Where(x => x.HasValue).Select(x => x.Value);

            // find the points inside the range
            var valuesInRange = this.chart1.Series["Series1"].Points
                                .Where(p => p.XValue >= xRangeStart && p.XValue <= xRangeEnd)
                                .Select(x => x.YValues[0]);

            // find the minimum and maximum Y values
            var    values = valuesInRange.Concat(edgeValues);
            double yMin;
            double yMax;

            if (values.Any())
            {
                yMin = values.Min();
                yMax = values.Max();
            }
            else
            {
                yMin = this.chart1.Series["Series1"].Points.Min(x => x.YValues[0]);
                yMax = this.chart1.Series["Series1"].Points.Max(x => x.YValues[0]);
            }

            // zoom Y-axis to [yMin - yMax]
            axisY.ScaleView.Zoom(yMin, yMax);
        }
예제 #24
0
 private void OnPerformanceCursorPositionChanged(object sender, CursorEventArgs e)
 {
     if (chPerformance.Series.Count > 0 && _currentRecords.Count > 0)
     {
         var index = _currentRecords.FindIndex(p => p.Value16.ToOADate() >= e.NewPosition);
         if (_lastPointIndex != index && index >= 0)
         {
             _lastPointIndex = index;
             SetPerformanceInfo();
         }
         Debug.WriteLine(e.NewPosition);
     }
 }
예제 #25
0
    private void Cursor_CursorDeactivated(object sender, CursorEventArgs e)
    {
        var cursor = sender as HandCursor;

        cursor.CursorDeactivated -= Cursor_CursorDeactivated;

        ActiveCursors.Remove(cursor);

        SendMessage("CursorDeactivate", new CursorEventArgs()
        {
            Sender = this, Cursor = cursor
        }, SendMessageOptions.DontRequireReceiver);
    }
예제 #26
0
 private void Chart1SelectionRangeChanging(object sender, CursorEventArgs e)
 {
     if (e.Axis.AxisName == AxisName.X)
     {
         if (Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) < .03 * (e.ChartArea.AxisX.ScaleView.ViewMaximum -
                                                                        e.ChartArea.AxisX.ScaleView.ViewMinimum)
             //||(Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) < ScaleXMin)
             )
         {
             e.NewSelectionEnd = e.NewSelectionStart;
         }
     }
 }
예제 #27
0
    void CursorDeactivate(CursorEventArgs e)
    {
        switch (e.Sender.ActiveCursors.Count)
        {
        case 1:
            DestroyImmediate(twoPointComp);
            addOnePoint(e.Sender.ActiveCursors[0].transform);
            break;

        case 0:
            DestroyImmediate(onePointComp);
            break;
        }
    }
예제 #28
0
        private void Chart1_CursorPositionChanged(object sender, CursorEventArgs e)
        {
            chart2.ChartAreas[0].AxisX.ScaleView          = chart1.ChartAreas[0].AxisX.ScaleView;
            chart2.ChartAreas[0].AxisX.Interval           = chart1.ChartAreas[0].AxisX.Interval;
            chart2.ChartAreas[0].IsSameFontSizeForAllAxes = chart1.ChartAreas[0].IsSameFontSizeForAllAxes;
            chart2.ChartAreas[0].CursorX = chart1.ChartAreas[0].CursorX;

            chart3.ChartAreas[0].AxisX.ScaleView          = chart1.ChartAreas[0].AxisX.ScaleView;
            chart3.ChartAreas[0].AxisX.Interval           = chart1.ChartAreas[0].AxisX.Interval;
            chart3.ChartAreas[0].IsSameFontSizeForAllAxes = chart1.ChartAreas[0].IsSameFontSizeForAllAxes;
            chart3.ChartAreas[0].CursorX = chart1.ChartAreas[0].CursorX;
            SetChart1();
            SetChart2();
            SetChart3();
        }
예제 #29
0
 /// <summary>
 /// Moves the selection on the opposite time domain to the same position as the active one.
 /// </summary>
 /// <param name="sender">The time domain channel that is calling the event handler (Left or Right channel).</param>
 /// <param name="e">Unused.</param>
 private void MoveSelection(object sender, CursorEventArgs e)
 {
     if (sender == this.LTimeChannel.Chart)
     {
         this.RTimeChannel.ChartArea.CursorX.SelectionStart = this.LTimeChannel.ChartArea.CursorX.SelectionStart;
         this.RTimeChannel.ChartArea.CursorX.SelectionEnd   = this.LTimeChannel.ChartArea.CursorX.SelectionEnd;
         this.RTimeChannel.ChartArea.CursorX.Position       = this.LTimeChannel.ChartArea.CursorX.Position;
     }
     else
     {
         this.LTimeChannel.ChartArea.CursorX.SelectionStart = this.RTimeChannel.ChartArea.CursorX.SelectionStart;
         this.LTimeChannel.ChartArea.CursorX.SelectionEnd   = this.RTimeChannel.ChartArea.CursorX.SelectionEnd;
         this.LTimeChannel.ChartArea.CursorX.Position       = this.RTimeChannel.ChartArea.CursorX.Position;
     }
 }
예제 #30
0
    void CursorActivate(CursorEventArgs e)
    {
        if (!isReady)
        {
            return;
        }

        activeCursor = e.Cursor;

        var loader = Instantiate(ContentLoaderPrefab);

        loader.transform.position = e.Cursor.Cursor.transform.position;
        loader.transform.LookAt(Camera.main.transform);
        loader.GetComponent <ContentLoader>().RequestContent(SocketId, activeCursor);
    }
 private void chartMain_SelectionRangeChanged(object sender, CursorEventArgs e)
 {
     if ((e.NewSelectionStart > 0 && Math.Abs(e.NewSelectionEnd - e.NewSelectionStart) > MinimumZoom)
         || (e.NewSelectionStart == 0 && e.NewSelectionEnd == 0))
     {
         ShowDataRange((int)e.NewSelectionStart, (int)e.NewSelectionEnd);
     }
 }
예제 #32
0
 private void OnPaletteSelectionChanged(CursorEventArgs args)
 {
     if (PaletteSelectionChanged != null) {
         PaletteSelectionChanged(this, args);
     }
 }
예제 #33
0
 void mModel_OnCursorChange(object sender, CursorEventArgs e)
 {
     this.RaiseOnCursorChange(e.Cursor);
 }
예제 #34
0
 void mView_OnCursorChange(object sender, CursorEventArgs e)
 {
     this.Cursor = e.Cursor;
 }