How to realize Wind Direction and Wind symbol plotting in the Secondary Development of TE
This article will explain in detail how to realize wind direction and wind symbol plotting in the secondary development of TE. 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 relevant meteorological system, we will encounter the symbol marking requirements of the relevant wind vane, draw the symbol in the designated position of the map, and describe the wind direction and wind force vividly.
Can be used to make icons, to do all kinds of wind pictures, but also according to the direction of the wind, rotate the angle of the picture.
The other is to draw lines on the map and splice the lines together to achieve the effect of a weather vane, which is described below.
Generally speaking, the direction of the wind is the tail direction of the wind vane, and the wind force is expressed by several bars on the basic line, which is not enough for a grade. With a half-long line, the length of the line should be drawn longer when the viewing range is relatively large.
The specific implementation code is as follows (C #):
/ / _ pos1 is the location of the wind indicator, and _ level is the wind
Void DrawIcon (IPosition70 _ pos1, double _ level)
{
IPosition70 _ aiPos
ITerrainPolyline70 _ cPolyline
Double [] _ arr
ILineString _ cRing
/ / calculate several wind bars according to the grade
Double _ cValue = Math.Ceiling (_ level)
For (double ile = 0; ile)
< _cValue; ile++) { //先按照风向移动距离 _aiPos = _pos1.Move(8000 * ile, _pos1.Yaw, 0); if ((_level - 1 - ile) >= 0)
{
/ / in the case of a first-class wind
/ / rotate 120 degrees at the angle of the wind direction to draw the direction of the wind
Var _ aiPos1 = _ aiPos.Move (20000, _ pos1.Yaw + 120,0)
_ arr = new double [] {_ aiPos.X, _ aiPos.Y, 1000, _ aiPos1.X, _ aiPos1.Y, 1000}
/ / spell out a straight line at two points
_ cRing = _ sgworld.Creator.GeometryCreator.CreateLineStringGeometry (_ arr)
_ cPolyline = _ sgworld.Creator.CreatePolyline (_ cRing, 0xff0000ff, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, string.Empty, "100k500")
}
Else
{
/ / under the condition of insufficient first-class wind force
/ / rotate 120 degrees at the angle of the wind direction and draw half the direction of the wind
Var _ aiPos1 = _ aiPos.Move (20000 * 0.5, _ pos1.Yaw + 120,0)
_ arr = new double [] {_ aiPos.X, _ aiPos.Y, 1000, _ aiPos1.X, _ aiPos1.Y, 1000}
_ cRing = _ sgworld.Creator.GeometryCreator.CreateLineStringGeometry (_ arr)
_ cPolyline = _ sgworld.Creator.CreatePolyline (_ cRing, 0xff0000ff, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, string.Empty, "100k500")
}
}
/ / the moving distance draws the horizontal handle line of the wind direction.
_ aiPos = _ pos1.Move (40000, _ pos1.Yaw, 0)
_ arr = new double [] {_ pos1.X, _ pos1.Y, 1000, _ aiPos.X, _ aiPos.Y, 1000}
_ cRing = _ sgworld.Creator.GeometryCreator.CreateLineStringGeometry (_ arr)
_ cPolyline = _ sgworld.Creator.CreatePolyline (_ cRing, 0xff0000ff, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, string.Empty, "100k500")
}
The following is the effect of the plotting:
This is the end of this article on "how to achieve wind symbol plotting in the secondary development of TE". 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.