Пример #1
0
        public static IfcValidationTask NewIfcGuidCheckingTask(IfcGuidStore guidStore, IfcModel ifcModel)
        {
            if (null == ifcModel)
            {
                throw new ArgumentNullException(nameof(ifcModel));
            }
            if (null == guidStore)
            {
                throw new ArgumentNullException(nameof(guidStore));
            }

            return(new IfcValidationTask(ifcModel, (t) =>
            {
                var innerModel = ifcModel.XbimModel;
                if (null == innerModel)
                {
                    throw new NotSupportedException("No internal model available");
                }

                var monitor = t.CreateProgressMonitor(LogReason.Checked);
                monitor.NotifyProgressEstimateUpdate(innerModel.Instances.Count / 50);

                List <IfcValidationMessage> failingMessages = new List <IfcValidationMessage>();
                foreach (var instance in innerModel.Instances.OfType <IIfcRoot>())
                {
                    var message = guidStore.Put(ifcModel.Qualifier, instance);

                    if (monitor.State.Done > 0.90 * monitor.State.TotalEstimate)
                    {
                        monitor.NotifyProgressEstimateUpdate((long)Math.Floor(monitor.State.TotalEstimate * 1.25));
                    }

                    monitor.NotifyOnProgressChange(1, "Checking unique IfcGUID values...");

                    failingMessages.Add(message);
                    if (monitor.State.IsCanceled)
                    {
                        break;
                    }
                }

                monitor.NotifyOnProgressEnd();

                return new IfcGuidCheckResult(guidStore)
                {
                    MessagePipe = failingMessages
                };
            }));
        }
Пример #2
0
 internal IfcGuidCheckResult(IfcGuidStore theStore) : base()
 {
     GlobalUniqueIdStore = theStore;
 }