In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to limit the scope of map browsing in Cesium development. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
In the development of two-dimensional map, there are maxbounds attribute or maxextent attribute, which can limit the browsing of the map to a certain range of four-to-coordinate.
Compared with the two-dimensional map, the three-dimensional map has more parameters such as height, rotation, viewing angle and so on. The API that sets the lowest and highest viewing height in Cesium can be controlled on the viewing height. The following code is as follows:
Viewer.scene.screenSpaceCameraController.maximumZoomDistance = 100000
Viewer.scene.screenSpaceCameraController.minimumZoomDistance = 10
The API with a range of four to four has not been found and requires further development based on the existing API.
The idea is to control the scope of browsing in the pre-set range of four to real-time detection, beyond the range, let the lens return to the set range.
The real-time monitoring function uses preRender, and this event is executed frequently:
Viewer.scene.preRender.addEventListener (function () {/ / function content})
Cesium's lens field of view, which starts with computeViewRectangle, calculates a viewing field of view, and the result is west,east,north,south5 range parameters.
Let _ viewRectangle = viewer.camera.computeViewRectangle ()
Then compare the above four range parameters with the set four-to-range, and use the set four-to-range for the part out of the range. finally, the viewing range of the camera is forced to jump back to the viewing field of view to prevent it from exceeding.
However, in such a calculation, the scene has a certain jump, and the effect is not very ideal. Later, we expanded the set range of four to viewer.camera.position, limited the viewing coordinates to four to the range, and forced to jump back to the part beyond the range. Although there is a certain error in the viewing range, the overall effect is still better.
Thank you for reading! This is the end of the article on "how to limit the scope of map browsing in Cesium development". I hope the above content can be of some help to you, so that you can 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.