In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how Qt compiles map annotation point interaction". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "Qt how to compile map annotation point interaction".
I. Preface
In the application of map project, the interactive use of annotation points is very high, which should be the most commonly used scenario. For example, reading the information of the device from the database, including latitude and longitude coordinates, and then displaying the corresponding device on the map, you need to use the addMarker function to dynamically add annotation points. With regard to the encapsulated function, it has been continuously perfected for many years. It is strange why such a simple function still needs to be improved. In fact, this is also accumulated in the actual combat project applications, to meet a variety of simple and complex application scenarios, this function with many parameters, at least 10, and then list the specific meaning of the parameters and the requirements scenarios encountered.
V0.1:addMarker (name, point), very simple, beginner level, only need to pass in the name and latitude and longitude coordinates.
V0.2:addMarker (name, addr, title, tips, point) has three more parameters, namely, address, title and prompt content. At the beginning, the string content is displayed as it is passed, but later it is found that it is not flexible enough. For example, many users need to customize the content or even color to display prompt information, which requires content in html format.
V0.3:addMarker (name, addr, title, tips, width, point, action), two more parameters, one represents the width of the pop-up box, and when the width is set, it is displayed according to the set value. Action has three choices, indicating what action 0 is triggered after clicking-does not process 1-self pop-up box 2-sends a signal, the default 0 means no processing, and if you add a note point, fill in 1 to pop up the box according to the set prompt. 2 does not pop up the box, but will send the form of identification information signal to the interface and let the interface handle it on its own, for example, the pop-up window displays the real-time video of the corresponding point after clicking a callout point.
V0.4:addMarker (name, addr, title, tips, width, point, action, animation, iconfile, iconindex), with three more parameters, animation represents animation 0-does not handle 1-jump 2-fall, used to distinguish between different devices, iconfile indicates the path of the icon file, if not set, uses the default icon, pays attention to the size of the picture, iconindex indicates that the icon corresponds to the index in the picture, and the local file is treated as the picture size. The prompt information will be automatically adjusted to the appropriate position according to the size.
V0.5: add delete dimension point function deleteMarker (name) and move dimension point function moveMarker (name, point). If name is empty, it represents all dimension points.
II. Functional features
Both online map and offline map modes are supported.
It also supports webkit kernel, webengine kernel, miniblink kernel and IE kernel.
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.
Provides a function interface to handle latitude and longitude resolution to address and address resolution to latitude and longitude coordinates.
The demo provided can be directly selected to perform corresponding processing such as route query.
You can get the collection of point coordinate information queried by the route, such as for robot coordinate navigation.
Encapsulates a wealth of functions such as deleting specified points and all points, deleting specified coverings and all coverings, etc.
Callout point pop-up box information can be customized in standard html format.
Dimension point click event optional 0-do not process 1-own pop-up box 2-send a signal.
Dimension points can be animated 0-do not process 1-Jump 2-fall
Dimension points can be set up local picture files and so on.
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
IV. The related code void MapBaiDu::addMarker (QStringList & list) {/ / dynamically add point / / name indicates that the text displayed next to the icon of the dimension point name is empty, then does not display / / addr indicates that the dimension point address / / title represents the pop-up box information html format title / / tips represents the pop-up box information html format content / / width represents the pop-up box Width / / point indicates longitude and latitude coordinates / / action indicates what action is triggered after click 0-do not process 1-self pop-up box 2-send signal / / animation indicates animation 0-do not process 1-jump 2-fall / / iconfile indicates icon file path If it is not set, the default icon is used. Note that the size of the picture / / iconindex indicates that the icon corresponds to the index in the picture, and the local file is treated as the picture size list.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.