Пример #1
0
        void gp_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            _graphicsLayer.Graphics.Clear();
            ResourceDictionary mydictionary = new ResourceDictionary();

            mydictionary.Source = new Uri("/AirCraftRouteGenerationLineAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);
            //client.SimpleRenderer simRen = mydictionary["RouteRenderer"] as client.SimpleRenderer;

            client.GraphicsLayer gLayer = _mapWidget.Map.Layers["ComputedLine"] as client.GraphicsLayer;
            if (gLayer == null)
            {
                gLayer    = new client.GraphicsLayer();
                gLayer.ID = "ComputedLine";
                //gLayer.Renderer = simRen;
                //client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                //if (aclyrs.Count() > 0)
                _mapWidget.Map.Layers.Add(gLayer);
            }
            GPFeatureRecordSetLayer gpFLayer = e.Parameter as GPFeatureRecordSetLayer;

            if (gpFLayer.FeatureSet.Features.Count > 0)
            {
                foreach (client.Graphic g in gpFLayer.FeatureSet.Features)
                {
                    g.Symbol = mydictionary["BasicLineSymbol_Green_3"] as client.Symbols.LineSymbol;
                    gLayer.Graphics.Add(g);
                }
            }
        }
        void _geoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs ev1)
        {
            if (ev1.Parameter is GPDataFile)
            {
                GPDataFile ClipResultFile = ev1.Parameter as GPDataFile;

                if (String.IsNullOrEmpty(ClipResultFile.Url))
                {
                    return;
                }

                MessageBoxResult res = MessageBox.Show("Data file created. Would you like to download the file?", "Geoprocessing Task Success", MessageBoxButton.OKCancel);
                if (res == MessageBoxResult.OK)
                {
                    WebClient webClient = new WebClient();
                    webClient.OpenReadCompleted += (s, ev) =>
                    {
                        _streamedDataFile         = ev.Result;
                        SaveFileButton.Visibility = Visibility.Visible;
                        ProcessingTextBlock.Text  = "Download completed.  Click on 'Save data file' button to save to disk.";
                    };
                    webClient.OpenReadAsync(new Uri((ev1.Parameter as GPDataFile).Url), UriKind.Absolute);
                }
                else
                {
                    ProcessingTextBlock.Text       = "";
                    ProcessingTextBlock.Visibility = Visibility.Collapsed;
                    SaveFileButton.Visibility      = Visibility.Collapsed;
                }
            }
            _processingTimer.Stop();
        }
Пример #3
0
        void findNearestWSGPTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            try
            {
                GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
                foreach (client.Graphic graphic in gpLayer.FeatureSet.Features)
                {
                    double distance = Convert.ToDouble(graphic.Attributes["NEAR_DIST"]) * 69.09;
                    _weatherStationDistanceInfo = "Distance to weather station: " + distance.ToString("0.000") + " miles";

                    //get the wind direction from the nearest weather station...
                    int fid = Convert.ToInt32(graphic.Attributes["NEAR_FID"]);

                    if (_windDirectionLayer != null)
                    {
                        QueryTask windDirectionQueryTask = new QueryTask(_windDirectionLayer.Url);
                        windDirectionQueryTask.ExecuteCompleted += WindDirectionQueryTask_ExecuteCompleted;
                        windDirectionQueryTask.Failed           += QueryTask_Failed;

                        ESRI.ArcGIS.Client.Tasks.Query windDirectionQuery = new ESRI.ArcGIS.Client.Tasks.Query();
                        windDirectionQuery.OutFields.AddRange(new string[] { "*" });
                        windDirectionQuery.Where = "OBJECTID =" + fid;

                        windDirectionQueryTask.ExecuteAsync(windDirectionQuery);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                MessageBox.Show("Error processing ERG Task Results!", "Error");
                return;
            }
        }
Пример #4
0
        /// <summary>
        /// Raises the <see cref="E:Geocrest.Data.Sources.Gis.GeoprocessingTask.GetResultDataCompleted"/> event.
        /// </summary>
        /// <param name="args">The <see cref="T:Geocrest.Model.ArcGIS.Tasks.GPParameterEventArgs"/> instance containing the event data.</param>
        private void OnGetResultDataComplete(GPParameterEventArgs args)
        {
            EventHandler <GPParameterEventArgs> handler = GetResultDataCompleted;

            if (handler != null)
            {
                handler(this, args);
            }
        }
 private void GPService_GetResultDataCompleted(object sender, GPParameterEventArgs e)
 {
     if (e.Parameter is GPDataFile)
     {
         lnkExtractionOutput.Visibility = Visibility.Visible;
         txtJobErrorMessage.Visibility  = Visibility.Collapsed;
         string dataUrl = (e.Parameter as GPDataFile).Url;
         lnkExtractionOutput.NavigateUri = new Uri(dataUrl, UriKind.Absolute);
     }
 }
        void GeoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            if (e.Parameter is GPFeatureRecordSetLayer)
            {
                GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;

                int count = 0;
                foreach (Graphic graphic in gpLayer.FeatureSet.Features)
                {
                    graphic.Symbol = bufferSymbols[count++];
                    graphicsLayer.Graphics.Add(graphic);
                }
            }
        }
