在 Gtk+ 中显示平铺地图;应用程序
我即将开始一个项目,该项目将涉及一个 GUI 应用程序,该应用程序需要显示一个地图界面,该界面是从全局地图切片缓存(在本地磁盘上)以不同的缩放级别生成的。
该应用程序将使用 Gtk 编写,虽然我相当熟悉基本的 Gtk 小部件,但我不确定如何处理地图界面组件。有各种小部件看起来可能是一个好的开始(框架、布局、视口),但我想知道其他人如何解决同样的问题。
我想要一些具体方面的建议:
- 是否可以在界面中显示图像(例如 1000x1000)但仅显示一部分(例如 500x500)?这里的想法是,当地图滚动时,可以将丢失的图块添加到图像的隐藏部分,因此不存在可见的丢失图块。
- 能够通过使用鼠标抓取和拖动图像来滚动地图。
- 能够在地图上绘制交互式叠加层。例如,代表地标的小图标,响应工具提示和鼠标按钮事件。
任何可以做类似事情的开源 gtk 应用程序都可以作为参考,那就太好了。
干杯
I am about to embark on a project that will involve a GUI application that will need to display a map interface, generated from a global map tile cache (on local disk) at different levels of zoom.
The app will be written using Gtk, and while I am fairly familiar with the basic Gtk widgets, I am unsure how to approach the map interface component. There are various widgets that look like they might be a good start (frames, layouts, viewports), but I would like to know how others might approach the same problem.
Some specific aspects I would like advice on:
- Is it possible to have an image (say 1000x1000) but only display a section (say 500x500) in the interface? The idea here is that missing tiles can be added to the hidden part of the image as the map is being scrolled, so there are no visible missing tiles.
- Being able to scroll the map by using the mouse to grab and drag the image.
- Being able to draw interactive overlays ontop of the map. E.g. a small icon representing a place-mark, that responds to tooltip and mouse-button events.
Any open source gtk apps that do something similar that I can use as a reference would be great.
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经做到了,但代码无法共享。我当前的实现使用修改后的 geoc (http://geocanvas.sourceforge.net/geoc/index.html html)、带有 Spatialite 的 SqlLite 和 GDAL。有一种叫做 champlain 的东西可能适合你的情况,但它使用了 Clutter。
I have done it but in code that I cannot share. My current implementation uses a modified geoc (http://geocanvas.sourceforge.net/geoc/index.html), SqlLite with Spatialite, and GDAL. There is something called champlain which may work for your situation but that uses Clutter.