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

C# FeatureLayer类代码示例

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

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



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

示例1: Initialize

        private void Initialize()
        {
            // Create new Map
            Map myMap = new Map();

            // Create the uri for the tiled layer
            Uri tiledLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer");

            // Create a tiled layer using url
            ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tiledLayerUri);
            tiledLayer.Name = "Tiled Layer";

            // Add the tiled layer to map
            myMap.OperationalLayers.Add(tiledLayer);

            // Create the uri for the ArcGISMapImage layer
            var imageLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer");

            // Create ArcGISMapImage layer using a url
            ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(imageLayerUri);
            imageLayer.Name = "Image Layer";

            // Set the visible scale range for the image layer
            imageLayer.MinScale = 40000000;
            imageLayer.MaxScale = 2000000;

            // Add the image layer to map
            myMap.OperationalLayers.Add(imageLayer);

            //Create Uri for feature layer
            var featureLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/FeatureServer/0");

            //Create a feature layer using url
            FeatureLayer myFeatureLayer = new FeatureLayer(featureLayerUri);
            myFeatureLayer.Name = "Feature Layer";

            // Add the feature layer to map
            myMap.OperationalLayers.Add(myFeatureLayer);

            // Create a mappoint the map should zoom to
            MapPoint mapPoint = new MapPoint(-11000000, 4500000, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 50000000);

            // Initialize the model list with unknown status for each layer
            foreach (Layer layer in myMap.OperationalLayers)
            {
                _layerStatusModels.Add(new LayerStatusModel(layer.Name, "Unknown"));
            }

            // Create the tableview source and pass the list of models to it
            _tableView.Source = new LayerViewStatusTableSource(_layerStatusModels);

            // Event for layer view state changed
            _myMapView.LayerViewStateChanged += OnLayerViewStateChanged;

            // Provide used Map to the MapView
            _myMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:60,代码来源:DisplayLayerViewState.cs


示例2: FeatureLayerHelper

        public FeatureLayerHelper(Map map, string name, FeatureLayer.QueryMode mode, bool visible)
        {
            this.FeatureLayer = (FeatureLayer)map.Layers.FirstOrDefault(layer => (layer is FeatureLayer) && ((FeatureLayer)layer).DisplayName.ToLower().Equals(name.ToLower()));
              if (this.FeatureLayer == null)
              {
            Log.Trace("Could not find layer with name '" + name + "'");
            return;
              }

              this.FeatureLayer.Visible  = visible;
              this.FeatureLayer.Mode     = mode;
              this.FeatureLayer.AutoSave = false;

              this.Fields = QueryLayerFields(this.FeatureLayer);
              if (this.Fields == null)
            Log.Trace("Could not query layer fields '" + name + "'");

              this.FeatureLayer.Initialized += FeatureLayer_Initialized;
              this.FeatureLayer.Initialize();

              this.FeatureLayer.BeginSaveEdits += FeatureLayer_BeginSaveEdits;
              this.FeatureLayer.EndSaveEdits += FeatureLayer_EndSaveEdits;
              this.FeatureLayer.UpdateCompleted += FeatureLayer_UpdateCompleted;
              this.FeatureLayer.UpdateFailed += FeatureLayer_UpdateFailed;
              this.FeatureLayer.SaveEditsFailed += FeatureLayer_SaveEditsFailed;
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:26,代码来源:FeatureLayerHelper.cs


示例3: mapView_Initialized

        /// <summary>
        /// マップビュー初期化時のイベント ハンドラ
        /// </summary>
        private async void mapView_Initialized(object sender, EventArgs e)
        {
            try
            {
                //ローカル ジオデータベース(Runtime コンテンツ)を読み込みマップに追加
                var gdb = await Geodatabase.OpenAsync(GDB_PATH);
                foreach (var table in gdb.FeatureTables)
                {
                    var flayer = new FeatureLayer()
                    {
                        ID = table.Name,
                        DisplayName = table.Name,
                        FeatureTable = table
                    };

                    //フィーチャ レイヤーのラベル プロパティを初期化し赤ラベルと青ラベルを設定
                    flayer.Labeling = new LabelProperties();
                    var redLabelClass = this.layoutRoot.Resources["redLabel"] as AttributeLabelClass;
                    flayer.Labeling.LabelClasses.Add(redLabelClass);
                    var blueLabelClass = this.layoutRoot.Resources["blueLabel"] as AttributeLabelClass;
                    flayer.Labeling.LabelClasses.Add(blueLabelClass);

                    //マップにフィーチャ レイヤーを追加
                    mapView.Map.Layers.Add(flayer);
                }

                //すべてのレイヤーを初期化
                await mapView.LayersLoadedAsync();
            }
            catch(Exception ex)
            {
                MessageBox.Show(string.Format("フィーチャ レイヤーの作成に失敗しました: {0}", ex.Message));
            }
        }
开发者ID:EsriJapan,项目名称:arcgis-samples-dotnet,代码行数:37,代码来源:LabelingFeaturesByScale.xaml.cs


示例4: AddLocalToMap

        private async void AddLocalToMap(object sender, RoutedEventArgs e)
        {
            try {

                _gdb = await Geodatabase.OpenAsync(GDB_PATH);

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


                        MyMapView.Map.Layers.Add(flayer);
                        MyMapView.SetView(flayer.FullExtent);
                    }
                    catch (Exception ex) {
                        Console.WriteLine("Error creating feature layer: " + ex.Message, "Samples");
                    }
                }
            }
            catch (Exception ex) {
                Console.WriteLine("Error creating feature layer: " + ex.Message, "Samples");
            }
        }
