diff --git a/Demo.WindowsPresentation/Source/Map.cs b/Demo.WindowsPresentation/Source/Map.cs new file mode 100644 --- /dev/null +++ b/Demo.WindowsPresentation/Source/Map.cs @@ -0,0 +1,47 @@ + +namespace Demo.WindowsPresentation +{ + using System.Windows.Controls; + using System.Windows.Media; + using GMap.NET.WindowsPresentation; + using System.Globalization; + using System.Windows.Forms; + using System.Windows; + using System; + + /// + /// the custom map f GMapControl + /// + public class Map : GMapControl + { + public long ElapsedMilliseconds; + +#if DEBUG + DateTime start; + DateTime end; + int delta; + + private int counter; + readonly Typeface tf = new Typeface("GenericSansSerif"); + readonly System.Windows.FlowDirection fd = new System.Windows.FlowDirection(); + + /// + /// any custom drawing here + /// + /// + protected override void OnRender(DrawingContext drawingContext) + { + start = DateTime.Now; + + base.OnRender(drawingContext); + + end = DateTime.Now; + delta = (int)(end - start).TotalMilliseconds; + + FormattedText text = new FormattedText(string.Format(CultureInfo.InvariantCulture, "{0:0.0}", Zoom) + "z, " + MapProvider + ", refresh: " + counter++ + ", load: " + ElapsedMilliseconds + "ms, render: " + delta + "ms", CultureInfo.InvariantCulture, fd, tf, 20, Brushes.Blue); + drawingContext.DrawText(text, new Point(text.Height, text.Height)); + text = null; + } +#endif + } +}