In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "TE how to calculate the zoom level of the map", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "TE how to calculate the zoom level of the map" this article.
In the two-dimensional map, the map is displayed at different levels, and the map elements displayed at each level are not exactly the same. In the three-dimensional map of TE, the terrain data is also displayed at different levels. However, the API of TE does not provide the level to which the current field of view is displayed, only SGWorld.Terrain.Levels is provided, and the total number of levels of 3D terrain can be obtained, probably because in the three-dimensional view. Different places may display different levels of maps.
An example of a hierarchical slice of a 2D map:
However, a ready-made tool is provided in TE to calculate the vector layer loaded in TE and set the optimal block width, according to which the vector can achieve the best performance in TE.
This feature is a web page that is embedded in TE. By analyzing the code in it, the current zoom level of TE can be calculated vaguely. The following is a brief analysis according to the code:
Function init ()
{
/ / the block width value positioned in initialization can be used as an indication of the level, but the numbering order defined below should be reversed. The higher the level, the smaller the width of the block.
RealNumLevels = SGWorld.Terrain.Levels
AddLevel (22, "40075" + SGLang.i18n ("Text7"))
AddLevel (21, "20037" + SGLang.i18n ("Text7"))
AddLevel (20, "10018" + SGLang.i18n ("Text7"))
AddLevel (19, "5009" + SGLang.i18n ("Text7"))
AddLevel (18, "2504" + SGLang.i18n ("Text9"))
AddLevel (17, "1252" + SGLang.i18n ("Text7"))
AddLevel (16,626 + SGLang.i18n ("Text10"))
AddLevel (15,313 + SGLang.i18n ("Text11"))
AddLevel (14,156 + SGLang.i18n ("Text7"))
AddLevel (13, "78" + SGLang.i18n ("Text12"))
AddLevel (12, "39" + SGLang.i18n ("Text13"))
AddLevel (11, "19" + SGLang.i18n ("Text7"))
AddLevel (10, "9783" + SGLang.i18n ("Text14"))
AddLevel (9, "4891" + SGLang.i18n ("Text15"))
AddLevel (8, "2445" + SGLang.i18n ("Text8"))
AddLevel (7, "1222" + SGLang.i18n ("Text16"))
AddLevel (6,611 + SGLang.i18n ("Text17"))
AddLevel (5,305 + SGLang.i18n ("Text8"))
AddLevel (4,152 + SGLang.i18n ("Text18"))
AddLevel (3, "76" + SGLang.i18n ("Text19"))
AddLevel (2, "38" + SGLang.i18n ("Text8"))
AddLevel (1, "19" + SGLang.i18n ("Text8"))
}
Function getBestViewPoint () {
/ / get the spatial coordinates of the center of the current screen. Of course, the field of view cannot point to the sky.
Var worldPointMid = SGWorld.Window.CenterPixelToWorld ()
If (worldPointMid.Type = = 32) {
Alert (SGLang.i18n ("Text20"))
Return null
}
Return worldPointMid.Position
}
/ / calculate the level according to the location, which is the key function in it, including the following functions
Function getPreferredLevel (viewPoint)
{
/ / calculate the distance between the position of the current field of view and the center point of the screen
Var DistCameraToTerrain = SGWorld.Navigate.GetPosition () .DistanceTo (viewPoint)
/ / the true width of the half
Var HalfRealWidth = DistCameraToTerrain * Math.tan ((53.02.0) * Math.PI / 180.0)
Var NumBlocksInViewWidth = 4
/ / convert block width to grade
Var IdealBlockSize = HalfRealWidth * 2.0 / NumBlocksInViewWidth
Var blockLevel = BlockWidthToLevel (IdealBlockSize)
Var LayerType =-1
If (document.all ["layertype"] [0] .minutes)
LayerType = 0; / / "points"
If (document.all ["layertype"] [1] .conversation)
LayerType = 1; / / "lines"
If (document.all ["layertype"] [2] .minutes)
LayerType = 2; / / "polygons"
If (LayerType =-1)
{
Alert (SGLang.i18n ("Text21"))
Return-1
}
Else if (LayerType! = 0)
BlockLevel + = 1
BlockLevel = Math.min (blockLevel, fakeNumLevels-1)
Return blockLevel
}
/ / convert block width to grade
Function BlockWidthToLevel (blockWidth)
{
Var numOfBlocksInLevel = blockWidth / bestLevelWidth
Var deltaFromBestLevel = Math.log (numOfBlocksInLevel) / Math.log (2.0)
Var L1 = bestLevelWidth * Math.pow (2, Math.floor (deltaFromBestLevel))
Var L2 = bestLevelWidth * Math.pow (2, Math.floor (deltaFromBestLevel + 0.5))
If (Math.abs (L1-blockWidth)
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.