MapPoint 2009 负载性能
我在将 MS MapPoint 2009 集成到 C# 中的 WinForms .Net 2.0 应用程序中时遇到一些问题。 我已将 ActiveX MapPoint 控件添加到表单中,并且可以毫无问题地显示地图和位置; 我担心的是创建地图后加载地图所需的时间。
我的开发机器上的测试显示平均加载时间在 3 到 5 秒之间,在此期间应用程序完全锁定。 虽然这并非完全不可接受,但失去对应用程序的控制需要很长时间。 另外,由于 GUI 线程被锁定,我无法显示加载对话框或其他内容来掩盖加载时间。
挂起的行是这样的:(其中 axMappointControl1 是 MapPoint 控件)
axMappointControl1.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica);
我尝试在另一个线程上执行 NewMap 方法,但 GUI 线程最终仍然被阻止。
我的问题是:
- 如何加快 MapPoint 的加载速度?
- 有没有办法加载MapPoint,这样它就不会阻塞GUI线程?
任何帮助是极大的赞赏。
I'm having some problems integrating MS MapPoint 2009 into my WinForms .Net 2.0 application in C#. I've added the ActiveX MapPoint control onto a form and have no problems getting it to display a maps and locations; my concern is the time it takes to load a map once it is created.
The tests on my development machine have shown the average load time to be between 3 and 5 seconds, during which the application is totally locked. While this isn't totally unacceptable, it's an awfully long time to lose control of the application. Also, because the GUI thread is locked, I cannot show a loading dialog or something to mask the load time.
The line that hangs is this: (where axMappointControl1 is the MapPoint control)
axMappointControl1.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica);
I've tried executing the NewMap method on another thread but the GUI thread still ends up being blocked.
My questions are:
- What can I do to speed up MapPoint when it loads?
- Is there any way to load MapPoint so that it won't block the GUI thread?
Any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据这些 < a href="http://www.mapforums.com/activex-performance-net-3415.html" rel="nofollow noreferrer">threads at mapforums.com ActiveX 启动缓慢是众所周知且不可避免的(尽管线程有助于 GUI 响应能力的问题仍然悬而未决。
建议的一件事是放弃 ActiveX 版本,转而使用 MapPoint.Application 对象。
希望有所帮助。
According to these threads at mapforums.com the slowness of ActiveX startup is well known and unavoidable (though the question of threading to help with GUI responsiveness is still open.
One thing suggested was to abandon the ActiveX version in favor of the MapPoint.Application object instead.
Hope that helps.
是的,应用程序版本在它自己的线程上运行 - 所以这应该是一个更快的替代方案 - 在启动时更容易做你自己的事情。 但是,当用户启动 MapPoint 2010 时,它往往需要几秒钟的时间才能启动。
我将创建一个临时 GUI 线程,并使用它在启动期间显示启动屏幕和/或执行您需要执行的任何线程安全初始化。
对 MapPoint 实例(或 ActiveX 控件)的所有调用必须来自创建 MapPoint 控件或应用程序对象的同一线程。
Yes the Application version runs on its own thread - so this should be a quicker alternative - easier to do your own stuff whilst it is starting up. However, MapPoint 2010 tends to take a few seconds to start up when started by a user.
I would create a temporary GUI thread and use this to display a splash screen during start up and/or do any thread-safe initialisation that you need to do.
All calls to a MapPoint instance (or ActiveX control) must be from the same thread that create the MapPoint control or application object.