コード例 #1
0
        /// <summary>
        /// Executes the initialize action.
        /// </summary>
        ///
        /// <param name="hWnd">The HWND we present to when rendering.</param>
        ///
        /// <seealso cref="M:ActivizWPF.Framework.Native.HwndWrapper.OnInitialize(IntPtr)"/>
        protected override void OnInitialize(IntPtr hWnd)
        {
            try
            {
                vtkLogoWidget vtkLogoWidget = new vtkLogoWidget();

                _renderer     = vtkRenderer.New();
                _renderWindow = vtkRenderWindow.New();

                _renderWindowInteractor = vtkRenderWindowInteractor.New();

                vtkInteractorStyleSwitch interactorStyleSwitch = _renderWindowInteractor.GetInteractorStyle() as vtkInteractorStyleSwitch;

                if (null != interactorStyleSwitch)
                {
                    interactorStyleSwitch.SetCurrentStyleToTrackballCamera();
                }

                _renderWindow.SetParentId(hWnd);
                _renderWindow.AddRenderer(_renderer);

                AttachInteractor();

                vtkLogoWidget.Dispose();
            }
            catch (Exception ex)
            {
                log.ErrorException("OnInitialize()", ex);
            }
        }