Ejemplo n.º 1
0
        // Create a unique value renderer by state sub-region name
        private async Task SetupSymbology()
        {
            try
            {
                // Generate a unique value renderer on the server
                GenerateRendererTask generateRendererTask = new GenerateRendererTask(new Uri(LAYER_URL));

                UniqueValueDefinition uvDef = new UniqueValueDefinition()
                {
                    Fields = new List <string> {
                        "sub_region"
                    }
                };
                uvDef.ColorRamps.Add(new ColorRamp()
                {
                    From = Colors.Purple, To = Colors.Yellow, Algorithm = Algorithm.LabLch
                });
                GenerateRendererParameters rendererParams = new GenerateRendererParameters()
                {
                    ClassificationDefinition = uvDef
                };

                var rendererResult = await generateRendererTask.GenerateRendererAsync(rendererParams);

                _graphicsOverlay.Renderer = rendererResult.Renderer;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Statistics Sample");
            }
        }
Ejemplo n.º 2
0
        private void GenerateUniqueValueClick(object sender, System.Windows.RoutedEventArgs e)
        {
            UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
            {
                Fields = new List <string>()
                {
                    "STATE_NAME"
                }
            };

            uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
            {
                From      = Colors.Blue,
                To        = Colors.Red,
                Algorithm = Algorithm.CIELabAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = uniqueValueDefinition,
                Where = "STATE_NAME NOT IN ('Alaska', 'Hawaii')"
            };

            generateRendererTask.ExecuteAsync(rendererParams, rendererParams.Where);
        }
        // Create a unique value renderer by state sub-region name
        private async Task SetUniqueRenderer()
        {
            try
            {
                // Generate a unique value renderer on the server
                GenerateRendererTask generateRendererTask = new GenerateRendererTask(new Uri(LAYER_URL));

                UniqueValueDefinition uvDef = new UniqueValueDefinition()
                {
                    Fields = new string[] { "sub_region" }
                };
                uvDef.ColorRamps.Add(new ColorRamp()
                {
                    From = Colors.Purple, To = Colors.Yellow, Algorithm = Algorithm.LabLch
                });
                GenerateRendererParameter rendererParams = new GenerateRendererParameter()
                {
                    ClassificationDefinition = uvDef
                };

                var rendererResult = await generateRendererTask.GenerateRendererAsync(rendererParams);

                _graphicsLayer.Renderer = rendererResult.Renderer;
            }
            catch (Exception ex)
            {
                var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
        }
        private async void GenerateUniqueValueClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }

                IsBusy = true;

                UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
                {
                    Fields = new List <string>()
                    {
                        "STATE_NAME"
                    }
                };

                uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
                {
                    From      = Colors.Blue,
                    To        = Colors.Red,
                    Algorithm = Algorithm.CieLab
                });

                // Create a new GenerateRendererParameter object and set the ClassificationDefinition
                // Also specify a Where clause on the layer to demonstrate excluding features from the classification
                GenerateRendererParameters rendererParam = new GenerateRendererParameters()
                {
                    ClassificationDefinition = uniqueValueDefinition,
                    Where = "STATE_NAME NOT IN ('Alaska', 'Hawaii')"
                };

                await GenerateRenderer(rendererParam);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error generating renderer: " + ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
        // Create a unique value renderer by state sub-region name
		private async Task SetupSymbology()
        {
            try
            {
                // Generate a unique value renderer on the server
                GenerateRendererTask generateRendererTask = new GenerateRendererTask(new Uri(LAYER_URL));

                UniqueValueDefinition uvDef = new UniqueValueDefinition() { Fields = new List<string> { "sub_region" } };
                uvDef.ColorRamps.Add(new ColorRamp() { From = Colors.Purple, To = Colors.Yellow, Algorithm = Algorithm.LabLch });
                GenerateRendererParameters rendererParams = new GenerateRendererParameters() { ClassificationDefinition = uvDef };

                var rendererResult = await generateRendererTask.GenerateRendererAsync(rendererParams);
				_graphicsOverlay.Renderer = rendererResult.Renderer;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Statistics Sample");
            }
        }
        // Create a unique value renderer by state sub-region name
        private async Task SetUniqueRenderer()
        {
            try
            {
                // Generate a unique value renderer on the server
                GenerateRendererTask generateRendererTask = new GenerateRendererTask(new Uri(LAYER_URL));

                UniqueValueDefinition uvDef = new UniqueValueDefinition() { Fields = new string[] { "sub_region" } };
                uvDef.ColorRamps.Add(new ColorRamp() { From = Colors.Purple, To = Colors.Yellow, Algorithm = Algorithm.LabLch });
                GenerateRendererParameter rendererParams = new GenerateRendererParameter() { ClassificationDefinition = uvDef };

                var rendererResult = await generateRendererTask.GenerateRendererAsync(rendererParams);
                _graphicsLayer.Renderer = rendererResult.Renderer;
            }
            catch (Exception ex)
            {
                var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
        }
        private async void GenerateUniqueValueClick(object sender, RoutedEventArgs e)
        {
            try
            {
                progress.Visibility = Visibility.Visible;

                UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
                {
                    Fields = new List <string>()
                    {
                        "STATE_NAME"
                    }
                };

                uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
                {
                    From      = Colors.Blue,
                    To        = Colors.Red,
                    Algorithm = Algorithm.CieLab
                });

                // Create a new GenerateRendererParameter object and set the ClassificationDefinition
                // Also specify a Where clause on the layer to demonstrate excluding features from the classification
                GenerateRendererParameter rendererParam = new GenerateRendererParameter()
                {
                    ClassificationDefinition = uniqueValueDefinition,
                    Where = "STATE_NAME NOT IN ('Alaska', 'Hawaii')"
                };

                await GenerateRenderer(rendererParam);
            }
            catch (Exception ex)
            {
                var _ = new MessageDialog("Error generating renderer: " + ex.Message).ShowAsync();
            }
            finally
            {
                progress.Visibility = Visibility.Collapsed;
            }
        }
        private async void GenerateUniqueValueClick(object sender, RoutedEventArgs e)
        {
            try
            {
                progress.Visibility = Visibility.Visible;

                UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
                {
                    Fields = new List<string>() { "STATE_NAME" }
                };

                uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
                {
                    From = Colors.Blue,
                    To = Colors.Red,
                    Algorithm = Algorithm.CieLab
                });

                // Create a new GenerateRendererParameter object and set the ClassificationDefinition
                // Also specify a Where clause on the layer to demonstrate excluding features from the classification
                GenerateRendererParameter rendererParam = new GenerateRendererParameter()
                {
                    ClassificationDefinition = uniqueValueDefinition,
                    Where = "STATE_NAME NOT IN ('Alaska', 'Hawaii')"
                };

                await GenerateRenderer(rendererParam);
            }
            catch (Exception ex)
            {
                var _ = new MessageDialog("Error generating renderer: " + ex.Message).ShowAsync();
            }
            finally
            {
                progress.Visibility = Visibility.Collapsed;
            }
        }
