Exemplo n.º 1
0
 private CodeX <Distance> MyCoderX(LayoutX x, LayoutY y)
 {
     return(new CodeX <Distance>
     {
         Cx = Distance.FromMeter(GeoEu.Length(x.Lx, y.Ly)),
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// マウスWheelイベント
        /// </summary>
        /// <param name="e"></param>
        public void OnMouseWheel(MouseState e)
        {
            if (e.Attr.Equals(_trigger))
            {
                // 選択ペーンの描画領域の中心をズームのセンターの設定
                var _posDown = new ScreenPos
                {
                    X = e.Pane.GetPaneRect().LT.X + e.Pos.X - e.Pane.GetPaneRect().LT.X,
                    Y = e.Pane.GetPaneRect().LT.Y + e.Pos.Y - e.Pane.GetPaneRect().LT.Y
                };
                var _scrollDown = (ScreenPos)Pane.Scroll.Clone();
                var _zoomDown   = (XyBase)Pane.Zoom.Clone();
                var vol         = (int)(GeoEu.Length(Pane.Zoom.X, Pane.Zoom.Y) / 1000 * e.Delta.Y * 0.1);

                // 画面の拡大/縮小

                XyBase zoomNow;
                if (_isX && !_isY)
                {
                    zoomNow = Pane.Zoom + XyBase.FromInt(vol, 0);          // ズーム値の算出
                }
                else if (!_isX && _isY)
                {
                    zoomNow = Pane.Zoom + XyBase.FromInt(0, vol);          // ズーム値の算出
                }
                else
                {
                    zoomNow = Pane.Zoom + vol;                          // ズーム値の算出
                }
                // ズーム値を規定範囲内に収める
                if (zoomNow.X > 4000)
                {
                    zoomNow.X = 4000;
                }

                if (zoomNow.Y > 4000)
                {
                    zoomNow.Y = 4000;
                }

                if (zoomNow.X < 5)
                {
                    zoomNow.X = 5;
                }

                if (zoomNow.Y < 5)
                {
                    zoomNow.Y = 5;
                }

                Pane.Zoom = (XyBase)zoomNow.Clone();           // ズーム値の反映

                // クリックした位置を基準にしてズームするように画面をスクロールする。
                var ZoomRatioX = (double)zoomNow.X / _zoomDown.X;                     // X方向のズーム率の算出
                var ZoomRatioY = (double)zoomNow.Y / _zoomDown.Y;                     // Y方向のズーム率の算出

                var beforeDownPos = _posDown - _scrollDown - e.Pane.GetPaneRect().LT; //
                var afterDownPos  = ScreenPos.FromInt((int)(ZoomRatioX * beforeDownPos.X), (int)(ZoomRatioY * beforeDownPos.Y));

                if (_noscrollmove.value == false)
                {
                    Pane.Scroll = _scrollDown - (afterDownPos - beforeDownPos);
                }
                else
                {
                    _noscrollmove.value = false;
                }
                Pane.Invalidate(null);
            }
            else
            {
                OnMouseUp(e);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// selection score
        /// </summary>
        /// <param name="pane"></param>
        /// <param name="pos"></param>
        /// <returns></returns>
        public float SelectingScore(IDrawArea pane, ScreenPos pos)
        {
            var s1 = GetScreenPos(pane);

            return((float)GeoEu.Length(s1.X.Sx, s1.Y.Sy, pos.X.Sx, pos.Y.Sy) / DotR);
        }