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 the algorithm of Extent conversion TE viewing position of two-dimensional Map by C #

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article will explain in detail how to realize the Extent conversion TE viewing position algorithm of two-dimensional map in C#. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

In the development of the system, we sometimes encounter the function development of two-dimensional linkage, that is, when the two-dimensional map moves, the three-dimensional movement moves with the movement, the three-dimensional map moves, and the two-dimensional map also changes.

The perspective of two-dimensional map is an upright viewing direction from top to bottom, and three-dimensional map can constantly change the viewing direction, so, in the process of linkage, when two-dimensional controls three-dimensional, the three-dimensional perspective can only maintain an upright downward direction in order to be consistent with two-dimensional.

In the process of moving a two-dimensional map, the four-to-four coordinates of the map, namely XMax,XMin,YMax,YMin, can be obtained. According to this range, a rough range can be calculated in TE for map positioning.

The specific code implementation is as follows (C #):

/ / XMax,XMin,YMax,YMin is 4 coordinates

Double pcenterX = (XMax+XMin) / 2

Double pcenterY = (YMax + YMin) / 2

/ / calculate the horizontal distance of the map

Double pdistance = SGWorld.CoordServices.GetDistance (XMax, YMax, XMin,YMax)

/ / calculate the vertical viewing height according to the horizontal viewing distance and the viewing range of the TE

Double pviewHeight = pdistance / 2 / Math.Tan (Math.PI * SGWorld.Navigate.FieldOfView / 360)

/ / calculate the viewing position according to the center point and viewing height

Var newPos = SGWorld.Creator.CreatePosition (pcenterX, pcenterY, pviewHeight, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, 0,-89, 0, 0)

/ / navigate to the new location

SGWorld61.Navigate.SetPosition (newPos)

On "how to achieve two-dimensional map Extent TE viewing position algorithm" this article is shared here, 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, please share it out 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.

Share To

Internet Technology

Wechat

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

12
Report