/// <summary>
        /// Renders a point feature layer using a continuous color gradient to represent density of points.
        /// </summary>
        /// <remarks>
        /// ![Heat map renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/heat-map.png)
        /// </remarks>
        /// <returns>
        /// </returns>
        internal static Task HeatMapRenderersAsync()
        {
            //Check feature layer name
            //Code works with the U.S. Cities feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "U.S. Cities");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the U.S. Cities feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //defining a heatmap renderer that uses values from Population field as the weights
                HeatMapRendererDefinition heatMapDef = new HeatMapRendererDefinition()
                {
                    Radius = 20,
                    WeightField = SDKHelpers.GetNumericField(featureLayer),
                    ColorRamp = SDKHelpers.GetColorRamp(),
                    RendereringQuality = 8,
                    UpperLabel = "High Density",
                    LowerLabel = "Low Density"
                };

                CIMHeatMapRenderer heatMapRndr = (CIMHeatMapRenderer)featureLayer.CreateRenderer(heatMapDef);
                featureLayer.SetRenderer(heatMapRndr);
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Renders a feature layer using proportional symbols to draw quantities.
        /// ![Proportional Symbols renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/proportional-renderer.png)
        /// </summary>
        /// <remarks></remarks>
        /// <returns></returns>
        internal static Task ProportionalRendererAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //Gets the first numeric field of the feature layer
                var firstNumericFieldOfFeatureLayer = SDKHelpers.GetNumericField(featureLayer);
                //Gets the min and max value of the field
                var sizes = SDKHelpers.GetFieldMinMax(featureLayer, firstNumericFieldOfFeatureLayer);
                ProportionalRendererDefinition prDef = new ProportionalRendererDefinition()
                {
                    Field = firstNumericFieldOfFeatureLayer,
                    MinimumSymbolSize = 4,
                    MaximumSymbolSize = 50,
                    LowerSizeStop = Convert.ToDouble(sizes.Item1),
                    UpperSizeStop = Convert.ToDouble(sizes.Item2)
                };
                CIMProportionalRenderer propRndr = (CIMProportionalRenderer)featureLayer.CreateRenderer(prDef);
                featureLayer.SetRenderer(propRndr);
            }));
        }
 private JObject BuildRequest(JObject tags)
 {
     return(new JObject(
                new JProperty("application", _appId),
                new JProperty("hwid", SDKHelpers.GetDeviceUniqueId()),
                new JProperty("tags", tags)));
 }
        /// <summary>
        /// Renders a feature layer using an unclassed color gradient.
        /// ![cb-unclassed.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-unclassed.png "Class breaks unclassed renderer.")
        /// </summary>
        /// <returns>
        /// </returns>
        internal static Task UnclassedRenderer()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "U.S. National Transportation Atlas Interstate Highways");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the U.S. National Transportation Atlas Interstate Highways feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //Gets the first numeric field of the feature layer
                var firstNumericFieldOfFeatureLayer = SDKHelpers.GetNumericField(featureLayer);
                //Gets the min and max value of the field
                var labels = SDKHelpers.GetFieldMinMax(featureLayer, firstNumericFieldOfFeatureLayer);
                UnclassedColorsRendererDefinition ucDef = new UnclassedColorsRendererDefinition()
                {
                    Field = firstNumericFieldOfFeatureLayer,
                    ColorRamp = SDKHelpers.GetColorRamp(),
                    LowerColorStop = Convert.ToDouble(labels.Item1),
                    UpperColorStop = Convert.ToDouble(labels.Item2),
                    UpperLabel = labels.Item2,
                    LowerLabel = labels.Item1,
                };
                CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(ucDef);
                featureLayer?.SetRenderer(renderer);
            }));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Renders a feature layer using unique values from one or multiple fields
        /// </summary>
        /// <remarks>
        /// ![Unique Value renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/unique-value.png)
        /// </remarks>
        /// <returns>
        /// ![Unique Value renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/unique-value.png)
        /// </returns>
        internal static Task UniqueValueRendererAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //construct unique value renderer definition
                UniqueValueRendererDefinition uvr = new
                                                    UniqueValueRendererDefinition()
                {
                    ValueFields = new List <string> {
                        SDKHelpers.GetDisplayField(featureLayer)
                    },                                     //multiple fields in the array if needed.
                    ColorRamp = SDKHelpers.GetColorRamp(), //Specify color ramp
                };

                //Creates a "Renderer"
                var cimRenderer = featureLayer.CreateRenderer(uvr);

                //Sets the renderer to the feature layer
                featureLayer.SetRenderer(cimRenderer);
            }));
        }
        private void ChannelShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            Debug.WriteLine("/********************************************************/");
            Debug.WriteLine("Received Toast: " + DateTime.Now.ToShortTimeString());

            foreach (string key in e.Collection.Keys)
            {
                Debug.WriteLine("{0}: {1}", key, e.Collection[key]);
                if (key == "wp:Param")
                {
                    LastPush = SDKHelpers.ParsePushData(e.Collection[key]);
                }
            }
            Debug.WriteLine("/********************************************************/");

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                var message        = new PushNotificationMessage(e.Collection);
                message.Completed += (o, args) =>
                {
                    if (args.PopUpResult == PopUpResult.Ok)
                    {
                        FireAcceptedPush();
                    }
                };
                message.Show();
            });
        }
