• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.GeoMouseArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotSpatial.Controls.GeoMouseArgs的典型用法代码示例。如果您正苦于以下问题:C# GeoMouseArgs类的具体用法?C# GeoMouseArgs怎么用?C# GeoMouseArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GeoMouseArgs类属于DotSpatial.Controls命名空间,在下文中一共展示了GeoMouseArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnMouseUp

        /// <summary>
        /// Handles the Mouse Up situation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            Map.Invalidate();

            Rectangle r = e.Map.MapFrame.View;
            int w = r.Width;
            int h = r.Height;

            if (e.Button == MouseButtons.Left)
            {
                r.Inflate(r.Width / 2, r.Height / 2);
                r.X += w / 2 - e.X;
                r.Y += h / 2 - e.Y;
                e.Map.MapFrame.View = r;
                e.Map.MapFrame.ResetExtents();
            }
            else
            {
                r.Inflate(-r.Width / 4, -r.Height / 4);
                // The mouse cursor should anchor the geographic location during zoom.
                r.X += (e.X / 2) - w / 4;
                r.Y += (e.Y / 2) - h / 4;
                e.Map.MapFrame.View = r;
                e.Map.MapFrame.ResetExtents();
            }

            base.OnMouseUp(e);
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:32,代码来源:MapFunctionZoomOut.cs


示例2: OnMouseUp

        /// <summary>
        /// Overrides the OnMouseUp event to handle the situation where we are trying to
        /// identify the vector features in the specified area.
        /// </summary>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (e.Button != MouseButtons.Left) return;

            var rtol = new Rectangle(e.X - 8, e.Y - 8, 16, 16);
            var rstr = new Rectangle(e.X - 1, e.Y - 1, 2, 2);
            var tolerant = e.Map.PixelToProj(rtol);
            var strict = e.Map.PixelToProj(rstr);

            if (_frmFeatureIdentifier == null || _frmFeatureIdentifier.IsDisposed)
            {
                _frmFeatureIdentifier = new FeatureIdentifier();
            }
            _frmFeatureIdentifier.treFeatures.BeginUpdate();
            _frmFeatureIdentifier.SuspendLayout();
            _frmFeatureIdentifier.Clear();

            Identify(e.Map.MapFrame.GetLayers(), strict, tolerant);

            _frmFeatureIdentifier.ReSelect();
            _frmFeatureIdentifier.ResumeLayout();
           
            SetSelectToSelectedNode(e.Map);
            _frmFeatureIdentifier.treFeatures.EndUpdate();

            if (!_frmFeatureIdentifier.Visible)
            {
                _frmFeatureIdentifier.Show(Map.MapFrame != null ? Map.MapFrame.Parent : null);
            }

            base.OnMouseUp(e);
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:36,代码来源:MapFunctionIdentify.cs


示例3: OnGlpyhClick

 /// <inheritdoc/>
 protected override void OnGlpyhClick(GeoMouseArgs e)
 {
     using (var form = new ExtensionManagerForm())
     {
         form.App = Manager;
         form.ShowDialog();
     }
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:9,代码来源:AppFunction.cs


示例4: OnMouseDown

 /// <summary>
 /// Handles the actions that the tool controls during the OnMouseDown event
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseDown(GeoMouseArgs e)
 {
     if (e.Button == MouseButtons.Left && _preventDrag == false)
     {
         //PreventBackBuffer = true;
         _dragStart = e.Location;
         _source = e.Map.MapFrame.View;
     }
     base.OnMouseDown(e);
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:14,代码来源:MapFunctionPan.cs


示例5: OnMouseDown

 /// <summary>
 /// Handles the MouseDown
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseDown(GeoMouseArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         _startPoint = e.Location;
         _geoStartPoint = e.GeographicLocation;
         _isDragging = true;
         Map.IsBusy = true;
     }
     base.OnMouseDown(e);
 }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:15,代码来源:MapFunctionSelect.cs


示例6: OnMouseUp

        /// <summary>
        /// Overrides the OnMouseUp event to handle the situation where we are trying to
        /// identify the vector features in the specified area.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (e.Button != MouseButtons.Left) return;
            Rectangle rtol = new Rectangle(e.X - 8, e.Y - 8, 16, 16);
            Rectangle rstr = new Rectangle(e.X - 1, e.Y - 1, 2, 2);
            Extent tolerant = e.Map.PixelToProj(rtol);
            Extent strict = e.Map.PixelToProj(rstr);

            if (_frmFeatureIdentifier == null)
            {
                _frmFeatureIdentifier = new FeatureIdentifier();
            }
            _frmFeatureIdentifier.SuspendLayout();
            _frmFeatureIdentifier.Clear();
            Identify(e.Map.MapFrame.GetLayers(), strict, tolerant);
            _frmFeatureIdentifier.ReSelect();
            _frmFeatureIdentifier.ResumeLayout();
            _frmFeatureIdentifier.Show(Map.MapFrame != null? Map.MapFrame.Parent : null);
            base.OnMouseUp(e);
        }
