示例#1
0
        private static void SetConfiguration(TableSplitControl control, ViewportWindowConfiguration configuration)
        {
            if (control == null || configuration == null)
            {
                return;
            }

            control.Configuration = configuration.Configuration;
            var viewports = GetViewportsForTableSplitControl(control);

            control.Controls.Clear();
            foreach (var vp in viewports)
            {
                vp.Dispose();
                Viewports.Remove(vp);
            }

            LoadViewports(control, configuration);
        }
示例#2
0
        private static void CreateViewportWindow(ViewportWindowConfiguration config)
        {
            var win = new ViewportWindow(config.Configuration);

            win.Text += " - Window " + config.WindowID;
            LoadViewports(win.TableSplitControl, config);
            Windows.Add(win);
            win.Closed += (s, e) =>
            {
                Windows.Remove(win);
                win.Dispose();
            };
            win.Show(Editor.Instance);
            if (!config.Size.IsEmpty)
            {
                win.Location    = config.Size.Location;
                win.Size        = config.Size.Size;
                win.WindowState = config.Maximised ? FormWindowState.Maximized : FormWindowState.Normal;
            }
        }
示例#3
0
        private static void LoadViewports(TableSplitControl tableSplitControl, ViewportWindowConfiguration config)
        {
            var defaultViewports = new[]
            {
                Tuple.Create(true, Viewport3D.ViewType.Textured, Viewport2D.ViewDirection.Top),
                Tuple.Create(false, Viewport3D.ViewType.Textured, Viewport2D.ViewDirection.Top),
                Tuple.Create(false, Viewport3D.ViewType.Textured, Viewport2D.ViewDirection.Front),
                Tuple.Create(false, Viewport3D.ViewType.Textured, Viewport2D.ViewDirection.Side)
            };

            var viewports = config.Viewports ?? new List <string>();

            for (int i = 0; i < config.Configuration.Rectangles.Count; i++)
            {
                var viewport = viewports.Count > i ? viewports[i] : "";
                var def      = defaultViewports[(i % defaultViewports.Length)];
                var vp       = CreateViewport(viewport, def.Item1, def.Item2, def.Item3);
                Viewports.Add(vp);
                SubscribeExceptions(vp);
                tableSplitControl.Controls.Add(vp);
                Mediator.Publish(EditorMediator.ViewportCreated, vp);
                vp.Run();
            }
        }