/// <summary> /// 响应Player加载模型完成消息 /// </summary> /// <param name="player"></param> /// <param name="param"></param> public void OnLoadModel(WIZPlayer player, IntPtr param) { WIZPlayer.Const.ParamLoadModel st = Marshal.PtrToStructure <WIZPlayer.Const.ParamLoadModel>(param); // 几乎所有事件的回调都在Player线程中,如果我们需要进行UI操作考虑Send/Post到主线程中 mainContext.Send((o) => { this.Text = st.fileName; }, null); }
public void OnMarkerSelect(WIZPlayer player, IntPtr param) { WIZMarkerCompoment.Const.ParamMarkerSelect sel = Marshal.PtrToStructure <WIZMarkerCompoment.Const.ParamMarkerSelect>(param); if (sel.bMark == 0) { siStatus.Caption = string.Format("标记:") + sel.id; } else { siStatus.Caption = string.Format("形状:") + sel.id; } }
void InitSkinGallery() { SkinHelper.InitSkinGallery(rgbiSkins, true); wizPanel = this.splitContainerControl.Panel2; player = WIZPlayer.CreateInstance(); player.addMessageHandler(WIZPlayer.Const.PMSG_INIT, this.onEngineInitHandler = this.OnEngineInited); player.addMessageHandler(WIZPlayer.Const.PMSG_LOADMODEL, this.onLoadModelHandler = this.OnLoadModel); player.addMessageHandler(WIZPlayer.Const.PMSG_REGISTERTOOL, this.onEngineToolRegisterHandler = this.OnEngineToolRegister); player.addMessageHandler(WIZPlayer.Const.PMSG_SELECTTOOL, this.onEngineSelectToolHandler = this.OnEngineSelectTool); player.addMessageHandler(WIZMarkerCompoment.Const.PMSG_EDIT, this.OnMarkerEditHander = this.OnMarkerEdit); player.addMessageHandler(WIZMarkerCompoment.Const.PMSG_SELECT, this.OnMarkerSelectHandler = this.OnMarkerSelect); player.start(wizPanel.Handle); }
/// <summary> /// 响应工具注册消息 /// </summary> /// <param name="player"></param> /// <param name="param"></param> public void OnEngineToolRegister(WIZPlayer player, IntPtr param) { WIZTool tool = param; //TODO: add tool menu string name = tool.getName(); string dname1 = tool.getDisplayName(0); string dname2 = tool.getDisplayName(1); string gname1 = tool.getGroupName(0); string gname2 = tool.getGroupName(1); mainContext.Post((o) => { BarButtonItem baritem = new BarButtonItem(); baritem.Caption = dname1 + '.' + dname2; baritem.Tag = tool; baritem.ItemClick += baritem_ItemClick; this.OperationBar.ItemLinks.Add((BarItem)baritem); }, null); }
public void OnMarkerEdit(WIZPlayer player, IntPtr param) { int editType = Marshal.PtrToStructure <int>(param); switch ((MarkerNotice)editType) { case MarkerNotice.NewMark: TimeBar.Caption = "New Mark!"; break; case MarkerNotice.AddMark: TimeBar.Caption = "Add Mark!"; break; case MarkerNotice.UpdateMark: TimeBar.Caption = "Update Mark!"; break; case MarkerNotice.RemoveSelect: TimeBar.Caption = "Remove Select!"; break; case MarkerNotice.DeleteMark: TimeBar.Caption = "Delete Mark!"; break; case MarkerNotice.SelectMark: TimeBar.Caption = "Select Mark!"; break; case MarkerNotice.LoadMark: TimeBar.Caption = "Load Mark!"; break; case MarkerNotice.BrowseMark: TimeBar.Caption = "Browse Mark!"; break; default: break; } }
/// <summary> /// 响应Player初始化消息 /// </summary> /// <param name="player"></param> /// <param name="param"></param> public void OnEngineInited(WIZPlayer player, IntPtr param) { // Player初始化后加载所需要的插件 string pluginDir = Application.StartupPath + "\\plugin"; player.loadPlugins(pluginDir); player.setRect(0, 0, wizPanel.Width, wizPanel.Height); player.setFocus(); //获取标记插件 marker = WIZMarkerCompoment.From(player); if (marker.isValid()) { //get error } WIZTreeCompoment tree = WIZTreeCompoment.From(player); if (tree.isValid()) { mainContext.Post((o) => { tree.setParent(this.navBarControl.Handle); tree.setRect(0, 0, this.navBarControl.Width, this.navBarControl.Height); }, null); } /// 获取组建 _wizQXSY = WIZObliquePhotograph.From(player); _wizGIS = WIZGISPlatform.From(player); _wizCamAnim = WIZCameraAnimation.From(player); _wizCamAnimPlay = WIZCameraAnimationPlay.From(player); _wizShpComponent = WIZShpCompoment.From(player); if (_wizCamAnim.isValid()) { player.addMessageHandler(WIZCameraAnimation.Const.PMSG_CAM_CURTIME, onCamAnimTimeChange = this.OnCamAnimTimeChange); //TODO: WIZCameraAnimation.Const.PMSG_CAM_DELETE } }
/// <summary> /// 响应Player切换工具消息 /// </summary> /// <param name="player"></param> /// <param name="param"></param> public void OnEngineSelectTool(WIZPlayer player, IntPtr param) { WIZPlayer.Const.ParamSelectTool st = Marshal.PtrToStructure <WIZPlayer.Const.ParamSelectTool>(param); //TODO: 更新工具的check状态 }
private MessageHandler onEngineInitHandler; // 保存一个类成员防止委托被回收导致C++内调用失败 public void OnCamAnimTimeChange(WIZPlayer player, IntPtr param) { int time = Marshal.PtrToStructure <int>(param); // mainContext.Post((o) => { this.CamTimerBar.Value = time; }, 0); }