Exemplo n.º 7
0
        /// <summary>
        /// Renders a feature layer using graduated symbols and natural breaks to draw quantities.
        /// ![cb-symbols.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-symbols.png "Graduated symbols with natural breaks renderer.")
        /// </summary>
        /// <returns>
        /// </returns>
        internal static Task CBRendererGraduatedSymbols()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                GraduatedSymbolsRendererDefinition gsDef = new GraduatedSymbolsRendererDefinition()
                {
                    ClassificationField = SDKHelpers.GetNumericField(featureLayer), //getting the first numeric field
                    ClassificationMethod = ClassificationMethod.NaturalBreaks,
                    MinimumSymbolSize = 4,
                    MaximumSymbolSize = 50,
                    BreakCount = 5,
                    ColorRamp = SDKHelpers.GetColorRamp(), //getting a color ramp
                };
                CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gsDef);
                featureLayer?.SetRenderer(renderer);
            }));
        }
Exemplo n.º 8
0
        static public void HandleStartPush(string arguments)
        {
            if (arguments != null && arguments.Length != 0)
            {
                try
                {
                    //Sample to handle push custom data on start
                    ToastPush push = SDKHelpers.ParsePushData(arguments);
                    if (push != null)
                    {
                        push.OnStart = true;
                        NotificationService.StartPush = push;

                        NotificationService service = NotificationService.GetCurrent(null);
                        if (service != null)
                        {
                            StatisticRequest request = new StatisticRequest {
                                AppId = service.AppID, Hash = push.Hash
                            };
                            PushwooshAPIServiceBase.InternalSendRequestAsync(request, null, null);
                        }
                    }
                }
                catch { }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Renders a feature layer using graduated colors and manual intervals to draw quantities.
        ///  ![cb-colors-manual-breaks.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-colors-manual-breaks.png "Graduated colors with manual intervals renderer.")
        /// </summary>
        /// <returns></returns>
        internal static Task CBGraduatedColorsManualBreaks()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            //Change these class breaks to be appropriate for your data. These class breaks defined below apply to the US States feature class
            List <CIMClassBreak> listClassBreaks = new List <CIMClassBreak>
            {
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB).MakeSymbolReference(),
                    UpperBound = 24228
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreenRGB).MakeSymbolReference(),
                    UpperBound = 67290
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlueRGB).MakeSymbolReference(),
                    UpperBound = 121757
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB).MakeSymbolReference(),
                    UpperBound = 264435
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB).MakeSymbolReference(),
                    UpperBound = 576594
                }
            };

            return(QueuedTask.Run(() =>
            {
                CIMClassBreaksRenderer cimClassBreakRenderer = new CIMClassBreaksRenderer
                {
                    ClassBreakType = ClassBreakType.GraduatedColor,
                    ClassificationMethod = ClassificationMethod.Manual,
                    Field = SDKHelpers.GetNumericField(featureLayer),
                    //Important to add the Minimum break for your data to be classified correctly.
                    //This is vital especially if you have data with negative values.
                    //MinimumBreak =
                    Breaks = listClassBreaks.ToArray()
                };

                featureLayer?.SetRenderer(cimClassBreakRenderer);
            }));
        }
 private string BuildRequest(string tags)
 {
     return((new JObject(
                 new JProperty("request",
                               new JObject(
                                   new JProperty("application", _appId),
                                   new JProperty("hwid", SDKHelpers.GetDeviceUniqueId()),
                                   new JProperty("tags", JObject.Parse(tags)))))).ToString());
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var applicationService = ((PhonePushApplicationService)PhoneApplicationService.Current);

            applicationService.NotificationService.LastPush = SDKHelpers.ParsePushData(e.Uri.ToString());

            applicationService.NotificationService.FireAcceptedPush();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Renders a feature layer using graduated colors to draw quantities. The outline width is varied based on attributes.
        /// ![graduatedColorOutline.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/graduatedColorOutline.png "Graduated colors with natural breaks renderer.")
        /// </summary>
        /// <returns></returns>
        internal static Task CBRendererGraduatedColorsOutlineAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //Gets the first numeric field of the feature layer
                var firstNumericFieldOfFeatureLayer = SDKHelpers.GetNumericField(featureLayer);
                //Gets the min and max value of the field
                var minMax = SDKHelpers.GetFieldMinMax(featureLayer, firstNumericFieldOfFeatureLayer);
                GraduatedColorsRendererDefinition gcDef = new GraduatedColorsRendererDefinition()
                {
                    ClassificationField = SDKHelpers.GetNumericField(featureLayer),
                    ClassificationMethod = ClassificationMethod.NaturalBreaks,
                    BreakCount = 5,
                    ColorRamp = SDKHelpers.GetColorRamp()
                };
                CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gcDef);
                //Create array of CIMVisualVariables to hold the outline information.
                var visualVariables = new CIMVisualVariable[] {
                    new CIMSizeVisualVariable
                    {
                        ValueExpressionInfo = new CIMExpressionInfo
                        {
                            Title = "Custom",
                            Expression = "$feature.AREA",
                            ReturnType = ExpressionReturnType.Default
                        },
                        AuthoringInfo = new CIMVisualVariableAuthoringInfo
                        {
                            MinSliderValue = Convert.ToDouble(minMax.Item1),
                            MaxSliderValue = Convert.ToDouble(minMax.Item2),
                            ShowLegend = false,
                            Heading = firstNumericFieldOfFeatureLayer
                        },
                        VariableType = SizeVisualVariableType.Graduated,
                        Target = "outline",
                        MinSize = 1,
                        MaxSize = 13,
                        MinValue = Convert.ToDouble(minMax.Item1),
                        MaxValue = Convert.ToDouble(minMax.Item2)
                    },
                };
                renderer.VisualVariables = visualVariables;
                featureLayer?.SetRenderer(renderer);
            }));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Renders a feature layer using Bar chart symbols to represent data
        /// </summary>
        /// <remarks>
        /// ![bar chart renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/bar-chart.png)
        /// </remarks>
        /// <returns></returns>
        internal static Task BarChartRendererAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                var chartFields = new string[]
                {
                    "WHITE10",
                    "BLACK10",
                    "AMERIND10",
                    "ASIAN10",
                    "HISPPOP10",
                    "HAMERIND10",
                    "HWHITE10",
                    "HASIAN10",
                    "HPACIFIC10",
                    "HBLACK10",
                    "HOTHRACE10"
                };

                QueuedTask.Run(() =>
                {
                    BarChartRendererDefinition barChartRendererDefn = new BarChartRendererDefinition()
                    {
                        ChartFields = chartFields,
                        BarWidth = 12,
                        BarSpacing = 1,
                        MaximumBarLength = 65,
                        Orientation = ChartOrientation.Vertical,
                        DisplayIn3D = true,
                        ShowAxes = true,
                        ColorRamp = SDKHelpers.GetColorRamp()
                    };
                    //Creates a "Renderer"
                    var barChartChartRenderer = featureLayer.CreateRenderer(barChartRendererDefn);

                    //Sets the renderer to the feature layer
                    featureLayer.SetRenderer(barChartChartRenderer);
                });
            }));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Renders a feature layer using stacked bar chart symbols to represent data
        /// </summary>
        /// <remarks>
        /// ![stacked bar chart renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/stacked-bar-chart.png)
        /// </remarks>
        /// <returns></returns>
        internal static Task StackedBarChartRendererAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                var chartFields = new string[]
                {
                    "WHITE10",
                    "BLACK10",
                    "AMERIND10",
                    "ASIAN10",
                    "HISPPOP10",
                    "HAMERIND10",
                    "HWHITE10",
                    "HASIAN10",
                    "HPACIFIC10",
                    "HBLACK10",
                    "HOTHRACE10"
                };

                QueuedTask.Run(() =>
                {
                    StackedChartRendererDefinition barChartpieChartRendererDefn = new StackedChartRendererDefinition()
                    {
                        ChartFields = chartFields,
                        SizeOption = StackChartSizeOptions.SumSelectedFields,
                        Orientation = ChartOrientation.Horizontal,
                        ShowOutline = true,
                        DisplayIn3D = true,
                        StackWidth = 8,
                        StackLength = 25.87,
                        ColorRamp = SDKHelpers.GetColorRamp()
                    };
                    //Creates a "Renderer"
                    var stackedBarChartChartRenderer = featureLayer.CreateRenderer(barChartpieChartRendererDefn);

                    //Sets the renderer to the feature layer
                    featureLayer.SetRenderer(stackedBarChartChartRenderer);
                });
            }));
        }
 /// <summary>
 /// Renders a feature layer using graduated colors to draw quantities.
 /// ![cb-colors.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-colors.png "Graduated colors with natural breaks renderer.")
 /// </summary>
 /// <param name="featureLayer"></param>
 /// <returns>
 /// </returns>
 internal static async Task CBRendererGraduatedColors(FeatureLayer featureLayer)
 {
     await QueuedTask.Run(() =>
     {
         GraduatedColorsRendererDefinition gcDef = new GraduatedColorsRendererDefinition()
         {
             ClassificationField  = SDKHelpers.GetNumericField(featureLayer),
             ClassificationMethod = ClassificationMethod.NaturalBreaks,
             BreakCount           = 5,
             ColorRamp            = SDKHelpers.GetColorRamp(),
         };
         CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gcDef);
         featureLayer?.SetRenderer(renderer);
     });
 }
        /// <summary>
        /// Renders a feature layer using graduated colors and manual intervals to draw quantities.
        ///  ![cb-colors-manual-breaks.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-colors-manual-breaks.png "Graduated colors with manual intervals renderer.")
        /// </summary>
        /// <param name="featureLayer"></param>
        /// <returns></returns>
        internal static Task CBGraduatedColorsManualBreaks(FeatureLayer featureLayer)
        {
            //Change these class breaks to be appropriate for your data. These class breaks defined below apply to the US States feature class
            List <CIMClassBreak> listClassBreaks = new List <CIMClassBreak>
            {
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB).MakeSymbolReference(),
                    UpperBound = 24228
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreenRGB).MakeSymbolReference(),
                    UpperBound = 67290
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlueRGB).MakeSymbolReference(),
                    UpperBound = 121757
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB).MakeSymbolReference(),
                    UpperBound = 264435
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB).MakeSymbolReference(),
                    UpperBound = 576594
                }
            };

            return(QueuedTask.Run(() =>
            {
                CIMClassBreaksRenderer cimClassBreakRenderer = new CIMClassBreaksRenderer
                {
                    ClassBreakType = ClassBreakType.GraduatedColor,
                    ClassificationMethod = ClassificationMethod.Manual,
                    Field = SDKHelpers.GetNumericField(featureLayer),
                    //Important to add the Minimum break for your data to be classified correctly.
                    //This is vital especially if you have data with negative values.
                    //MinimumBreak =
                    Breaks = listClassBreaks.ToArray()
                };

                featureLayer?.SetRenderer(cimClassBreakRenderer);
            }));
        }
