/// <summary> /// Execute is called when user chooses the feature action from the feature actions context menu. Only called if /// CanExecute returned true. /// </summary> public void Execute(DataSource searchAreaDS, client.Graphic searchArea) { try { //Clear any running task _geometryTask.CancelAsync(); //Get the map widget and the map that contains the polygon used to generate the buffer client.Map mwMap = MapWidget.Map; //Define the params to pass to the buffer operation client.Tasks.BufferParameters bufferParameters = CreateBufferParameters(searchArea, mwMap); //Copy the display field of the search area for later use. //Polygon.Attributes[polygonDataSrc.DisplayFieldName] might be null if for example, //user creates a new polygon without specifying its attributes if (searchArea.Attributes[searchAreaDS.DisplayFieldName] == null) { SearchAreaName = ""; } else { SearchAreaName = searchArea.Attributes[searchAreaDS.DisplayFieldName].ToString(); } //Execute the GP tool _geometryTask.BufferAsync(bufferParameters); } catch (Exception) { MessageBox.Show("Error searching for team. Please retry"); } }
private client.Tasks.BufferParameters CreateBufferParameters(client.Graphic feature, client.Map mwMap) { client.Tasks.BufferParameters bufferParameters = new client.Tasks.BufferParameters() { Unit = BufferUnit, BufferSpatialReference = mwMap.SpatialReference, OutSpatialReference = mwMap.SpatialReference, UnionResults = true, }; bufferParameters.Distances.AddRange(new List<double> { BufferDistance }); bufferParameters.Features.AddRange(new List<client.Graphic>() { feature }); return bufferParameters; }
/// <summary> /// This function creates the buffer area from user's selected feature /// </summary> public void Execute(ESRI.ArcGIS.OperationsDashboard.DataSource BufferDS, client.Graphic BufferFeature) { //Clear any running task _geometryTask.CancelAsync(); //Get the map that contains the feature used to generate the buffer client.Map mwMap = mapWidget.Map; //Define the params to pass to the buffer operation client.Tasks.BufferParameters bufferParameters = CreateBufferParameters(BufferFeature, mwMap); //Execute the GP tool _geometryTask.BufferAsync(bufferParameters); }
/// <summary> /// Define the radius where teams will be searched. We hardcoded it to 1 mile for this sample /// </summary> private client.Tasks.BufferParameters CreateBufferParameters(client.Graphic polygon, client.Map mwMap) { client.Tasks.BufferParameters bufferParameters = new client.Tasks.BufferParameters() { Unit = client.Tasks.LinearUnit.SurveyMile, BufferSpatialReference = mwMap.SpatialReference, OutSpatialReference = mwMap.SpatialReference, UnionResults = true, }; bufferParameters.Distances.AddRange(new List <double> { 0.5 }); bufferParameters.Features.AddRange(new List <client.Graphic>() { polygon }); return(bufferParameters); }
/// <summary> /// Define the radius where teams will be searched. We hardcoded it to 1 mile for this sample /// </summary> private client.Tasks.BufferParameters CreateBufferParameters(client.Graphic polygon, client.Map mwMap) { client.Tasks.BufferParameters bufferParameters = new client.Tasks.BufferParameters() { Unit = client.Tasks.LinearUnit.SurveyMile, BufferSpatialReference = mwMap.SpatialReference, OutSpatialReference = mwMap.SpatialReference, UnionResults = true, }; bufferParameters.Distances.AddRange(new List<double> { 0.5 }); bufferParameters.Features.AddRange(new List<client.Graphic>() { polygon }); return bufferParameters; }