Ejemplo n.º 9
0
        public StatisticsRenderOnMap()
        {
            InitializeComponent();

            subRegionGraphicsLayer = MyMap.Layers["SumGraphicsLayer"] as GraphicsLayer;

            // Generate a unique value renderer on the server
            GenerateRendererTask generateRendererTask = new GenerateRendererTask();

            generateRendererTask.Url = _layerUrl;

            generateRendererTask.ExecuteCompleted += (o, e) =>
            {
                subRegionGraphicsLayer.Renderer = e.GenerateRendererResult.Renderer;
            };

            UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
            {
                Fields = new List <string>()
                {
                    "SUB_REGION"
                }
            };

            uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
            {
                From      = Colors.Purple,
                To        = Colors.Yellow,
                Algorithm = Algorithm.LabLChAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = uniqueValueDefinition,
            };

            generateRendererTask.ExecuteAsync(rendererParams);

            // When layers initialized, return all states, generate statistics for a group,
            // union graphics based on grouped statistics
            MyMap.Layers.LayersInitialized += (a, b) =>
            {
                QueryTask queryTask1     = new QueryTask(_layerUrl);
                Query     queryAllStates = new Query()
                {
                    ReturnGeometry      = true,
                    OutSpatialReference = MyMap.SpatialReference,
                    Where = "1=1"
                };
                queryAllStates.OutFields.Add("SUB_REGION");

                queryTask1.ExecuteCompleted += (c, d) =>
                {
                    // Return statistics for states layer. Population and total count of states grouped by sub-region.
                    QueryTask queryTask2 = new QueryTask(_layerUrl);
                    Query     query      = new Query()
                    {
                        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
                            }
                        }
                    };
                    queryTask2.ExecuteCompleted += (e, f) =>
                    {
                        // foreach group (sub-region) returned from statistic results
                        foreach (Graphic regionGraphic in f.FeatureSet.Features)
                        {
                            // Collection of graphics based on sub-region
                            IEnumerable <Graphic> toUnion =
                                (f.UserState as FeatureSet).Features.Where(stateGraphic =>
                                                                           (string)stateGraphic.Attributes["SUB_REGION"] ==
                                                                           (string)regionGraphic.Attributes["SUB_REGION"]);

                            // Union graphics based on sub-region, add to graphics layer
                            GeometryService geometryService =
                                new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
                            geometryService.UnionCompleted += (g, h) =>
                            {
                                Graphic unionedGraphic = h.UserState as Graphic;
                                unionedGraphic.Geometry = h.Result;
                                subRegionGraphicsLayer.Graphics.Add(unionedGraphic);
                            };
                            geometryService.UnionAsync(toUnion.ToList(), regionGraphic);
                        }

                        // populate the ListBox
                        FeatureSet featureSet = f.FeatureSet;
                        if (featureSet != null && featureSet.Features.Count > 0)
                        {
                            OutStatisticsListBox.ItemsSource = featureSet.Features;
                        }
                    };

                    queryTask2.ExecuteAsync(query, d.FeatureSet);
                };

                queryTask1.ExecuteAsync(queryAllStates);
            };
        }
        public StatisticsRenderOnMap()
        {
            InitializeComponent();

            subRegionGraphicsLayer = MyMap.Layers["SumGraphicsLayer"] as GraphicsLayer;

            // Generate a unique value renderer on the server
            GenerateRendererTask generateRendererTask = new GenerateRendererTask();
            generateRendererTask.Url = _layerUrl;

            generateRendererTask.ExecuteCompleted += (o, e) =>
            {
                subRegionGraphicsLayer.Renderer = e.GenerateRendererResult.Renderer;
            };

            UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
            {
                Fields = new List<string>() { "SUB_REGION" }
            };

            uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
            {
                From = Colors.Purple,
                To = Colors.Yellow,
                Algorithm = Algorithm.LabLChAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = uniqueValueDefinition,
            };

            generateRendererTask.ExecuteAsync(rendererParams);

            // When layers initialized, return all states, generate statistics for a group,
            // union graphics based on grouped statistics
            MyMap.Layers.LayersInitialized += (a, b) =>
              {
                  QueryTask queryTask1 = new QueryTask(_layerUrl);
                  Query queryAllStates = new Query()
                  {
                      ReturnGeometry = true,
                      OutSpatialReference = MyMap.SpatialReference,
                      Where = "1=1"
                  };
                  queryAllStates.OutFields.Add("SUB_REGION");

                  queryTask1.ExecuteCompleted += (c, d) =>
                      {
                          // Return statistics for states layer. Population and total count of states grouped by sub-region.
                          QueryTask queryTask2 = new QueryTask(_layerUrl);
                          Query query = new Query()
                          {
                              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
                                }
                             }
                          };
                          queryTask2.ExecuteCompleted += (e, f) =>
                          {
                              // foreach group (sub-region) returned from statistic results
                              foreach (Graphic regionGraphic in f.FeatureSet.Features)
                              {
                                  // Collection of graphics based on sub-region
                                  IEnumerable<Graphic> toUnion =
                                      (f.UserState as FeatureSet).Features.Where(stateGraphic =>
                                          (string)stateGraphic.Attributes["SUB_REGION"] ==
                                          (string)regionGraphic.Attributes["SUB_REGION"]);

                                  // Union graphics based on sub-region, add to graphics layer
                                  GeometryService geometryService =
                                      new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
                                  geometryService.UnionCompleted += (g, h) =>
                                  {
                                      Graphic unionedGraphic = h.UserState as Graphic;
                                      unionedGraphic.Geometry = h.Result;
                                      subRegionGraphicsLayer.Graphics.Add(unionedGraphic);
                                  };
                                  geometryService.UnionAsync(toUnion.ToList(), regionGraphic);
                              }

                              // populate the ListBox
                              FeatureSet featureSet = f.FeatureSet;
                              if (featureSet != null && featureSet.Features.Count > 0)
                              {
                                  OutStatisticsListBox.ItemsSource = featureSet.Features;
                              }
                          };

                          queryTask2.ExecuteAsync(query, d.FeatureSet);
                      };

                  queryTask1.ExecuteAsync(queryAllStates);
              };
        }
        private void GenerateUniqueValueClick(object sender, RoutedEventArgs e)
        {
            UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
            {
                Fields = new List<string>() { "STATE_NAME" }
            };
            uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
                {
                    From = Colors.Blue,
                    To = Colors.Red,
                    Algorithm = Algorithm.CIELabAlgorithm
                });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = uniqueValueDefinition,
                Where = "STATE_NAME NOT IN ('Alaska', 'Hawaii')"
            };

            generateRendererTask.ExecuteAsync(rendererParams, rendererParams.Where);
        }
        private async void GenerateUniqueValueClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsBusy)
                    return;

                IsBusy = true;

                UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
                {
                    Fields = new List<string>() { "STATE_NAME" }
                };

                uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
                {
                    From = Colors.Blue,
                    To = Colors.Red,
                    Algorithm = Algorithm.CieLab
                });

                // Create a new GenerateRendererParameter object and set the ClassificationDefinition
                // Also specify a Where clause on the layer to demonstrate excluding features from the classification
                GenerateRendererParameters rendererParam = new GenerateRendererParameters()
                {
                    ClassificationDefinition = uniqueValueDefinition,
                    Where = "STATE_NAME NOT IN ('Alaska', 'Hawaii')"
                };

                await GenerateRenderer(rendererParam);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error generating renderer: " + ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            layer = (map.Layers[0] as ArcGISDynamicMapServiceLayer);
            DynamicLayerInfoCollection myDynamicLayerInfos = layer.DynamicLayerInfos;
            if (myDynamicLayerInfos == null)
            {
                myDynamicLayerInfos = layer.CreateDynamicLayerInfosFromLayerInfos();
            }

            #region TableDataSource
            DynamicLayerInfo info = new DynamicLayerInfo()
            {
                ID = 1,
                Source = new LayerDataSource()
                {
                    DataSource = new QueryDataSource()
                    {
                        GeometryType = ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline,
                        OIDFields = new string[] { "OBJECTID" },
                        Query = "SELECT * FROM  SDE.china_road where FNODE_ > 1000",
                        WorkspaceID = "MyDatabaseWorkspaceID"
                    }
                }
            };
            #endregion

            #region QueryDataSource
            DynamicLayerInfo info = new DynamicLayerInfo()
            {
                ID = 1,
                Source = new LayerDataSource()
                {
                    DataSource = new QueryDataSource()
                    {
                        GeometryType = ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline,
                        OIDFields = new string[] { "OBJECTID" },
                        Query = "SELECT * FROM  SDE.china_road where FNODE_ > 1000",
                        WorkspaceID = "MyDatabaseWorkspaceID"
                    }
                }
            };
            #endregion

            #region UserDefine Simple Render Line
            //LayerDrawingOptions layerDrawOptions = new LayerDrawingOptions();
            //layerDrawOptions.LayerID = 1;
            //layerDrawOptions.Renderer = new SimpleRenderer()
            //{
            //	Symbol = new SimpleLineSymbol()
            //	{
            //		Color = new SolidColorBrush(Color.FromArgb((int)255, (int)0, (int)0, (int)255)),
            //		Width = 2
            //	}
            //};

            //layer.LayerDrawingOptions = new LayerDrawingOptionsCollection() { layerDrawOptions };
            #endregion

            #region UserDefine Simple Render Poly
            LayerDrawingOptions layerDrawOptions = new LayerDrawingOptions();
            layerDrawOptions.LayerID = 1;
            layerDrawOptions.Renderer = new SimpleRenderer()
            {
                Symbol = new SimpleFillSymbol()
                {
                    Fill = new SolidColorBrush(Color.FromArgb((int)255, (int)0, (int)0, (int)255)),
                }
            };

            layer.LayerDrawingOptions =
                    new LayerDrawingOptionsCollection() { layerDrawOptions };
            #endregion

            #region JoinDataSource
            DynamicLayerInfo info = new DynamicLayerInfo()
            {
                ID = 1,
                Source = new LayerDataSource()
                {

                    DataSource = new JoinDataSource()
                    {

                        JoinType = JoinType.LeftInnerJoin,
                        LeftTableSource = new LayerDataSource()
                        {
                            DataSource = new TableDataSource()
                            {
                                DataSourceName = "SDE.china_county",
                                WorkspaceID = "MyDatabaseWorkspaceID"
                            }
                        },
                        LeftTableKey = "OBJECTID",
                        RightTableSource = new LayerDataSource()
                        {
                            DataSource = new TableDataSource()
                            {
                                DataSourceName = "SDE.china_road",
                                WorkspaceID = "MyDatabaseWorkspaceID"
                            }
                        },
                        RightTableKey = "OBJECTID"
                    }
                }
            };
            #endregion

            #region RasterDataSource
            //DynamicLayerInfo info = new DynamicLayerInfo()
            //{
            //	ID = 1,
            //	Source = new LayerDataSource()
            //	{
            //		DataSource = new RasterDataSource()
            //		{
            //			DataSourceName = "rr1",
            //			WorkspaceID = "MyRasterWorkspaceID"
            //		}
            //	}
            //};
            #endregion

            myDynamicLayerInfos.Add(info);
            layer.DynamicLayerInfos = myDynamicLayerInfos;

            layer.VisibleLayers = new int[] { 1 };
            //layer.Refresh();
            //map.ZoomTo(new Envelope(11.8435360079, 49.4443060783, 11.8568721432, 49.4528247773));
            //map.ZoomTo(layer.Layers[1].e)

            #region Generate Render Class Break
            ClassBreaksDefinition classBreaksDefinition = new ClassBreaksDefinition()
            {
                ClassificationField = "FNODE_",
                ClassificationMethod = ClassificationMethod.StandardDeviation,
                BreakCount = 10,
                StandardDeviationInterval = ESRI.ArcGIS.Client.Tasks.StandardDeviationInterval.OneQuarter
            };
            classBreaksDefinition.ColorRamps.Add(new ColorRamp()
            {
                From = Colors.Blue,
                To = Colors.Red,
                Algorithm = Algorithm.HSVAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = classBreaksDefinition,
                Source = info.Source
            };

            generateRendererTask.ExecuteAsync(rendererParams, rendererParams.Where);
            #endregion

            #region Generate Render Unique Value
            UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
            {
                Fields = new List<string>() { "FNODE_" }
            };
            uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
            {
                From = Colors.Blue,
                To = Colors.Red,
                Algorithm = Algorithm.CIELabAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = uniqueValueDefinition,
                Source = info.Source
            };

            generateRendererTask.ExecuteAsync(rendererParams, rendererParams.Where);
            #endregion
        }