Exemplo n.º 17
0
        /// <summary>
        /// Renders a feature layer using Pie chart symbols to represent data
        /// </summary>
        /// <remarks>
        /// ![Pie chart renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/pie-chart.png)
        /// </remarks>
        /// <returns>
        /// </returns>
        internal static Task PieChartRendererAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //Fields to use for the pie chart slices
                var chartFields = new string[]
                {
                    "WHITE10",
                    "BLACK10",
                    "AMERIND10",
                    "ASIAN10",
                    "HISPPOP10",
                    "HAMERIND10",
                    "HWHITE10",
                    "HASIAN10",
                    "HPACIFIC10",
                    "HBLACK10",
                    "HOTHRACE10"
                };

                PieChartRendererDefinition pieChartRendererDefn = new PieChartRendererDefinition()
                {
                    ChartFields = chartFields,
                    ColorRamp = SDKHelpers.GetColorRamp(),
                    SizeOption = PieChartSizeOptions.Field,
                    FieldName = "BLACK10",
                    FixedSize = 36.89,
                    DisplayIn3D = true,
                    ShowOutline = true,
                    Orientation = PieChartOrientation.CounterClockwise,
                };
                //Creates a "Renderer"
                var pieChartRenderer = featureLayer.CreateRenderer(pieChartRendererDefn);

                //Sets the renderer to the feature layer
                featureLayer.SetRenderer(pieChartRenderer);
            }));
        }
 /// <summary>
 /// Renders a feature layer using graduated symbols and natural breaks to draw quantities.
 /// ![cb-symbols.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-symbols.png "Graduated symbols with natural breaks renderer.")
 /// </summary>
 /// <param name="featureLayer"></param>
 /// <returns>
 /// </returns>
 internal static async Task CBRendererGraduatedSymbols(FeatureLayer featureLayer)
 {
     await QueuedTask.Run(() =>
     {
         GraduatedSymbolsRendererDefinition gsDef = new GraduatedSymbolsRendererDefinition()
         {
             ClassificationField  = SDKHelpers.GetNumericField(featureLayer), //getting the first numeric field
             ClassificationMethod = ClassificationMethod.NaturalBreaks,
             MinimumSymbolSize    = 4,
             MaximumSymbolSize    = 50,
             BreakCount           = 5,
             ColorRamp            = SDKHelpers.GetColorRamp(), //getting a color ramp
         };
         CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gsDef);
         featureLayer?.SetRenderer(renderer);
     });
 }
