Beispiel #1
0
        private void Refresh()
        {
            ShapefileLayer areaLayer = Map1.FindLayer <ShapefileLayer>("countries-900913");

            if (areaLayer == null)
            {
                return;
            }
            if (values == null)
            {
                values = areaLayer.Source.GetUniqueFieldValues(columnName).Distinct().ToArray();
            }

            areaLayer.Styles.Clear();
            ValueStyle valueStyle = ValueStyle.Create(columnName, values, DimensionType.Area, colorFamily, new GeoColor(255, 108, 144, 150), 0.01f);

            areaLayer.Styles.Add(valueStyle);

            LegendTitleTextBlock.Text = $"Thematic by \"{columnName}\" column";
            LegendView.Update(valueStyle.ValueItems.OrderBy(i => i.Value).SelectMany(i =>
            {
                foreach (var style in i.Styles)
                {
                    style.Name = $"{columnName} = \"{i.Value}\"";
                }
                return(i.Styles);
            }));
            Map1.Refresh(RefreshType.Redraw);
        }
Beispiel #2
0
        private void Refresh()
        {
            ShapefileLayer areaLayer = Map1.FindLayer <ShapefileLayer>("countries-900913");

            if (areaLayer == null)
            {
                return;
            }
            areaLayer.Styles.Clear();
            ClassBreakStyle classBreakStyle = ClassBreakStyle.Create(columnName, 281396894, 5000000, 11, DimensionType.Area, colorFamily, new GeoColor(50, 100, 200, 150), 0.01f);

            classBreakStyle.ClassBreaks[0].Value = 0;
            areaLayer.Styles.Add(classBreakStyle);

            LegendTitleTextBlock.Text = "The population of countries";
            ClassBreak[] classBreaks = classBreakStyle.ClassBreaks.OrderBy(i => i.Value).ToArray();
            for (int i = 0; i < classBreaks.Length; i++)
            {
                ClassBreak fromClassBreak = classBreaks[i];
                ClassBreak toClassBreak   = i + 1 < classBreaks.Length ? classBreaks[i + 1] : null;
                foreach (var style in fromClassBreak.Styles)
                {
                    if (toClassBreak != null)
                    {
                        style.Name = $"{(fromClassBreak.Value / 1000000).ToString("N0")} ~ {(toClassBreak.Value / 1000000).ToString("N0")} million";
                    }
                    else
                    {
                        style.Name = $">= {(fromClassBreak.Value / 1000000).ToString("N0")} million";
                    }
                }
            }
            LegendView.Update(classBreaks.SelectMany(i => i.Styles));
            Map1.Refresh(RefreshType.Redraw);
        }