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


C# Envelope.ToExtent方法代码示例

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


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

示例1: 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

示例2: LoadFeatureFromGeomProperty

        private void LoadFeatureFromGeomProperty(DbSet dbSet, PropertyInfo propertyGeom)
        {
            Envelope env = new Envelope();
            IDataService dataService = ServiceLocator.Current.GetInstance<IDataService>();
            EntityTableInfo tableInfo = dataService.GetEntityTableInfo(dbSet.ElementType);
            this.Lines.DataTable = this.CreateDataTable(dbSet.ElementType);
            this.Points.DataTable = this.CreateDataTable(dbSet.ElementType);
            this.Polygons.DataTable = this.CreateDataTable(dbSet.ElementType);
            PropertyInfo propertyId = dbSet.ElementType.GetProperty("Id");
            foreach (Object obj in dbSet)
            {

                Object data = propertyGeom.GetValue(obj);
                if (data != null)
                {
                    String strData = data.ToString();
                    Geometry geometry = this.CreateGeometryFromWkt(strData);
                    if (geometry != null)
                    {

                        env.ExpandToInclude(geometry.Envelope);
                        if (geometry is LineString || geometry is MultiLineString)
                        {
                            IFeature feature = this.Lines.AddFeature(geometry);
                            System.Data.DataRow row = this.Lines.DataTable.NewRow();
                            row.BeginEdit();
                            row["Id"] = (Int64)propertyId.GetValue(obj);
                            this.Lines.DataTable.Rows.Add(row);
                            feature.DataRow = row;
                            row.EndEdit();

                        }
                        else if (geometry is Point)
                        {
                            IFeature feature = this.Points.AddFeature(geometry);
                            System.Data.DataRow row = this.Points.DataTable.NewRow();
                            row.BeginEdit();
                            row["Id"] = (Int64)propertyId.GetValue(obj);
                            this.Points.DataTable.Rows.Add(row);
                            feature.DataRow = row;
                            row.EndEdit();

                        }
                        else if (geometry is Polygon)
                        {
                            IFeature feature = this.Polygons.AddFeature(geometry);
                            System.Data.DataRow row = this.Polygons.DataTable.NewRow();
                            row.BeginEdit();
                            row["Id"] = (Int64)propertyId.GetValue(obj);
                            this.Polygons.DataTable.Rows.Add(row);
                            feature.DataRow = row;
                            row.EndEdit();
                        }
                    }

                }
            }
            this.Extent = env.ToExtent();
        }
开发者ID:ChampsyGnom,项目名称:GeoPat,代码行数:59,代码来源:FeatureSetAdapter.cs

示例3: LoadTemplate

        private void LoadTemplate(TemplateViewModel template)
        {
            template.Nodes.Clear();
            this.Map.Layers.Clear();
            DbSet<SigNode> nodeSet = this.DataService.GetDbSet<SigNode>();
            List<TemplateNodeLayerViewModel> layersNodes = new List<TemplateNodeLayerViewModel>();
            this.RecurseLoadTemplate(nodeSet, template, template.Nodes, -1, layersNodes);
            Envelope env = new Envelope();
            layersNodes = (from ln in layersNodes where ln.Model.SigLayer != null orderby ln.Model.SigLayer.MapOrder  select ln).ToList();
            foreach (TemplateNodeLayerViewModel layersNode in layersNodes)
            {
                layersNode.CreateLayers();
                if (layersNode.Envelope != null)
                { env.ExpandToInclude(layersNode.Envelope); }

                foreach (IMapLayer mapLayer in layersNode.Layers)
                {
                    this.Map.Layers.Add(mapLayer);
                  
                }
            }
            this.Map.ViewExtents = env.ToExtent();
        }
开发者ID:ChampsyGnom,项目名称:GeoPat,代码行数:23,代码来源:CartoViewModel.cs


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