Пример #7
0
        void GeoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            if (e.Parameter is GPFeatureRecordSetLayer)
            {
                GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;

                int count = 0;
                foreach (Graphic graphic in gpLayer.FeatureSet.Features)
                {
                    graphic.Symbol = bufferSymbols[count++];
                    graphicsLayer.Graphics.Add(graphic);
                }
            }
        }
Пример #8
0
        void gp_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            try
            {
                ResourceDictionary mydictionary = new ResourceDictionary();
                mydictionary.Source = new Uri("/SatelliteEphemerisGenerationAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);

                GPFeatureRecordSetLayer gpFLayer = e.Parameter as GPFeatureRecordSetLayer;
                if (gpFLayer.FeatureSet.Features.Count > 0)
                {
                    foreach (client.Graphic g in gpFLayer.FeatureSet.Features)
                    {
                        if (e.UserState.ToString() == "Footprints")
                        {
                            g.Symbol = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol;
                            _graphicsLayerPoly.Graphics.Add(g);
                        }
                        else if (e.UserState.ToString() == "Lines")
                        {
                            g.Symbol = mydictionary["BasicLineSymbol_Green_3"] as client.Symbols.SimpleLineSymbol;
                            _graphicsLayerLine.Graphics.Add(g);
                        }
                        else if (e.UserState.ToString() == "Points")
                        {
                            g.Symbol = mydictionary["BluePin"] as client.Symbols.MarkerSymbol;
                            _graphicsLayerPoint.Graphics.Add(g);
                        }
                    }
                }
                if (e.UserState.ToString() == "Footprints")
                {
                    gp.GetResultDataAsync(_jobid, "EphemerisLines", "Lines");
                }
                else if (e.UserState.ToString() == "Lines")
                {
                    gp.GetResultDataAsync(_jobid, "EphemerisPoints", "Points");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in GetResultDataCompleted, UserState: " + e.UserState.ToString());
                MessageBox.Show("Error in GetResultDataCompleted, Exception: " + ex.Message);
            }
        }
Пример #9
0
        void geoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs gpParameterEventArgs)
        {
            // Get the result features from the parameter
            GPFeatureRecordSetLayer gpLayer;

            gpLayer = gpParameterEventArgs.Parameter as GPFeatureRecordSetLayer;

            // Check the parameter name, reproject and add to the appropriate graphics layer.
            // again - two separate tasks are created allowing them to run conncurrently.
            switch (gpParameterEventArgs.Parameter.Name)
            {
            case "Sysvalves_Layer":
                GeometryService valvesProjectTask =
                    new GeometryService(localGeometryService.UrlGeometryService);

                valvesProjectTask.ProjectCompleted += (sender2, graphicsEventArgs) =>
                {
                    valvesGraphicsLayer.Graphics.AddRange(graphicsEventArgs.Results);
                };
                valvesProjectTask.ProjectAsync(gpLayer.FeatureSet.Features,
                                               new SpatialReference(3857));
                break;

            case "DistribMains_Layer":
                GeometryService mainsProjectTask =
                    new GeometryService(localGeometryService.UrlGeometryService);

                mainsProjectTask.ProjectCompleted += (sender2, graphicsEventArgs) =>
                {
                    mainsGraphicsLayer.Graphics.AddRange(graphicsEventArgs.Results);
                };
                mainsProjectTask.ProjectAsync(gpLayer.FeatureSet.Features,
                                              new SpatialReference(3857));
                break;
            }
        }
        void _geoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs ev1)
        {
            if (ev1.Parameter is GPDataFile)
            {
                GPDataFile ClipResultFile = ev1.Parameter as GPDataFile;

                if (String.IsNullOrEmpty(ClipResultFile.Url))
                    return;

                MessageBoxResult res = MessageBox.Show("Data file created. Would you like to download the file?", "Geoprocessing Task Success", MessageBoxButton.OKCancel);
                if (res == MessageBoxResult.OK)
                {
                    WebClient webClient = new WebClient();
                    webClient.OpenReadCompleted += (s, ev) =>
                    {
                        _streamedDataFile = ev.Result;
                        SaveFileButton.Visibility = Visibility.Visible;
                        ProcessingTextBlock.Text = "Download completed.  Click on 'Save data file' button to save to disk.";
                    };
                    webClient.OpenReadAsync(new Uri((ev1.Parameter as GPDataFile).Url), UriKind.Absolute);
                }
                else
                {
                    ProcessingTextBlock.Text = "";
                    ProcessingTextBlock.Visibility = Visibility.Collapsed;
                    SaveFileButton.Visibility = Visibility.Collapsed;
                }
            }
            _processingTimer.Stop();
        }
        void gp_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            _graphicsLayer.Graphics.Clear();
            ResourceDictionary mydictionary = new ResourceDictionary();
            mydictionary.Source = new Uri("/AirCraftRouteGenerationLineAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);
            //client.SimpleRenderer simRen = mydictionary["RouteRenderer"] as client.SimpleRenderer;

            client.GraphicsLayer gLayer = _mapWidget.Map.Layers["ComputedLine"] as client.GraphicsLayer;
            if (gLayer == null)
            {
                gLayer = new client.GraphicsLayer();
                gLayer.ID = "ComputedLine";
                //gLayer.Renderer = simRen;
                //client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                //if (aclyrs.Count() > 0)
                _mapWidget.Map.Layers.Add(gLayer);
            }
            GPFeatureRecordSetLayer gpFLayer = e.Parameter as GPFeatureRecordSetLayer;
            if (gpFLayer.FeatureSet.Features.Count > 0)
            {
                foreach (client.Graphic g in gpFLayer.FeatureSet.Features)
                {
                    g.Symbol = mydictionary["BasicLineSymbol_Green_3"] as client.Symbols.LineSymbol;
                    gLayer.Graphics.Add(g);
                }
            }
        }
