您的位置:首页 > 其它

[WorldWind学习]15.模型加载

2013-05-06 20:01 316 查看


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

public override void Initialize(DrawArgs drawArgs)
{
if(!IsVisible(drawArgs.WorldCamera))
return;

try
{
if(meshFileName.EndsWith(".x"))
9                     LoadDirectXMesh(drawArgs);//设置断点,反复改变球,最终找到。注意大概缩放到的经纬度(116.4E,39.9N)
else if(meshFileName.EndsWith(".dae")||meshFileName.EndsWith(".xml"))
LoadColladaMesh(drawArgs);
if (mesh == null)
throw new InvalidMeshException();

vertExaggeration = World.Settings.VerticalExaggeration;
if (isElevationRelative2Ground==true)
currentElevation = World.TerrainAccessor.GetElevationAt(Latitude, Longitude);

isInitialized = true;
}
catch(Exception caught)
{
Utility.Log.Write( caught );
errorMsg = "Failed to read mesh from " + meshFileName;
}
}


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

<?xml version="1.0" encoding="utf-8"?>
<LayerSet Name="Clark Test" ShowOnlyOneLayer="false" ShowAtStartup="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerSet.xsd">
<ModelFeature ShowAtStartup="true">
<Name>Tiny1</Name>
<DistanceAboveSurface>560.0</DistanceAboveSurface>
<Latitude>
<Value>39.93</Value>
</Latitude>
<Longitude>
<Value>116.400002</Value>
</Longitude>
12     <ScaleFactor>100</ScaleFactor>
<MeshFilePath>C:\tiny.x</MeshFilePath>
<Orientation>
<RotationX>0.0</RotationX>
<RotationY>90.0</RotationY>
<RotationZ>90.0</RotationZ>
</Orientation>
<MaxViewRange>10000.0</MaxViewRange>
<MinViewRange>10</MinViewRange>
</ModelFeature>

<ModelFeature ShowAtStartup="true">
<Name>Tiny2</Name>
<DistanceAboveSurface>160.0</DistanceAboveSurface>
<Latitude>
<Value>39.93</Value>
</Latitude>
<Longitude>
<Value>116.410002</Value>
</Longitude>
<ScaleFactor>2</ScaleFactor>
<MeshFilePath>Data\Model\tiny.x</MeshFilePath>
<Orientation>
<RotationX>0.0</RotationX>
<RotationY>-90.0</RotationY>
<RotationZ>90.0</RotationZ>
</Orientation>
<MaxViewRange>10000.0</MaxViewRange>
<MinViewRange>10</MinViewRange>
</ModelFeature>

<LineFeature ShowAtStartup="true">
<Name>Sample Line</Name>
<ExtrudeHeight>20000</ExtrudeHeight>
<ExtrudeUpwards>false</ExtrudeUpwards>
<DistanceAboveSurface>50000</DistanceAboveSurface>
<MinimumDisplayAltitude>10</MinimumDisplayAltitude>
<MaximumDisplayAltitude>5000000</MaximumDisplayAltitude>
<LineString>
<posList>-120,35,10000 -119,36,20000 -120,38,100000 -122,38,60000</posList>
</LineString>
<FeatureColor>
<Red>255</Red>
<Green>100</Green>
<Blue>0</Blue>
</FeatureColor>
<Outline>true</Outline>
<OutlineColor>
<Red>100</Red>
<Green>100</Green>
<Blue>100</Blue>
</OutlineColor>
<Opacity>150</Opacity>
</LineFeature>
</LayerSet>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: