In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how Qt compiles maps to achieve mass point labeling, and the content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
I. Preface
The emergence of massive point tagging is to solve the problem of rapid decline in the performance of more than hundreds of ordinary equipment points. Ordinary marker tagging exists in the map in the form of objects, the more the number is, the more memory is occupied, and the performance of more than 1000 points is extremely poor. Even if you use point aggregation, when you drag the map, it is a card, which is called shit for short, and it slows down into a piece of shit when loading. So there is an urgent need for another form to support thousands of mass points, and the best way is to draw graphics and simplify a lot of attributes, such as custom icons, rotation angles, click animation jumps, and so on. In fact, most of the time, these features are not needed, in the mass point scene, you can sacrifice these features, and then use the simplest form of drawing graphics to draw mass points One of the most basic functions provided is to identify which point you clicked.
The core of massive point labeling is to use the js object class PointCollection built in the map to pass in the longitude and latitude coordinate set of the point. At the same time, it can also uniformly set the color, size and shape of the point, judge which point is clicked by addEventListener monitoring events, and finally add a mass of point coverage to the map by adding a cover.
Size parameters:
1 = BMAP_POINT_SIZE_TINY 2px*2px
2 = BMAP_POINT_SIZE_SMALLER 4px*4px
3 = BMAP_POINT_SIZE_SMALL 8px*8px
4 = BMAP_POINT_SIZE_NORMAL 10px*10px default
5 = BMAP_POINT_SIZE_BIG 16px*16px
6 = BMAP_POINT_SIZE_BIGGER 20px*20px
7 = BMAP_POINT_SIZE_HUGE 30px*30px
Shape parameters:
1 = BMAP_POINT_SHAPE_CIRCLE circle default
2 = BMAP_POINT_SHAPE_STAR star
3 = BMAP_POINT_SHAPE_SQUARE square
4 = BMAP_POINT_SHAPE_RHOMBUS diamond
5 = BMAP_POINT_SHAPE_WATERDROP droplets
II. Functional features
The timer queues to download the provincial and municipal outline map point coordinate set and stores it to the JS file.
Support multiple irregular area downloads in one administrative area.
Automatically calculate the number of download profiles in the administrative area.
Can accurately select provinces, urban areas, county towns, can also directly enter the name of the administrative region.
You can set the download interval, start the download at any time, and stop the download.
Provide editing boundary function, you can directly edit the collection of points in irregular areas on the map, and then obtain the boundary point set data, which can be used to draw the area to get the data, such as the administrative data of a township or even a community. Impressive.
Third, experience address
Experience address: https://pan.baidu.com/s/1ZxG-oyUKe286LPMPxOrO2A extraction code: o05q file name: bin_map.zip
Domestic site: https://gitee.com/feiyangqingyun
International site: https://github.com/feiyangqingyun
4. Effect picture
5. The related code void frmMapMarkers::addMarker () {/ / first clears all the original coverings, including the dimension point runJs ("deleteOverlay (')"); / / takes out the large longitude and latitude values of the anchor point QString point = ui- > txtPointLeftBottom- > text (); QStringList list = point.split (","); double lng = list.first (). ToDouble (); double lat = list.last (). ToDouble () / / maximum longitude and latitude decimal point float dotLng = 0.015; float dotLat = 0.011; / limit the maximum quantity int index = ui- > cboxType- > currentIndex (); int count = ui- > cboxCount- > currentText (). ToInt (); int maxCount = 300; if (index = = 1) {maxCount = 1000;} else if (index = 2) {maxCount = 50000 } if (count > maxCount) {QString info = QString ("due to the official limited performance of this method, it is recommended that the number not exceed% 1!") .Arg (maxCount); QUIHelper::showMessageBoxError (info); return } / / different types of processing, random simulation of longitude and latitude, you can adjust the range value if (index = = 0) {/ / add dimension point for (int I = 0; I < count; + + I) {QStringList points = QUIHelper::getRandPoint (1, lng, lat, dotLng, dotLat) QString js = QString ("addMarker (', 30,'1')") .Arg (points.first ()); runJs (js);}} else if (index = = 1) {/ / add point aggregation QStringList points = QUIHelper::getRandPoint (count, lng, lat, dotLng, dotLat) QString js = QString ("addMarkerClusterer ('% 1')") .arg (points.join ("|")); runJs (js);} else if (index = = 2) {/ / add mass point QStringList points = QUIHelper::getRandPoint (count, lng, lat, dotLng, dotLat); QString js = QString ("addPointCollection ('% 1th,'# A279C5')") .arg (points.join ("|")) RunJs (js);}} void frmMapMarkers::on_btnDo_clicked () {/ / automatically obtain the current regional boundary runJs ("getBounds ()");} about how Qt compiles maps to achieve massive point labeling, so much for sharing here. I hope the above content can be helpful to everyone and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.