Пример #12
0
        void geoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs gpParameterEventArgs)
        {
            // Get the result features from the parameter
            GPFeatureRecordSetLayer gpLayer;
            gpLayer = gpParameterEventArgs.Parameter as GPFeatureRecordSetLayer;

            // Check the parameter name, reproject and add to the appropriate graphics layer.
            // again - two separate tasks are created allowing them to run conncurrently.
            switch (gpParameterEventArgs.Parameter.Name)
            {
                case "Sysvalves_Layer":
                    GeometryService valvesProjectTask =
                        new GeometryService(localGeometryService.UrlGeometryService);

                    valvesProjectTask.ProjectCompleted += (sender2, graphicsEventArgs) =>
                    {
                        valvesGraphicsLayer.Graphics.AddRange(graphicsEventArgs.Results);
                    };
                    valvesProjectTask.ProjectAsync(gpLayer.FeatureSet.Features,
                        new SpatialReference(3857));
                    break;
                case "DistribMains_Layer":
                    GeometryService mainsProjectTask =
                        new GeometryService(localGeometryService.UrlGeometryService);

                    mainsProjectTask.ProjectCompleted += (sender2, graphicsEventArgs) =>
                    {
                        mainsGraphicsLayer.Graphics.AddRange(graphicsEventArgs.Results);
                    };
                    mainsProjectTask.ProjectAsync(gpLayer.FeatureSet.Features,
                        new SpatialReference(3857));
                    break;
            }
        }
