public void Dispose() { linePoints = null; transformedPoints = null; loader = null; bitmap.Dispose(); gr.Dispose(); myPen.Dispose(); GC.SuppressFinalize(this); }
//Gets the lines needed to draw map, tranforms, and draws onto a bitmap public Bitmap DrawMap(ref OSMDataManager xmlData) { loader = xmlData; GetPoints(); TransformPoints(); DrawToBitmap(); transformedPoints = new ConcurrentBag <Tuple <float, float, float, float> >(); return(bitmap); }
//Parses OSM file and creates bitmaps that contain the map async void LoadAndDraw() { textBox1.Text = "Loading in Nodes..."; xmlData = await Task.Run(() => new OSMDataManager(fileLoc)); textBox1.Text = "Drawing Map..."; drawer = new MapDrawer(new Tuple <int, int>(dbPanel1.Width * 4, dbPanel1.Height * 4)); fullSizedBitmap = new Bitmap(await Task.Run(() => drawer.DrawMap(ref xmlData))); await Task.Run(() => drawer.Dispose()); await Task.Run(() => xmlData.Dispose()); CreateBitmaps(); GC.Collect(); GC.Collect(); RefreshScreen(); textBox1.Visible = false; }