开发者ID:nikson898,项目名称:dot-spatial,代码行数:25,代码来源:MapFunctionIdentify.cs


示例7: Map_GeoMouseMove

 private void Map_GeoMouseMove(object sender, GeoMouseArgs e)
 {
     xPanel.Caption = String.Format("X: {0:.#####}", e.GeographicLocation.X);
     yPanel.Caption = String.Format("Y: {0:.#####}", e.GeographicLocation.Y);
 }
开发者ID:Nucleotic,项目名称:Geometrix,代码行数:5,代码来源:StatusBarCoordinates.cs


示例8: OnMouseUp

 /// <summary>
 /// Fires the MouseUP event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnMouseUp(GeoMouseArgs e)
 {
     if (MouseUp == null)
     {
         return;
     }
     MouseUp(this, e);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:12,代码来源:MapFunction.cs


示例9: OnMouseWheel

 /// <summary>
 /// Allows for inheriting tools to override the behavior
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnMouseWheel(GeoMouseArgs e)
 {
     if (MouseWheel == null)
     {
         return;
     }
     MouseWheel(this, e);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:12,代码来源:MapFunction.cs


示例10: OnMouseUp

        /// <summary>
        /// Handles the Mouse-Up situation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (_standBy)
            {
                return;
            }
            // Add the current point to the featureset

            if (e.Button == MouseButtons.Right)
            {
                if (_coordinates.Count > 1)
                {
                    _previousParts.Add(_coordinates);
                    if (_areaMode)
                    {
                        _measureDialog.TotalArea = _currentArea;
                    }
                    else
                    {
                        _previousDistance += _currentDistance;
                        _currentDistance = 0;
                        _currentArea = 0;
                        _measureDialog.Distance = 0;
                        _measureDialog.TotalDistance = _previousDistance;
                    }
                }

                _coordinates = new List<Coordinate>();
                Map.Invalidate();
            }
            else
            {
                if (_coordinates == null)
                {
                    _coordinates = new List<Coordinate>();
                }

                if (_coordinates.Count > 0)
                {
                    if (_measureDialog.MeasureMode == MeasureMode.Distance)
                    {
                        Coordinate c1 = e.GeographicLocation;
                        double dist = GetDist(c1);
                        _measureDialog.TotalDistance = _previousDistance + dist;
                        _currentDistance += dist;
                    }
                }
                _coordinates.Add(e.GeographicLocation);
                if (_areaMode)
                {
                    if (_coordinates.Count >= 3)
                    {
                        double area = GetArea(_coordinates);
                        _currentArea = area;
                    }
                }
                Map.Invalidate();
            }

            base.OnMouseUp(e);
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:65,代码来源:MapFunctionMeasure.cs


示例11: OnMouseDoubleClick

 /// <summary>
 /// Fires the DoubleClick event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnMouseDoubleClick(GeoMouseArgs e)
 {
     if (MouseDoubleClick == null)
     {
         return;
     }
     MouseDoubleClick(this, e);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:12,代码来源:MapFunction.cs


示例12: OnMouseUp

 /// <inheritdoc/>
 protected override void OnMouseUp(GeoMouseArgs e)
 {
     Rectangle glyph = GlpyhBounds;
     if (glyph.Contains(e.Location))
     {
         OnGlpyhClick(e);
         // whether they do anything or not, the glyph is the only thing that should happen in this window.
         e.Handled = true;
     }
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:11,代码来源:MapFunctionGlyph.cs


示例13: OnMouseWheel

 /// <summary>
 /// Fires the OnMouseWheel event for the active tools
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseWheel(MouseEventArgs e)
 {
     GeoMouseArgs args = new GeoMouseArgs(e, this);
     foreach (IMapFunction tool in MapFunctions)
     {
         if (tool.Enabled)
         {
             tool.DoMouseWheel(args);
             if (args.Handled) break;
         }
     }
     base.OnMouseWheel(e);
 }
开发者ID:nikson898,项目名称:dot-spatial,代码行数:17,代码来源:Map.cs


示例14: DoMouseDoubleClick

 /// <summary>
 /// Forces this tool to execute whatever behavior should occur during a double click even on the panel
 /// </summary>
 /// <param name="e"></param>
 public void DoMouseDoubleClick(GeoMouseArgs e)
 {
     OnMouseDoubleClick(e);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:8,代码来源:MapFunction.cs


示例15: OnMouseMove

        /// <summary>
        /// This method occurs as the mouse moves.
        /// </summary>
        /// <param name="e">The GeoMouseArcs class describes the mouse condition along with geographic coordinates.</param>
        protected override void OnMouseMove(GeoMouseArgs e)
        {
            if (_standBy) { return; }

            // Begin snapping changes
            Coordinate snappedCoord = e.GeographicLocation;
            bool prevWasSnapped = this.isSnapped;
            this.isSnapped = ComputeSnappedLocation(e, ref snappedCoord);
            _coordinateDialog.X = snappedCoord.X;
            _coordinateDialog.Y = snappedCoord.Y;
            // End snapping changes

            if (_coordinates != null && _coordinates.Count > 0)
            {
                List<Point> points = _coordinates.Select(coord => Map.ProjToPixel(coord)).ToList();
                Rectangle oldRect = SymbologyGlobal.GetRectangle(_mousePosition, points[points.Count - 1]);
                Rectangle newRect = SymbologyGlobal.GetRectangle(e.Location, points[points.Count - 1]);
                Rectangle invalid = Rectangle.Union(newRect, oldRect);
                invalid.Inflate(20, 20);
                Map.Invalidate(invalid);
            }
            
            // Begin snapping changes
            _mousePosition = this.isSnapped ? Map.ProjToPixel(snappedCoord) : e.Location;
            DoMouseMoveForSnapDrawing(prevWasSnapped, _mousePosition);
            // End snapping changes

            base.OnMouseMove(e);
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:33,代码来源:AddShapeFunction.cs


示例16: OnMouseMove

 /// <summary>
 /// Handles MouseMove
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseMove(GeoMouseArgs e)
 {
     _currentPoint = e.Location;
     Map.Invalidate();
     base.OnMouseMove(e);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:10,代码来源:MapFunctionLabelSelect.cs


示例17: OnMouseUp

        /// <summary>
        /// Handles the Mouse Up situation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            _currentPoint = e.Location;
            _isDragging = false;
            Map.Invalidate();
            if (_geoStartPoint != null)
            {
                _selectionEnvelope = new Envelope(_geoStartPoint.X, e.GeographicLocation.X, _geoStartPoint.Y,
                                                  e.GeographicLocation.Y);
            }

            // If they are not pressing shift, then first clear the selection before adding new members to it.
            if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift) == false)
            {
                foreach (IMapLayer lyr in Map.MapFrame.Layers)
                {
                    IMapFeatureLayer fl = lyr as IMapFeatureLayer;
                    if (fl == null)
                    {
                        continue;
                    }
                    IMapLabelLayer gll = fl.LabelLayer;
                    if (gll != null)
                    {
                        gll.ClearSelection();
                    }
                }
            }

            _doSelect = true;
            e.Map.MapFrame.ResetBuffer();
            e.Map.Invalidate();
            base.OnMouseUp(e);
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:38,代码来源:MapFunctionLabelSelect.cs


示例18: OnMouseWheel

        /// <summary>
        /// Mouse Wheel
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseWheel(GeoMouseArgs e) //Fix this
        {
            _zoomTimer.Stop(); // if the timer was already started, stop it.

            Extent MaxExtent = e.Map.GetMaxExtent();
         
            if ((e.Map.IsZoomedToMaxExtent == true) && (_direction * e.Delta < 0))
            {}
            else
            {
                e.Map.IsZoomedToMaxExtent = false;
                Rectangle r = e.Map.MapFrame.View;

                // For multiple zoom steps before redrawing, we actually
                // want the x coordinate relative to the screen, not
                // the x coordinate relative to the previously modified view.
                if (_client == Rectangle.Empty)
                {
                    _client = r;
                }
                int cw = _client.Width;
                int ch = _client.Height;

                double w = r.Width;
                double h = r.Height;

                if (_direction * e.Delta > 0)
                {

                    double inFactor = 2.0 * _sensitivity;
                    r.Inflate(Convert.ToInt32(-w / inFactor), Convert.ToInt32(-h / inFactor));
                    // try to keep the mouse cursor in the same geographic position
                    r.X += Convert.ToInt32((e.X * w / (_sensitivity * cw)) - w / inFactor);
                    r.Y += Convert.ToInt32((e.Y * h / (_sensitivity * ch)) - h / inFactor);

                }
                else
                {
                    double outFactor = 0.5 * _sensitivity;
                    r.Inflate(Convert.ToInt32(w / _sensitivity), Convert.ToInt32(h / _sensitivity));
                    r.X += Convert.ToInt32(w / _sensitivity - (e.X * w / (outFactor * cw)));
                    r.Y += Convert.ToInt32(h / _sensitivity - (e.Y * h / (outFactor * ch)));
                }
                int mapHeight = e.Map.MapFrame.View.Height;
                int mapWidth = e.Map.MapFrame.View.Width;


                e.Map.MapFrame.View = r;
                e.Map.Invalidate();
                _zoomTimer.Start();
                _mapFrame = e.Map.MapFrame;
                if (!BusySet)
                {
                    Map.IsBusy = true;
                    BusySet = true;
                }
                base.OnMouseWheel(e);

            }

        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:65,代码来源:MapFunctionZoom.cs


示例19: ComputeSnappedLocation

        /// <summary>
        /// Computes a snapped coordinate.  If the mouse is near a snappable object, the output
        /// location of the mouse will be the coordinates of the object rather than the actual
        /// mouse coords.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="snappedCoord">set if a coordinate is found</param>
        /// <returns>true if snap found</returns>
        protected bool ComputeSnappedLocation(GeoMouseArgs e, ref Coordinate snappedCoord)
        {
            if (this.snapLayers == null || e == null || Map == null)
                return false;

            Rectangle mouseRect = new Rectangle(e.X - this.snapTol, e.Y - this.snapTol, this.snapTol * 2, this.snapTol * 2);

            Extent pix = Map.PixelToProj(mouseRect);
            if (pix == null)
                return false;

            IEnvelope env = pix.ToEnvelope();

            foreach (IFeatureLayer layer in this.snapLayers)
            {
                foreach (IFeature feat in layer.DataSet.Features)
                {
                    foreach (Coordinate c in feat.Coordinates)
                    {
                        // If the mouse envelope contains the current coordinate, we found a
                        // snap location.
                        if (env.Contains(c))
                        {
                            snappedCoord = c;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:39,代码来源:SnappableMapFunction.cs


示例20: OnMouseUp

        /// <summary>
        /// Handles the Mouse Up situation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            e.Map.IsZoomedToMaxExtent = false;
            bool handled = false;
            _currentPoint = e.Location;

            Map.Invalidate();
            if (_isDragging)
            {
                if (_geoStartPoint != null && _startPoint != e.Location)
                {
                    IEnvelope env = new Envelope(_geoStartPoint.X, e.GeographicLocation.X,
                                                 _geoStartPoint.Y, e.GeographicLocation.Y);
                    if (Math.Abs(e.X - _startPoint.X) > 1 && Math.Abs(e.Y - _startPoint.Y) > 1)
                    {
                        e.Map.ViewExtents = env.ToExtent();
                        handled = true;
                    }
                }
            }
            _isDragging = false;

            if (handled == false)
            {
                Rectangle r = e.Map.MapFrame.View;
                int w = r.Width;
                int h = r.Height;
                if (e.Button == MouseButtons.Left)
                {
                    r.Inflate(-r.Width / 4, -r.Height / 4);
                    // The mouse cursor should anchor the geographic location during zoom.
                    r.X += (e.X / 2) - w / 4;
                    r.Y += (e.Y / 2) - h / 4;
                }
                else
                {
                    r.Inflate(r.Width / 2, r.Height / 2);
                    r.X += w / 2 - e.X;
                    r.Y += h / 2 - e.Y;
                }
                e.Map.MapFrame.View = r;
                e.Map.MapFrame.ResetExtents();
            }

            base.OnMouseUp(e);
            Map.IsBusy = false;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:51,代码来源:MapFunctionClickZoom.cs



注:本文中的DotSpatial.Controls.GeoMouseArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.MapArgs类代码示例发布时间:2022-05-24
下一篇:
C# CSLapack.XERBLA类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap