/// <summary> /// Draws all locations in "extraLocations" on Bitmap tile with box /// containing the start and end point of the tile in geological coordinates. /// Locations will only be drawn in certain zoomlevels. /// </summary> private void drawExtras(BBox box, Bitmap tile, Location[] extraLocations, int zoomLevel) { foreach (Location extraLocation in extraLocations) { Image icon = getIconFromLocationType(extraLocation.Type, zoomLevel); if (icon != null) { drawExtra(box, tile, extraLocation, icon); } } }
/// <summary> /// Draws a location on the map with Image "icon" on /// the Bitmap "tile", where box represents the position /// and size of the tile in geological coordinates. /// </summary> private void drawExtra(BBox box, Bitmap tile, Location location, Image icon) { Graphics gr = Graphics.FromImage(tile); gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; Point start = nodeToTilePoint(box, tile, new Node(box.XMin, box.YMax, 0)); Point p = nodeToTilePoint(box, tile, location); gr.DrawImage(icon, new Point(p.X - start.X, -p.Y + start.Y)); }