Exemplo n.º 19
0
        private async Task ShareToWeixinAsync(string name)
        {
            shareType = name == "WeixinShare" ?
                        ShareType.WechatSession :
                        ShareType.WechatTimeLine;
            var doc = new HtmlDocument();

            doc.LoadHtml(nativeString);
            var bytes = await SDKHelpers.ReadResFromImageAsync(thumb);

            await SDKHelpers.SendWechatShareToUserChoiceRequestAsync(
                url : currentUri.ToString(),
                title : title,
                thumb : bytes,
                desc : description,
                toTimeLine : shareType);
        }
 /// <summary>
 /// Renders a feature layer using graduated colors to draw quantities. The outline width is varied based on attributes.
 /// ![graduatedColorOutline.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/graduatedColorOutline.png "Graduated colors with natural breaks renderer.")
 /// </summary>
 /// <param name="featureLayer"></param>
 /// <returns></returns>
 internal static Task CBRendererGraduatedColorsOutline(FeatureLayer featureLayer)
 {
     return(QueuedTask.Run(() =>
     {
         //Gets the first numeric field of the feature layer
         var firstNumericFieldOfFeatureLayer = SDKHelpers.GetNumericField(featureLayer);
         //Gets the min and max value of the field
         var minMax = SDKHelpers.GetFieldMinMax(featureLayer, firstNumericFieldOfFeatureLayer);
         GraduatedColorsRendererDefinition gcDef = new GraduatedColorsRendererDefinition()
         {
             ClassificationField = SDKHelpers.GetNumericField(featureLayer),
             ClassificationMethod = ClassificationMethod.NaturalBreaks,
             BreakCount = 5,
             ColorRamp = SDKHelpers.GetColorRamp()
         };
         CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gcDef);
         //Create array of CIMVisualVariables to hold the outline information.
         var visualVariables = new CIMVisualVariable[] {
             new CIMSizeVisualVariable
             {
                 ValueExpressionInfo = new CIMExpressionInfo
                 {
                     Title = "Custom",
                     Expression = "$feature.AREA",
                     ReturnType = ExpressionReturnType.Default
                 },
                 AuthoringInfo = new CIMVisualVariableAuthoringInfo
                 {
                     MinSliderValue = Convert.ToDouble(minMax.Item1),
                     MaxSliderValue = Convert.ToDouble(minMax.Item2),
                     ShowLegend = false,
                     Heading = firstNumericFieldOfFeatureLayer
                 },
                 VariableType = SizeVisualVariableType.Graduated,
                 Target = "outline",
                 MinSize = 1,
                 MaxSize = 13,
                 MinValue = Convert.ToDouble(minMax.Item1),
                 MaxValue = Convert.ToDouble(minMax.Item2)
             },
         };
         renderer.VisualVariables = visualVariables;
         featureLayer?.SetRenderer(renderer);
     }));
 }
        /// <summary>
        /// Renders a feature layer using graduated colors and manual intervals to draw quantities.
        ///  ![cb-colors-manual-breaks.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-colors-manual-breaks.png "Graduated colors with manual intervals renderer.")
        /// </summary>
        /// <param name="featureLayer"></param>
        /// <returns></returns>
        internal static async Task CBGraduatedColorsManualBreaks(FeatureLayer featureLayer)
        {
            //Change these class breaks to be appropriate for your data. These class breaks defined below apply to the US States feature class
            List <CIMClassBreak> listClassBreaks = new List <CIMClassBreak>
            {
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB).MakeSymbolReference(),
                    UpperBound = 24228
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreenRGB).MakeSymbolReference(),
                    UpperBound = 67290
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlueRGB).MakeSymbolReference(),
                    UpperBound = 121757
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB).MakeSymbolReference(),
                    UpperBound = 264435
                },
                new CIMClassBreak
                {
                    Symbol     = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.WhiteRGB).MakeSymbolReference(),
                    UpperBound = 576594
                }
            };
            await QueuedTask.Run(() =>
            {
                CIMClassBreaksRenderer cimClassBreakRenderer = new CIMClassBreaksRenderer
                {
                    ClassBreakType       = ClassBreakType.GraduatedColor,
                    ClassificationMethod = ClassificationMethod.Manual,
                    Field  = SDKHelpers.GetNumericField(featureLayer),
                    Breaks = listClassBreaks.ToArray()
                };

                featureLayer?.SetRenderer(cimClassBreakRenderer);
            });
        }
