[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>
文章未经说明均属原创,学习笔记可能有大段的引用,一般会注明参考文献。 欢迎大家留言交流,转载请注明出处。
原文地址:https://www.cnblogs.com/yhlx125/p/3063495.html