当前位置: 首页>>代码示例>>C#>>正文


C# Envelope.ExpandBy方法代码示例

本文整理汇总了C#中DotSpatial.Topology.Envelope.ExpandBy方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.ExpandBy方法的具体用法?C# Envelope.ExpandBy怎么用?C# Envelope.ExpandBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotSpatial.Topology.Envelope的用法示例。


在下文中一共展示了Envelope.ExpandBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnMouseUp

        /// <summary>
        /// Handles the Mouse Up situation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (Map == null) Map = e.Map;
            Stopwatch sw = new Stopwatch();
            sw.Start();
            if (_isDragging == false) return;
            _currentPoint = e.Location;
            _isDragging = false;
            //Map.Invalidate(); // Get rid of the selection box
            //Application.DoEvents();
            IEnvelope env = new Envelope(_geoStartPoint.X, e.GeographicLocation.X,
                _geoStartPoint.Y, e.GeographicLocation.Y);
            IEnvelope tolerant = env;

            if (_startPoint.X == e.X && _startPoint.Y == e.Y)
            {
                // click selection doesn't work quite right without some tiny tolerance.
                double tol = Map.MapFrame.ViewExtents.Width / 10000;
                env.ExpandBy(tol);
            }

            if (Math.Abs(_startPoint.X - e.X) < 8 && Math.Abs(_startPoint.Y - e.Y) < 8)
            {
                Coordinate c1 = e.Map.PixelToProj(new Point(e.X - 4, e.Y - 4));
                Coordinate c2 = e.Map.PixelToProj(new Point(e.X + 4, e.Y + 4));
                tolerant = new Envelope(c1, c2);
            }

            former = null;
            foreach (var l in Map.MapFrame.GetAllLayers())
            {
                if (l.IsSelected)
                {
                    former = l;
                    l.IsSelected = false;
                }
            }
            if (former == null && Map.MapFrame.IsSelected)
            {
                former = Map.MapFrame;
            }
            Map.MapFrame.IsSelected = true;
            Map.MapFrame.SuspendEvents();
            HandleSelection(tolerant, env);
            Map.MapFrame.IsSelected = false;
            if (former != null)
            {
                former.IsSelected = true;
            }
            Map.MapFrame.ResumeEvents();
            // Force an invalidate to clear the dotted lines, even if we haven't changed anything.
            e.Map.Invalidate();
            //e.Map.MapFrame.Initialize();
            sw.Stop();

            Debug.WriteLine("Initialize: " + sw.ElapsedMilliseconds);
            base.OnMouseUp(e);
            Map.IsBusy = false;
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:63,代码来源:MapFunctionSelect.cs


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