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)); } }
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; }
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; } }