/// <summary> /// 打开地图文件 /// </summary> /// <param name="axGlobeControl"></param> /// <param name="InitDirectory"></param> public static void Open3DGlobeMap(AxGlobeControl axGlobeControl, string InitDirectory) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = InitDirectory; ofd.Multiselect = false; ofd.RestoreDirectory = true; ofd.Title = "打开三维地图文档"; ofd.Filter = "三维地图(*.3dd)|*.3dd|所有文件(*.*)|*.*"; ofd.CheckFileExists = true; //检查文件是否存在 if (ofd.ShowDialog() == DialogResult.OK) { if (File.Exists(ofd.FileName)) //判断文件是否存在 { axGlobeControl.Load3dFile(ofd.FileName); //加载地图 } } } catch { return; } }
/// <summary> /// 加载地图文档 /// </summary> /// <param name="fileName"></param> private void Open3ddFile(string fileName) { if (axGlobeControl.Check3dFile(fileName)) { axGlobeControl.Load3dFile(fileName); } }
private void glbDisplay_AfterDraw(ISceneViewer pViewer) { // load 3dd on first time render only, let the WPF drawing thread render the window controls first if (globeControl.DocumentFilename == null) { globeControl.Load3dFile(mapPath + _map.MapName + ".3dd"); } }