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

C# QueryTask类代码示例

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

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



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

示例1: MyDrawSurface_DrawComplete

        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            ResultsDisplay.Visibility = Visibility.Collapsed;
            MyDrawObject.IsEnabled = false;
            selectionGraphicslayer.ClearGraphics();

            QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");
            queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
            queryTask.Failed += QueryTask_Failed;

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");
            resultFeaturesBinding.Source = queryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);
            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            // Specify fields to return from query
            query.OutFields.AddRange(new string[] { "STATE_NAME", "SUB_REGION", "STATE_FIPS", "STATE_ABBR", "POP2000", "POP2007" });
            query.Geometry = args.Geometry;

            // Return geometry with result features
            query.ReturnGeometry = true;
            query.OutSpatialReference = MyMap.SpatialReference;

            queryTask.ExecuteAsync(query);
        }
开发者ID:ahthakore,项目名称:arcgis-samples-silverlight,代码行数:26,代码来源:SpatialQuery.xaml.cs


示例2: dispatcherTimer_Tick

        void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            _infoWindow.IsOpen = false;

            QueryTask queryTask =
                new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/4");
            Query query = new Query()
            {
                Geometry = _tapPoint,
                OutSpatialReference = MyMap.SpatialReference
            };
            query.OutFields.Add("NAME");

            queryTask.ExecuteCompleted += (s, evt) =>
            {
                if (evt.FeatureSet.Features.Count > 0)
                {
                    _infoWindow.Anchor = _tapPoint;
                    (_infoWindow.Content as TextBlock).Text = evt.FeatureSet.Features[0].Attributes["NAME"] as string;
                    _infoWindow.IsOpen = true;
                }
            };
            queryTask.ExecuteAsync(query);
            _dispatcherTimer.Stop();
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:25,代码来源:InfoWindowDynamic.xaml.cs