Exemplo n.º 22
0
        /// <summary>
        /// Renders a point feature layer using a continuous color gradient to represent density of points.
        /// </summary>
        /// <remarks>
        /// ![Heat map renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/heat-map.png)
        /// </remarks>
        /// <param name="featureLayer"></param>
        /// <returns>
        /// </returns>
        internal static Task HeatMapRenderersAsync(FeatureLayer featureLayer)
        {
            return(QueuedTask.Run(() =>
            {
                //defining a heatmap renderer that uses values from Population field as the weights
                HeatMapRendererDefinition heatMapDef = new HeatMapRendererDefinition()
                {
                    Radius = 20,
                    WeightField = SDKHelpers.GetNumericField(featureLayer),
                    ColorRamp = SDKHelpers.GetColorRamp(),
                    RendereringQuality = 8,
                    UpperLabel = "High Density",
                    LowerLabel = "Low Density"
                };

                CIMHeatMapRenderer heatMapRndr = (CIMHeatMapRenderer)featureLayer.CreateRenderer(heatMapDef);
                featureLayer.SetRenderer(heatMapRndr);
            }));
        }
Exemplo n.º 23
0
        /// <summary>
        /// Renders a feature layer using unique values from one or multiple fields
        /// </summary>
        /// <remarks>
        /// ![Unique Value renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/unique-value.png)
        /// </remarks>
        /// <param name="featureLayer"></param>
        /// <returns>
        /// ![Unique Value renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/unique-value.png)
        /// </returns>
        internal static Task UniqueValueRendererAsync(FeatureLayer featureLayer)
        {
            return(QueuedTask.Run(() =>
            {
                //construct unique value renderer definition
                UniqueValueRendererDefinition uvr = new
                                                    UniqueValueRendererDefinition()
                {
                    ValueFields = new string[] { SDKHelpers.GetDisplayField(featureLayer) }, //multiple fields in the array if needed.
                    ColorRamp = SDKHelpers.GetColorRamp(),                                   //Specify color ramp
                };

                //Creates a "Renderer"
                var cimRenderer = featureLayer.CreateRenderer(uvr);

                //Sets the renderer to the feature layer
                featureLayer.SetRenderer(cimRenderer);
            }));
        }
 /// <summary>
 /// Renders a feature layer using proportional symbols to draw quantities.
 /// ![Proportional Symbols renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/proportional-renderer.png)
 /// </summary>
 /// <remarks></remarks>
 /// <param name="featureLayer"></param>
 /// <returns></returns>
 internal static Task ProportionalRenderer(FeatureLayer featureLayer)
 {
     return(QueuedTask.Run(() =>
     {
         //Gets the first numeric field of the feature layer
         var firstNumericFieldOfFeatureLayer = SDKHelpers.GetNumericField(featureLayer);
         //Gets the min and max value of the field
         var sizes = SDKHelpers.GetFieldMinMax(featureLayer, firstNumericFieldOfFeatureLayer);
         ProportionalRendererDefinition prDef = new ProportionalRendererDefinition()
         {
             Field = firstNumericFieldOfFeatureLayer,
             MinimumSymbolSize = 4,
             MaximumSymbolSize = 50,
             LowerSizeStop = Convert.ToDouble(sizes.Item1),
             UpperSizeStop = Convert.ToDouble(sizes.Item2)
         };
         CIMProportionalRenderer propRndr = (CIMProportionalRenderer)featureLayer.CreateRenderer(prDef);
         featureLayer.SetRenderer(propRndr);
     }));
 }
