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


C# Envelope.Union方法代码示例

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


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

示例1: CreateFeatureLayersAsync

        private async Task CreateFeatureLayersAsync()
        {
            try
            {
                var gdb = await Geodatabase.OpenAsync(GDB_PATH);

                Envelope extent = new Envelope();
                foreach (var table in gdb.FeatureTables)
                {
                    var flayer = new FeatureLayer()
                    {
                        ID = table.Name,
                        DisplayName = table.Name,
                        FeatureTable = table
                    };

                    if (table.Extent != null)
                    {
                        if (extent == null)
                            extent = table.Extent;
                        else
                            extent = extent.Union(table.Extent);
                    }

                    mapView.Map.Layers.Add(flayer);
                }

                await mapView.SetViewAsync(extent.Expand(1.10));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples");
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:FeatureLayerFromLocalGeodatabase.xaml.cs

示例2: mapView_ExtentChanged

        /// <summary>Add feature tables from a local geodatabase as layers on the map</summary>
        private async void mapView_ExtentChanged(object sender, EventArgs e)
        {
            mapView.ExtentChanged -= mapView_ExtentChanged;

            try
            {
                var gdbFile = await ApplicationData.Current.LocalFolder.TryGetItemAsync(LOCAL_GDB_PATH);
                if (gdbFile == null)
                    throw new Exception("Local geodatabase not found. Please download sample data from 'Sample Data Settings'");

                var gdb = await Geodatabase.OpenAsync(gdbFile.Path);

                Envelope extent = new Envelope();
                foreach (var table in gdb.FeatureTables)
                {
                    var flayer = new FeatureLayer()
                    {
                        ID = table.Name,
                        DisplayName = table.Name,
                        FeatureTable = table
                    };

                    if (table.Extent != null)
                    {
                        if (extent == null)
                            extent = table.Extent;
                        else
                            extent = extent.Union(table.Extent);
                    }

                    mapView.Map.Layers.Add(flayer);
                }

                if (!extent.IsEmpty)
                    await mapView.SetViewAsync(extent.Expand(1.10));
            }
            catch (Exception ex)
            {
                var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:42,代码来源:FeatureLayerFromLocalGeodatabase.xaml.cs

示例3: LocateBlock

 private void LocateBlock()
 {
     _blockTable = _blockTable ?? _dataService.GetTable(ConfigurationManager.AppSettings["BlocTableName"]);
     var result = _dataService.GeneralQuery<BlocTBE>(_blockTable, string.Format("NoBloc = '{0}'", NoBloc));
     var envelopeTotal = new Envelope() as IEnvelope;
     result.ForEach(x =>
     {
         IEnvelope envelope = x.Shape.Envelope;
         envelopeTotal.Union(envelope);
     });
     _mapControl.ZoomToExtent(envelopeTotal);
 }
开发者ID:ananse23,项目名称:EsriWPF,代码行数:12,代码来源:MessageViewModel.cs

示例4: CreateFeatureLayersAsync

        // Create feature layers from the given geodatabase file
        private async Task CreateFeatureLayersAsync(string gdbPath)
        {
            try
            {
                var gdb = await Geodatabase.OpenAsync(gdbPath);

                if (gdb.FeatureTables.Count() == 0)
                    throw new ApplicationException("Downloaded geodatabase has no feature tables.");

                var groupLayer = mapView.Map.Layers["Local_Geodatabase"] as GroupLayer;
                if (groupLayer != null)
                    mapView.Map.Layers.Remove(groupLayer);
                
                groupLayer = new GroupLayer()
                {
                    ID = "Local_Geodatabase",
                    DisplayName = string.Format("Local ({0})", gdbPath)
                };

                Envelope extent = new Envelope();
                foreach (var table in gdb.FeatureTables)
                {
                    var flayer = new FeatureLayer()
                    {
                        ID = table.Name,
                        DisplayName = string.Format("{0} ({1})", table.Name, table.RowCount),
                        FeatureTable = table
                    };

                    if (table.Extent != null)
                    {
                        if (extent == null)
                            extent = table.Extent;
                        else
                            extent = extent.Union(table.Extent);
                    }

                    groupLayer.ChildLayers.Add(flayer);
                }

                mapView.Map.Layers.Add(groupLayer);

                await mapView.SetViewAsync(extent.Expand(1.10));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error creating feature layer: " + ex.Message, "Sample Error");
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:50,代码来源:GenerateGeodatabase.xaml.cs

示例5: Import

        /// <summary>
        /// 导入CAD文件
        /// </summary>
        public void Import()
        {
            OpenFileDialog openDwg = new OpenFileDialog();
            openDwg.Filter = "CAD file(*.DWG)|*.DWG|CAD DGN file(*.DGN)|*.DGN|CAD DXF file(*.DXF)|*.DXF";
            openDwg.Title = "DWG格式数据的输入";
            if (openDwg.ShowDialog() == DialogResult.OK)
            {
                string dwgfileName = openDwg.FileName;
                string fileName = dwgfileName.Substring(dwgfileName.LastIndexOf(@"\") + 1);
                string filePath = dwgfileName.Substring(0, dwgfileName.Length - fileName.Length - 1);
                IFeatureLayer pFeatureLayer;
                //打开CAD数据集
                IWorkspaceFactory2 pWorkspaceFactory = new CadWorkspaceFactory() as IWorkspaceFactory2;
                IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(filePath, 0);
                //打开一个要素集
                IFeatureDataset pFeatureDataset = pFeatureWorkspace.OpenFeatureDataset(fileName);
                //IFeaturClassContainer可以管理IFeatureDataset中的每个要素类
                IFeatureClassContainer pFeatureClassContainer = (IFeatureClassContainer)pFeatureDataset;
                //对CAD文件中的要素进行遍历处理
                IEnvelope envelope = new Envelope() as IEnvelope;
                for (int i = 0; i < pFeatureClassContainer.ClassCount; i++)
                {
                    try
                    {
                        IFeatureClass pFeatureClass = pFeatureClassContainer.get_Class(i);
                        if (pFeatureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                        {
                            //如果是注记,则添加注记层
                            pFeatureLayer = new CadAnnotationLayer() as IFeatureLayer;
                        }
                        else//如果是点、线、面,则添加要素层
                        {
                            pFeatureLayer = new FeatureLayer() as IFeatureLayer;
                        }
                        pFeatureLayer.Name = pFeatureClass.AliasName;
                        pFeatureLayer.FeatureClass = pFeatureClass;
                        this.AxMapControl.Map.AddLayer(pFeatureLayer);

                        //

                        IQueryFilter queryFilter = new QueryFilter() as IQueryFilter;
                        queryFilter.WhereClause = "";
                        IFeatureCursor featureCursor = pFeatureLayer.FeatureClass.Search(queryFilter, true);
                        IFeature feature = featureCursor.NextFeature();
                        while (feature != null)
                        {
                            IGeometry geometry = feature.Shape;
                            IEnvelope featureExtent = geometry.Envelope;
                            envelope.Union(featureExtent);
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(feature);
                            feature = featureCursor.NextFeature();
                        }
                    }
                    catch (Exception ex)
                    {
                        continue;
                    }

                }
                this.AxMapControl.ActiveView.Refresh();
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:65,代码来源:GIS_FileMenu.cs

示例6: Center

        /// <summary>
        /// 居中
        /// </summary>
        /// <param name="FeatureClass"></param>
        /// <param name="WhereClause"></param>
        public void Center(IFeatureClass FeatureClass, string WhereClause)
        {
            IEnvelope envelope = new Envelope() as IEnvelope;
            if (!string.IsNullOrEmpty(WhereClause))
            {
                IQueryFilter queryfilter = new QueryFilterClass();
                queryfilter.WhereClause = WhereClause;
                IFeatureCursor featurecursor = FeatureClass.Search(queryfilter, false);
                IFeature feature = featurecursor.NextFeature();
                while (feature != null)
                {
                    envelope.Union(feature.Extent);
                    feature = featurecursor.NextFeature();
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(featurecursor);
            }
            else
            {
                envelope = this.ExtentFeature.Shape.Envelope;
                //envelope = axMapControl1.FullExtent;
            }

            CenterBase(envelope);
        }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:29,代码来源:MainForm.cs


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