void IExportControl.Init(AppConfig config) { _Config = config; _LocalConfig = _Config.Gltf; _Features = new List <FeatureInfo> { new FeatureInfo(FeatureType.ExcludeTexture, Strings.FeatureNameExcludeTexture, Strings.FeatureDescriptionExcludeTexture, true, false), new FeatureInfo(FeatureType.ExcludeLines, Strings.FeatureNameExcludeLines, Strings.FeatureDescriptionExcludeLines), new FeatureInfo(FeatureType.ExcludePoints, Strings.FeatureNameExcludePoints, Strings.FeatureDescriptionExcludePoints, true, false), new FeatureInfo(FeatureType.OnlySelected, Strings.FeatureNameOnlySelected, Strings.FeatureDescriptionOnlySelected), new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb), new FeatureInfo(FeatureType.UseGoogleDraco, Strings.FeatureNameUseGoogleDraco, Strings.FeatureDescriptionUseGoogleDraco, true, false), new FeatureInfo(FeatureType.ExtractShell, Strings.FeatureNameExtractShell, Strings.FeatureDescriptionExtractShell, true, false), new FeatureInfo(FeatureType.ExportSvfzip, Strings.FeatureNameExportSvfzip, Strings.FeatureDescriptionExportSvfzip, true, false), }; _VisualStyles = new List <VisualStyleInfo>(); _VisualStyles.Add(new VisualStyleInfo(@"Colored", Strings.VisualStyleColored + $@"({Strings.TextDefault})", new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, true } })); _VisualStyles.Add(new VisualStyleInfo(@"Textured", Strings.VisualStyleTextured, new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, false } })); _VisualStyleDefault = _VisualStyles.First(x => x.Key == @"Colored"); cbVisualStyle.Items.Clear(); cbVisualStyle.Items.AddRange(_VisualStyles.Select(x => (object)x).ToArray()); }
/// <summary> /// 开始导出 /// </summary> /// <param name="localConfig"></param> /// <param name="features"></param> /// <param name="progressCallback"></param> /// <param name="cancellationToken"></param> private void StartExport(AppConfigGltf localConfig, Dictionary <FeatureType, bool> features, Action <int> progressCallback, CancellationToken cancellationToken) { using (var log = new RuntimeLog()) { var featureList = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>(); var exporter = new ExporterX(App.GetHomePath()); exporter.Export(localConfig.LastTargetPath, featureList, log, progressCallback, cancellationToken); } }
/// <summary> /// 开始导出 /// </summary> /// <param name="uidoc"></param> /// <param name="view"></param> /// <param name="localConfig"></param> /// <param name="features"></param> /// <param name="progressCallback"></param> /// <param name="cancellationToken"></param> private void StartExport(UIDocument uidoc, View3D view, AppConfigGltf localConfig, Dictionary <FeatureType, bool> features, Action <int> progressCallback, CancellationToken cancellationToken) { using (var log = new RuntimeLog()) { var featureList = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>(); var elementIdList = _ElementIds?.Where(x => x.Value).Select(x => x.Key).ToList(); var exporter = new ExporterX(InnerApp.GetHomePath()); exporter.Export( uidoc, view, localConfig.LevelOfDetail, localConfig.LastTargetPath, featureList, elementIdList, log, progressCallback, cancellationToken ); } }
void IExportControl.Init(UIDocument uidoc, View3D view, AppConfig config, Dictionary <int, bool> elementIds) { _UIDocument = uidoc; _View = view; _Config = config; _LocalConfig = _Config.Gltf; _ElementIds = elementIds; _Features = new List <FeatureInfo> { new FeatureInfo(FeatureType.ExcludeTexture, Strings.FeatureNameExcludeTexture, Strings.FeatureDescriptionExcludeTexture, true, false), new FeatureInfo(FeatureType.ExcludeLines, Strings.FeatureNameExcludeLines, Strings.FeatureDescriptionExcludeLines), new FeatureInfo(FeatureType.ExcludePoints, Strings.FeatureNameExcludePoints, Strings.FeatureDescriptionExcludePoints, true, false), new FeatureInfo(FeatureType.OnlySelected, Strings.FeatureNameOnlySelected, Strings.FeatureDescriptionOnlySelected), new FeatureInfo(FeatureType.ExportGrids, Strings.FeatureNameExportGrids, Strings.FeatureDescriptionExportGrids), new FeatureInfo(FeatureType.Wireframe, Strings.FeatureNameWireframe, Strings.FeatureDescriptionWireframe, true, false), new FeatureInfo(FeatureType.Gray, Strings.FeatureNameGray, Strings.FeatureDescriptionGray, true, false), new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb), new FeatureInfo(FeatureType.GenerateThumbnail, Strings.FeatureNameGenerateThumbnail, Strings.FeatureDescriptionGenerateThumbnail), new FeatureInfo(FeatureType.UseViewOverrideGraphic, Strings.FeatureNameUseViewOverrideGraphic, Strings.FeatureDescriptionUseViewOverrideGraphic, true, false), new FeatureInfo(FeatureType.UseBasicRenderColor, string.Empty, string.Empty, true, false), new FeatureInfo(FeatureType.UseGoogleDraco, Strings.FeatureNameUseGoogleDraco, Strings.FeatureDescriptionUseGoogleDraco, true, false), new FeatureInfo(FeatureType.ExtractShell, Strings.FeatureNameExtractShell, Strings.FeatureDescriptionExtractShell, true, false), new FeatureInfo(FeatureType.ExportSvfzip, Strings.FeatureNameExportSvfzip, Strings.FeatureDescriptionExportSvfzip, true, false), }; _VisualStyles = new List <VisualStyleInfo>(); _VisualStyles.Add(new VisualStyleInfo(@"Wireframe", Strings.VisualStyleWireframe, new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, true }, { FeatureType.Wireframe, true }, { FeatureType.UseViewOverrideGraphic, false }, { FeatureType.UseBasicRenderColor, false }, { FeatureType.Gray, false } })); _VisualStyles.Add(new VisualStyleInfo(@"Gray", Strings.VisualStyleGray, new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, true }, { FeatureType.Wireframe, false }, { FeatureType.UseViewOverrideGraphic, false }, { FeatureType.UseBasicRenderColor, false }, { FeatureType.Gray, true } })); _VisualStyles.Add(new VisualStyleInfo(@"Colored", Strings.VisualStyleColored, new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, true }, { FeatureType.Wireframe, false }, { FeatureType.UseViewOverrideGraphic, true }, { FeatureType.UseBasicRenderColor, false }, { FeatureType.Gray, false } })); _VisualStyles.Add(new VisualStyleInfo(@"Textured", Strings.VisualStyleTextured + $@"({Strings.TextDefault})", new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, false }, { FeatureType.Wireframe, false }, { FeatureType.UseViewOverrideGraphic, false }, { FeatureType.UseBasicRenderColor, true }, { FeatureType.Gray, false } })); _VisualStyles.Add(new VisualStyleInfo(@"Realistic", Strings.VisualStyleRealistic, new Dictionary <FeatureType, bool> { { FeatureType.ExcludeTexture, false }, { FeatureType.Wireframe, false }, { FeatureType.UseViewOverrideGraphic, false }, { FeatureType.UseBasicRenderColor, false }, { FeatureType.Gray, false } })); _VisualStyleDefault = _VisualStyles.First(x => x.Key == @"Colored"); const int DEFAULT_LEVEL_OF_DETAILS = 6; _LevelOfDetails = new List <ComboItemInfo>(); _LevelOfDetails.Add(new ComboItemInfo(-1, Strings.TextAuto)); for (var i = 0; i <= 15; i++) { string text; switch (i) { case 0: text = $@"{i} ({Strings.TextLowest})"; break; case DEFAULT_LEVEL_OF_DETAILS: text = $@"{i} ({Strings.TextNormal})"; break; case 15: text = $@"{i} ({Strings.TextHighest})"; break; default: text = i.ToString(); break; } _LevelOfDetails.Add(new ComboItemInfo(i, text)); } _LevelOfDetailDefault = _LevelOfDetails.Find(x => x.Value == DEFAULT_LEVEL_OF_DETAILS); cbVisualStyle.Items.Clear(); cbVisualStyle.Items.AddRange(_VisualStyles.Select(x => (object)x).ToArray()); cbLevelOfDetail.Items.Clear(); cbLevelOfDetail.Items.AddRange(_LevelOfDetails.Select(x => (object)x).ToArray()); }