Exemplo n.º 25
0
 /// <summary>
 /// Renders a feature layer using an unclassed color gradient.
 /// ![cb-unclassed.png](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/cb-unclassed.png "Class breaks unclassed renderer.")
 /// </summary>
 /// <param name="featureLayer"></param>
 /// <returns>
 /// </returns>
 internal static Task UnclassedRenderer(FeatureLayer featureLayer)
 {
     return(QueuedTask.Run(() =>
     {
         //Gets the first numeric field of the feature layer
         var firstNumericFieldOfFeatureLayer = SDKHelpers.GetNumericField(featureLayer);
         //Gets the min and max value of the field
         var labels = SDKHelpers.GetFieldMinMax(featureLayer, firstNumericFieldOfFeatureLayer);
         UnclassedColorsRendererDefinition ucDef = new UnclassedColorsRendererDefinition()
         {
             Field = firstNumericFieldOfFeatureLayer,
             ColorRamp = SDKHelpers.GetColorRamp(),
             LowerColorStop = Convert.ToDouble(labels.Item1),
             UpperColorStop = Convert.ToDouble(labels.Item2),
             UpperLabel = labels.Item2,
             LowerLabel = labels.Item1,
         };
         CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(ucDef);
         featureLayer?.SetRenderer(renderer);
     }));
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            ToastPush push = SDKHelpers.ParsePushData(e.Uri.ToString());

            push.OnStart = true;

            NotificationService instance = NotificationService.GetCurrent();

            if (instance != null)
            {
                instance.FireAcceptedPush(push);
            }
            else
            {
                NotificationService.StartPush = push;
            }

            string startPage = "/" + WMAppManifestReader.GetInstance().NavigationPage;

            ((PhoneApplicationFrame)Application.Current.RootVisual).Navigate(new Uri(startPage, UriKind.RelativeOrAbsolute));
        }
