Skip to content

Commit

Permalink
Demo.WindowsForms: updated static image rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
radioman committed May 8, 2015
1 parent 21c89d0 commit 383f61b
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions Demo.WindowsForms/Forms/StaticImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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
Expand Down Expand Up @@ -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));
}
}
Expand Down

0 comments on commit 383f61b

Please sign in to comment.