lixiaojun
2024-09-23 81819f13e1e3a49bf8456051ec0f0b51e3f10821
解析优化
已修改6个文件
已添加1个文件
95 ■■■■ 文件已修改
Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Revit.Core/04-service/01-json/model/RevitOthersJsonProp.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Revit.Core/04-service/03-parse/RevitParseHelper.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/00-core/ImportXhsProjectFileHelper.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs
@@ -10,7 +10,12 @@
        /// <summary>
        /// ä»Žjson字符串中解析
        /// </summary>
        public static HStation.Model.RevitModel FromJsonString(string revitJsonString, out string msg)
        public static HStation.Model.RevitModel FromJsonString
            (
                string revitJsonString,
                string revitOthersJsonString,
                out string msg
            )
        {
            msg = string.Empty;
            if (string.IsNullOrEmpty(revitJsonString))
@@ -22,6 +27,7 @@
            {
                var model = new Model.RevitModel();
                //解析结构json
                var jarray = JArray.Parse(revitJsonString);
                for (int i = 0; i < jarray.Count; i++)
                {
@@ -1079,11 +1085,41 @@
                                decorator.Name = string.Empty;
                                decorator.Category = jobject[RevitJsonProp.ClanAndType][RevitJsonProp.ClanName].ToString();
                                decorator.Decoration = string.Empty;
                                decorator.Decoration = string.Empty;
                                model.Decorators.Add(decorator);
                            }
                            break;
                        default: break;
                    }
                }
                //解析其他json
                var jothersArray = JArray.Parse(revitOthersJsonString);
                if (jothersArray != null && jothersArray.Count > 0)
                {
                    var allParterList = model.GetAllParters();
                    for (int i = 0; i < jothersArray.Count; i++)
                    {
                        var jobject = jothersArray[i];
                        var id = jobject[RevitOthersJsonProp.Id]?.ToString();
                        if (string.IsNullOrEmpty(id))
                        {
                            continue;
                        }
                        if (allParterList.Exists(x => x.Id == id))
                        {
                            continue;
                        }
                        if (model.Decorators.Exists(x => x.Id == id))
                        {
                            continue;
                        }
                        var decorator = new Model.RevitDecorator();
                        decorator.Id = id;
                        decorator.Code = id;
                        decorator.Name = jobject[RevitOthersJsonProp.Name]?.ToString();
                        decorator.Category = jobject[RevitOthersJsonProp.CategoryName]?.ToString();
                        decorator.Decoration = jobject[RevitOthersJsonProp.CategoryID]?.ToString();
                        model.Decorators.Add(decorator);
                    }
                }