Exemplo n.º 27
0
        private void ChannelShellToastNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs e)
        {
            Debug.WriteLine("/********************************************************/");
            Debug.WriteLine("Incoming Notification: " + DateTime.Now.ToString());

            String notificationContent = String.Empty;

            ToastPush push = null;
            String    type = String.Empty;

            switch (e.NotificationType)
            {
            case PushNotificationType.Badge:
                notificationContent = e.BadgeNotification.Content.GetXml();
                type = "Badge";
                break;

            case PushNotificationType.Tile:

                notificationContent = e.TileNotification.Content.GetXml();
                type = "Tile";
                break;

            case PushNotificationType.Toast:

                notificationContent = e.ToastNotification.Content.GetXml();

                try
                {
                    IXmlNode node       = e.ToastNotification.Content.DocumentElement.SelectSingleNode("/toast");
                    IXmlNode launchAttr = node.Attributes.GetNamedItem("launch");
                    String   args       = launchAttr.NodeValue.ToString();

                    push = SDKHelpers.ParsePushData(args);

                    //Sample to handle push custom data on start
                    StatisticRequest request2 = new StatisticRequest {
                        AppId = AppID, Hash = push.Hash
                    };
                    PushwooshAPIServiceBase.InternalSendRequestAsync(request2, null, null);
                }
                catch { }

                type = "Toast";
                break;

            case PushNotificationType.Raw:
                notificationContent = e.RawNotification.Content;
                type = "Raw";
                break;
            }

            if (push == null)
            {
                StatisticRequest request2 = new StatisticRequest {
                    AppId = AppID
                };
                PushwooshAPIServiceBase.InternalSendRequestAsync(request2, null, null);
            }

            Debug.WriteLine("Received {0} notification", type);
            Debug.WriteLine("Notification content: " + notificationContent);

            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                try
                {
                    if (push != null)
                    {
                        FireAcceptedPush(push);
                    }
                }
                catch (Exception)
                {
                    //Noting todo here
                }
            });
        }
