/// <summary> /// Executes the specified command data. /// </summary> /// <param name="cmdData">The command data.</param> /// <param name="message">The message.</param> /// <returns>CmdResult.</returns> public CmdResult Execute(ExtendCmdData cmdData, ref string message) { var mainForm = cmdData.MainForm as Form; var viewForm = cmdData.ViewForm as IViewForm; if (viewForm == null) { return(CmdResult.Cancel); } var osgView = viewForm.View as ZfOsgViewCtrl; var osgObj = osgView.OsgObj; string[] osgFileNames; if (!DialogUtil.OpenOSG(out osgFileNames)) { return(CmdResult.Cancel); } foreach (var osgFileName in osgFileNames) { var node = OsgDB._.readNodeFile(osgFileName); // 读取模型 if (node.IsValid()) { // 使用[分组]-[模型],的方式组织模型树,模型Name为Key,即如果添加相同名称的模型,原来的模型会删除 node.Name = Path.GetFileNameWithoutExtension(osgFileName); osgObj.AddOrReplaceModel("Models", node); osgObj.SetView(ViewMode.ShowAll);//显示全图 } else { ZfMessageUtil.ShowError(string.Format("打开文件\"{0}\"失败!", osgFileName)); } } return(CmdResult.Succeed); }
/// <summary> /// Executes the specified command data. /// </summary> /// <param name="cmdData">The command data.</param> /// <param name="message">The message.</param> /// <returns>CmdResult.</returns> public CmdResult Execute(ExtendCmdData cmdData, ref string message) { ZfMessageUtil.ShowInfo("Hello World!"); return(CmdResult.Succeed); }