Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Baidu online Map with Qt

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "Qt how to achieve Baidu online map", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Qt how to achieve Baidu online map" bar!

I. Preface

There are not many difficulties in online maps. To build a simple online map demo is definitely a matter of a few lines of code every minute. In the process of using it, several small areas have been improved. For example, the margin of the map needs to be set to html,body {height:100%;width:100%;margin:0px;padding:0px;}. For example, there is a Baidu logo in the lower left corner. If you want to remove it, add a css to .anchorBL {display:none. }, otherwise release it out, others will see how there is still Baidu's logo to lose face. For example, the scroll bar style, many people say that I clearly set the Qt scroll bar style, ah, why the scroll bar inside has no effect? In fact, the scroll bar in this is a web page, not controlled, you need to set the scrollbar css of the web page as follows.

::-webkit-scrollbar {width:0.8em;}::-webkit-scrollbar-track {background:rgb (241241241);}::-webkit-scrollbar-thumb {background:rgb (188188188);} II. Functional features

Both online map and offline map modes are supported.

Support webkit kernel, webengine kernel and IE kernel at the same time.

Multiple dimension points can be set, including name, address, longitude and latitude.

You can set whether the map can be clicked, dragged, or scrolled.

You can set the protocol version, secret key, theme style, central coordinates, central city, geocoding location, and so on.

Can set the map zoom scale and level, thumbnails, scale, road information and other controls visible.

Support map interaction, such as mouse press to get the latitude and longitude of the corresponding location.

Support to query the route, you can set the starting point, end point, route mode, route mode, route scheme (minimum time, least transfer, least walk, do not take the subway, shortest distance, avoid highway).

Can display dots, lines and surfaces tools, and can draw lines, points, rectangles, circles and so on directly on the map.

Administrative divisions can be set up, a certain urban area drawing layer can be specified, and the online map automatically outputs the administrative division boundary points to the js file for offline map use.

Multiple coverings can be added statically or dynamically. Support points, broken lines, polygons, rectangles, circles, arcs, point aggregations, etc.

The function interface is friendly and unified, and it is easy to use, just one class.

Support js dynamic interaction to add points, delete points, clear points, reset points, no need to refresh the page.

Support any Qt version, any system, any compiler.

Third, effect picture

4. Related code void MapBaiDu::addBody (QStringList & list) {/ / build the content list of the main part of the web page

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report