Exemplo n.º 28
0
        /// <summary>
        /// Renders a polygon feature layer with Dot Density symbols to represent quantities.
        /// ![Dot Density renderer](http://Esri.github.io/arcgis-pro-sdk/images/Renderers/dotDensity-renderer.png)
        /// </summary>
        /// <remarks></remarks>
        /// <returns></returns>
        internal static Task DotDensityRendererAsync()
        {
            //Check feature layer name
            //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
            var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");

            if (featureLayer == null)
            {
                MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                //Define size of the dot to use for the renderer
                int dotSize = 3;
                //Check if the TOTPOP10 field exists
                int idxField = -1;
                using (var table = featureLayer.GetTable())
                {
                    var def = table.GetDefinition();
                    idxField = def.FindField("TOTPOP10");
                }
                // "TOTPOP10" field was not found
                if (idxField == -1)
                {
                    return;
                }

                //array of fields to be represented in the renderer
                string[] valueFields = new string[] { "TOTPOP10" };
                //Create the DotDensityRendererDefinition object
                var dotDensityDef = new DotDensityRendererDefinition(valueFields, SDKHelpers.GetColorRamp(),
                                                                     dotSize, 30000, "Dot", "people");
                //Create the renderer using the DotDensityRendererDefinition
                CIMDotDensityRenderer dotDensityRndr = (CIMDotDensityRenderer)featureLayer.CreateRenderer(dotDensityDef);

                //if you want to customize the dot symbol for the renderer, create a "DotDensitySymbol" which is an
                //Amalgamation of 3 symbol layers: CIMVectorMarker, CIMSolidFill and CIMSolidStroke
                //Define CIMVectorMarker layer
                var cimMarker = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.RedRGB, dotSize);
                var dotDensityMarker = cimMarker as CIMVectorMarker;
                //Definte the placement
                CIMMarkerPlacementInsidePolygon markerPlacement = new CIMMarkerPlacementInsidePolygon {
                    Randomness = 100, GridType = PlacementGridType.RandomFixedQuantity, Clipping = PlacementClip.RemoveIfCenterOutsideBoundary
                };
                dotDensityMarker.MarkerPlacement = markerPlacement;

                //Define CIMSolidFill layer
                CIMSolidFill solidFill = new CIMSolidFill {
                    Color = new CIMRGBColor {
                        R = 249, G = 232, B = 189, Alpha = 50
                    }
                };

                //Define CIMSolidStroke
                CIMSolidStroke solidStroke = new CIMSolidStroke {
                    Color = ColorFactory.Instance.GreyRGB, Width = .5
                };

                //Create the amalgamated CIMPolygonSymbol that includes the 3 layers
                var dotDensitySymbol = new CIMPolygonSymbol
                {
                    SymbolLayers = new CIMSymbolLayer[] { dotDensityMarker, solidFill, solidStroke }
                };

                //Apply the dotDensitySymbol to the CIMDotDenstityRenderer's DotDensitySymbol property.
                dotDensityRndr.DotDensitySymbol = dotDensitySymbol.MakeSymbolReference();

                //Apply the renderer to the polygon Feature Layer.
                featureLayer.SetRenderer(dotDensityRndr);
            }));
        }