Ejemplo n.º 14
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            layer = (map.Layers[0] as ArcGISDynamicMapServiceLayer);
            DynamicLayerInfoCollection myDynamicLayerInfos = layer.DynamicLayerInfos;

            if (myDynamicLayerInfos == null)
            {
                myDynamicLayerInfos = layer.CreateDynamicLayerInfosFromLayerInfos();
            }

            #region TableDataSource
            DynamicLayerInfo info = new DynamicLayerInfo()
            {
                ID     = 1,
                Source = new LayerDataSource()
                {
                    DataSource = new QueryDataSource()
                    {
                        GeometryType = ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline,
                        OIDFields    = new string[] { "OBJECTID" },
                        Query        = "SELECT * FROM  SDE.china_road where FNODE_ > 1000",
                        WorkspaceID  = "MyDatabaseWorkspaceID"
                    }
                }
            };
            #endregion

            #region QueryDataSource
            DynamicLayerInfo info = new DynamicLayerInfo()
            {
                ID     = 1,
                Source = new LayerDataSource()
                {
                    DataSource = new QueryDataSource()
                    {
                        GeometryType = ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline,
                        OIDFields    = new string[] { "OBJECTID" },
                        Query        = "SELECT * FROM  SDE.china_road where FNODE_ > 1000",
                        WorkspaceID  = "MyDatabaseWorkspaceID"
                    }
                }
            };
            #endregion

            #region UserDefine Simple Render Line
            //LayerDrawingOptions layerDrawOptions = new LayerDrawingOptions();
            //layerDrawOptions.LayerID = 1;
            //layerDrawOptions.Renderer = new SimpleRenderer()
            //{
            //	Symbol = new SimpleLineSymbol()
            //	{
            //		Color = new SolidColorBrush(Color.FromArgb((int)255, (int)0, (int)0, (int)255)),
            //		Width = 2
            //	}
            //};

            //layer.LayerDrawingOptions = new LayerDrawingOptionsCollection() { layerDrawOptions };
            #endregion

            #region UserDefine Simple Render Poly
            LayerDrawingOptions layerDrawOptions = new LayerDrawingOptions();
            layerDrawOptions.LayerID  = 1;
            layerDrawOptions.Renderer = new SimpleRenderer()
            {
                Symbol = new SimpleFillSymbol()
                {
                    Fill = new SolidColorBrush(Color.FromArgb((int)255, (int)0, (int)0, (int)255)),
                }
            };

            layer.LayerDrawingOptions =
                new LayerDrawingOptionsCollection()
            {
                layerDrawOptions
            };
            #endregion

            #region JoinDataSource
            DynamicLayerInfo info = new DynamicLayerInfo()
            {
                ID     = 1,
                Source = new LayerDataSource()
                {
                    DataSource = new JoinDataSource()
                    {
                        JoinType        = JoinType.LeftInnerJoin,
                        LeftTableSource = new LayerDataSource()
                        {
                            DataSource = new TableDataSource()
                            {
                                DataSourceName = "SDE.china_county",
                                WorkspaceID    = "MyDatabaseWorkspaceID"
                            }
                        },
                        LeftTableKey     = "OBJECTID",
                        RightTableSource = new LayerDataSource()
                        {
                            DataSource = new TableDataSource()
                            {
                                DataSourceName = "SDE.china_road",
                                WorkspaceID    = "MyDatabaseWorkspaceID"
                            }
                        },
                        RightTableKey = "OBJECTID"
                    }
                }
            };
            #endregion

            #region RasterDataSource
            //DynamicLayerInfo info = new DynamicLayerInfo()
            //{
            //	ID = 1,
            //	Source = new LayerDataSource()
            //	{
            //		DataSource = new RasterDataSource()
            //		{
            //			DataSourceName = "rr1",
            //			WorkspaceID = "MyRasterWorkspaceID"
            //		}
            //	}
            //};
            #endregion

            myDynamicLayerInfos.Add(info);
            layer.DynamicLayerInfos = myDynamicLayerInfos;


            layer.VisibleLayers = new int[] { 1 };
            //layer.Refresh();
            //map.ZoomTo(new Envelope(11.8435360079, 49.4443060783, 11.8568721432, 49.4528247773));
            //map.ZoomTo(layer.Layers[1].e)

            #region Generate Render Class Break
            ClassBreaksDefinition classBreaksDefinition = new ClassBreaksDefinition()
            {
                ClassificationField       = "FNODE_",
                ClassificationMethod      = ClassificationMethod.StandardDeviation,
                BreakCount                = 10,
                StandardDeviationInterval = ESRI.ArcGIS.Client.Tasks.StandardDeviationInterval.OneQuarter
            };
            classBreaksDefinition.ColorRamps.Add(new ColorRamp()
            {
                From      = Colors.Blue,
                To        = Colors.Red,
                Algorithm = Algorithm.HSVAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = classBreaksDefinition,
                Source = info.Source
            };

            generateRendererTask.ExecuteAsync(rendererParams, rendererParams.Where);
            #endregion

            #region Generate Render Unique Value
            UniqueValueDefinition uniqueValueDefinition = new UniqueValueDefinition()
            {
                Fields = new List <string>()
                {
                    "FNODE_"
                }
            };
            uniqueValueDefinition.ColorRamps.Add(new ColorRamp()
            {
                From      = Colors.Blue,
                To        = Colors.Red,
                Algorithm = Algorithm.CIELabAlgorithm
            });

            GenerateRendererParameters rendererParams = new GenerateRendererParameters()
            {
                ClassificationDefinition = uniqueValueDefinition,
                Source = info.Source
            };

            generateRendererTask.ExecuteAsync(rendererParams, rendererParams.Where);
            #endregion
        }