/// <summary>
        /// 始点が存在するとき
        ///   マウスがホバーしたら
        ///     一時的エッジを描画。
        /// </summary>
        private void CanvasMouseMove(MouseEventArgs e)
        {
            var posExact = e.GetPosition(mCanvas);
            var pos      = PointProc.SnapToGrid(posExact.X, posExact.Y, mDP.mGridSz);

            if (e.LeftButton == MouseButtonState.Released)
            {
                switch (mMode)
                {
                case Mode.ModeSetFirstPoint:
                    mPP.SetFirstPointMouseMove(pos);
                    break;

                case Mode.ModeAddEdge:
                    TmpEdgeRedrawMouseMove(pos);
                    break;

                case Mode.ModeDeletePointEdge:
                    DeletePointEdgeMouseMove(pos);
                    break;
                }
            }
            else
            {
                // マウスが左ドラッグ。
            }
        }
        private void CanvasMouseDownRight(MouseButtonEventArgs e)
        {
            var posExact = e.GetPosition(mCanvas);
            var pos      = PointProc.SnapToGrid(posExact.X, posExact.Y, mDP.mGridSz);

            switch (mMode)
            {
            case Mode.ModeAddEdge:
                PointAddRightClicked(pos);
                break;
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            mInitialized = true;

            mDP          = new DrawParams();
            mDP.mCanvas  = mCanvas;
            mDP.mGridSz  = int.Parse(mTextBoxGridSize.Text);
            mDP.mPointSz = int.Parse(mTextBoxPointSize.Text);
            mDP.mArrowSz = int.Parse(mTextBoxArrowSize.Text);

            mPP = new PointProc(mDP);
            mEP = new EdgeProc(mDP, mPP);

            mDataGridPointProc = new DataGridPointProc(mDataGridP, mPP.PointParamChanged);
            mDataGridEdgeProc  = new DataGridEdgeProc(mDataGridE, mEP.EdgeParamChanged);

            RedrawGrid();
            UpdateDescription();
        }
        private void CanvasMouseDownLeft(MouseButtonEventArgs e)
        {
            var posExact = e.GetPosition(mCanvas);
            var pos      = PointProc.SnapToGrid(posExact.X, posExact.Y, mDP.mGridSz);

            switch (mMode)
            {
            case Mode.ModeSetFirstPoint:
                SetFirstPointLeftClicked(pos);
                break;

            case Mode.ModeAddEdge:
                PointAddLeftClicked(pos);
                break;

            case Mode.ModeDeletePointEdge:
                DeletePointEdgeLeftClicked(pos);
                break;
            }
        }
Beispiel #5
0
 public EdgeProc(DrawParams dp, PointProc pp)
 {
     mDP = dp;
     mPP = pp;
 }