예제 #1
0
 private void tabList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabList.SelectedTab.Tag is IExportControl exporter)
     {
         _Exporter = exporter;
     }
 }
예제 #2
0
        public FormExport(UIDocument uidoc, View3D view, AppConfig config, Dictionary <int, bool> elementIds, string target)
            : this()
        {
            tabList.TabPages.Clear();

            var exporters = new List <IExportControl>();

            void AddPage(Control control, IExportControl exporter)
            {
                var tab = new TabPage();

                tabList.Controls.Add(tab);
                tab.Text = exporter.Title;
                tab.Name = $@"tabPage{exporter.Title}";
                tab.UseVisualStyleBackColor = true;
                tab.ImageKey = exporter.Icon;
                tab.Controls.Add(control);
                tab.Tag      = exporter;
                control.Dock = DockStyle.Fill;

                if (exporter.Title == target)
                {
                    _Exporter = exporter;
                }

                exporters.Add(exporter);
            }

#if !EXPRESS
            #region 增加 SvfZip 导出
            {
                var control  = new ExportSvfzip();
                var exporter = (IExportControl)control;
                AddPage(control, exporter);
            }
            #endregion
#endif

            #region 增加 glTF/glb 导出
            {
                var control  = new ExportGltf();
                var exporter = (IExportControl)control;
                AddPage(control, exporter);
            }
            #endregion

            #region 增加 3D Tiles 导出
            {
                var control  = new ExportCesium3DTiles();
                var exporter = (IExportControl)control;
                AddPage(control, exporter);
            }
            #endregion

            if (_Exporter == null)
            {
                _Exporter = exporters.First();
            }

            foreach (var exporter in exporters)
            {
                exporter.Init(uidoc, view, config, elementIds);
            }

            foreach (TabPage tab in tabList.TabPages)
            {
                if (tab.Tag == _Exporter)
                {
                    tabList.SelectTab(tab);
                    break;
                }
            }
        }