protected override void DrawCore(GeoCanvas geoCanvas, Style style)
        {
            Bitmap          bitmap          = new Bitmap(35, 20);
            ClassBreakStyle classBreakStyle = style as ClassBreakStyle;
            RectangleShape  worldExtent     = new RectangleShape(-180, 90, 180, -90);

            // Draw Icon
            geoCanvas.BeginDrawing(bitmap, worldExtent, GeographyUnit.DecimalDegree);
            if (StartClassBreak.DefaultAreaStyle != null)
            {
                StartClassBreak.DefaultAreaStyle.Draw(new BaseShape[] { worldExtent }, geoCanvas, new System.Collections.ObjectModel.Collection <SimpleCandidate>(), new System.Collections.ObjectModel.Collection <SimpleCandidate>());
            }
            geoCanvas.DrawArea(worldExtent, new GeoPen(GeoColor.FromHtml("#cccccc"), 2), DrawingLevel.LabelLevel);
            geoCanvas.EndDrawing();

            this.Image = bitmap;
            if (EndClassBreak != null)
            {
                this.Title = string.Format("{0:#,0.####} ~ {1:#,0.####}",
                                           MapSuiteSampleHelper.GetFormatedStringForLegendItem(classBreakStyle.ColumnName, StartClassBreak.Value),
                                           MapSuiteSampleHelper.GetFormatedStringForLegendItem(classBreakStyle.ColumnName, EndClassBreak.Value));
            }
            else
            {
                this.Title = string.Format("> {0:#,0.####}",
                                           MapSuiteSampleHelper.GetFormatedStringForLegendItem(classBreakStyle.ColumnName, StartClassBreak.Value));
            }
        }
        // Here we load all the nodes on the left from xml file.
        private void InitializetionDataCategories()
        {
            var xDoc     = XDocument.Load(MapSuiteSampleHelper.GetValueFromConfiguration("CategoryFilePath"));
            var elements = from category in xDoc.Element("DemographicMap").Elements("Category")
                           select category;

            foreach (var element in elements)
            {
                DataCategoryViewModel category = null;
                string title = element.Attribute("name").Value;
                category               = title != "Custom Data" ? new DataCategoryViewModel() : new CustomDataCategoryViewModel();
                category.Title         = title;
                category.CategoryImage = new BitmapImage(new Uri(string.Format(CultureInfo.InvariantCulture, "{0}{1}", "pack://application:,,,/MapSuiteUSDemographicMap;component/", element.Attribute("icon").Value), UriKind.RelativeOrAbsolute));

                foreach (var item in element.Elements("item"))
                {
                    ColumnViewModel categoryItem = new ColumnViewModel();
                    categoryItem.Parent      = category;
                    categoryItem.ColumnName  = item.Element("columnName").Value;
                    categoryItem.Alias       = item.Element("alias").Value;
                    categoryItem.LegendTitle = item.Element("legendTitle").Value;
                    category.Columns.Add(categoryItem);
                }
                category.CanUsePieView = category.Columns.Count >= 2;
                CategoryList.Add(category);
            }
        }
        private void InitializeMap()
        {
            mapControl.MapTools.Logo.IsEnabled                      = true;
            mapControl.MapTools.Logo.Margin                         = new Thickness(0, 0, 10, 5);
            mapControl.MapTools.MouseCoordinate.IsEnabled           = true;
            mapControl.MapTools.MouseCoordinate.Visibility          = Visibility.Hidden;
            mapControl.MapTools.MouseCoordinate.Margin              = new Thickness(0, 0, 100, 5);
            mapControl.MapTools.MouseCoordinate.MouseCoordinateType = MouseCoordinateType.Custom;

            mapControl.Overlays.Add(new WorldMapKitWmsWpfOverlay());

            censusStateFeatureLayer = new ShapeFileFeatureLayer(MapSuiteSampleHelper.GetValueFromConfiguration("UsShapefilePath"));
            censusStateFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            demographicLayerOverlay          = new LayerOverlay();
            demographicLayerOverlay.TileType = TileType.SingleTile;
            mapControl.Overlays.Add(demographicLayerOverlay);

            highlightOverlay = new HighlightOverlay();
            mapControl.Overlays.Add(highlightOverlay);

            legendAdornmentLayer          = new LegendAdornmentLayer();
            legendAdornmentLayer.Location = AdornmentLocation.LowerLeft;
            legendAdornmentLayer.Title    = new LegendItem();
            legendAdornmentLayer.Title.ImageJustificationMode = LegendImageJustificationMode.JustifyImageRight;
            legendAdornmentLayer.Title.TopPadding             = 10;
            legendAdornmentLayer.Title.BottomPadding          = 10;
            legendAdornmentLayer.Title.TextStyle = new TextStyle("Population", new GeoFont("Segoe UI", 12), new GeoSolidBrush(GeoColor.SimpleColors.Black));
            mapControl.AdornmentOverlay.Layers.Add(legendAdornmentLayer);

            DefaultFeatureLayer = censusStateFeatureLayer;

            MapControl.CurrentExtent = globeExtent;
        }
        protected override void DrawCore(GeoCanvas geoCanvas, Style style)
        {
            Bitmap bitmap = new Bitmap(50, 50);

            CustomDotDensityStyle dotDensityStyle = style as CustomDotDensityStyle;
            RectangleShape        drawingExtent   = new RectangleShape(-180, 90, 180, -90);

            // Draw Icon Outline
            geoCanvas.BeginDrawing(bitmap, drawingExtent, GeographyUnit.DecimalDegree);
            geoCanvas.DrawArea(drawingExtent, new GeoPen(GeoColor.FromHtml("#cccccc"), 2), DrawingLevel.LevelOne);

            // Draw Icon points
            Random random = new Random(DateTime.Now.Millisecond);
            Collection <BaseShape> mockupPoints = new Collection <BaseShape>();

            for (int i = 0; i < DotCount; i++)
            {
                double x = random.NextDouble() * (drawingExtent.LowerRightPoint.X - drawingExtent.LowerLeftPoint.X) + drawingExtent.LowerLeftPoint.X;
                double y = random.NextDouble() * (drawingExtent.UpperLeftPoint.Y - drawingExtent.LowerLeftPoint.Y) + drawingExtent.LowerLeftPoint.Y;
                mockupPoints.Add(new PointShape(x, y));
            }
            dotDensityStyle.CustomPointStyle.Draw(mockupPoints, geoCanvas, new Collection <SimpleCandidate>(), new Collection <SimpleCandidate>());

            // Draw Icon Label
            geoCanvas.DrawText(DotCount.ToString("N0"), LabelFont, LabelBrush, null, new ScreenPointF[] { new ScreenPointF(20f, 20f) }, DrawingLevel.LabelLevel, 0, 0, 0);
            geoCanvas.EndDrawing();

            Title = string.Format(CultureInfo.InvariantCulture, "{0:0.####}", MapSuiteSampleHelper.GetFormatedStringForLegendItem(dotDensityStyle.ColumnName, (DotCount / dotDensityStyle.PointToValueRatio)));
            Image = bitmap;
        }
        private LayerTile DrawHighlightTile(RectangleShape targetExtent, LayerTile tile)
        {
            tile.DrawingLayers.Clear();
            if (highlightFeatureLayer.InternalFeatures.Count > 0)
            {
                tile.DrawingLayers.Add(highlightFeatureLayer);
            }

            GeoCanvas geoCanvas = new PlatformGeoCanvas()
            {
                CompositingQuality = CompositingQuality.HighSpeed,
                DrawingQuality     = DrawingQuality.HighSpeed,
                SmoothingMode      = SmoothingMode.HighSpeed
            };
            Bitmap bitmap = new Bitmap((int)tile.Width, (int)tile.Height);

            geoCanvas.BeginDrawing(bitmap, targetExtent, MapArguments.MapUnit);
            tile.Draw(geoCanvas);
            geoCanvas.EndDrawing();
            tile.CommitDrawing(geoCanvas, MapSuiteSampleHelper.GetImageSourceFromNativeImage(bitmap));

            return(tile);
        }
        protected override void DrawCore(GeoCanvas geoCanvas, Style style)
        {
            Bitmap           bitmap           = new Bitmap(50, 50);
            RectangleShape   worldExtent      = new RectangleShape(-180, 90, 180, -90);
            ValueCircleStyle valueCircleStyle = style as ValueCircleStyle;

            double radius = Math.Sqrt(circleArea / Math.PI);

            // Draw Icon
            geoCanvas.BeginDrawing(bitmap, worldExtent, GeographyUnit.DecimalDegree);
            if (valueCircleStyle != null)
            {
                geoCanvas.DrawEllipse(new PointShape(0, 0), (float)(radius * 2), (float)(radius * 2), new GeoPen(new GeoSolidBrush(valueCircleStyle.OuterColor)), new GeoSolidBrush(valueCircleStyle.InnerColor), DrawingLevel.LevelOne);
            }

            geoCanvas.DrawArea(worldExtent, new GeoPen(GeoColor.FromHtml("#cccccc"), 2), DrawingLevel.LabelLevel);
            geoCanvas.EndDrawing();

            //Calculate the value of radius
            double drawingRadius = circleArea / valueCircleStyle.DrawingRadiusRatio * valueCircleStyle.BasedScale / valueCircleStyle.DefaultZoomLevel.Scale;
            double dCircleArea   = valueCircleStyle.MaxCircleAreaInDefaultZoomLevel - valueCircleStyle.MinCircleAreaInDefaultZoomLevel;
            double dValue        = valueCircleStyle.MaxValidValue - valueCircleStyle.MinValidValue;
            double ratio         = dValue / dCircleArea;
            double resultValue   = (drawingRadius - valueCircleStyle.MinCircleAreaInDefaultZoomLevel) * ratio + valueCircleStyle.MinValidValue;

            if (resultValue > 0)
            {
                Image = bitmap;
                Title = MapSuiteSampleHelper.GetFormatedStringForLegendItem(valueCircleStyle.ColumnName, resultValue);
            }
            else
            {
                Image = null;
                Title = null;
            }
        }