@@ -1100,7 +1136,7 @@
        /// <summary>
        /// ä»Žjson文件中解析
        /// </summary>
        public static Model.RevitModel FromJsonFile(string revitJsonFile, out string msg)
        public static Model.RevitModel FromJsonFile(string revitJsonFile, string revitOthersJsonFile, out string msg)
        {
            if (!File.Exists(revitJsonFile))
            {
@@ -1108,7 +1144,12 @@
                return default;
            }
            var revitJson = File.ReadAllText(revitJsonFile);
            var revitModel = FromJsonString(revitJson, out msg);
            var revitOthersJson = string.Empty;
            if (File.Exists(revitOthersJsonFile))
            {
                revitOthersJson = File.ReadAllText(revitOthersJsonFile);
            }
            var revitModel = FromJsonString(revitJson, revitOthersJson, out msg);
            if (revitModel == null)
            {
                return default;
Service/HStation.Service.Revit.Core/04-service/01-json/model/RevitOthersJsonProp.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
namespace HStation.Service
{
    /// <summary>
    ///
    /// </summary>
    internal class RevitOthersJsonProp
    {
        public const string Id = "ID";
        public const string Name = "Name";
        public const string CategoryName = "CategoryName";
        public const string CategoryID = "CategoryID";
    }
}
Service/HStation.Service.Revit.Core/04-service/03-parse/RevitParseHelper.cs
@@ -10,9 +10,9 @@
        /// </summary>
        /// <param name="revitJsonString">Revit json å­—符串</param>
        /// <returns></returns>
        public static Model.RevitModel FromJsonString(string revitJsonString, out string msg)
        public static Model.RevitModel FromJsonString(string revitJsonString, string revitOthersJsonString, out string msg)
        {
            var rhs = RevitJsonHelper.FromJsonString(revitJsonString, out msg);
            var rhs = RevitJsonHelper.FromJsonString(revitJsonString, revitOthersJsonString, out msg);
            if (rhs == null)
            {
                return default;
@@ -29,9 +29,9 @@
        /// </summary>
        /// <param name="revitJsonFile">Revit json æ–‡ä»¶</param>
        /// <returns></returns>
        public static Model.RevitModel FromJsonFile(string revitJsonFile, out string msg)
        public static Model.RevitModel FromJsonFile(string revitJsonFile, string revitOthersJsonFile, out string msg)
        {
            var rhs = RevitJsonHelper.FromJsonFile(revitJsonFile, out msg);
            var rhs = RevitJsonHelper.FromJsonFile(revitJsonFile, revitOthersJsonFile, out msg);
            if (rhs == null)
            {
                return default;
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs
@@ -157,8 +157,9 @@
                feedBackProgress?.Invoke(100, 100);
                return true;
            }
            var structOthersFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructOthersFileName);
            var structRevitModel = HStation.Service.RevitParseHelper.FromJsonFile(structFileInfo.FullName, out msg);
            var structRevitModel = HStation.Service.RevitParseHelper.FromJsonFile(structFileInfo.FullName, structOthersFileInfo?.FullName, out msg);
            if (structRevitModel == null)
            {
                feedBackMsg?.Invoke($"{msg}!!!", Color.Red);
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/00-core/ImportXhsProjectFileHelper.cs
@@ -73,7 +73,7 @@
                return false;
            }
            var revitModel = HStation.Service.RevitParseHelper.FromJsonFile(jsonFileInfo.FullName, out msg);
            var revitModel = HStation.Service.RevitParseHelper.FromJsonFile(jsonFileInfo.FullName, null, out msg);
            if (revitModel == null)
            {
                feedBackMsg?.Invoke($"{msg}!!!", Color.Red);
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs
@@ -357,7 +357,7 @@
            docPnlMatchingList.Dock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
            docPnlMatchingList.FloatVertical = true;
            docPnlMatchingList.ID = new Guid("19fbbff8-5202-46bc-b9f4-472249e3c49a");
            docPnlMatchingList.Location = new Point(0, 297);
            docPnlMatchingList.Location = new Point(0, 548);
            docPnlMatchingList.Name = "docPnlMatchingList";
            docPnlMatchingList.OriginalSize = new Size(200, 59);
            docPnlMatchingList.Size = new Size(886, 59);
@@ -385,7 +385,7 @@
            docPnlHydroParterList.Dock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
            docPnlHydroParterList.FloatVertical = true;
            docPnlHydroParterList.ID = new Guid("facc1bde-3cf7-455c-b59c-8377daa6b90e");
            docPnlHydroParterList.Location = new Point(0, 552);
            docPnlHydroParterList.Location = new Point(0, 469);
            docPnlHydroParterList.Name = "docPnlHydroParterList";
            docPnlHydroParterList.OriginalSize = new Size(200, 79);
            docPnlHydroParterList.Size = new Size(886, 79);
@@ -415,7 +415,7 @@
            docPnlHydroCalcu.Dock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
            docPnlHydroCalcu.FloatVertical = true;
            docPnlHydroCalcu.ID = new Guid("ac7055c0-e9fe-40c2-bf51-83dde5710cd4");
            docPnlHydroCalcu.Location = new Point(0, 468);
            docPnlHydroCalcu.Location = new Point(0, 385);
            docPnlHydroCalcu.Name = "docPnlHydroCalcu";
            docPnlHydroCalcu.OriginalSize = new Size(200, 84);
            docPnlHydroCalcu.Size = new Size(886, 84);
@@ -442,7 +442,7 @@
            docPnlHydroCheck.Controls.Add(controlContainer1);
            docPnlHydroCheck.Dock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
            docPnlHydroCheck.ID = new Guid("dee18895-8b3d-44cd-9001-28bee516095d");
            docPnlHydroCheck.Location = new Point(0, 380);
            docPnlHydroCheck.Location = new Point(0, 297);
            docPnlHydroCheck.Name = "docPnlHydroCheck";
            docPnlHydroCheck.OriginalSize = new Size(200, 88);
            docPnlHydroCheck.SavedDock = DevExpress.XtraBars.Docking.DockingStyle.Bottom;
@@ -497,12 +497,12 @@
            AutoScaleDimensions = new SizeF(7F, 14F);
            AutoScaleMode = AutoScaleMode.Font;
            Controls.Add(tabPane1);
            Controls.Add(docPnlMatchingList);
            Controls.Add(docPnlProperty);
            Controls.Add(docPnlUnMatchingList);
            Controls.Add(docPnlHydroCheck);
            Controls.Add(docPnlHydroCalcu);
            Controls.Add(docPnlHydroParterList);
            Controls.Add(docPnlMatchingList);
            Controls.Add(docPnlProperty);
            Controls.Add(docPnlUnMatchingList);
            Controls.Add(ribbonControl1);
            Margin = new Padding(2);
            Name = "XhsProjectSimulationCorePage";
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -95,7 +95,7 @@
            }
            if (_fastShowHideCodeList == null)
            {
                _fastShowHideCodeList = _hydroInfo.Waterboxs.Select(x => x.Code).ToList();
                _fastShowHideCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList();
                await this.xhsProjectSimulationBimfaceCtrl1.HideComponents(_fastShowHideCodeList);
            }
            else
@@ -328,7 +328,7 @@
                DbId = x.DbId,
                DbLocked = x.DbLocked,
                ModelType = x.ModelType,
                //Caliber = x.Caliber,
                Caliber = x.Caliber,
                Material = x.Material
            }).ToList();
            input.FourLinkMatchingModels = _hydroInfo.Fourlinks?.Select(x => new FourLinkMatchingViewModel()
@@ -339,7 +339,7 @@
                Dbid = x.DbId,
                DbLocked = x.DbLocked,
                ModelType = x.ModelType,
                //   Caliber = x.Caliber,
                Caliber = x.Caliber,
                Material = x.Material
            }).ToList();
            input.PipeLineMatchingModels = _hydroInfo.Pipes?.Select(x => new PipeLineMatchingViewModel()