开发者ID:fjkish,项目名称:DotNet,代码行数:28,代码来源:MainWindow.xaml.cs


示例5: FeatureLayerChangeVersion

        public FeatureLayerChangeVersion()
        {
            InitializeComponent();

            featureLayer = (MyMap.Layers["ServiceConnections"] as FeatureLayer);

            Geoprocessor gp_ListVersions = new Geoprocessor("http://sampleserver6.arcgisonline.com/arcgis/rest/services/GDBVersions/GPServer/ListVersions");

            gp_ListVersions.Failed += (s, a) =>
            {
                MessageBox.Show("Geoprocessing service failed: " + a.Error);
            };

            gp_ListVersions.ExecuteCompleted += (c, d) =>
            {
                VersionsCombo.DataContext = (d.Results.OutParameters[0] as GPRecordSet).FeatureSet;

                foreach (Graphic g in (d.Results.OutParameters[0] as GPRecordSet).FeatureSet.Features)
                {
                    if ((g.Attributes["name"] as string) == featureLayer.GdbVersion)
                    {
                        VersionsCombo.SelectedValue = g;
                        break;
                    }
                }
            };

            List<GPParameter> gpparams = new List<GPParameter>();
            gpparams.Add(new GPRecordSet("Versions", new FeatureSet()));
            gp_ListVersions.ExecuteAsync(gpparams);
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:31,代码来源:FeatureLayerChangeVersion.xaml.cs


示例6: Initialize

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
                SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Create uri to the used feature service
            var serviceUri = new Uri(
               "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");

            // Create feature table for the pools feature service
            ServiceFeatureTable poolsFeatureTable = new ServiceFeatureTable(serviceUri);

            // Define the request mode
            poolsFeatureTable.FeatureRequestMode = FeatureRequestMode.OnInteractionNoCache;

            // Create FeatureLayer that uses the created table
            FeatureLayer poolsFeatureLayer = new FeatureLayer(poolsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(poolsFeatureLayer);

            // Assign the map to the MapView
            MyMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:ServiceFeatureTableNoCache.xaml.cs


示例7: RelateInfo

 /// <summary>
 /// Represents the Relationship Class information
 /// </summary>
 /// <param name="featureLayer"></param>
 /// <param name="selection"></param>
 public RelateInfo(FeatureLayer featureLayer, Selection selection)
 {
     _featureLayer = featureLayer;
     _selection = selection;            
     _featureClassName = _featureLayer.GetFeatureClass().GetName();
     
 }
开发者ID:ChaitG,项目名称:arcgis-pro-sdk-community-samples,代码行数:12,代码来源:RelateInfo.cs


示例8: CreateFeatureLayers

		private async void CreateFeatureLayers()
		{
			try
			{
				var geodatabase = await Geodatabase.OpenAsync(GeodatabasePath);

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

					if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent))
					{
						if (Geometry.IsNullOrEmpty(extent))
							extent = table.ServiceInfo.Extent;
						else
							extent = extent.Union(table.ServiceInfo.Extent);
					}

					MySceneView.Scene.Layers.Add(featureLayer);
				}

				await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982));
			}
			catch (Exception ex)
			{
				MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples");
			}
		}
