开发者

Zoom causes (heavy) problems in Bing Maps with polylines

Hello i have some problems with the Bing Map control.

If i zoom to near to the polylines they begin to disappear (from bottom to top and from right to left)

The Polylines are generated dynamically with an ItemsControl (that one which is included in the maps namespace) bound to a collection o开发者_StackOverflow社区f my own LocationData from ViewModel thats converted by a IValueConverter to the map specific LocationPoints.

Some values that are not accessible from ViewModel are set in the loaded event.

The map and the container stretch over the whole screen.

So if the lines begin to disappear and i zoom out via a button in my ApplicationBar

private void ZoomOut_Click(object sender, RoutedEventArgs e)
{
    map1.ZoomLevel -= 1.0;
}

the Application exits without exception...

I have tested it on a real device with and without debugger and the debugger only says that he have lost the connection to the device.

Anyone have this or similar problems and hopefully solved it?

Thanks for any help.

PS: My LocationData contains approximately 100 - 200 points that are split up to 3 - 7 lines that can't be to much or?


Yes, hundreds of points is too much, but that's the least of your problems. The way you have coded this, you are reconverting and replotting your points every time there is a pan or zoom.

  • Don't use the type converter. Convert your points once, cache the converted points and bind to the converted points.
  • Research quadtrees and how they apply to culling your point set in proportion to zoom level.
  • Apply a clipping rectangle. In my experience, half a degree larger each side of your display region works well.
  • Study the Bing map event model and redesign your code so that you only cull, clip and plot when map manipulation stops.
  • Ideally, write your cull, clip and plot logic so that it is asynch and can be signalled to abort so that if manipulation restarts before cull, clip and plot is finished, it can be aborted and restarted.

Using the techniques above I am able to get performance comparable to the built-in map.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