Пример #13
0
        // ***********************************************************************************
        // * ..ERGChemcial GP Tool Job Completed Successfully... Get the Result
        // ***********************************************************************************
        void ergGPTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            try
            {
                if (e.Parameter.Name == "output_areas")
                {
                    _ergZoneGraphicsLayer.Graphics.Clear();
                    ESRI.ArcGIS.Client.Geometry.Polygon sharedPolygon = null;

                    //add the erg zone polygons on the map
                    GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
                    foreach (client.Graphic graphic in gpLayer.FeatureSet.Features)
                    {
                        string zone = graphic.Attributes["ERGZone"].ToString();
                        switch (zone)
                        {
                        case "Initial Isolation Zone":
                            graphic.Symbol = _mydictionary["sfsZone2"] as client.Symbols.SimpleFillSymbol;
                            break;

                        case "Protective Action Zone":
                            graphic.Symbol = _mydictionary["sfsZone1"] as client.Symbols.SimpleFillSymbol;
                            break;

                        case "Combined Zone":
                            graphic.Symbol = _mydictionary["sfsZone3"] as client.Symbols.SimpleFillSymbol;
                            sharedPolygon  = (ESRI.ArcGIS.Client.Geometry.Polygon)graphic.Geometry;
                            break;
                        }
                        _ergZoneGraphicsLayer.Graphics.Add(graphic);
                    }
                    //zoom to the result
                    if (chkZoomToMap.IsChecked == true)
                    {
                        _mapWidget.Map.Extent = sharedPolygon.Extent.Expand(1.2);
                    }

                    selectFeaturesOnTheMap(sharedPolygon);
                    Geoprocessor geoprocessorTask = sender as Geoprocessor;
                    geoprocessorTask.GetResultDataAsync(_gpJobId, "output_lines");
                }
                else
                {
                    //add the erg zone polygons on the map
                    GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
                    foreach (client.Graphic graphic in gpLayer.FeatureSet.Features)
                    {
                        string lineType = graphic.Attributes["LineType"].ToString();
                        switch (lineType)
                        {
                        case "Arc":
                            graphic.Symbol = _mydictionary["ArcLineSymbol"] as client.Symbols.SimpleLineSymbol;
                            break;

                        case "Radial":
                            graphic.Symbol = _mydictionary["RadialSymbol"] as client.Symbols.SimpleLineSymbol;
                            break;
                        }
                        _ergZoneGraphicsLayer.Graphics.Add(graphic);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                MessageBox.Show("Error processing ERG Task Results!", "Error");
                return;
            }
        }
        void findNearestWSGPTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            try
            {
                GPFeatureRecordSetLayer gpLayer =e.Parameter as GPFeatureRecordSetLayer; 
                foreach (client.Graphic graphic in gpLayer.FeatureSet.Features)
                {
                    double distance = Convert.ToDouble(graphic.Attributes["NEAR_DIST"]) * 69.09;
                    _weatherStationDistanceInfo = "Distance to weather station: " + distance.ToString("0.000") + " miles";

                    //get the wind direction from the nearest weather station... 
                    int fid = Convert.ToInt32(graphic.Attributes["NEAR_FID"]);

                    if (_windDirectionLayer != null)
                    {
                        QueryTask windDirectionQueryTask = new QueryTask(_windDirectionLayer.Url);
                        windDirectionQueryTask.ExecuteCompleted += WindDirectionQueryTask_ExecuteCompleted;
                        windDirectionQueryTask.Failed += QueryTask_Failed;

                        ESRI.ArcGIS.Client.Tasks.Query windDirectionQuery = new ESRI.ArcGIS.Client.Tasks.Query();
                        windDirectionQuery.OutFields.AddRange(new string[] { "*" });
                        windDirectionQuery.Where = "OBJECTID =" + fid;

                        windDirectionQueryTask.ExecuteAsync(windDirectionQuery);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                MessageBox.Show("Error processing ERG Task Results!", "Error");
                return;
            }
        }
        // ***********************************************************************************
        // * ..ERGChemcial GP Tool Job Completed Successfully... Get the Result
        // ***********************************************************************************
        void ergGPTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
        {
            try
            {
                if (e.Parameter.Name == "output_areas")
                {
                    _ergZoneGraphicsLayer.Graphics.Clear();
                    ESRI.ArcGIS.Client.Geometry.Polygon sharedPolygon = null;

                    //add the erg zone polygons on the map
                    GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
                    foreach (client.Graphic graphic in gpLayer.FeatureSet.Features)
                    {
                        string zone = graphic.Attributes["ERGZone"].ToString();
                        switch (zone)
                        {
                            case "Initial Isolation Zone":
                                graphic.Symbol = _mydictionary["sfsZone2"] as client.Symbols.SimpleFillSymbol;
                                break;
                            case "Protective Action Zone":
                                graphic.Symbol = _mydictionary["sfsZone1"] as client.Symbols.SimpleFillSymbol;
                                break;
                            case "Combined Zone":
                                graphic.Symbol = _mydictionary["sfsZone3"] as client.Symbols.SimpleFillSymbol;
                                sharedPolygon = (ESRI.ArcGIS.Client.Geometry.Polygon)graphic.Geometry;
                                break;
                        }
                        _ergZoneGraphicsLayer.Graphics.Add(graphic);
                    }
                    //zoom to the result
                    if (chkZoomToMap.IsChecked == true)
                        _mapWidget.Map.Extent = sharedPolygon.Extent.Expand(1.2);

                    selectFeaturesOnTheMap(sharedPolygon);
                    Geoprocessor geoprocessorTask = sender as Geoprocessor;
                    geoprocessorTask.GetResultDataAsync(_gpJobId, "output_lines");
                }
                else
                {
                    //add the erg zone polygons on the map
                    GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
                    foreach (client.Graphic graphic in gpLayer.FeatureSet.Features)
                    {
                        string lineType = graphic.Attributes["LineType"].ToString();
                        switch (lineType)
                        {
                            case "Arc":
                                graphic.Symbol = _mydictionary["ArcLineSymbol"] as client.Symbols.SimpleLineSymbol;
                                break;
                            case "Radial":
                                graphic.Symbol = _mydictionary["RadialSymbol"] as client.Symbols.SimpleLineSymbol;
                                break;
                        }
                        _ergZoneGraphicsLayer.Graphics.Add(graphic);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                MessageBox.Show("Error processing ERG Task Results!", "Error");
                return;
            }
        }