开发者ID:kbheadley,项目名称:NET,代码行数:34,代码来源:FeatureLayerFromLocalGeodatabase3d.xaml.cs


示例9: CreateFeatureLayers

        private async void CreateFeatureLayers()
        {
            try
            {
                var gdb = await Geodatabase.OpenAsync(GDB_PATH);

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

					if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent))
					{
						if (Geometry.IsNullOrEmpty(extent))
							extent = table.ServiceInfo.Extent;
						else
							extent = extent.Union(table.ServiceInfo.Extent);
					}

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

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


示例10: FeatureLayerHitTesting

        /// <summary>Construct FeatureLayerHitTesting sample control</summary>
        public FeatureLayerHitTesting()
        {
            InitializeComponent();

            DataContext = this;
            _featureLayer = MyMapView.Map.Layers["FeatureLayer"] as FeatureLayer;
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:8,代码来源:FeatureLayerHitTesting.xaml.cs


示例11: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create a mappoint the map should zoom to
            MapPoint mapPoint = new MapPoint(-13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            _myMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            //Add the feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:26,代码来源:FeatureLayerDefinitionExpression.cs


示例12: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create a MapPoint the map should zoom to
            MapPoint mapPoint = new MapPoint(
                -13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri(
                "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            //Add the feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);

            // TODO: https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/96
            if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Other)
            {
                await _featureLayer.RetryLoadAsync();
            }
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:FeatureLayerDefinitionExpression.xaml.cs


示例13: Initialize

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map location
            MapPoint initialLocation = new MapPoint(
                -11000000, 5000000, SpatialReferences.WebMercator);
                myMap.InitialViewpoint = new Viewpoint(initialLocation, 100000000);

            // Create feature table using a url
            _featureTable = new ServiceFeatureTable(new Uri(_statesUrl));

            // Create feature layer using this feature table
            _featureLayer = new FeatureLayer(_featureTable);

            // Set the Opacity of the Feature Layer
            _featureLayer.Opacity = 0.6;

            // Create a new renderer for the States Feature Layer
            SimpleLineSymbol lineSymbol = new SimpleLineSymbol(
                SimpleLineSymbolStyle.Solid, Color.Black, 1); 
            SimpleFillSymbol fillSymbol = new SimpleFillSymbol(
                SimpleFillSymbolStyle.Solid, Color.Yellow, lineSymbol);

            // Set States feature layer renderer
            _featureLayer.Renderer = new SimpleRenderer(fillSymbol);

            // Add feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);

            // Assign the map to the MapView
            _myMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:34,代码来源:FeatureLayerQuery.cs


示例14: EditingCodedValueDomains

        public EditingCodedValueDomains()
        {
            InitializeComponent();

            editor = LayoutRoot.Resources["MyEditor"] as Editor;
            featureLayer = MyMap.Layers["RecreationFacilities"] as FeatureLayer;
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:7,代码来源:EditingCodedValueDomains.xaml.cs


示例15: OnClick

        protected override void OnClick()
        {
            //
            //  TODO: Sample code showing how to access button host
            //
            ArcMap.Application.CurrentTool = null;

            //Create the workspace and then create the feature class.
            Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
            IWorkspace workspace = workspaceFactory.OpenFromFile(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), @"Data\testData.gdb").ToString(), 0);
            IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace;

            IFeatureClass createdFeatureClass = CreateFeatureClass("Reddies", featureWorkspace);

            //Generate data for the feature class
            BoboDataGeneration(createdFeatureClass, featureWorkspace);

            //Create the layer and add it to the display
            IFeatureLayer layer = new FeatureLayer();
            layer.FeatureClass = createdFeatureClass;
            layer.Name = createdFeatureClass.AliasName;
            layer.DisplayField = "HistoField";

            RenderFeatures(layer);

            //Add the layer to the map
            ArcMap.Document.FocusMap.AddLayer(layer);
        }
开发者ID:nohe427,项目名称:MyAddins,代码行数:29,代码来源:HistoClass.cs


示例16: ArcMap_NewDocument

        private void ArcMap_NewDocument()
        {
            // TODO: Handle new document event

            IMap map = ArcMap.Document.FocusMap;

            Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
            IWorkspace workspace = workspaceFactory.OpenFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ,@"Data\PointsToAdd.gdb"), 0);
            IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace;
            IFeatureClass featureClassLines = featureWorkspace.OpenFeatureClass("Lines");
            IFeatureClass featureClassPoints = featureWorkspace.OpenFeatureClass("Points");

            IFeatureLayer featureLayerLines = new FeatureLayer();
            IFeatureLayer featureLayerPoints = new FeatureLayer();

            featureLayerLines.FeatureClass = featureClassLines;
            featureLayerPoints.FeatureClass = featureClassPoints;
            featureLayerPoints.Name = "Points";
            featureLayerLines.Name = "Lines";

            map.AddLayer(featureLayerPoints);
            map.AddLayer(featureLayerLines);
            map.RecalcFullExtent();
        }
开发者ID:nohe427,项目名称:MyAddins,代码行数:25,代码来源:AddsTheData.cs


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


示例18: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map location
            MapPoint initialLocation = new MapPoint(
                -13630484, 4545415, SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation, 500000);

            // Create uri to the used feature service
            var serviceUri = new Uri(
               "http://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Create feature table for the incident feature service
            _incidentsFeatureTable = new ServiceFeatureTable(serviceUri);

            // Define the request mode
            _incidentsFeatureTable.FeatureRequestMode = FeatureRequestMode.ManualCache;

            // When feature table is loaded, populate data
            _incidentsFeatureTable.LoadStatusChanged += OnLoadedPopulateData;

            // Create FeatureLayer that uses the created table
            FeatureLayer incidentsFeatureLayer = new FeatureLayer(_incidentsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(incidentsFeatureLayer);

            // Assign the map to the MapView
            _myMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:32,代码来源:ServiceFeatureTableManualCache.cs


示例19: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(BasemapType.Topographic, 34.056, -117.196, 4);

            // Create uri to the used feature service
            var serviceUri = new Uri(
                "http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0");

            // Initialize a new feature layer
            ServiceFeatureTable myFeatureTable = new ServiceFeatureTable(serviceUri);
            FeatureLayer myFeatureLayer = new FeatureLayer(myFeatureTable);

            // Make sure that the feature layer gets loaded
            await myFeatureLayer.LoadAsync();

            // Add the feature layer to the Map
            myMap.OperationalLayers.Add(myFeatureLayer);

            // Provide used Map to the MapView
            _myMapView.Map = myMap;

            // Hook up the DrawStatusChanged event
            _myMapView.DrawStatusChanged += OnMapViewDrawStatusChanged;

            // Animate the activity spinner
            _activityIndicator.StartAnimating();
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:28,代码来源:DisplayDrawingStatus.cs


示例20: SetUpSymbolLevelsForUSHighways

        /// <summary>
        /// Call this method to apply symbol groups to the featureLayer - one group per value in the renderer.
        /// The first group to be added will be the first group to be drawn
        /// </summary>
        /// <param name="featureLayer"></param>
        private void SetUpSymbolLevelsForUSHighways(FeatureLayer featureLayer) {

            //All of these methods have to be called on the MCT
            if (Module1.OnUIThread)
                throw new CalledOnWrongThreadException();

            CIMBaseLayer baseLayer = featureLayer.GetDefinition();
            //We need CIMGeoFeatureLayerBase because this class controls whether or not we
            //use 'groups' (ie Pro Symbol Levels) with the renderer
            CIMGeoFeatureLayerBase geoFeatureLayer = baseLayer as CIMGeoFeatureLayerBase;

            // assume the unique value renderer was created using the CreateCIMRenderer()
            CIMUniqueValueRenderer uniqueValueRenderer = geoFeatureLayer.Renderer as CIMUniqueValueRenderer;

            CIMSymbolLayerDrawing symbolLayerDrawing = new CIMSymbolLayerDrawing();

            // This flag controls the drawing code and forces it to use defined symbol layers.
            //It must be set 'true'
            symbolLayerDrawing.UseSymbolLayerDrawing = true;

            // setup the symbol layers.
            List<CIMSymbolLayerIdentifier> symbolLayers = new List<CIMSymbolLayerIdentifier>();

            // this will be a for loop that will iterate over the unique value classes and updating the symbol in each class        
            int index = 0;
            foreach (CIMUniqueValueGroup nextGroup in uniqueValueRenderer.Groups) {
                foreach (CIMUniqueValueClass nextClass in nextGroup.Classes) {
                    CIMMultiLayerSymbol multiLayerSymbol = nextClass.Symbol.Symbol as CIMMultiLayerSymbol;
                    if (multiLayerSymbol == null) //This check probably is not needed
                        continue;
                    //Each group must be uniquely named
                    string uniqueName = "Group_" + index.ToString();
                    nextClass.Symbol.SymbolName = uniqueName;

                    for (int i = 0; i < multiLayerSymbol.SymbolLayers.Length; i++)
                        //Assign the unique name to all of the layers in the symbol
                        multiLayerSymbol.SymbolLayers[i].Name = uniqueName;

                    index++;
                    //Assign the name to a 'CIMSymbolLayerIdentifier'. This is the equivalent
                    //of a KeyValuePair in a Dictionary. The Names of each SymbolLayerIdentifier
                    //will be matched up in the renderer to a corresponding symbol (via nextClass.Symbol.SymbolName)
                    //So that each SymbolLayer is associated with a specific symbol for a specific value
                    CIMSymbolLayerIdentifier nextSymbolLayer = new CIMSymbolLayerIdentifier() {
                        SymbolReferenceName = "symbolReferenceName",
                        SymbolLayerName = uniqueName
                    };

                    symbolLayers.Add(nextSymbolLayer);
                    
                }
            }
            //This is where the symbol layers get added to the feature layer definition
            symbolLayerDrawing.SymbolLayers = symbolLayers.ToArray();
            geoFeatureLayer.SymbolLayerDrawing = symbolLayerDrawing;

            // update the featureLayer definition.
            featureLayer.SetDefinition(geoFeatureLayer as  CIMBaseLayer);
        }
开发者ID:ChaitG,项目名称:arcgis-pro-sdk-community-samples,代码行数:64,代码来源:CreateSymbolLevelsOnUSHighways.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# FeatureLayerClass类代码示例发布时间:2022-05-24
下一篇:
C# FeatureDataTable类代码示例发布时间: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