From 383f61bdc090b58b633d94439b6509d5874929d6 Mon Sep 17 00:00:00 2001 From: radioman Date: Fri, 8 May 2015 10:26:59 +0300 Subject: [PATCH] Demo.WindowsForms: updated static image rendering --- Demo.WindowsForms/Forms/StaticImage.cs | 30 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Demo.WindowsForms/Forms/StaticImage.cs b/Demo.WindowsForms/Forms/StaticImage.cs index b423f3e2..4202aff5 100644 --- a/Demo.WindowsForms/Forms/StaticImage.cs +++ b/Demo.WindowsForms/Forms/StaticImage.cs @@ -60,7 +60,8 @@ void bg_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) this.Text = "Static Map maker"; progressBar1.Value = 0; button1.Enabled = true; - numericUpDown1.Enabled = true; + numericUpDown1.Enabled = true; + Main.MainMap.Refresh(); } void bg_ProgressChanged(object sender, ProgressChangedEventArgs e) @@ -234,10 +235,12 @@ void bg_DoWork(object sender, DoWorkEventArgs e) px.Offset(padding, padding); px.Offset(-topLeftPx.X, -topLeftPx.Y); px.Offset(r.Offset.X, r.Offset.Y); - - r.LocalPosition = new System.Drawing.Point((int)px.X, (int)px.Y); - - r.OnRender(gfx); + + gfx.ResetTransform(); + gfx.TranslateTransform(-r.LocalPosition.X, -r.LocalPosition.Y); + gfx.TranslateTransform((int)px.X, (int)px.Y); + + r.OnRender(gfx); } } @@ -248,10 +251,22 @@ void bg_DoWork(object sender, DoWorkEventArgs e) { if(!string.IsNullOrEmpty(m.ToolTipText)) { - m.ToolTip.OnRender(gfx); + var pr = m.Position; + GPoint px = info.Type.Projection.FromLatLngToPixel(pr.Lat, pr.Lng, info.Zoom); + + px.Offset(padding, padding); + px.Offset(-topLeftPx.X, -topLeftPx.Y); + px.Offset(m.Offset.X, m.Offset.Y); + + gfx.ResetTransform(); + gfx.TranslateTransform(-m.LocalPosition.X, -m.LocalPosition.Y); + gfx.TranslateTransform((int)px.X, (int)px.Y); + + m.ToolTip.OnRender(gfx); } } } + gfx.ResetTransform(); } // draw info @@ -370,7 +385,8 @@ private void button1_Click(object sender, EventArgs e) numericUpDown1.Enabled = false; progressBar1.Value = 0; button1.Enabled = false; - + Main.MainMap.HoldInvalidation = true; + bg.RunWorkerAsync(new MapInfo(area.Value, (int)numericUpDown1.Value, Main.MainMap.MapProvider, checkBoxWorldFile.Checked)); } }