[WorldWind学习]15.模型加载

http://blog.csdn.net/jk276993857/article/details/5951738验证其可行性。只是模型太小,很难找到。在ConfigurationLoader.cs和ModelFeature类中设置断点监视:

复制代码
 1 public override void Initialize(DrawArgs drawArgs)
 2         {
 3             if(!IsVisible(drawArgs.WorldCamera))
 4                 return;
 5 
 6             try
 7             {
 8                 if(meshFileName.EndsWith(".x"))
 9                     LoadDirectXMesh(drawArgs);//设置断点,反复改变球,最终找到。注意大概缩放到的经纬度(116.4E,39.9N)
10                 else if(meshFileName.EndsWith(".dae")||meshFileName.EndsWith(".xml"))
11                     LoadColladaMesh(drawArgs);
12                 if (mesh == null)
13                     throw new InvalidMeshException();
14                 
15                 vertExaggeration = World.Settings.VerticalExaggeration;
16                 if (isElevationRelative2Ground==true)
17                     currentElevation = World.TerrainAccessor.GetElevationAt(Latitude, Longitude);
18                 
19 
20                 isInitialized = true;
21             }
22             catch(Exception caught)
23             {
24                 Utility.Log.Write( caught );
25                 errorMsg = "Failed to read mesh from " + meshFileName;
26             }
27         }
复制代码

同时修改模型的缩放因子ScaleFactor:

复制代码
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LayerSet Name="Clark Test" ShowOnlyOneLayer="false" ShowAtStartup="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerSet.xsd">
 3   <ModelFeature ShowAtStartup="true">
 4     <Name>Tiny1</Name>
 5     <DistanceAboveSurface>560.0</DistanceAboveSurface>
 6     <Latitude>
 7       <Value>39.93</Value>
 8     </Latitude>
 9     <Longitude>
10       <Value>116.400002</Value>
11     </Longitude>
12     <ScaleFactor>100</ScaleFactor>
13     <MeshFilePath>C:\tiny.x</MeshFilePath>
14     <Orientation>
15       <RotationX>0.0</RotationX>
16       <RotationY>90.0</RotationY>
17       <RotationZ>90.0</RotationZ>
18     </Orientation>
19     <MaxViewRange>10000.0</MaxViewRange>
20     <MinViewRange>10</MinViewRange>
21   </ModelFeature>
22 
23   <ModelFeature ShowAtStartup="true">
24     <Name>Tiny2</Name>
25     <DistanceAboveSurface>160.0</DistanceAboveSurface>
26     <Latitude>
27       <Value>39.93</Value>
28     </Latitude>
29     <Longitude>
30       <Value>116.410002</Value>
31     </Longitude>
32     <ScaleFactor>2</ScaleFactor>
33     <MeshFilePath>Data\Model\tiny.x</MeshFilePath>
34     <Orientation>
35       <RotationX>0.0</RotationX>
36       <RotationY>-90.0</RotationY>
37       <RotationZ>90.0</RotationZ>
38     </Orientation>
39     <MaxViewRange>10000.0</MaxViewRange>
40     <MinViewRange>10</MinViewRange>
41   </ModelFeature>
42 
43  <LineFeature ShowAtStartup="true">
44     <Name>Sample Line</Name>
45     <ExtrudeHeight>20000</ExtrudeHeight>
46     <ExtrudeUpwards>false</ExtrudeUpwards>
47     <DistanceAboveSurface>50000</DistanceAboveSurface>
48     <MinimumDisplayAltitude>10</MinimumDisplayAltitude>
49     <MaximumDisplayAltitude>5000000</MaximumDisplayAltitude>
50     <LineString>
51       <posList>-120,35,10000 -119,36,20000 -120,38,100000 -122,38,60000</posList>
52     </LineString>
53     <FeatureColor>
54       <Red>255</Red>
55       <Green>100</Green>
56       <Blue>0</Blue>
57     </FeatureColor>
58     <Outline>true</Outline>
59     <OutlineColor>
60       <Red>100</Red>
61       <Green>100</Green>
62       <Blue>100</Blue>
63     </OutlineColor>
64     <Opacity>150</Opacity>
65   </LineFeature>  
66 </LayerSet>
复制代码

 

 

posted @   太一吾鱼水  阅读(560)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程
点击右上角即可分享
微信分享提示