/// <summary> /// 加载地形,方便测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { //添加地形,方便分析 GSOTerrain terrain = globeControl1.Globe.Terrains.Add(Application.StartupPath + "/Resource/dem/TestDem.tif"); //添加影像,方便分析 globeControl1.Globe.Layers.Add(Application.StartupPath + "/Resource/gisdata/tianditudata/天地图影像.lrc"); //移动视角,方便分析 flyToLayerOrTerrain(globeControl1, terrain.LatLonBounds); }
public static string getCaptionWithExtensionFromLayer(GSOTerrain terrain) { if (terrain == null) { return(""); } //string name = terrain.Name; //int index = name.LastIndexOf('.'); //return terrain.Caption + name.Substring(index); return(terrain.Caption); }
public static GSOTerrain getTerrainByName(GSOGlobeControl globeControl1, string terrainName) { GSOTerrain layer = null; if (globeControl1 != null) { terrainName = terrainName.Replace("\\", "/"); for (int i = 0; i < globeControl1.Globe.Terrains.Count; i++) { GSOTerrain layerItem = globeControl1.Globe.Terrains[i]; string layerItemName = layerItem.Name.Replace("\\", "/"); if (layerItemName == terrainName) { layer = layerItem; break; } } } return(layer); }