配置载入器类ConfigurationLoader主要从指定的路径中加载保存星球相关参数的xml文件,从中读取数据来构造星球对象及其所关联的可渲染子对象列表并返回。该类的类图如下所示。
该类所包含的主要的方法基本都是静态的,功能说明如下:
public static double ParseDouble(string s)将字符串s解析为Double型数字
private static bool ParseBool(string booleanString) 将字符串s解析为bool型
public static void XMLValidationCallback(object sender, ValidationEventArgs args)XML文件有效性验证时的回调委托事件(severity:严重、严格、猛烈)。
public static World Load(string filename, Cache cache)函数是本类中的重点函数,主要从指定的路径如“bin\x86\Debug\Config\Earth.xml”文件中加载保存星球相关参数的xml文件,从中读取数据来构造星球对象并返回。
private static RenderableObjectList getRenderablesFromLayerDirectory(string layerDirectory, World parentWorld, Cache cache)函数从指定的图层目录中回去与指定父类星球parentWorld相关联的可渲染子对象列表。被本类和RenderableObjectList类中的相关函数调用。内部调用其重载形式 public static RenderableObjectList getRenderableFromLayerFile(string layerFile, World parentWorld, Cache cache, bool enableRefresh),重载形式内容比较多,需要细看。
public static bool IsLayerOn(RenderableObject ro)设置指定的可渲染对象图层是开启还是关闭
private static RenderableObjectList addChildLayerSet(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable, Cache cache)添加子图层集合到可渲染子对象列表
private static ImageTileService getImageTileServiceFromXPathNodeIterator(XPathNodeIterator iter)返回指定节点所对应的影像瓦片服务对象
private static ImageStore getImageStoreFromXPathNodeIterator(string name, XPathNodeIterator imageAccessorIter, RenderableObjectList parentRenderable, Cache cache) 返回指定节点所对应的影像存储对象
private static void addQuadTileLayersFromXPathNodeIterator(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable, Cache cache)从指定节点中添加四叉树瓦片图层到可渲染子对象列表
private static TimeSpan getCacheExpiration(XPathNodeIterator iter)返回缓冲区过期时间间隔
private static void addExtendedInformation(XPathNodeIterator iter, RenderableObject renderable)添加扩展信息
public static string GetRenderablePathString(RenderableObject renderable)添加可渲染路径字符串,内部调用准同名函数private static string getRenderablePathString(RenderableObject renderable)
private static void addImageLayersFromXPathNodeIterator(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable) 从指定节点中添加影像图层到可渲染子对象列表
private static void addScreenOverlays(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable, Cache cache)添加屏幕覆盖图层(PS:Overlays:覆盖图、镶边、包镶物)
private static void addScreenOverlaysToIcon(XPathNodeIterator iter, World parentWorld, Icon icon, Cache cache) 添加屏幕覆盖图层至ICON图标
private static System.Drawing.Color getColor(XPathNodeIterator iter)返回XpathNodeIterator节点迭代器所指定的元素的颜色
private static Microsoft.DirectX.Direct3D.FontDescription getDisplayFont(XPathNodeIterator iter) 返回XpathNodeIterator节点迭代器所指定的显示字体的字体描述结构体对象
private static void addTiledPlacenameSet(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable)添加已经切分成瓦片的地名集合所构建的TiledPlacenameSet对象到可渲染子对象列表
private static void addTiledWFSPlacenameSet(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable, Cache cache) 添加已经切分成瓦片的地名集合所构建的TiledWFSPlacenameSet对象到可渲染子对象列表
private static void addIcon(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable, Cache cache) )添加XpathNodeIterator节点迭代器所指定的Icon对象到可渲染子对象列表
private static void addPathList(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable) 添加XpathNodeIterator节点迭代器所指定的PathList路径列表对象到可渲染子对象列表
private static void addLineFeature(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable) 添加XpathNodeIterator节点迭代器所指定的LineFeature线型要素对象到可渲染子对象列表
private static void addPolygonFeature(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable) 添加XpathNodeIterator节点迭代器所指定的PolygonFeature多边形要素对象到可渲染子对象列表
private static void addModelFeature(XPathNodeIterator iter, World parentWorld, RenderableObjectList parentRenderable) 添加XpathNodeIterator节点迭代器所指定的ModelFeature模型要素对象到可渲染子对象列表
private static TerrainAccessor[] getTerrainAccessorsFromXPathNodeIterator(XPathNodeIterator iter, string cacheDirectory)从指定的XpathNodeIterator节点迭代器所指向的元素中获取地形访问器对象
static string getInnerTextFromFirstChild(XPathNodeIterator iter) 从指定的XpathNodeIterator节点迭代器所指向的元素中获取第一个子元素的内部文本字符串