示例3: doQuery

        private async Task doQuery()
        {
            // Clear previous results and show busy indicator
            ResultsItemsControl.ItemsSource = null;
            ProgressBar.Visibility = Visibility.Visible;

            // Create task to query for states
            QueryTask queryTask =
                new QueryTask(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"));

            // Specify query parameters.  Query for the inptu text and include all fields in the results
            Query query = new Query(StateNameTextBox.Text);
            query.OutFields.Add("*");

            try
            {
                // Do the query and update the results
                var result = await queryTask.ExecuteAsync(query);
                ResultsItemsControl.ItemsSource = result.FeatureSet.Features;
            }
            catch (TaskCanceledException taskCanceledEx)
            {
                System.Diagnostics.Debug.WriteLine(taskCanceledEx.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            // Hide busy indicator
            ProgressBar.Visibility = Visibility.Collapsed;
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:32,代码来源:QueryOnly.xaml.cs


示例4: QueryImageTiles

        // Query the image service for sample tiles
        private async Task QueryImageTiles()
        {
            try
            {
                var envelope = await MyMapView.Editor.RequestShapeAsync(DrawShape.Envelope) as Envelope;

				var imageLayer = MyMapView.Map.Layers["ImageLayer"] as ArcGISImageServiceLayer;
                QueryTask queryTask = new QueryTask(new Uri(imageLayer.ServiceUri));
                Query query = new Query(envelope)
                {
                    OutFields = new OutFields(new string[] { "Name", "LowPS" }),
                    ReturnGeometry = true,
                    OutSpatialReference = MyMapView.SpatialReference,
                    Where = "Category = 1"
                };

                var result = await queryTask.ExecuteAsync(query);

				_graphicsOverlay.Graphics.AddRange(result.FeatureSet.Features.OfType<Graphic>());
            }
            catch (Exception ex)
            {
				var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
			}
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:26,代码来源:GetSamples.xaml.cs


示例5: mapView1_Tapped_1

         private async void mapView1_Tapped_1(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            var mp = e.Location;
            Graphic g = new Graphic() { Geometry = mp };
            var graphicsLayer = mapView1.Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.Graphics.Add(g);

            var bufferResult = GeometryEngine.Buffer(mp, 100);
            var bufferLayer = mapView1.Map.Layers["BufferLayer"] as GraphicsLayer;
            bufferLayer.Graphics.Add(new Graphic() { Geometry = bufferResult });


            var queryTask = new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
            var query = new Query("1=1")
            {
                ReturnGeometry = true,
                OutSpatialReference = mapView1.SpatialReference,
                Geometry = bufferResult
            };
            query.OutFields.Add("OWNERNME1");

            try
            {
                var queryResult = await queryTask.ExecuteAsync(query);
                if (queryResult != null && queryResult.FeatureSet != null)
                {
                    var resultLayer = mapView1.Map.Layers["MyResultsGraphicsLayer"] as GraphicsLayer;
                    resultLayer.Graphics.AddRange(queryResult.FeatureSet.Features);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:35,代码来源:QueryWithBuffer.xaml.cs


示例6: mapView_MapViewTapped

        // Select a set of wells near the click point
        private async void mapView_MapViewTapped(object sender, MapViewInputEventArgs e)
        {
            try
            {
                _wellsLayer.Graphics.Clear();
                wellsGrid.ItemsSource = relationshipsGrid.ItemsSource = null;

                QueryTask queryTask =
                    new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));

                Query query = new Query("1=1")
                {
                    Geometry = Expand(mapView.Extent, e.Location, 0.01),
                    ReturnGeometry = true,
                    OutSpatialReference = mapView.SpatialReference,
                    OutFields = OutFields.All
                };

                var result = await queryTask.ExecuteAsync(query);
                if (result.FeatureSet.Features != null && result.FeatureSet.Features.Count > 0)
                {
                    _wellsLayer.Graphics.AddRange(result.FeatureSet.Features);
                    wellsGrid.ItemsSource = result.FeatureSet.Features;
                    resultsPanel.Visibility = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:32,代码来源:QueryRelatedTables.xaml.cs


示例7: mapView1_Loaded

        async void mapView1_Loaded(object sender, RoutedEventArgs e)
        {
            if (originalGraphicsLayer != null && originalGraphicsLayer.Graphics.Count == 0)
            {
                QueryTask queryTask = new QueryTask(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/1"));
                Query query = new Query("NAME = 'Mississippi'");
                query.ReturnGeometry = true;
                query.OutSpatialReference = mapView1.SpatialReference;


                var results = await queryTask.ExecuteAsync(query, CancellationToken.None);
                foreach (Graphic g in results.FeatureSet.Features)
                {
                    g.Symbol = defaultLineSymbol;
                    g.Geometry.SpatialReference = mapView1.SpatialReference;
                    originalGraphicsLayer.Graphics.Add(g);

                    foreach (var pc in (g.Geometry as Polyline).Paths)
                    {
                        foreach (var point in pc)
                        {
                            var vertice = new Graphic()
                            {
                                Symbol = defaultMarkerSymbol,
                                Geometry = new MapPoint(point.X, point.Y)
                            };
                            originalGraphicsLayer.Graphics.Add(vertice);
                        }
                    }
                }
                GeneralizeButton.IsEnabled = true;
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:33,代码来源:Generalize.xaml.cs


示例8: QueryImageTiles

        // Query the image service for sample tiles
        private async Task QueryImageTiles()
        {
            try
            {
                var envelope = await MyMapView.Editor.RequestShapeAsync(DrawShape.Envelope) as Envelope;

                QueryTask queryTask = new QueryTask(
                    new Uri("http://servicesbeta.esri.com/ArcGIS/rest/services/Portland/PortlandAerial/ImageServer/query"));

                Query query = new Query(envelope)
                {
                    OutFields = new OutFields(new string[] { "Name", "LowPS" }),
                    ReturnGeometry = true,
                    OutSpatialReference = MyMapView.SpatialReference,
                    Where = "Category = 1"
                };

                var result = await queryTask.ExecuteAsync(query);

				_graphicsOverlay.Graphics.AddRange(result.FeatureSet.Features.OfType<Graphic>());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sample Error");
            }
        }
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:27,代码来源:GetSamples.xaml.cs


示例9: RunQuery

        private async void RunQuery()
        {
            QueryTask queryTask =
                new QueryTask(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2"));

            Query query = new Query("1=1")
             {
                 GroupByFieldsForStatistics = new List<string> { "sub_region" },
                 OutStatistics = new List<OutStatistic> { 
                    new OutStatistic(){
                        OnStatisticField = "pop2000",
                        OutStatisticFieldName = "subregionpopulation",
                        StatisticType = StatisticType.Sum
                    },
                    new OutStatistic(){
                        OnStatisticField = "sub_region",
                        OutStatisticFieldName = "numberofstates",
                        StatisticType = StatisticType.Count
                    }
                 }
             };
            try
            {
                var result = await queryTask.ExecuteAsync(query);
                if (result.FeatureSet.Features != null && result.FeatureSet.Features.Count > 0)
                {
                    ResultGrid.ItemsSource = result.FeatureSet.Features;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:Statistics.xaml.cs


示例10: MyMapView_MapViewTapped

		// Select a set of wells near the click point
		private async void MyMapView_MapViewTapped(object sender, MapViewInputEventArgs e)
		{
			try
			{
				_wellsOverlay.Graphics.Clear();
				wellsGrid.ItemsSource = relationshipsGrid.ItemsSource = null;

				QueryTask queryTask =
					new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));
				
				// Get current viewpoints extent from the MapView
				var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
				var viewpointExtent = currentViewpoint.TargetGeometry.Extent;

				Query query = new Query("1=1")
				{
					Geometry = Expand(viewpointExtent, e.Location, 0.01),
					ReturnGeometry = true,
					OutSpatialReference = MyMapView.SpatialReference,
					OutFields = OutFields.All
				};

				var result = await queryTask.ExecuteAsync(query);
				if (result.FeatureSet.Features != null && result.FeatureSet.Features.Count > 0)
				{
					_wellsOverlay.Graphics.AddRange(result.FeatureSet.Features.OfType<Graphic>());
					wellsGrid.ItemsSource = result.FeatureSet.Features;
					resultsPanel.Visibility = Visibility.Visible;
				}
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
			}
		}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:36,代码来源:QueryRelatedRecords.xaml.cs


示例11: mapView_MapViewTapped

        // buffer the click point, query the map service with the buffer geometry as the filter and add graphics to the map
        private async void mapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            try
            {
                graphicsLayer.Graphics.Add(new Graphic(e.Location));

                var bufferResult = GeometryEngine.Buffer(e.Location, 100);
                bufferLayer.Graphics.Add(new Graphic(bufferResult));

                var queryTask = new QueryTask(
                    new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
                var query = new Query("1=1")
                {
                    ReturnGeometry = true,
                    OutSpatialReference = mapView.SpatialReference,
                    Geometry = bufferResult
                };
                query.OutFields.Add("OWNERNME1");

                var queryResult = await queryTask.ExecuteAsync(query);
                if (queryResult != null && queryResult.FeatureSet != null)
                {
                    parcelLayer.Graphics.AddRange(queryResult.FeatureSet.Features);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Spatial Query Sample");
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:31,代码来源:SpatialQuery.xaml.cs


示例12: RunQuery

        private void RunQuery()
        {
            parcelsGraphicsLayer.Graphics.Clear();

            ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query()
            {
                ReturnGeometry = true,
                OutSpatialReference = MyMap.SpatialReference,
                Where = string.Format("OWNER_NAME LIKE '%{0}%'", SearchTextBox.Text),
                OrderByFields = new List<OrderByField>() { new OrderByField("OWNER_NAME", SortOrder.Ascending) }
            };

            query.OutFields.Add("OWNER_NAME,PARCEL_ID,ZONING,DEED_DATE");

            QueryTask queryTask = new QueryTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/MontgomeryQuarters/MapServer/1");
            queryTask.ExecuteCompleted += (s, a) =>
            {
                foreach (Graphic g in a.FeatureSet.Features)
                {
                    parcelsGraphicsLayer.Graphics.Add(g);
                    FeatureListBox.Items.Add(g);
                }

                (ApplicationBar.Buttons[0] as IApplicationBarIconButton).IsEnabled = true;
                FeatureChoicesPage.Visibility = Visibility.Visible;
            };
            FeatureListBox.Items.Clear();
            queryTask.ExecuteAsync(query);
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:29,代码来源:OrderByFieldQuery.xaml.cs


示例13: initializeComboBox

        private async Task initializeComboBox()
        {
            if (QueryListPicker.ItemsSource != null) // already initialized
                return;

            // Construct the query to return all features (where clause of "1=1") and only the state name
            Query query = new Query("1=1") { ReturnGeometry = false };
            query.OutFields.Add("STATE_NAME");

            QueryTask queryTask = new QueryTask(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"));
            try
            {
                // Do the query
                var result = await queryTask.ExecuteAsync(query);

                // Make sure results were received
                if (result != null && result.FeatureSet != null && result.FeatureSet.Features != null)
                {
                    // Add the states to the list picker, ordered by state name
                    QueryListPicker.ItemsSource = result.FeatureSet.Features.OrderBy(
                        x => x.Attributes["STATE_NAME"]);

                    // Enable the list picker and hide the busy indicator
                    QueryListPicker.IsEnabled = true;
                    progress.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:32,代码来源:AttributeQuery.xaml.cs


示例14: RunQuery

        private async Task RunQuery(IGeometry geometry)
        {
            var l = MyMap.Layers["GraphicsWellsLayer"] as GraphicsLayer;
            l.Graphics.Clear();
            QueryTask queryTask =
                new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));

            ESRI.ArcGIS.Runtime.Tasks.Query query = new ESRI.ArcGIS.Runtime.Tasks.Query()
             {
                Geometry = geometry,
                ReturnGeometry = true,
                OutSpatialReference = MyMap.SpatialReference,
                OutFields = OutFields.All
             };
            try
            {
                var result = await queryTask.ExecuteAsync(query);
                if (result.FeatureSet.Features != null && result.FeatureSet.Features.Count > 0)
                {
                    ResultsGrid.ItemsSource = result.FeatureSet.Features;
                        l.Graphics.AddRange(from g in result.FeatureSet.Features select g);
                }
            }
            catch (Exception ex)            
            {
                return;
            }
        }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:28,代码来源:QueryRelatedRecords.xaml.cs


示例15: MyMap_Tapped_1

        private async void MyMap_Tapped_1(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            var mp = MyMap.ScreenToMap(e.GetPosition(MyMap));
            Graphic g = new Graphic() { Geometry = mp };
            var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.Graphics.Add(g);

            var bufferResult = GeometryEngine.Buffer(mp, 100);
            var bufferLayer = MyMap.Layers["BufferLayer"] as GraphicsLayer;
            bufferLayer.Graphics.Add(new Graphic() { Geometry = bufferResult });


            var queryTask = new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
            var query = new ESRI.ArcGIS.Runtime.Tasks.Query()
            {
                ReturnGeometry = true,
                OutSpatialReference = MyMap.SpatialReference,
                Geometry = bufferResult
            };
            query.OutFields.Add("OWNERNME1");

            try
            {
                var queryResult = await queryTask.ExecuteAsync(query);
                if (queryResult != null && queryResult.FeatureSet != null)
                {
                    var resultLayer = MyMap.Layers["MyResultsGraphicsLayer"] as GraphicsLayer;
                    resultLayer.Graphics.AddRange(queryResult.FeatureSet.Features);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:35,代码来源:QueryWithBuffer.xaml.cs


示例16: WellsGrid_SelectionChanged

		// Query for rows related to the selected well in the wells list view
		private async void WellsGrid_SelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
		{
			try
			{
				if (e.AddedItems != null && e.AddedItems.Count > 0)
				{
					QueryTask queryTask =
					   new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));

					//Relationship query
					var objectIds = e.AddedItems.OfType<Graphic>()
						.Select(g => Convert.ToInt64(g.Attributes["OBJECTID"]));

					RelationshipParameters parameters = new RelationshipParameters(new List<long>(objectIds), 3)
					{
						OutSpatialReference = MyMapView.SpatialReference
					};

					parameters.OutFields.AddRange(new string[] { "OBJECTID, API_NUMBER, ELEVATION, FORMATION, TOP" });

					var result = await queryTask.ExecuteRelationshipQueryAsync(parameters);
					relationshipsGrid.ItemsSource = result.RelatedRecordGroups.FirstOrDefault().Value;
				}
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
			}
		}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:QueryRelatedRecords.xaml.cs


示例17: LoadParcelsAsync

        // Load parcels from map service
        private async Task LoadParcelsAsync()
        {
            var queryTask = new QueryTask(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1"));
            var query = new Query(mapView.Extent) { ReturnGeometry = true, OutSpatialReference = mapView.SpatialReference, OutFields = new OutFields(new List<string> { "Shape" }) };
            var result = await queryTask.ExecuteAsync(query);

            parcelLayer.Graphics.Clear();
            parcelLayer.Graphics.AddRange(result.FeatureSet.Features);
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:10,代码来源:OffsetGeometry.xaml.cs


示例18: QueryRelatedRecords

        public QueryRelatedRecords()
        {
            InitializeComponent();

            graphicsLayer = MyMap.Layers["GraphicsWellsLayer"] as GraphicsLayer;

            queryTask = new QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0");
            queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
            queryTask.ExecuteRelationshipQueryCompleted += QueryTask_ExecuteRelationshipQueryCompleted;
            queryTask.Failed += QueryTask_Failed;
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:11,代码来源:QueryRelatedRecords.xaml.cs


示例19: BufferQueryTaskAsync

        public BufferQueryTaskAsync()
        {
            InitializeComponent();

            _geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

            _queryTask = new QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2");

            _pointAndBufferGraphicsLayer = MyMap.Layers["MyBufferPointGraphicsLayer"] as GraphicsLayer;
            _resultsGraphicsLayer = MyMap.Layers["MyResultsGraphicsLayer"] as GraphicsLayer;
        }
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:11,代码来源:BufferQueryTaskAsync.xaml.cs


示例20: MyDrawObject_DrawComplete

        private async void MyDrawObject_DrawComplete(object sender, DrawEventArgs args)
        {
            try
            {
                _myDrawObject.IsEnabled = false;

                if (_cts != null)
                    _cts.Cancel();

                _cts = new CancellationTokenSource();

                QueryTask queryTask =
                      new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1");
                Query query = new Query()
                {
                    Geometry = args.Geometry,
                    ReturnGeometry = true,
                    OutSpatialReference = MyMap.SpatialReference
                };

                QueryResult parcelsToIntersectResult = await queryTask.ExecuteTaskAsync(query, _cts.Token);

                List<Graphic> graphicList = new List<Graphic>();
                graphicList.Add(new Graphic() { Geometry = args.Geometry });
                SimplifyResult simplifiedIntersectGeometryResult = await _geometryService.SimplifyTaskAsync(graphicList, _cts.Token);

                IntersectResult intersectedParcelsResult = await _geometryService.IntersectTaskAsync(parcelsToIntersectResult.FeatureSet.ToList(), simplifiedIntersectGeometryResult.Results[0].Geometry, _cts.Token);

                Random random = new Random();
                foreach (Graphic g in intersectedParcelsResult.Results)
                {
                    SimpleFillSymbol symbol = new SimpleFillSymbol()
                    {
                        Fill = new System.Windows.Media.SolidColorBrush(
                            System.Windows.Media.Color.FromArgb(255, (byte)random.Next(0, 255), (byte)random.Next(0, 255),
                            (byte)random.Next(0, 255))),
                        BorderBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black),
                        BorderThickness = 1
                    };
                    g.Symbol = symbol;
                    _intersectGraphicsLayer.Graphics.Add(g);
                }
            }
            catch (Exception ex)
            {
                if (ex is ServiceException)
                {
                    MessageBox.Show(String.Format("{0}: {1}", (ex as ServiceException).Code.ToString(), (ex as ServiceException).Details[0]), "Error", MessageBoxButton.OK);
                    return;
                }
            }
        }
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:52,代码来源:IntersectTaskAsync.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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